vlachoudis / bCNC

GRBL CNC command sender, autoleveler and g-code editor
GNU General Public License v2.0
1.57k stars 533 forks source link

CAM/Scaling replaces M commands #1200

Open smooker opened 5 years ago

smooker commented 5 years ago

Replaces M04 GRBL laser command with M03 during scale.

Harvie commented 5 years ago

@MARIOBASZ any ideas?

smooker commented 5 years ago

Additional info: vim: build/lib/bCNC/plugins/scaling.py 209,24-59

                                        bid_block.append("(---- Scale (x "+str(xscale)+" : 1.0),(y "+str(yscale)+" : 1.0),(z "+str(zscale)+" : 1.0) ---- )")
                                        bid_block.append("(center "+str(center[0])+" ,"+str(center[1])+" )")
                                        bid_block.append("M03")
                                        bid_block.append("S "+str(rpm))
                                        bid_block.append(CNC.zsafe())
                                        bid_block.append("F "+str(zfeed))
                                        bid_block.append("g0 x "+str(info[0])+" y "+str(info[1]))

CNC.zsafe() is not needed here for laser engraving. (milling of scaled model too :) slows down the process or breaks the instruments with coefficients bigger than 1.000) A lot of lower cases and spaces.

Regards, smooker.

MARIOBASZ commented 5 years ago

@Harvie, Laser option is saved as variable in bcnc? If it is correct, you tell me how to summon it thus saving time, and it is not necessary to place the option in the plugin?

smooker commented 5 years ago

M03 or M04 in front of every path (block) M05 to turn off the laser in the end of the path (to not make scratches between bridges :) )

I think that Zsafe should be scaled too (in milling mode) and ingnored in laser. Opinions ?

MARIOBASZ commented 5 years ago

M03 or M04 in front of every path (block) M05 to turn off the laser in the end of the path (to not make scratches between bridges :) ) Ok

MARIOBASZ commented 5 years ago

@smooker, I did not understand what are you saying:

I think that Zsafe should be scaled too (in milling mode) and ingnored in laser. Opinions ?

MARIOBASZ commented 5 years ago

place the laser / milling option if there is a "laser variable" stored in bcnc, I will try to call it (@Harvie, delete an earlier comment by mistake, can you tell me if it is stored in bcnc as a variable, and how do I call a laser variable to save time?) If it does not exist, in the plugin I will place the Laser / engraving option

Harvie commented 5 years ago

Scaling plugin should only change the scale of g-code coordinates. I don't understand why it should change how motors/lasers are engaged... You should keep the M commands as written in original g-code.

MARIOBASZ commented 5 years ago

I'm not in my machine. but at the end of the block must go to zsafe for safety in milling, and for laser they say "change between m03 / m05)

MARIOBASZ commented 5 years ago

@smooker, if you send me a simple code to burn a square with laser, or two squares, one in each block, I will understand faster

MARIOBASZ commented 5 years ago

@Harvie, when you do laser pocket operation, in more than one figure, write m03m05 instead of zsafe ztarget?

MARIOBASZ commented 5 years ago

@smooker, I'm glad you can use scaling. here a use to scaling and modified (even in test) for 3d, oval from circle. Disadvantage: My wife told me "Mario, go and take a shower" 49F47F67-141F-4F4E-8CBE-37B966E9C874

smooker commented 5 years ago

Two 10mm squares. One in absolute space, the other in G91.

smooker@sh21 /mnt/vg3.2/home/smooker/src/bCNC/examples $ cat MARIOBASZ.ngc

G21 (All units in mm)

S1000 (speed of the motor is pwm to laser)

G00 X0.0 Y0.0 Z0.0 (laser stays on Z=0 always)
M03 (turn on grbl laser)
G01 X0.0 Y10.0 Z0.000000 F400.000000
G01 X10.0 Y10.0 Z0.000000
G01 X10.0 Y0.0 Z0.000000
G01 X0.0 Y0.0 Z0.000000
M05

G00 X20.0 Y0.0
G91
M04 (turn on grbl laser in "auto" mode)
G01 X0.0 Y10.0 Z0.000000 F400.000000
G01 X10.0 Y0.0 Z0.000000
G01 X0.0 Y-10.0 Z0.000000
G01 X-10.0 Y0.0 Z0.000000
M05

@MARIOBASZ : Nice :) Mine is blaming me crazy.

MARIOBASZ commented 5 years ago

Thank you! Have you corrected the plugin? Do you want to make your modification? Do you want me to do it?

smooker commented 5 years ago

I've tried, but w/o success. Have no idea of python :) It's enough just to bypass the M commands as they are and as Harvie said :)

following just puts M05 at the end of the file. Not what I need.

                        bid_block.append(CNC.zsafe())                   #<<< Move rapid Z axis to the safe height in Stock Material
                        bid_block.append("M05 (smooker)")
                        all_blocks.append(bid_block)
#                       print "bid", bid_block.name(), bid_block,"*****************"

P.S. What I have to do to insert images here ? ;)

smooker commented 5 years ago

Screenshot_2019-03-24_12-39-49 Screenshot_2019-03-24_12-40-17 Screenshot_2019-03-24_12-40-39

MARIOBASZ commented 5 years ago

it is that it selects the route, and on it realizes scale, I think that it ignores the line that says m04 m05, it should fix me. At least I will put "select for laser" if it is simpler, until final solution. One question, for when installing a laser: ignore height z, or if you write z-1 low z?

smooker commented 5 years ago

Do not ignore Z, because some people may use it for focus/defocus (increase/decrease the area of the "tool"). Just scale Z too. It'll be up to the user to put the correct scale factor.

MARIOBASZ commented 5 years ago

with laser you use pocket operation? automatically type m04 m05?

smooker commented 5 years ago

Yes. it's not needed to turn off the laser with M05 for deeper engraving (pocket), but it's ok.

.... My mistake... M05 is mandatory in this case too. :) Principle is: During bridges moving (no matter that Z stays the same) you have to turn off the laser.

MARIOBASZ commented 5 years ago

I see that you are trying to modify the plugin, Animo! Believe me I barely got some python! experience modifying what I wrote, surely you will be able to do it, but between today and tomorrow I modify it so that it serves you and you do not have to correct the gcode by hand

MARIOBASZ commented 5 years ago

Place boolean laser field (look at trochoid 3d plugin or helical, I think there is a Boolean field) At the end you must say Zsafe, for no laser and m05 for laser

MARIOBASZ commented 5 years ago

How BCNC behaves profile, pocket or cut, to know if it is with laser or with milling? (write M03 M05 or write Z safe or Z objective?) Is there any laser / cutter option?

MARIOBASZ commented 5 years ago

I have added an option for Laser scaling (as long as you do not know how bcnc knows that you should write for laser, it is a solution) @smooker, can you check that everything works correctly?

smooker commented 5 years ago

sorry for the delay. will check later and post the result

smooker commented 5 years ago

I can not see any difference :) Which one is the commit ?

MARIOBASZ commented 5 years ago

scaling.zip

smooker commented 5 years ago

Screenshot_2019-03-30_19-28-07 Screenshot_2019-03-30_19-28-30 Screenshot_2019-03-30_19-29-09

smooker commented 5 years ago

Screenshot_2019-03-30_19-32-22 Just a suggestion...