Dear Ladies & Gents,
Here I'm pleased to share my super-macro .
I've came across several times, (and not only me, as far as I've seen,) with the need of calculating the total length of 1 or several sweep features, where the path is made of multiple segments, sometimes not easy to select one by one.
So this macro calculates the total length of all the sweep features within a part, distinguishing between construction and non construction segments.
It could be a wire, tube, pipe, cable, etc....
Once calculated, it returns through a MsgBox:
But also added as a Custom Property "Length" to the current configuration, that can be pulled from a BOM.
08-08-2018: macro updated including Composite Curves and any kind of sweept, solid or surfaces.
Enjoy it!!
Message was edited by: Marcos Rodríguez Macro updated now considering CompositeCurves
Message was edited by: Marcos Rodríguez Added an Alternative macro, with the Pre-Selection option by Ali request.
After a full review of this Macro, I found several things that could go wrong, share sketches, suppresed features, modification after the sweep, etc... and to be honest there were too many requirements to meet for this pour macro.
Usign it intensively for calculating fibre optics length, I've got to the conclusion that the process could be simplified a lot based in Volume. So the length is calculated as the Volumen divided by the cross section.
The few restrictions are:
- the cross section must remain constant,
- and all lengths must come from solid bodies.
So the tricky part is to determine the cross section. In this case it looks for a sweep features and check its faces, till it determines which one is the cross section (last one).
It can calculate the lentgh of something like this, as long as at least 1 feature had been made with sweep. other could be patterns or extrude.
It works as well if a representative face of the cross section is selected previous running the macro.
Enjoy Macro7! Simple and easy.