Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inventor iLogic - Get the Loop lengt for flat pattern

5 REPLIES 5
Reply
Message 1 of 6
ryabinina_olya
438 Views, 5 Replies

Inventor iLogic - Get the Loop lengt for flat pattern

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
5 REPLIES 5
Message 2 of 6

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

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

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

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
Message 5 of 6

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
Message 6 of 6

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report