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:

Low Gear Question


Recommended Posts

I am trying to setup a low gear selection for drilling holes on a lathe. I saw the use_gear mode and don't really think it is for me. I defined a Misc Intiger to use the low gear. I got the code to output correctly but I am still getting errors. It doesn't seem to like how I am calling variable plowgear.

plowgear        #Use spindle gear Max rpm 750		if mi5$ = one,			[			"M41"			]		else, 			[			"M42"			]
prpm            #Output for start spindle      speed = speedrpm      if posttype$ = two,  #Lathe mode spindle        [        if speed = zero,          pbld, n$, *spindle_l, e$  #RPM = '0', output just an 'M05'        else,          [          result = nwadrs(strs, speed)           #'S' for lathe spindle		  plbd, plowgear, e$          pbld, n$, *sg97, *speed, *spindle_l, pgear, e$          ]        ]      else,    #Milling mode spindle        [        if nextdc$ = three & tool_op$ = 56,  #Radial Tapping cycle          [          result = nwadrs(strs, speed)  #'S' for Radial Tapping          pbld, n$, *speed, e$          ]        else,          [          result = nwadrs(strp, speed) #'P' for Mill spindle          pbld, n$, *sg97, *speed, *spindle_m, e$          ]        ]      !css_actv$prpmnull       #Output for RPM at NULL tlchg (don't force spindle 'M' code)      speed = speedrpm      if posttype$ = two,   #Lathe mode spindle        [        result = nwadrs(strs, speed)           #'S' for Lathe Spindle		plbd, plowgear, e$        pbld, n$, *sg97, *speed, spindle_l, pgear, e$        ]      else,    #Milling mode spindle        [        if nextdc$ = three & tool_op$ = 56,  #Radial Tapping cycle          [          result = nwadrs(strs, speed)  #'S' for Radial Tapping          pbld, n$, *speed, e$          ]        else,          [          result = nwadrs(strp, speed) #'P' for Mill spindle          pbld, n$, *sg97, *speed, spindle_m, e$          ]        ]      !css_actv$
G20(TOOL - 8 OFFSET - 8)(LATHE TOOL 78  INSERT - CNMG-432)G00 T0808M41 (it's giving me what I want, it just seems like my logic is off)G97 S182 M3G00 G54 Z.3 M88X9.42G50 S2500G96 S450X2.25Z.1G99 G01 Z0. F.008Z-5.8G00 Z.3X9.42M89M5G53 X0.G53 Z0.M30%
  • Like 1
Link to comment
Share on other sites

I tried some new stuff so I am only getting 3 errors instead of a bunch.

 

The ouput code

%O0000(PROFILE)(DATE=DD-MM-YY - 08-11-16 TIME=HH:MM - 14:13)(MCX FILE - C:\USERS\ASMURPHY\DOCUMENTS\MY MCAM2017\WORKFOLDER\...\PROFILE.MCAM)(NC FILE - C:\USERS\ASMURPHY\DOCUMENTS\MY MCAM2017\LATHE\NC\PROFILE.NC)(MATERIAL - STEEL INCH - 1030 - 200 BHN)G20(TOOL - 8 OFFSET - 8)(LATHE TOOL 78  INSERT - CNMG-432)G00 T0808M41G97 S182 M3G00 G54 Z.3 M88X9.42G50 S2500G96 S450X2.25Z.1G99 G01 Z0. F.008Z-5.8G00 Z.3X9.42M89M5G53 X0.G53 Z0.M30%

Error log

08 Nov 2016 02:13:12 PM - Report created.08 Nov 2016 02:13:12 PM - Initialize posting log file08 Nov 2016 02:13:12 PM - Using MP run version 19.00 and post components version 19.0008 Nov 2016 02:13:12 PM - Initiate opening the post processor file(s).08 Nov 2016 02:13:12 PM - C:\Users\Public\Documents\shared Mcam2017\lathe\Posts\SL-40 Post.PST08 Nov 2016 02:13:12 PM - The post processor file has been successfully opened.08 Nov 2016 02:13:12 PM - Initialization of pre-defined post variables, strings, postblocks was successful.08 Nov 2016 02:13:12 PM - Search for defined post variables, strings, postblocks was successful.08 Nov 2016 02:13:12 PM - PST LINE (1990) - The post block output type processing has failed!, , Label has not been defined[6]08 Nov 2016 02:13:12 PM - PST LINE (2001) - The post block output type processing has failed!, , Label has not been defined[5]08 Nov 2016 02:13:12 PM - PST LINE (2025) - The post block output type processing has failed!, , Label has not been defined[3]08 Nov 2016 02:13:12 PM - Successful completion of posting process!
pgear           #Use spindle gear range, find gear from RPM at X min.      if use_gear = one & mi5$ = one,        [        if lathtype = zero | lathtype = two, x_min$ = c1_x_max        else, x_min$ = c1_x_min        x_min$ = x_min$ + c1_tox  #Correction for workshift        if x_min$ = zero, x_min$ = 0.001        if css_actv$ = zero, gear_spd = speedrpm        else, gear_spd = (conversion * g_speed) / (pi$ * abs(x_min$) * two)        gear = frange(one, gear_spd)        *gear        ]	  else,	   [plbd, "M42", e$]                                                                  (This line is 1990)
prpm            #Output for start spindle      speed = speedrpm      if posttype$ = two,  #Lathe mode spindle        [        if speed = zero,          pbld, n$, *spindle_l, e$  #RPM = '0', output just an 'M05'        else,          [          result = nwadrs(strs, speed)           #'S' for lathe spindle		  fout, *pgear, e$                                                                     (this line is 2001)          pbld, n$, *sg97, *speed, *spindle_l, e$          ]        ]      else,    #Milling mode spindle        [        if nextdc$ = three & tool_op$ = 56,  #Radial Tapping cycle          [          result = nwadrs(strs, speed)  #'S' for Radial Tapping          pbld, n$, *speed, e$          ]        else,          [          result = nwadrs(strp, speed) #'P' for Mill spindle          pbld, n$, *sg97, *speed, *spindle_m, e$          ]        ]      !css_actv$
prpmnull       #Output for RPM at NULL tlchg (don't force spindle 'M' code)      speed = speedrpm      if posttype$ = two,   #Lathe mode spindle        [        result = nwadrs(strs, speed)           #'S' for Lathe Spindle		fout, *pgear, e$                                                                  (this line is 2025)        pbld, n$, *sg97, *speed, spindle_l, e$        ]      else,    #Milling mode spindle        [        if nextdc$ = three & tool_op$ = 56,  #Radial Tapping cycle          [          result = nwadrs(strs, speed)  #'S' for Radial Tapping          pbld, n$, *speed, e$          ]        else,          [          result = nwadrs(strp, speed) #'P' for Mill spindle          pbld, n$, *sg97, *speed, spindle_m, e$          ]        ]      !css_actv$
Link to comment
Share on other sites

Ok, first error is just a spelling mistake. "plbd", instead of 'pbld'. It is the "block delete" post block call. It isn't needed, unless you activate Block Delete with Canned Text. (So you can just remove it if you want.)

 

Then you have 'fout' on the other two lines. This is a variable that hasn't been defined. What are you trying to do with it?

 

A post block is like a Subroutine call on the machine. It isn't a variable, it is a "jump" to another location, and the post "returns" after the code inside the block is executed.

 

You can't "force" a post block; because there is no need. The jump will always be made. Remove the asterisk in front of the 'plowgear' call. It isn't needed.

 

Sometimes you will see two different post blocks with similar names, an example would be:

 

pfxout

pxout

 

In the 'pxout' post block, the output is based on Modality. The value only outputs when it changes from the last output value.

 

In 'pfxout', the value is "forced" out. This is done at variable level "inside" the post block. The block itself is just a jump or call. That is why there are two different post block names for blocks that do something similar. One has Modal output, the other has forced output.

 

So just delete the 'fout' variables, they aren't needed...

Link to comment
Share on other sites

Thanks Colin,

 

I didn't really understand what is used as text for variables or text to be output. In C+ to get a line to be output is cout and for the text to be read is cin. I thought it was something like that.

 

What is the * used for then?

 

As usual you are the man. :cheers:. I have the videos for the eapprentice post builders class and I need to get back to watching them. There is a ton of info in those videos and I need to start writing notes and descriptions on what is in each video so I can reference back to it when I need. 

  • Like 2
Link to comment
Share on other sites

The Asterisk is a "Variable Modifier", used on Numeric Variables. Look at the following post blocks for an example:

 

pxout

pfxout

 

In 'pxout', the variable 'xabs' or 'xinc' is output, based on two things:

 

  1. The state of the 'absinc$' variable. This controls "absolute vs. incremental" output, and is set in each Operation, with "Miscellaneous Integer #2". This allows you to control the output for each operation, and switch "output modes" at the operation level.
  2. The "Modality" of the Numeric Variable itself. Modality is a mechanism inside the MP Language that allows you to control output, based on the "previous" value of a variable. If the previously output value is different than the current value, then Modality tells MP to output the variable to the NC File. If the value is the same as the previous, then MP skips the output. This is the behavior inside 'pxout'. In 'pfxout', the structure is exactly the same as 'pxout', but the "Force Modifier" (*) is added to the output variables. This means if you call 'pfxout', instead of 'pxout', you will always get the variable output. This is what the "Force" modifier does.

You cannot "force" a post block call, since by definition a post block call will always be made when encountered on an output post line. It is common to either use Boolean logic inside the block to determine the output condition (Modal vs. Forced), or to build similar post block structures and make "one forced" and the other "modal".

 

 

So why do we use the structure for these output blocks, instead of just putting 'xabs' on the output line? (Or *xabs - if forced?) Because we want to be able to change output modes between Absolute or Incremental, in addition to Force vs. Modal behavior...

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