Author Topic: X and Y position may be wrong after a tool change (M6)  (Read 9456 times)

Offline DDB

  • Ewok
  • *
  • Posts: 27
    • View Profile
X and Y position may be wrong after a tool change (M6)
« on: December 28, 2013, 15:08:51 pm »
I found that after a tool change (M6), CamBam (0.98N) does not necessarily force X and Y to be (re-)set. If one of them is the same before and after the tool change the axis is not addressed again.

I ran into this yesterday, when my USBCNC refused to load a file that I had successfully validated in CutViewer before, claiming "radius to end of arc differs from radius to start".

This is the code

Code: [Select]
...

G2 X110.61 Y8.5566 I1.22 J0.0
G2 Y6.4434 I-0.61 J-1.0566
G2 X108.78 Y7.5 I-0.61 J1.0566
M9

( Chamfer )
G0 Z3.0
M6 T15
(TOOL/CHAMFER, 8,90,30,3)
M8
M3 S21000
G0 X12.45            ; <--- here
G0 Z-18.9
G1 F300.0 Z-20.0
G2 F1500.0 X8.775 Y5.3782 I-2.45 J0.0
G2 Y9.6218 I1.225 J2.1218

...


In my tool change macro I reposition the spindle to where it was before the change. So in my case this code would work, but basicly USBCNC is right. After a tool change the spindle could be anywhere.

Adding the proper Y-coordinate from before the change solved it (and makes the whole MOP more self contained and better to read) .

Code: [Select]
G2 X108.78 Y7.5 Z-23.5 I0.61 J1.0566
...

G2 X108.78 Y7.5 I-0.61 J1.0566
M9

( Chamfer )
G0 Z3.0
M6 T15
(TOOL/CHAMFER, 8,90,30,3)
M8
M3 S21000
G0 X12.45  Y7.5         ; <--- here
G0 Z-18.9
G1 F300.0 Z-20.0
G2 F1500.0 X8.775 Y5.3782 I-2.45 J0.0
...




Am I missing something or does this have good potential for some nice tool/stock damage?



Frank

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 9024
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #1 on: December 28, 2013, 16:53:47 pm »
Frank,

No CAM can know what a particular controller needs in terms of table movement to do a toolchange.  It is the job of the post-processor to hang onto those values, and re-assert the correct XY after the change.

To that end, you can very simply force the machine back to the correct XY by altering your post-processor.

For instance, the 'missing' Y in your example can be asserted simply by changing the post so that X and Y are non-modal.  Then, for _any_ move, both axes will be issued in the G-code.

You can also force the axes to your desired toolchange position without doing it manually, by adding that code to the toolchange macro in the post.  Then finish the toolchange macro with a G0 to the $mop.first.... coordinates, as laid out in the docs, and here:

$mop.first.x
$mop.first.y
$mop.first.z
[New! 0.9.8N]    

Insert the X, Y or Z coordinate of the first toolpath point of the current machining operation.

This macro may be useful after a tool change command, to move to the next machining X, Y coordinate at the tool change height, before plunging to the clearance plane.
\

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7482
    • View Profile
    • Cambam V1.0 French Doc
Re: X and Y position may be wrong after a tool change (M6)
« Reply #2 on: December 28, 2013, 18:02:24 pm »
Hello,

Maybe you can just use the Postpro for USBCNC  ;)

http://www.cambam.co.uk/forum/index.php?topic=3451.0

++
David

Offline DDB

  • Ewok
  • *
  • Posts: 27
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #3 on: December 28, 2013, 18:51:34 pm »
Lloyd,

thanks,

No CAM can know what a particular controller needs in terms of table movement to do a toolchange.  It is the job of the post-processor to hang onto those values, and re-assert the correct XY after the change.

To that end, you can very simply force the machine back to the correct XY by altering your post-processor.

No, of course not. Even more tool change procedure does not only differ from controler to controler but basicly from machine to machine (and their configuration settings).

That's why I think, it would be a good idea that the CAM software makes sure the spindle actually is where it is supposed to be, when it regains control over it. It can't query the controller directly, but it could easily say "Now that You're back, I'd like You to be 'there'".
It's doing that anyway, but assuming that the spindle has not been moved which in this particular situation is not the case.

I have designed my toolchange procedure so, that the controller brings back the spindle to the position where it picked it up when it got the toolchange command. The way back to the stock may be dangerous and I want the tool to be safe, when the controller returns control to the CAM (i.e. GCode).
You're right, CamBam does not know the way through the morass and it should be my (machine's) duty to deliver the package at a position where it can be safely taken over. However I think CamBam should do at least a minimum effort to make sure this happened.

We do the same, don't we? If You ask a colleague or friend to do something for You. Unless he reports by himself, You will ask him "did You that, did it work?..."

For instance, the 'missing' Y in your example can be asserted simply by changing the post so that X and Y are non-modal.  Then, for _any_ move, both axes will be issued in the G-code.

yes, I could but that would unnecessarily bloat the code.

Normally, once You pressed start, the CAM / GCode has control over the machine, line by line going through the code. Unless something unusual happens modal operations are fine.
At a tool change however control is given to the hands of the machinist. Whatever happens there is beyond the CAM's responsibility. It's giving the spindle into a black box and taking a nap until someone tips on its shoulder and whispers "You may continue". CamBam, still half asleep, rubs one eye and automatically replies "ah, eh, yes. X123.45!" without knowing where that thing actually is.   

