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:

Using program number for macro


Recommended Posts

For the way I run my horizontals I need to apply the program number to #602.  In the past I have just used #602=#4000.  This is a problem if you sub outnit will still use the original program.

 

so looking for a way to make say program 50 have this line. #602=0050.

 

if I use the *progno I will get #602=O0050

 

any way for me to fix this?

Link to comment
Share on other sites

i didn't understand what you were trying to do intially, but after thinking about this for a while.  I think I got it.    There must be some kinda verification macro to check what program you're trying to run to make sure its right one.  

The reply I gave before was wrong.  

 

Link to comment
Share on other sites

Do you still want the "O0050" at the header, or are you ok with eliminating that output, and just changing the formatting of 'progno$'. Because that is dead simple.

You just need to change the Format Assignment for 'progno$':

fmt  "#602=" 7  progno$ "."    #Program number

That should give you want you want:

#602=0050.

 

  • Like 1
Link to comment
Share on other sites

Hi Colin

 

I still need to keep the prog no at the top. I am just trying to save the program number to a macro. This should be simple with adding into the program #602=#4000. But if I am in a sub routine, and use this value it will still only set the main program value. SO instead of hand editing my programs. I was hoping to get the post to add the line automatically. 

 

 

Link to comment
Share on other sites

Soy did send me a message and gave me pointers. and I think I am close. 

 

I added to user variables 

Quote

fmt  "" 2 macroprogno  #macroprogno

in the pheader I have added

Quote

macroprogno = progno$

for the call out I have 

Quote

   35, "602=", "" , 35, macroprogno$ ,"              (        SET PROGRAM NUMBER           )", e$

I am getting this error for the call out line

Quote

15 Jul 2018 09:35:11 AM - PST LINE (2413) - The post block output type processing has failed!, , Label has not been defined[25]

the nc is posting

 

Quote

#602=#              (        SET PROGRAM NUMBER           )

 

basically anywhere I add macroprogno$ I will get the same label has not been defined error. Seems like I am close just missing something. 

 

 

 

 

Link to comment
Share on other sites
3 minutes ago, ajmer said:

You have to initialize the variable

Add this somewhere near the top of the post, it needs this for it to work. 

Or look for other initilized variable and put it on a line by itself

macroprogno  :  0

Sorry I forgot to add that also. I do have that like this in 


# Common User-defined Variable Initializations (not switches!)

macroprogno : 0   

 

 

Link to comment
Share on other sites

Your error is just a simple spelling error. I do it all the time.

You initialized a variable: macroprogno : 0

But when you used it on the output line, you added a dollar sign "$". The dollar sign indicates a "pre-defined" variable; a variable that is already defined in the MP.DLL post engine.

Your line should be:

   35, "602=", "" , 35, macroprogno ,"              (        SET PROGRAM NUMBER           )", e$ 

 

Link to comment
Share on other sites

Also, you are using "Format Statment #2", in your Format Assignment line:

fmt  "" 2 macroprogno  #macroprogno 

I would recommend creating a new Format Statement, so you can get different formatting, without affecting the other variables that use fs2 #2.

fs2 30 4.0 4.0l #Format number 30, Decimal, force 4 leading

Then, changing your Format Assignment to:

fmt  "#602=" 30 macroprogno  #macroprogno 

Now, instead of this:

   35, "602=", "" , 35, macroprogno ,"              (        SET PROGRAM NUMBER           )", e$ 

You just need this:

   *macroprogno ,"              (        SET PROGRAM NUMBER           )", e$ 

 

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