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:

Capturing a MD parameter


Recommended Posts

I've been attempting to teach myself how to manipulate these posts. I've had some very small victories but for the most part I'm being bricked. Frustration level alpha. I have the MP Documentation and have followed it to capture and use a parameter but nothing I try will return any value at all. The value I'm tryinig to grab is the Z position relative to the end of stock material for a lathe. It's param # 17435. In the documentation is states that all I need to do is have user defined variable and add this this line in the pmachineinfo$ post block...

if prmcode$ = 17435, main_stk_pos = rpar(sparameter$,1)

In order to get it to work at all I had to add this line

fmt  ""  2  main_stk_pos   "" #Main spindle stock position

in the Toolchange / NC output Variable Formats section of the post

The only output I can get out of it is '0.' I've attached a screenshot from the MP Documentation of the variable I'm trying to grab. Any help would be greatly appreciated.

MD Params.jpg

Link to comment
Share on other sites
1 hour ago, M.Bluedorn said:

I've been attempting to teach myself how to manipulate these posts. I've had some very small victories but for the most part I'm being bricked. Frustration level alpha. I have the MP Documentation and have followed it to capture and use a parameter but nothing I try will return any value at all. The value I'm tryinig to grab is the Z position relative to the end of stock material for a lathe. It's param # 17435. In the documentation is states that all I need to do is have user defined variable and add this this line in the pmachineinfo$ post block...

if prmcode$ = 17435, main_stk_pos = rpar(sparameter$,1)

In order to get it to work at all I had to add this line

fmt  ""  2  main_stk_pos   "" #Main spindle stock position

in the Toolchange / NC output Variable Formats section of the post

The only output I can get out of it is '0.' I've attached a screenshot from the MP Documentation of the variable I'm trying to grab. Any help would be greatly appreciated.

MD Params.jpg

Just because it is in the documentation doesn't mean it is getting passed through the NCI into the MP to read it. Might need to send a requests to the Post department at CNC Software and see if this is one of them that just isn't. Post this up on the official Mastercam forum and they should answer you pretty quickly. Looks like you have the understanding of how might just be one of these just not been found missing till now. 

  • Like 1
Link to comment
Share on other sites

Did you set 'rd_mch_ent_no$'?

That variable controls "what parameters" are available to 'pmachineinfo$'. By default, it gets set to read "only the active axis stream" for a given operation, at a "tool change event".

You will see this in the MPMaster Post:

      if sof = 1,
        [
        maxfeedpm = 999999       #Uncomment these variables to force use of machine def values as initial lowest max feedrate value
        maxfeedpm_m = 9999999    #Otherwise the default (post) initialization setting is used as initial value
        #minfeedpm = 999999
        #minfeedpm_m = 999999
        !maxfeedpm, !maxfeedpm_m  #, !minfeedpm, !minfeedpm_m
        rd_mch_ent_no$ = 0
        rd_md$       #Read machine definition parameters - calls pmachineinfo$
        ]

      rd_mch_ent_no$ = syncaxis$  #Retrieve machine parameters based on current axis combination - read from .nci G950 line
      rd_md$       #Read machine definition parameters - calls pmachineinfo$
      rd_tlpathgrp$  # Read toolpath group parameters - calls pmachineinfo$

In that piece of code, we first test the value of 'sof = 1'. If that is true (presumably at the start of processing), then all the code below it is read.

Notice that 'rd_mch_ent_no$' is set to '0'.

Then there is a call to 'rd_md$', which calls 'pmachineinfo$ for each of the Parameters.

You probably need some code like the following:

      rd_mch_ent_no$ = -1  #GET ALL MD PARAMETERS
      rd_md$       #Read machine definition parameters - calls pmachineinfo$

Then, inside pmachineinfo$, get the value of '17435'. I also like to add a "trap", to test for values, because MD Parameter Numbers can be overwritten. In other words; some MD Parameter values can be shared between multiple 'components'. As we process the "axis combination", we do this component-by-component. At some point, we should get 'the value you want'.

You should initialize a 2nd variable, to save the value as a backup. (A "test" if you will...)

Add:

fmt  ""  2  main_stk_pos   "" #Main spindle stock position 
fmt  ""  2  sav_main_stk_pos   "" #Main spindle stock position saved during pmachineinfo$ loop 

Try this inside pmachineinfo$:

      if prmcode$ = 17435,
        [
        main_stk_pos = rpar(sparameter$,1)
        if main_stk_pos <> zero & main_stk_pos <> -9999, sav_main_stk_pos = main_stk_pos
        result = mprint("The next value shown is current value of main_stk_pos")
        result = mprint(main_stk_pos)
        result = mprint("The next value shown is current value of sav_main_stk_pos")
        result = mprint(sav_main_stk_pos)
        ]

 

  • Like 2
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...