How do I measure the loop length of a 3D Sketch and set it as a parameter?

How do I measure the loop length of a 3D Sketch and set it as a parameter?

JohnRambo4
Contributor Contributor
171 Views
8 Replies
Message 1 of 9

How do I measure the loop length of a 3D Sketch and set it as a parameter?

JohnRambo4
Contributor
Contributor

How do I measure the loop length of a 3D Sketch with splines and set it as a parameter? For example I want the total length of a hose to be saved as a parameter to show up the Description or QTY field on a drawing. Obviously you can measure it with the Measure tool, but how to set the length to a Parameter? Thanks.

 

2025-09-12 14_42_51.png

0 Likes
Accepted solutions (1)
172 Views
8 Replies
Replies (8)
Message 2 of 9

kacper.suchomski
Mentor
Mentor

Hi

This is a question for @bradeneuropeArthur


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 3 of 9

andrewiv
Advisor
Advisor
Accepted solution

You will have to have an iLogic rule to accomplish this.  Here is a rule that used to use for this exact purpose.  I would set this rule to run on the geometry change trigger.

Dim oDoc as PartDocument
Dim se As SketchEntity3D
Dim oParameters As Inventor.Parameters

Try
	oDoc = ThisDoc.Document
	se = oDoc.ComponentDefinition.Sketches3D("3D Sketch1").SketchLines3D(1)
	oParameters = oDoc.ComponentDefinition.Parameters
	oParameters.Item("HOSE_LENGTH").Value = ThisApplication.MeasureTools.GetLoopLength(se)
Catch Ex2 As Exception
	MessageBox.Show ("ERROR, HOSE LENGTH VALUE WILL NOT UPDATE" & vbCr & vbCr & vbCr & Ex2.Message, _
		"SKETCH LOOP LENGTH ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

 

Andrew In’t Veld
Designer / CAD Administrator

Message 4 of 9

johnsonshiue
Community Manager
Community Manager

Hi! Another approach is to use an iLogic rule to get the volume of the tube and divide it by the tube cross section area. The result should be the length.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 5 of 9

JohnRambo4
Contributor
Contributor

This worked. I just needed to create a HOSE_LENGTH parameter before running the code, and checking the Export box in Parameters. Now I can have the length populate in the part description. Thanks. How do I get it to auto update on geometry change?

 

Strange there isn't a way to dimension the whole length in a sketch but whatever.

0 Likes
Message 6 of 9

bradeneuropeArthur
Mentor
Mentor

Would something like @kacper.suchomski may mention help you?

 

https://youtu.be/zN06eaBr2eY

 

And please vote the idea if you think this is a good addition for future releases of Inventor.

 

https://forums.autodesk.com/t5/inventor-ideas/sweep-length-to-parameter/idi-p/13005488

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 9

JohnRambo4
Contributor
Contributor

That tool looks great. Did you make it available somewhere?

0 Likes
Message 8 of 9

bradeneuropeArthur
Mentor
Mentor

Could you send me a private message maybe we can have a look at the possibilities.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 9

andrewiv
Advisor
Advisor

To have it update whenever the geometry changes you just have to add the ilogic rule to the the event triggers.  Just put it under the part geometry change trigger and then it will update the parameter any time the part is changed.

Andrew In’t Veld
Designer / CAD Administrator

0 Likes