Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.
Use your display name or email address to sign in:
@Zaffin_D Well done This is really a much cleaner solution.
But in my case it doesn't work properly because some operations that follow each other use the same tool with a "force toolchange" flag. We use this for example for remeasuring the tool during roughing operations. However, this messes up the algorithm. If the same tool is used twice in succession, the tool (which is the same in both operations) which is marked with the next "force toolchange"-flag is preselected in the first operation. This is not the desired behavior (in my case).
As you only loop over the g-code-change, I don´t know how to enhance your code to integrate a check for force toolchange flag and look if the next tool is the actual tool. If this is the case then operation must be skipped.
I really appreciate your smart code, but I don't know how to improve it quickly.
Thanks @Zaffin_D I tried what you suggested but unfortunately I don't know how to get the next op_id$, what I need to query the 20002 parameter. The problem of op_id$ is that this is not an ordered number. Would be happy if you can give me more hints
Hi guys,
I have a small problem that is giving me a headache. Maybe someone here can help me
On a new machine with automatic tool changer, I need to pre-stage the next tool. Normally the next tool is called with the variable next_tool$. However, in my case, the tool number is stored under the tool manufacturer's code due to our internal rules.
In a first step, I changed my post to get the output with the "normal next tool number":
stagetool : 1 #0 = Do not pre-stage tools, 1 = Stage tools
one : 1 #Define constant
s_last_used_tool : "" #last used tool
s_next_tool : "" #tool to be pre-staged in ATC
s_tdef : "TOOL DEF"
p_goto_strt_tl #Make the tool start up at toolchange
pfd_shft_inc
psign_ang_out
##### Custom changes allowed below #####
s_next_tool = no2asc(34) + no2str(next_tool$) + no2asc(34)
if stagetool = one,
[
if s_last_used_tool <> s_next_tool,
[
pbld, n$, s_tdef, s_next_tool, e$
s_last_used_tool = s_next_tool
]
]
If I just want the next tool number, that would work fine.
But now: How can I get the tool manufactures code of the next tool ?
I tried to use something like this:
s_next_tool = opinfo(20002,1)
However, this doesn´t work at all - because the returned value points to the next toolpath ( passed parmeter 1) and not to the next tool (change). If the next toolpath uses the same tool, the return value is "-99999".If the next toolpath uses a different tool, the return value is correct.
I thought it could be solved with a while loop, but that get´s me to the problem, that I have to know how to determine the end of all posted toolpaths to prevent a endless recursion.
Does anyone can give me a hint how I can solve this ?
I've searched this forum up and down and found some posts, but everything I've tried doesn't end up with the desired output.
It would be great if someone could give me some advice to get me back on track.
Thanks,
Erich
eMastercam - your online source for all things Mastercam.
Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.