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:

What is the post variable for the lathe stock diameter


Eric E
 Share

Recommended Posts

This isn't as easy as you would think, because there is no "pre-defined" variable to hold Lathe Stock information, the way there is in the Mill Product. With Mill, there are pre-defined "length, width, and height" variables. For Lathe, not so much.

What MD/CD/PST are you using?

I will describe how to do this in the Generic Fanuc 4X_MT Lathe Post. This might need some tweaking, depending on which Post you are using.

First thing to understand with Lathe is that "Stock" components are actually added "internally" to the Machine Definition. This means you need to access Machine Parameters to get the data. The default for "reading the machine" is to only read the components that are part of the "Current Axis Combination". This means that sometimes it will skip reading parameters that you actually want.

First, add two new variables at the top of your Post, in the "Format Assignment" section:

fmt "BAR DIA: " 2 stock_dia
fmt "BAR LEN: " 2 stock_length

 

Then, find the 'pset_mach' Post Block. Modify as follows:

# --------------------------------------------------------------------------
pset_mach       #Set post switches by reading machine def parameters
      #Reset variables prior to MD read
      y_axis_mch = no$    #Reset to zero - Set from Axis Combination

      #rd_mch_ent_no$ = syncaxis$  #Retrieve machine parameters based on current axis combination - read from .nci G950 line
      rd_mch_ent_no$ = -1 #Setting to '-1' tells MP to get "ALL" the machine parameters...
      rd_md$       #Read machine definition parameters - calls pmachineinfo$

      #We only need these set at toolchange (and start of file).  No need to set them each time a user may call rd_md

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

 

Now, in 'pmachineinfo$', make the following changes:

# --------------------------------------------------------------------------
# Machine definition and control definition parameter capture:
# --------------------------------------------------------------------------
pmachineinfo$   #Machine information parameters postblock
      #rd_mach 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

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

      if axis_label = 2, y_axis_mch = yes$    #Y axis in axis combination found

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

All I did "above" in 'pmachineinfo$' was to "uncomment" the line for "Machine Group Parameters". (19000 series)

Ok, next, search for "19000" in the Post, until you find the Parameter Table for the 19000 series. By default, it is "empty". (no variables, and set to "0" for table entries)

Make the following mods:

# Toolpath Group Parameters
fprmtbl 19000   2    #Table Number, Size
#       Param   Variable to load value into
        19125   stock_dia
        19136   stock_length

Notice that I set the number of entries in the table to "2", and entered the PRMCODE value, followed by some spaces, and then the variable name.

That's it. Finally, you can use the variables 'stock_dia' and 'stock_len' (or pick names you like better, just be sure you spell them the same when you define them, fill them with parameter data, and use them on an "output" post line in your file header...

 

  • Thanks 1
Link to comment
Share on other sites

Ok, I looked into this a bit more. Lathe Stock definition is actually in the NCI data. You no longer have to "pull" it from the Parameters.

So....

Ignore my last Post in this thread. Remove those changes I had you make, they are unnecessary...

Just format two predefined variables:

fmt "BAR LEN: " 2 stck_ht$
fmt "BAR DIA: " 2 stck_wdth$

Those variables get the data from the NCI, and should give you what you are looking for. I created a real quick test file, with only a facing Op, and here is what I got:

%
O0000
(PROGRAM NAME - T)
(DATE=DD-MM-YY - 15-11-17 TIME=HH:MM - 14:23)
(MCX FILE - T)
(MATERIAL - STEEL INCH - 1030 - 200 BHN)
(BAR LEN: 7.)
(BAR DIA: 4.125)
G20
(TOOL - 1 OFFSET - 1)
(OD ROUGH RIGHT - 80 DEG.  INSERT - CNMG-432)
G0 T0101
G18
M8
G97 S177 M03
G0 G54 X4.325 Z0.
G50 S3600
G96 S200
G99 G1 X-.0625 F.01
G0 Z.1
M9
G28 U0. V0. W0. M05
T0100
M30
%

 

If you want different "formatting" for the length, and diameter, you might need to create a new Format Statement:

fs2 25  0.4 0.4t    #Decimal, 4 place, trailing

Then, modify the variables Format Assignment to include this new Format Statement:
 

fmt "BAR LEN: " 25 stck_ht$
fmt "BAR DIA: " 25 stck_wdth$

Which gives you:

%
O0000
(PROGRAM NAME - T)
(DATE=DD-MM-YY - 15-11-17 TIME=HH:MM - 14:23)
(MCX FILE - T)
(MATERIAL - STEEL INCH - 1030 - 200 BHN)
(BAR LEN: 7.0000)
(BAR DIA: 4.1250)
G20
(TOOL - 1 OFFSET - 1)
(OD ROUGH RIGHT - 80 DEG.  INSERT - CNMG-432)
G0 T0101
G18
M8
G97 S177 M03
G0 G54 X4.325 Z0.
G50 S3600
G96 S200
G99 G1 X-.0625 F.01
G0 Z.1
M9
G28 U0. V0. W0. M05
T0100
M30
%

 

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