Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Activate a flat pattern Orientation through iLogic

L.Greft
Advocate

Activate a flat pattern Orientation through iLogic

L.Greft
Advocate
Advocate

I've made three orientations within the "Edit Flat Patter Definition" and I want to use iLogic to activate the correct orientation in a specific situation. I've found some code within the API help and tried to use that in different ways, but everytime I get a different error. I don't have (a lot of) experience with API, so I hope someone can help me with this and explain to me what I'm doing wrong.

 

I have 3 orientations named "Left", "Right" and "Middle" and I use the code below.

 

Dim partDoc As PartDocument = ThisApplication.ActiveDocument
Dim smDef As SheetMetalComponentDefinition = partDoc.ComponentDefinition

If SPLIT_AMOUNT = 1 Then
	smDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Activate("Left")
ElseIf SPLIT_AMOUNT = 2 Then
	smDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Activate("Right")
ElseIf SPLIT_AMOUNT = 3 Then
	smDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Activate("Middle")
End If

 

Inventor 2021.3.1

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Reply
Accepted solutions (1)
441 Views
2 Replies
Replies (2)

petr.meduna
Advocate
Advocate
Accepted solution

Hello,

you have to pick your created orientations from collection. Only then you can activate them.

 

If SPLIT_AMOUNT = 1 Then
	smDef.FlatPattern.FlatPatternOrientations.Item("Left").Activate
ElseIf SPLIT_AMOUNT = 2 Then
	smDef.FlatPattern.FlatPatternOrientations.Item("Right").Activate
ElseIf SPLIT_AMOUNT = 3 Then
	smDef.FlatPattern.FlatPatternOrientations.Item("Middle").Activate
End If

 

L.Greft
Advocate
Advocate

Thank you @petr.meduna, I'm not at work anymore so I will try this tomorrow.

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes