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:

Outputting XYZ values without letter prefix?


m_morgan
 Share

Recommended Posts

I'm in the process of making a post for a router, and to set up the initial move, it uses a line:

 

QX=100.000 QY=50.000 QZ=2.000

 

In the post I'm using:

 

"QX=", xabs, "QY=", yabs, "QZ=", zabs

 

to output the code, but when I post, it produces:

 

QX=X100.000 QY=Y50.000 QZ=Z2.000

 

What parameter do I use to output only the VALUE of the co-ordinate, not the whole string. Obviously it's not #abs.

 

Thanks in advance!

Link to comment
Share on other sites

Michael,

 

In you post processor,

 

Try changing this:

fmt X 2 xabs #X position output

fmt Y 2 yabs #Y position output

fmt Z 2 zabs #Z position output

fmt X 3 xinc #X position output

fmt Y 3 yinc #Y position output

fmt Z 3 zinc #Z position output

 

To that:

fmt QX= 2 xabs #X position output

fmt QY= 2 yabs #Y position output

fmt QZ= 2 zabs #Z position output

fmt QX= 3 xinc #X position output

fmt QY= 3 yinc #Y position output

fmt QZ= 3 zinc #Z position output

 

I did not try it but seems to me that it should do the trick.

Link to comment
Share on other sites

Martin,

 

Thanks for the response, but that changes all of the XYZ values to QX= QY= QZ=, whereas I just need the QX= QX= QZ= line once (for setting the 1st co-ordinate. The rest of the values are just XYZ.

 

I was thinking that there must be a way to strip the letter off?

Link to comment
Share on other sites

You could then try creating 2 post blocks to format the moves and then call the different post blocks like so:

 

pfirst_move # call of post block for first move

pbld,n, ... # positionning from the mastercam post

pother_moves # call of post block for other moves

 

 

and add these 2 post blocks:

 

pfirst_move # format output for first move

fmt QX= 2 xabs #X position output

fmt QY= 2 yabs #Y position output

fmt QZ= 2 zabs #Z position output

fmt QX= 3 xinc #X position output

fmt QY= 3 yinc #Y position output

fmt QZ= 3 zinc #Z position output

 

pother_moves

fmt X 2 xabs #X position output

fmt Y 2 yabs #Y position output

fmt Z 2 zabs #Z position output

fmt X 3 xinc #X position output

fmt Y 3 yinc #Y position output

fmt Z 3 zinc #Z position output

 

 

Hope that help,

Link to comment
Share on other sites

The fmt statements are global, you can only have one.

 

The way I would do a temporary change would be, in the post block where you are using the QX= ect, just before the output:

 

result = nwadrs(strqxeq, xabs)

result = nwadrs(strqyeq, xabs)

result = nwadrs(strqzeq, xabs)

 

n$, xabs, yabs, zabs, e$

 

When done outputting the value, in the same postblock, set the values back:

 

result = nwadrs(strx, xabs)

result = nwadrs(stry, xabs)

result = nwadrs(strz, xabs)

 

Near the top of the post there should be some string definitions, make sure to add the ones you want to use.

Table should look like this:

 

# --------------------------------------------------------------------------

#String and string selector definitions for NC output

# --------------------------------------------------------------------------

#Address string definitions

strc "C"

strf "F"

stri "I"

strj "J"

strk "K"

strm "M"

strn "N"

stro "O"

strp "P"

srad "R"

srminus "R-"

strx "X"

stry "Y"

strz "Z"

strl "L"

strqxeq "QX="

strqyeq "QY="

strqzeq "QZ="

 

 

sblank

 

 

Allan

Link to comment
Share on other sites

Michael,

 

You need to create some variables to capture the xabs, yabs, and zabs values. Those variable are not assigned the X,Y, or Z pre-fix until they are actually output.

 

First, backup your post.

 

In the variable initialization section, add the following variables:

 

code:

myvarXabs    : 0

myvarYabs : 0

myvarZabs : 0

This creates three new variables (make sure they start in the first column of the post).

 

Now in the format section below all the columns that contain the normal format assignments, add the following:

 

code:

fmt  QX= 2 myvarXabs

fmt QY= 2 myvarYabs

fmt QZ= 2 myvarZabs

This sets the format assignment for your new variables to match the format statement for the original xabs, yabs, zabs variables, but has the prefix you desire...

 

Now somewhere above your output line you need to add the following code:

 

code:

       myvarXabs = xabs

myvarYabs = yabs

myvarZabs = zabs

n$, myvarXabs, myvarYabs, myvarZabs, e$

This will give you a line with the output you want, with a sequence number in front. Just omit the "n$," parameter if you don't want a line number.

 

Hope that helps,

Link to comment
Share on other sites

Allan's method is nice too. Less work to do in the post as long as you only need to output those values once. If you need to output the variables with the different formatting in more than one spot (ex. you need those values output from pheader$, psof$, ptlchng$, or elsewhere), then you would have to use the "nwadrs" assignment in multiple spots...

 

Glad you got a solution that worked.

 

Allan, thanks for showing me something new! I'll have to play around with the new address function...

 

Thanks,

Link to comment
Share on other sites

Colin, I had a play with that too, and it works quite nicely. Went with the easy option though, as I only need to call the parameter once. Very good to know I can temporarily change values within a post block. Will definitely come in handy!

 

Was wondering why it wouldn't work, but then realised I was calling xabs, yabs, zabs. Stuck a * in front of each to output the value. Works find now! Why would that be?

Link to comment
Share on other sites

Asterix is the "force" variable output modifer. The variables weren't being output due to "modality". The post thought they had already been output somewhere else. This is explained in the Mastercam Post Reference Guide for V9, which you should get a copy of. I think it was on the FTP for a while... It is like 29 mb, so I can't email it to you...

 

Normally you can get a copy through your reseller.

Link to comment
Share on other sites

All...

 

I would consider Allan's solution to be "the best" as there are no possible "side effects".

 

Using the other proposed methods of assigning the values from xabs, yabs, zabs into other variables and then outputting those "new" variables does work, but...

 

You have bypassed outputting xabs, yabs, zabs as xabs, yabs, zabs - thus the prv_xabs, prv_yabs, prv_zabs (automatic previous) variables will not get updated.

 

This could possibly cause a modality issue on the next output the the "real" xabs, yabs, zabs variables, immediately after this "initial position" line.

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...