You can also force the axes to your desired toolchange position without doing it manually, by adding that code to the toolchange macro in the post. Then finish the toolchange macro with a G0 to the $mop.first.... coordinates, as laid out in the docs, and here:

$mop.first.x
$mop.first.y
$mop.first.z
[New! 0.9.8N]    
Insert the X, Y or Z coordinate of the first toolpath point of the current machining operation.
This macro may be useful after a tool change command, to move to the next machining X, Y coordinate at the tool change height, before plunging to the clearance plane.
\

Guess I'll have to do something like that. As mentioned above, my tool already is at the same position it was before the tool change (with a miniumum of Z add for safety), but in that particular situation my controller refused to load the file.
Maybe I just move X and Y by a fraction of a mm in the post....

Anyway, this way each and everyone has to modify the post to be on the safe side and I don't think that would be necessary.

Thanks for Your quick reply.

Frank



Offline DDB

  • Ewok
  • *
  • Posts: 27
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #4 on: December 28, 2013, 19:17:13 pm »
David,
Maybe you can just use the Postpro for USBCNC  ;)

http://www.cambam.co.uk/forum/index.php?topic=3451.0

Thanks, but there is nothing in that postprocessor addressing this issue.

I know I can get around that problem easily.
I still think that it is a potential danger that could easily be disarmed by the software if after a toolchange (or at the beginning of each MOP) all coordinates would be addressed even though the information is modal. The information is there and it would just make a few extra bytes.

Like a chapter in a book, each MOP begins with a caption (comment) a spindle speed command and a visit to the clearance plane. Why not make sure X and Y also are properly set?


Frank

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 9024
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #5 on: December 28, 2013, 20:26:31 pm »
Frank,

Your suggestion might make it _easier_ to get things right, but to use your own expression, it would "bloat the code" for machines where a 'toolchange' isn't a physical operation.

Take for instance Gerber photo-plotter machines, which never physically move the gantry when a toolchange occurs, but merely change an aperture in the light emitter head. 

Why use what you don't need?  Why have g-code in the file that isn't necessary? (and some of the older Gerbers have VERY limited code memory)

It's an option, just like selecting it from a menu might be.  Using or not using the $mop.first coordinates in your post allows you to select or not select things to match your machine's needs.

I think I'd rather have that flexibility than to be forced by the code to do it "Andy's way, or no way."  It's not like you need to make the change over and over, after all.

LLoyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline DDB

  • Ewok
  • *
  • Posts: 27
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #6 on: December 29, 2013, 00:10:00 am »
Lloyd,

Your suggestion might make it _easier_ to get things right, but to use your own expression, it would "bloat the code" for machines where a 'toolchange' isn't a physical operation.

Take for instance Gerber photo-plotter machines, which never physically move the gantry when a toolchange occurs, but merely change an aperture in the light emitter head. 

Why use what you don't need?  Why have g-code in the file that isn't necessary? (and some of the older Gerbers have VERY limited code memory)

It's an option, just like selecting it from a menu might be.  Using or not using the $mop.first coordinates in your post allows you to select or not select things to match your machine's needs.

I think I'd rather have that flexibility than to be forced by the code to do it "Andy's way, or no way."  It's not like you need to make the change over and over, after all.

Granted I did not see the Gerbers and other real "machines" that don't get data from harddisks.
Don't get me wrong, call it a feature or a bug, but I think it should be addressed. For me it is fine the way it is. I fell over it and fixed it. I added

Code: [Select]
{$clearance}
X{$mop.first.x} Y{$mop.first.y}

to the toolchange section of the post and it works exactly as expected. Thanks for the tip.

During daytime I develop software and sell it via internet. Completely other things but in a similar price range. Problem is that You have to deal with professionals as well as hobbyists, beginners as well as experts.
Reading through the forums, it seems that many of them work with Mach3.
From my own experience I know how much (or little) time and energy people invest in software they download.
They download it, click here and there and if it does not feel familiar at once it is put aside and something else is tried out. Thorough reading, complicated configuration - whishful thinking.

When we got our mill, my brother started looking for a CAM software to start with, because I could not spend a minute. Being completely new to the materia You don't know where to start, what You want and what You need. All the terms and procedures don't mean anything to You. If You're in that state asked to adapt Your Postprocessor, You literally have no clue what this ever could be.
At that time my brother decided that CamBam is not the right software... for me it is a wonderful piece of software and exactely the way I want it (Andy, if You read this, thanks for doing it this way).

This all is a completely different business from the one where the consultant visits the customer, sets up everything and teaches the handling.

I don't know if a true problem can arise from that, but if so, it might be a good idea, if not directly in code, then at least to adapt the Mach3 posts that are being installed with CamBam.

To me it feels like one of these "time bombs", you sometimes have in code. Things that work well 99.99% of the time and randomly  are the cause for "funny" effects.

Thanks for Your time

Frank


Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 9024
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #7 on: December 29, 2013, 00:27:49 am »
Frank,
We've come halfway each.  I believe it should be changed in the distribution version of all the post-processors, and I think the flexibility to affect it in the post should be retained.

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline DDB

  • Ewok
  • *
  • Posts: 27
    • View Profile
Re: X and Y position may be wrong after a tool change (M6)
« Reply #8 on: December 29, 2013, 12:30:06 pm »
Lloyd,

:)

Yes, I think that would be more than enough and if someone does not want it, he/she can take it out of the post

Have a great Sunday

Frank