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
112 Views
4 Replies
Message 1 of 5

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)
113 Views
4 Replies
Replies (4)
Message 2 of 5

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 5

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 5

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 5

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