Community
Fusion Manufacture
Talk shop with the Fusion (formerly Fusion 360) Manufacture Community. Share tool strategies, tips, get advice and solve problems together with the best minds in the industry.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting model size XYZ as a variable in the post processor

1 REPLY 1
SOLVED
Reply
Message 1 of 2
constantin3x
86 Views, 1 Reply

Getting model size XYZ as a variable in the post processor

So i've been busting my head around how I can get the the model size XYZ values as a comment and then store them as a macro variable for use within the program.

 

Something similar I have successfully managed to use is using stock size and storing in local macros with the following code, taken from a heidenhain post and using it for my Haas VF3 post.

 

// stock - workpiece
    var workpiece = getWorkpiece();
    var delta = Vector.diff(workpiece.upper, workpiece.lower);
    if (delta.isNonZero()) {
	var xWorkPiece = Math.abs(workpiece.upper.x-workpiece.lower.x);
	var yWorkPiece = Math.abs(workpiece.upper.y-workpiece.lower.y);
	var zWorkPiece = Math.abs(workpiece.upper.z-workpiece.lower.z);

	writeComment("Stock Size X" + xyzFormat.format(xWorkPiece) + " Y" + xyzFormat.format(yWorkPiece) + " Z" + xyzFormat.format(zWorkPiece));
	writeBlock("");
	writeBlock("#10="+xyzFormat.format(xWorkPiece));
	writeBlock("#11="+xyzFormat.format(yWorkPiece));
	writeBlock("#12="+xyzFormat.format(zWorkPiece));
    }

 

This would display after post processing as:

 

(Stock Size X155. Y95. Z30.)
#10=155.
#11=95.
#12=30.

 

So ideally I would like to be able to display the model size in similar fashion in order to be able to store the values as macros and use them in the NC program.

Labels (2)
1 REPLY 1
Message 2 of 2
matty.fuller
in reply to: constantin3x

Using the dump post you can see that this info is exposed as parameters:

onParameter('part-lower-x', 5.030097681470757)
onParameter('part-lower-y', 4.999977562850404)
onParameter('part-lower-z', -110.5683823152713)
onParameter('part-upper-x', 305.0301119865855)
onParameter('part-upper-y', 224.50505873960822)
onParameter('part-upper-z', 0.000007577306831763053)

 

You can retrieve these using the getParameter() function.

https://cam.autodesk.com/posts/reference/classPostProcessor.html#a70f41a777c780feefe35deee5fddf2ea 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report