Jump to content

Welcome to eMastercam

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:

WCS increment in Transform (rotate) by toolplane (multiple parts)


Recommended Posts

Hello,

I am programming a tombstone (horizontal B axis) where there are multiple identical parts on each face of the tombstone (four parts on B0 which are then copied around to the additional sides). My approach is to program one side of the tombstone completely and then use a transform (by toolplane) operation for each tool to rotate the toolpath operations around the tombstone. This works great and posts out nicely except when it comes to work coordinate system numbering. I have tried many variations of manipulating the wcs function in both the transform operation(s) as well as the WCS-View Manager but the result is that Mastercam will post out one addition WCS per additional tool plane regardless of the number of parts or WCS's used in the original operations. Everything else (B angles etc.) is posting perfectly.

 

So I decided I could solve this by adding a few features in the post processor using the custom parameters available in the Transform operation.

I set the number of parts per side as a miscellaneous integer in the Transform / custom parameters dialog and accessed it in the post via trans_mi2$.

I created a variable and indexed it by 1 each time the tombstone rotated, multiplied it by the number of parts in trans_mi2$ and added it to workofs$ for the WCS output. I had to set the Transform work offset numbering type to "Maintain source operations" which gave me an error (WCS used in more than one view) during posting but the output successfully incremented the work offset numbering to give each part on each side it's own unique work offset number which incremented sequentially.

 

So here's the problem...

I can't figure out how to reset it. It continually adds to the work offset numbering so it only works if I start at one point and work around the tombstone sequentially. I have multiple views on the part and not every tool will be able to cut in the same sequential order as the previous tool(s). If I could figure out how to tell it to "start over" I could design the work offset numbering (or add more work coordinate systems as numbering start points) to make it post complete with no hand edits but as for now I will either have to hand edit the program or scrap the Transform operations and program each side individually just for the proper work offset numbering.

 

The post debugger shows me that trans_mi2$ stays modal so when the Transform operation is complete and another "conventional" operation starts, the value in trans_mi2$ is in effect (setting off the logic that told it to index the WCS number) so the numbering just continues to increment. I've tried several techniques to "reset" the numbering with no success. The only thing that works is a tool change so I could select "Force tool change" but that wouldn't be very ideal.

 

 

Here are some details of what I have and what I've done...

 

Mastercam X7 16.2.0.4

 

The post is a customized version based on the Generic Haas 4X Mill.pst

 

