How to Calculate and Report Sweep Length in Autodesk Inventor
Extract parametrically linked sweep length data using iLogic and a bit of custom code in Inventor.
Maybe its spring cleaning, or that I’m just caught up in the TV season finales, but I have sweep(s) on my mind. So here is a deep dive look at sweep information and how to push our software to give us more than what is currently available in the interface.
Here is my design intent: I have a length of PVC, copper, or maybe some pool noodles, and I have to get a total length of this stuff reported in my bill so purchasing can buy it. Sure, I could just use the Measure command with the Loop option to report on the total length of the path and then type it into an iProperty or Parameter, but I want it so Billy Bob can do it and not forget the step to update the field. Why can’t I have a parametrically linked value reported?
Well, Inventor doesn’t report on that all by itself without a little nudging…or maybe a shove. To entice Inventor to release this information to me, I call upon iLogic to reach into Inventor’s guts and pull out this data for me. Now, in the code snippet provided below, the way I currently have it setup, the value is whatever path you have in SWEEP1. (Note: yes, you must use this or change the code to allow a new user defined feature name).
The code will work for 3D as well as 2D contiguous paths. Once we have the code extract this, it will write it to a custom parameter that we can then export to iProperties and use in Parts Lists and Bills of Material. We can even change our BOM Quantity calculation to use this length instead of an Each count resolved to the incremental integers we all know and love.
Anyway, I’ve already made a video for this you should check out…
I’ve tried it in 2013-2015 and it works like a champ with a small caveat in 2015 that you should check out in the video.
Here is the code snippet…Enjoy!
For more of Mark’s Inventor tips and tricks, check out IMAGINiT Manufacturing Solutions Blog.
Mark Flayler is a senior application engineer with IMAGINiT Technologies, specializing in manufacturing environments. He is also PSE and ATC certified in AutoCAD, AutoCAD Mechanical, AutoCAD Electrical, Autodesk Data Management and Autodesk Inventor.