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:

Machine Defintion Manager Description


Recommended Posts

Hello Everyone,
   I'm trying to call out "Machine Definition Manager - DESCRIPTION" into the post.  I did this

 

fmt   ""   4 MDMDescription

 

MDMDescription: 0

if prmcode$ = 17012, MDMDescription= rpar(sparameter$, 1) 

 

at...

Pheader:
   *MDMDescription, e$

 

but.... it failed.  can you guys tell me what I've done wrong?

 

Thank you
    

Untitled.png

Link to comment
Share on other sites

You are trying to extract a STRING from the post. You have formatted MDMDescription as a NUMERIC variable. (This is wrong. You should define MDMDescription as a STRING!)

sMDMDescription : ""

(Note: All STRINGS must start with the 's' character in the first column.)

No need to use "FMT" Statement.

if prmcode$ = 17012, sMDMDescription = sparameter$

All Parameter Values that you extract; are all stored as STRINGS!

The 'rpar' function is used to convert a STRING into a NUMERIC Variable. You don't need to do this if you want to capture a String. You only need to use 'rpar' if you want convert the String into a Numeric Variable. << You can only do this with "numeric" strings. In other words, a String, that "could" be a number value.

For example, if you had following STRINGS of characters:

1

1.0

0.001234422

35.64323

88

5425465

All of those values "look numeric", but they are not. They are simply a random collection of "Characters". You cannot use Math or Boolean Logic functions on STRINGS.

These can be "Converted" into Numeric Variables. MP has several functions to convert Strings into Numeric Variables. You can also convert a Numeric Variable, into a String. You just can't mix "string functions" with "numeric variable functions", without doing the internal conversion. They can be converted, because each String contains a single "numeric" looking value. (Integer or Decimal number)

Here are some more STRING examples:

Hurco VMC - 4X

T56

Fanuc 18im

A8.012 B1.0 C2=2.135

These cannot be converted, because the characters are "mixed" with Alpha (A-Z,a-z, +-*/=, ect.) Characters.  (Technically, there are some advanced String Functions that can "parse" a string, and extract some numeric values, depending on the Format of the characters within the string, but that just adds to the confusion, so for now, just remember that a String is a String, and Numeric Variable is a Number, and the two should not be mixed without conversion, if that is possible.)

Hope that helps,

Colin

 

 

  • Like 1
Link to comment
Share on other sites

Thank you for your time to respond my question, Colin.  

I did as you instructed and I tried to call it out under PHEADER with the * as FORCING it out and it is not outputting the value I want.  

 

Do you think I need some extra codes to convert from NUMERIC to STRING?   Thank you for your help.

 

 

sMDMDescription : ""
if prmcode$ = 17012, sMDMDescription = sparameter$
pheader$         #Call before start of file    
   *sMDMDescription, e$ 

 

Link to comment
Share on other sites

For Strings, you can just use them "as is". If you just want to output a String like the Machine Name, you just create a String Variable, and set it with the Parameter read section.

Your issue has nothing to do with "type conversion" of the variable. (String to Numeric, or Numeric to String).

The issue is that the 'pparameter$' Post Block can only read Operation and Toolpath Group parameters. There is a separate section (and logic) for reading both Control Definition, and Machine Definition Variables.

Machine Definition Parameters are stored in the 'prmcode$' values of 17,000 to 17,999. The Control Definition Parameters are stored in 18,000 to 18,999.

Both of these "Blocks" of parameters are already setup to be read using a "Parameter Table" mechanism inside the post.

 

So there are really two different ways of accomplishing the same thing:

  1. The first option is simply to modify the Parameter Table, by adding 1 more "entry".  But you need to remember the values stored are all strings. Since all Parameters in Mastercam are stored as Strings in 'sparameter$'.
  2. You can also just add logic directly to test 'prmcode$', inside 'pmachineinfo$'. << That is the piece of information you are missing. You need to add your logic there, not inside 'pparameter$'.

 

# --------------------------------------------------------------------------
# Machine definition and control definition parameter capture:
# --------------------------------------------------------------------------
pmachineinfo$   #Machine information parameters postblock
      #rd_md is used to call pmachineinfo postblock and read the parameters of the selected axis combination machine entity set in rd_mch_ent_no
      #rd_cd is used to call pmachineinfo postblock and read the active control definition parameters
      #rd_tlpathgrp is used to call pmachineinfo postblock and read the active toolpath group parameters
      #"-->pmachineinfo", ~prmcode$, "  ", ~sparameter$, e$  #Do not uncomment if being called from pprep$ - see pprep comment

      if prmcode$ = 17012, sMDMDescription = sparameter$

      #Read parameter lookup tables - 
      if prmcode$ >= 17000 & prmcode$ < 18000, result = fprm(1) #Run the parameter table for Machine Definition Parameters
      #Leave lines below commented until you enter values in related lookup tables
      if prmcode$ >= 18000 & prmcode$ < 19000, result = fprm(2) #Run the parameter table for Control Definition Parameters
      #if prmcode$ >= 19000 & prmcode$ < 19900, result = fprm(3) #Run the parameter table for Toolpath Group Parameters

      #Count rotary axis and output error message if more than one is found in the active axis combination
      if prmcode$ = 19958,
        [
        component_type = rpar(sparameter$, 1)  #Component type
        if component_type = 5,
          [
          rot_ax_cnt = rot_ax_cnt + 1  #Rotary component
          if rot_ax_cnt = 2, rotaxerror = rotaxerror + 1   #Post only supports 1 rotary per axis combination
          ]
        ]

      if prmcode$ = 17406 & component_type = 5, sav_lim_lo = lim_lo
      if prmcode$ = 17407 & component_type = 5, sav_lim_hi = lim_hi

      #Determine if operation parameters are being written or not
      if prmcode$ = 18171, write_ops = rpar(sparameter$, 1)  #Write NC operation information (True/False)

      #Determine Z direction - set vmc
      if prmcode$ = 17392 & axis_label = 3,
        [
        z_dir = rpar(sparameter$, 1)  #Z axis direction - +X=1,+Y=2,+Z=3,-X=7,-Y=8,-Z=9
        if z_dir <> 3 & z_dir <> 9, vmc = 0   #0 = Horizontal Machine, 1 = Vertical Mill
        else, vmc = 1
        ]

      #Set axis of rotation for rotary component
      if prmcode$ = 17399,
        [
        last_rot_axis = rot_axis
        rot_axis = rpar(sparameter$, 1)  #Axis of rotation - +X=1,+Y=2,+Z=3,-X=7,-Y=8,-Z=9
        if rot_axis > 3, rot_axis = rot_axis - 6 #Keep value positive (+X,+Y,+Z) for use in rot_on_x
        ]

 

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