Inventor iLogic - Get the Loop lengt for flat pattern

Inventor iLogic - Get the Loop lengt for flat pattern

ryabinina_olya
Contributor Contributor
666 Views
5 Replies
Message 1 of 6

Inventor iLogic - Get the Loop lengt for flat pattern

ryabinina_olya
Contributor
Contributor

Hi all!

I want to get Loop lenght from Mesuare tool for top face in flat pattern.

I have found a method for MeasureTools.GetLoopLength in the VBA object browser, but I can use it for sketch only(((

I have tried to create sketch for top face, but I don't now what I need to do next for getting Loop lenght.

Can someone help me with this?

Thank you in advance!!

 

11.PNG

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
667 Views
5 Replies
Replies (5)
Message 2 of 6

Sergio.D.Suárez
Mentor
Mentor

Try the following ilogic rule.

 

Dim oFace As Face = ThisApplication.CommandManager.Pick(15877, "Select Face") 
Dim oLength As Double = 0
Dim minParam As Double, maxParam As Double, curveLength As Double

For Each oEdge As Object In oFace.Edges
	oEdge.Evaluator.GetParamExtents(minParam, maxParam)
	oEdge.Evaluator.GetLengthAtParam(minParam, maxParam, curveLength)
	oLength = oLength + curveLength
Next

MessageBox.Show(Round(oLength,3) & " cm")

 

I hope this helps with your work. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 6

ryabinina_olya
Contributor
Contributor

Thank you very much!!! It really works!!

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
Message 4 of 6

johnsonshiue
Community Manager
Community Manager

Hi! Do you have to have the exact length of the external loop? Or, the flat pattern extent area would be sufficient? The extent area can be obtained easily using iLogic rule or custom iProperty.

Many thanks!



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

ryabinina_olya
Contributor
Contributor

Hello!

I have a problem with this rule.

I changed it for automatic top face specifying in flat pattern and when I use Emboss Feature it makes another result now. 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oLength As Double = 0
Dim minParam As Double, maxParam As Double, curveLength As Double
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
	Dim oFace As Face = oFlatPattern.TopFace
For Each oEdge As Object In oFace.Edges
	oEdge.Evaluator.GetParamExtents(minParam, maxParam)
	oEdge.Evaluator.GetLengthAtParam(minParam, maxParam, curveLength)
	oLength = oLength + curveLength 'cm
Next
End If

 On first screen - correct result with your rule, on second screen - wrong result with my rule
I can't understand. Can you help me?

11.PNG12.PNG

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes
Message 6 of 6

ryabinina_olya
Contributor
Contributor

Hello!

I need exact summary lenght of all edges on top face including internal pockets, edges of engraving etc.

Olga Ryabinina
Professor Assistant in Voronezh State Technical University
0 Likes