Hi!
I wanna have the bold part. 😄
Is there anybody out there thats already have this in a post?
If a tool uses a D value, I wanna have a G10 L12... line. The R value should be 0.0
Im using a generic fanuc post.
% :1001 (S)(QUASER 154PL/029)(0290001)(RITNR)(REV)(BENAMNING)(TEMPO) (T1 D=50. CR=0. - ZMIN=-2. - FACE MILL) (T5 D=5. CR=0. - ZMIN=-17. - FLAT END MILL) (T7 D=12. CR=0. TAPER=118DEG - ZMIN=-37. - DRILL) (T8 D=12. CR=0. - ZMIN=-17. - RIGHT HAND TAP) (T12 D=8. CR=0. - ZMIN=-17. - FLAT END MILL) G90 G94 G17 G49 G40 G80 G10 L12 P9 R0.5 (T9 ENDMILL) G10 L12 P7 R-0.39 (T7 CHAMFER) (PLANING) G54 T1 M6 (PLF D50.0) .......
Thanks
/Tobbe
Solved! Go to Solution.
Solved by skidsolo. Go to Solution.
You can use one of the post processors very powerful features thats already inside most generic posts:
Heres a quick example.
look for this section of code:
var tools = getToolTable(); if (tools.getNumberOfTools() > 0) { for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); var comment = "T" + toolFormat.format(tool.number) + " " + "D=" + xyzFormat.format(tool.diameter) + " " + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } if (zRanges[tool.number]) { comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum()); } comment += " - " + getToolTypeName(tool.type); writeComment(comment); if (tool.type == 5) { writeBlock("G10 L12 P"+ tool.number, "R" + xyzFormat.format(tool.diameter), "(T"+ tool.number, tool.description +")"); } } }
tools = getToolTable(); looks through all the sections and retreives the data for every tool
there is a "for" loop that increments through the tools and stores that single tools data into an array called "tool"
if you use the post processor called dump.cps, you can see all the data that is stored for every tool. I had to use a formating function to reduce the number of trailing zeros in the tool diameter
tool.number=2
tool.diameterOffset=2
tool.lengthOffset=2
tool.secondaryLengthOffset=0
tool.turningTool=false
tool.jetTool=false
tool.holderNumber=0
tool.surfaceSpeed=5890.4862254808595
tool.maximumSpindleSpeed=0
tool.spindleRPM=5000
tool.rampingSpindleRPM=5000
tool.clockwise=true
tool.numberOfFlutes=3
tool.threadPitch=0
tool.coolant=1
tool.material=0
tool.description=''
tool.comment=''
tool.vendor=''
tool.productId=''
tool.holderDescription='Default Holder'
tool.holderComment=''
tool.holderVendor=''
tool.holderProductId=''
tool.aggregateId=''
tool.unit=0
tool.type=5
tool.diameter=0.37499999999999994
tool.tipDiameter=0
tool.cornerRadius=0
tool.taperAngle=0
tool.fluteLength=0.6299212999999999
tool.shoulderLength=0.9448818999999999
tool.shaftDiameter=0.37499999999999994
tool.bodyLength=1.5747999999999998
tool.shaft=[object Shaft]
tool.jetDiameter=0
tool.jetDistance=0
tool.holderTipDiameter=0.984251968503937
tool.holderDiameter=1.9685000321996493
tool.holderLength=1.1417323961032657
tool.holder=[object Holder]
tool.boringBarOrientation=0
tool.compensationOffset=0
tool.secondaryCompensationOffset=0
tool.turret=0
tool.insertType=3
tool.holderType=0
tool.compensationMode=0
tool.manualToolChange=false
tool.breakControl=false
tool.tappingFeedrate=0
Hi!
I missed your reply.
This is what I was looking for! A little tweaking and its gonna be perfect.
Big thanks!
Gonna bump this old thread. 🙂
The solution kinda works. If the tool.type is 5 (endmill?) and uses a wear comp.
If its not using a compensation type it should not be showing up in the gcode.
If the tool type is something else like a chamfer mill (tool.type 13?) and uses a compensation type. Its not showing up in the post.
How do i get this code to work?
If a tool uses a compensation type Wear. I want it to output it to the gcode. And only then.
if (tools.getNumberOfTools() > 0) { for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); if (onParameter('operation:compensationType') == (wear)) { //if (tool.type == 5) { writeBlock("G90 G10 L12 P"+ tool.number, "R0.0", "(T"+ tool.number, tool.description +")"); } } }
This is obviously not the correct way to get it to work. 😉
Post your program with the dump.cps post processor it will help you locate the name of the parameter you are looking for. And also what value you are checking for.
Laurens Wijnschenk
3DTechDraw
AutoDesk CAM user & Post editor.
René for Legend.
First a different question,
what if a tool is used with and without compensation turned on?
From there on you are looking for an operation parameter but you aren't checking for it during the operation. That's why it doesn't work.
So you first need to tell it in which section it has to check for that parameter.
Laurens Wijnschenk
3DTechDraw
AutoDesk CAM user & Post editor.
René for Legend.
the right syntax should be:
if ( hasParameter( "operation:compensationType" ) && ( getParameter( "operation:compensationType" ) == "wear" ) )
Mario
Thanks for the help.
Im almost getting it to work now. 🙂
if (tools.getNumberOfTools() > 0) { for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); if (hasGlobalParameter("operation:compensationType") == (getGlobalParameter("operation:compensationType") == "wear"));{ writeBlock("G90 G10 L12 P"+ tool.number, "R0.0", "(T"+ tool.number, tool.description +")"); } } }
This works with a tool using a operation:compensationType wear offset parameter. And when a tool has that parameter "operation:compensationType" in the dump.
But when its a tool without the operation:compensationType parameter like a drill or facemill its error out.
How do i put in a if else statement for the tools not having a operation:compensationType parameter?
And why should it be hasGlobalParameter and not just hasParameter?
Excuse me, my mistake, was thinking the code is from onSection, I supposes your code snippet stands in onOpen, there you must use hasGlobalParameter but it will not work as well as you want.
getGlobalParameter used in onOpen will return only the value from the first operation where this parameter ( compensationType ) will be set.
means: if your e.g. first operation use as compensation-type control then your code will not work.
You must rethink your code, like Laurens said.
Mario
Can't find what you're looking for? Ask the community or share your knowledge.