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:
Thanks, it seems you're correct. I've been programming toolpaths on the top plane with this machine using another post for so long I didn't even notice that it was always orienting the C-axis to 90 degrees when I did so. Putting the toolpath on the back plane is equivalent to 0 degrees of rotation. This is successfully processed without the error, but I still need the others to work.
Which leads to the next question: What are the steps to cause it to use the C axis for the TOP, FRONT and BOTTOM planes - and everything in between? I found the chapter on Rotary Processing (MP-Ref-Guide_Legacy-chapters.pdf) wasn't very clear. It presented some code from one of the template posts (MPFAN, maybe?) but didn't go into enough detail on what each of the lines was doing and why.
I understand the matrix transform of coordinate systems, but what exactly needs done in the post to make it happen, and what's the reason behind each step?
For a Y-axis lathe having both axial and radial live tools, how do you differentiate between them in the post? Axial tools are programmed from the RIGHT plane and seem to be okay, but radial tools are programmed from the TOP plane (and others using the C-axis for rotation) and aren't output with the correct axis motion.
How are these translated correctly to avoid getting the following error message:?
RUN TIME -OPID(4)- Only single-axis rotation is allowed! Angles may be incorrect.
Assume a blank slate with none of the variables or postblocks from the existing default posts.
When I was browsing through some resources, I came across an example post in one of the CHook projects. I was surprised to see that it seemed to be passing parameters to post blocks when I haven't seen any documentation on this.
Does anyone know how exactly this is intended to work with respect to declaring variables, naming, etc? Any chance a value can also be returned from a postblock?
Here's the contents of the file "MPDraw_Ex.mcpost":
[POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V20.00 P4 E1 W20.00 T1517249798 M20.00 I0 O0
#region User Settings
#<UserSettings>
MPDrawDebugOutput : no$ # Output arguments passed to the MPDraw.dll
geometryLevel : 101 # Level to create/remove geometry
#</UserSettings>
#endregion End User Settings
#region Post Settings
rotary_type$ : 5
#endregion End Post Settings
#region Format Statments
fs2 1 0.8 0.7
fs2 2 1 0 1 0
#endregion End Format Statments
#region Draw Geometry
#region Geometry Variable Initializations
#region Enumerators
# Geometry type
DELETE@ : 0
LINE@ : 1
ARC@ : 2
# View number
TOP@ : 1
FRONT@ : 2
BACK@ : 3
BOTTOM@ : 4
RIGHT@ : 5
LEFT@ : 6
ISOMETRIC@ : 7
#endregion End Enumerators
#region Numeric Variable Initializations
# Return value for dll function
dllReturn : 0
# Line start and end point variables
lineStartX : 0
lineStartY : 0
lineStartZ : 0
lineEndX : 0
lineEndY : 0
lineEndZ : 0
# Arc variables
arcView : 0
arcCenterX : 0
arcCenterY : 0
arcCenterZ : 0
arcRadius : 0
arcStartAngle : 0
arcEndAngle : 0
# Line start and end point variables formatted for output to MPDraw.dll
fmt "" 1 sx
fmt "" 1 sy
fmt "" 1 sz
fmt "" 1 ex
fmt "" 1 ey
fmt "" 1 ez
# Arc variables formatted for output to MPDraw.dll
fmt "" 2 arcview
fmt "" 1 acx
fmt "" 1 acy
fmt "" 1 acz
fmt "" 1 ar
fmt "" 1 as
fmt "" 1 ae
# level and geometry type variables formatted for output to MPDraw.dll
fmt "" 2 level
fmt "" 2 geometryType
#endregion End Numeric Variable Initializations
#region String Variable Initializations
ssq : "'" # Single quote character
sdq : '"' # Double quote character
sspace : " " # Space character
sMPDrawDLL = "MPDraw.dll" # Constant string containg 'MPDraw.dll'
sdeleteData = "0" # Constant string to hold the delete data
slineData : "" # String to hold the line data
sarcData : "" # String to hold the arc data
sMPDeleteArgs : "" # String to pass the delete arguments to MPDraw.dll
sMPLineArgs : "" # String to pass the line arguments to MPDraw.dll
sMPArcArgs : "" # String to pass the arc arguments to MPDraw.dll
#endregion End String Variable Initializations
#endregion End Geometry Variable Initializations
#region Geometry Post Blocks
# Remove all geometry from a specified level
pDeleteGeometry(level)
# Set the geometryType
geometryType = DELETE@
# Construct the delete argument string(sdeleteData, level, geometryType)
sMPDeleteArgs = ssq + sdq + sdeleteData + sdq + sspace + sdq + drs_str(2, level) + sdq + sspace + sdq + drs_str(2, geometryType) + sdq + ssq
# Call the MPDraw.dll passing it the constructed argument string
dllReturn = dll(sMPDrawDLL, sMPDeleteArgs)
# If MPDrawDebugOutput = yes$, write the delete arguments to the NC file
if MPDrawDebugOutput, " Delete Arguments : ", *sMPDeleteArgs, e$
# Draw a line on a specified level
pDrawLine(sx, sy, sz, ex, ey, ez, level)
# Set the geometryType
geometryType = LINE@
# Convert the line data to a string
slineData = drs_str(2, sx) + sspace + drs_str(2, sy) + sspace + drs_str(2, sz) + sspace + drs_str(2, ex) + sspace + drs_str(2, ey) + sspace + drs_str(2, ez)
# Construct the line argument string(slineData, level, geometryType)
sMPLineArgs = ssq + sdq + slineData + sdq + sspace + sdq + drs_str(2, level) + sdq + sspace + sdq + drs_str(2, geometryType) + sdq + ssq
# Call the MPDraw.dll passing it the constructed argument string
dllReturn = dll(sMPDrawDLL, sMPLineArgs)
# If MPDrawDebugOutput = yes$, write the line arguments to the NC file
if MPDrawDebugOutput, " Line Arguments : ", *sMPLineArgs, e$
# Draw an arc on a specified level
pDrawArc(arcview, acx, acy, acz, ar, as, ae, level)
# Set the geometryType
geometryType = ARC@
# Convert the arc data to a string
sarcData = drs_str(2, arcview) + sspace + drs_str(2, acx) + sspace + drs_str(2, acy) + sspace + drs_str(2, acz) + sspace + drs_str(2, ar) + sspace + drs_str(2, as) + sspace + drs_str(2, ae)
# Construct the arc argument string(sarcData, level, geometryType)
sMPArcArgs = ssq + sdq + sarcData + sdq + sspace + sdq + drs_str(2, level) + sdq + sspace + sdq + drs_str(2, geometryType) + sdq + ssq
# Call the MPDraw.dll passing it the constructed argument string
dllReturn = dll(sMPDrawDLL, sMPArcArgs)
# If MPDrawDebugOutput = yes$, write the arc arguments to the NC file
if MPDrawDebugOutput, " Arc Arguments : ", *sMPArcArgs, e$
#endregion End Geometry Post Blocks
#endregion End Draw Geometry
#region System Post Blocks
pheader$ # pheader$ - in this example this post block runs first
# Remove all geometry on a specified level
pDeleteGeometry(geometryLevel)
psof$ # psof$ - in this example this post block runs second
lineStartX = vequ(x$)
lineEndX = vequ(m7$)
# Create a line on a specified level starting from the current x$,y$,z$ and extenting to the tool the toolplane Z
pDrawLine(lineStartX, lineStartY, lineStartZ, lineEndX, lineEndY, lineEndZ, geometryLevel)
peof$ # peof$ - in this example this post block runs last
arcView = TOP@
arcCenterX = 0
arcCenterY = 0
arcCenterZ = 1
arcRadius = .5
arcStartAngle = 0
arcEndAngle = 360
# Create an arc on a specified level using the values above
pDrawArc(arcView, arcCenterX, arcCenterY, arcCenterZ, arcRadius, arcStartAngle, arcEndAngle, geometryLevel)
#endregion End System Post Blocks
I realize I'm 7 years late to the party, but since Google searches still direct people like me here I'll share the very simple and elegant solution I used:
s_some_string = regex("\S.*\S", s_some_string, 0) # Strip leading/trailing whitespace
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.