[post_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V16.00 P0 E1 W16.00 T1398767629 M16.00 I0 O0

# Post Name : Generic Haas 4X Mill.pst

# Product : Mill

# Machine Name : Haas

# Control Name : Hass

# Description : Generic 4 Axis Mill Post

# 4-axis/Axis subs. : Yes

# 5-axis : No

# Subprograms : Yes

# Executable : MP 13.0

 

Some snippets of how the indexing works...

 

trans_mi2temp = trans_mi2$

 

if mi1$ > one,

[

if trans_mi2temp > 0 ,

[

if (prv_indx_out <> fmtrnd(indx_out)) | (prv_cabs <> fmtrnd(cabs)), #index wcs on rotate

[

pwcs_index = trans_mi2temp * index_val

]

sav_frc_wcs = force_wcs

if sub_level$ > 0, force_wcs = zero

if workofs$ <> prv_workofs$ | (force_wcs & toolchng),

[

if workofs$ < 6,

[

g_wcs = workofs$ + 54 + pwcs_index

*g_wcs

]

else,

[

p_wcs = workofs$ - five + pwcs_index

"G54.1", *p_wcs

]

]

force_wcs = sav_frc_wcs

!workofs$

]

else, #normal output

 

and also the variable which is set in the post block that indexes the tombstone...

 

index_val = index_val + 1

 

If you're still with me here maybe you can give me some ideas? I've made it work but how do I shut it off without a tool change? I've tried using other variables as flags to say "STOP" but so far it hasn't worked.

Link to comment
Share on other sites

Seems like you have a loop logic problem where you are not updating the vaule at the toolchange. I have seen many different ways to do this, but I am thinking the best is to do a trans_mi2temp = 0 or a trans_mi2$ = 0 some where in the toolchange block that way every time you come to a toolchange you reset the loop logic process since it stays model you need to create a process that resets itself. Some loops look to strings and the strings seem to help the loop logic stuff reset and others require the post creator to think far enough ahead to reset it to make it work. If you want to make a .z2g with your post and some sample stuff in it then someone will be glad to take a look and help you out.

 

Welcome to the forum and hope you are not the countless 1000's that post one thing and are never seen again since it is a interesting logical problem that will be a benefit to others.

 

HTH

Link to comment
Share on other sites

Hi,

Thank you for the response. I've tried multiple techniques for resetting the logic (including your suggestion) but in order to get it working I ended up needing to get trickier. The problem wasn't about resetting at a tool change but rather resetting between operations for the same tool. If I just added a line to reset the variable it would get reset too early and the process would only execute once.

 

To recap my goal: I wanted to work around the tombstone using a transform operation with the work offset numbers increasing for each part, and then start back at the beginning, (or a new plane with the same tool) and work around the tombstone again with the work offset numbers starting over and matching the numbers that were used the first time around (rather than continually counting up).

 

Anyway, I did manage to get it working and I will share just in case anybody else can gain from this. Keep in mind that there may still be some bugs to work out...

 

I used two misc. integers in the transform operation custom parameters. One to represent the number of parts on each side of the tombstone and one to represent the number of tombstone faces. A value in these variables indicates to the post to use the work offset number indexing section of the post (which I added) rather than the normal work offset numbering. I programmed each part on the first side of the tombstone conventionally with individual work coordinates for each part. The additional sides of the tombstone are programmed with the Transform operation (rotate by toolplane). I set the Transform operation Work Offset Numbering dialog to "Maintain source operations" so Mastercam outputs the same work offset numbers for the transformed parts as the original parts. I then intercepted the work offset numbers in the post so instead of outputting the original numbers they were increased by 1 for each new part. So if the first side uses G54.1 P1 and P2, side two will use P3 and P4, side three will use P5 and P6, etc.

 

In the post, each time an index occurs, the work offset numbering increases but the number of remaining parts is counted down. When the number of remaining parts reaches zero the post resets the variables and returns to conventional work offset numbering. This can be then be repeated for additional transform operations (in a new plane for instance).

 

These are the changes I made to the post...

 

#variable Initializations

pwcs_index : 0 #used to increment work offset number in tool plane transform

index_val : 1 #used to count the number of indexes made

trans_mi2temp : 0 #represents parts/side - passed with trans_mi2$

trans_mi3temp : 0 #represents number of sides - passed with trans_mi3$

trans_mi3flag : 0 #enable/disable work offset number indexing

 

#reset variables at tool change post block

index_val = one

pwcs_index = zero

trans_mi3flag = zero

 

#index output post block

index_val = index_val + 1 #count up by 1 each time tombstone indexes

 

pwcs #G54+ coordinate setting

 

trans_mi2temp = trans_mi2$ #value set in transform operation - represents number of parts/side

 

if mi1$ > one,

[

if (trans_mi2temp > 0) & (trans_mi3$ > 0), #execute only if work offset number indexing is turned on

[

if (trans_mi3temp <> trans_mi2temp * trans_mi3$) & (trans_mi3flag <> 1), #run once to set trans_mi3temp value. Flag is set to prevent from running again.

[

trans_mi3flag = 1

trans_mi3temp = trans_mi2temp * trans_mi3$

]

if (prv_indx_out <> fmtrnd(indx_out)) | (prv_cabs <> fmtrnd(cabs)) not (trans_mi3temp <= 0), #increase work offset numbers on rotate

[

pwcs_index = trans_mi2temp * index_val #multiply number of parts per side by number of indexes - this is added to the base work offset number

trans_mi3temp = trans_mi3temp - trans_mi2temp #count parts down on rotate so numbering can be reset when complete

]

if trans_mi3temp <= 0, #when all indexing is complete, reset work offset numbering and flag

[

pwcs_index = 0

index_val = 0

trans_mi3flag = 0

]

sav_frc_wcs = force_wcs

if sub_level$ > 0, force_wcs = zero

if workofs$ <> prv_workofs$ | (force_wcs & toolchng),

[

if workofs$ < 6,

[

g_wcs = workofs$ + 54 + pwcs_index #output work offset with value modifier

*g_wcs

]

else,

[

p_wcs = workofs$ - five + pwcs_index #output work offset with value modifier

"G54.1", *p_wcs

]

]

force_wcs = sav_frc_wcs

!workofs$

]

else, #no work offset number indexing so normal output

.

.

.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

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.

Follow us

×
×
  • Create New...