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.

1 September 26, 2014
by Mark Flayler, Applications Engineer, IMAGINiT Technologies

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!

Download Sweep Length Code Snippet

For more of Mark’s Inventor tips and tricks, check out IMAGINiT Manufacturing Solutions Blog.

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

1 Comment » for How to Calculate and Report Sweep Length in Autodesk Inventor
  1. Baron says:

    Hi Mark,

    Finally someone posted about this sweep calculation issue! I’m very new to Inventor and I found your tips very useful and concise. If you don’t mind can you teach me to modify your code of instead calculating from the centroid of the profile to be the end point of it. What I have is a wood molding to be a frame and the sweeplength calculates from the center of the profile. But what I need is to calculate the total length of the molding using the outer profile.

    I’ve been playing your code and hoping I could crack myself but no avail. Hope to hear from you soon. Thanks again and great tips!

Leave a Reply

Your email address will not be published. Required fields are marked *