Ilogic calculate length of 3D sketch

Ilogic calculate length of 3D sketch

Anonymous
Not applicable
1,283 Views
3 Replies
Message 1 of 4

Ilogic calculate length of 3D sketch

Anonymous
Not applicable

Hello!

 

I want Ilogic to calculate the length of a multiline in a 3D sketch. Is it possible?

 

Accepted solutions (1)
1,284 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Assuming:

- a part document is open

- the first 3D sketch contains the loop

- there's only this one loop in the sketch

 

you can do it with this little iLogic:

Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As PartDocument = oApp.ActiveDocument
Dim oSketch As Sketch3D = oDoc.ComponentDefinition.Sketches3D.Item(1)
Dim oProfile3d As Profile3D = oSketch.Profiles3D.AddOpen
Dim dLoopLength As Double = oApp.MeasureTools.GetLoopLength(oProfile3d.Item(1))

oProfile3d.Delete
MsgBox ("Length of 3D loop: " & Round(dLoopLength, 2) & " cm")

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 4

_dscholtes_
Advocate
Advocate

Please find below the steps I used to retrieve a set of connected lines / arcs / etc. from a sketch (to be used as a sweep path later). 
1. find the start point in the sketch (by selecting it or assuming it's the first of all sketch points);
2. get the lines / arcs / etc. connected to it;

3. pick the one you didn't already process (otherwise it could go back and forth between two connected lines);

4. store the line / arc with the other already processed ones (collection);
5. get it's length and add it to the total length found so far;

6. get the other end point of the line / arc / etc.

7. use that point as the first point and continue from step 1 for each connected line / arc / etc.

The above is more a brute-force than an elegant / simple solution, but it's the only approach I could think of.

Message 4 of 4

Manuelcamposcosta
Advocate
Advocate

thanks!!

 

I made a small change it was giving me an error on line 2 when saving trough an assembly.

 

Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As PartDocument = ThisDoc.Document
Dim oSketch As Sketch3D = oDoc.ComponentDefinition.Sketches3D.Item(1)
Dim oProfile3d As Profile3D = oSketch.Profiles3D.AddOpen
Dim Comprimento As Double = oApp.MeasureTools.GetLoopLength(oProfile3d.Item(1)) * 10

 

oProfile3d.Delete
MsgBox ("Length of 3D loop: " & Round(dLoopLength, 2) & " mm")

Manuel Campos Costa
0 Likes