Welcome! Log In Create A New Profile

Advanced

Help with customized start code needed

Posted by seefew 
Help with customized start code needed
July 19, 2014 11:44AM
Hello,
i use Slic3r and rev 0.9.9 works fine for me.
Now i´d need to insert a customized start code.
My problem:
The "Start G Code" from the "Printer Settings" will be placed after the temperature Control;
because of i´ve to switch on the heated bed PSU it´s necessary to put it as very first line of the G Code
Maybe anyone has knowledge to fix this issue.
Thx forward
Greetings
seefew
Re: Help with customized start code needed
July 21, 2014 12:13AM
I don't think you can have Slic3r do it for you but it's easy enough in any text editor or Repetier host as you can just cut and paste the command to any place you like.
Re: Help with customized start code needed
July 21, 2014 10:17AM
I'm not sure I follow what the problem is. Do you mean that you want to have some command to switch on the bed heater PSU, followed by the command to set the bed temperature? If so, then you can put substitution variables into the start G-code.

For example, I do a bunch of moves and switching on of LEDs in my gantry before setting the first layer bed temperature, and my start G-code looks like this (simplified for example):
M42 S255 P28				; Switch on gantry LEDs
G1 Z200 X-45 Y 95 F12000		; Move above block point
M190 S[first_layer_bed_temperature]	; Pre-heat bed
...

The only M190 code near the top of my generated G-code is this one that is parameterised in my Start G-code.
Re: Help with customized start code needed
July 22, 2014 06:45AM
Hello and thank´s for your answers.
my generated G-Code looks like:
......
; top infill extrusion width = 0.39mm
; first layer extrusion width = 0.73mm

G21 ; set units to millimeters
M107
M190 S75 ; wait for bed temperature to be reached
M104 S212 ; set temperature
G28 ; home all axes
.......
it came from Slic3r, my issue:
i´d like to put something like
M42 S255 P004 ; Switch on heated bed PSU
above the G21 Command
When i save it as "Custom Start Code" in the Settings, Slic3r will put my commands after the "M104"
With the M190 from Slic3r my Printer will wait to reach the Temp, but it can not happen because
there is no PSU powered at this time. You understand what i mean?
Greets
seefew
Re: Help with customized start code needed
July 22, 2014 09:40AM
As I said (and demonstrated in my code) if you use the parameters in the start G-code then this overrides the default values that get inserted at the top of your G-code by Slic3r.

I remember reading that you can use any of the parameters in the slic3r.ini but the most useful ones are:
S[first_layer_bed_temperature]
S[first_layer_temperature]

You can use these with any of the M190/140/109/104 commands to heat up the nozzle/bed to the settings you specify in the Filament tab, but at a point of your choosing in the g-code.

In my case, I do a bunch carriage moves and switch on things like the gantry LEDs using the M42 command before I start heating the bed and nozzle.

In your case, it doesn't need to be at the very top, it just needs to be before you set the bed temperature. If you look at my start G-code this is exactly what I have - an M42 command followed by a M190 command (and later on the M104 command)
Re: Help with customized start code needed
July 22, 2014 04:31PM
@QuakingPlums:
You made my Day thumbs up Thanks a lot.
I've misunderstood the docs, i´ve thought the default values overrides the custom code and not otherwise.
Am i right with this code?
M42 P004 S255 ;Switch on PSU
G4 P500 ; wait for "post" PSU
M190 S75
and so on

Greetings
seefew
Re: Help with customized start code needed
July 22, 2014 05:24PM
You're welcome grinning smiley

If you want to have different profiles (ABS vs PLA, for instance) then it's useful to have the custom g-code use whatever values from your configuration tab but at a point in the generated g-code of your choosing.
If you paste the following verbatim:
M42 P004 S255					; Switch on PSU
G4 P500						; wait for "post" PSU
M190 S[first_layer_bed_temperature]	; Use a substitution variable instead of explicit value!
and set the first layer bed temperature setting in your "filament" tab to 75 then the code that is generated after slicing will be exactly as you describe.

If however you only ever print with one filament and don't see the need to have multiple configurations then what you have is fine. I think. I've never used M190 commands with explicit values in my Start G-code but I would imagine that *any* occurrence of those temperature commands in the custom g-code will override Slic3r's default behaviour of inserting them at the top.

You can always preview the sliced output before sending it to the printer so there's no harm in playing with those to see the outcome.
Sorry, only registered users may post in this forum.

Click here to login