Active different FlatPatternOrientation object through iLogic

Active different FlatPatternOrientation object through iLogic

L.Greft
Advocate Advocate
401 Views
2 Replies
Message 1 of 3

Active different FlatPatternOrientation object through iLogic

L.Greft
Advocate
Advocate

Hello,

 

I'm working on parametric models and in some parts we also use splits. The problem I'm facing now is that the part I'm working on can have a horizontal split or a vertical split. The flat pattern has an alignment axis by default (in my case) set on a horizontal line, which is fine. But when I turn on the horizontal split the top of the part needs to be deleted, but the alignment axis is also placed here and causes an error. Because the edge/axis is not found.

 

So I wanted to add a second orientation named "Split" that is activated when the horizontal split is unsuppressed. I searched within the API help and came across the object "FlatPatternOrientation" which has a method named "Activate". I tried the following code, but it didn't work because it has to many arguments.

sheetMetalDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Activate("Split")

 

Can someone help me with this, please? Below is a photo that will (hopefully) make it easier to understand what my goal is.

Flat pattern.jpg

 

Inventor 2021

Check out my ideas: https://autode.sk/2TKe6LH
0 Likes
Accepted solutions (1)
402 Views
2 Replies
Replies (2)
Message 2 of 3

dalton98
Collaborator
Collaborator
Accepted solution

Something like this might be what your after...

Dim oDoc As PartDocument = ThisApplication.ActiveDocument

Dim oFeature As PartFeature
For Each oFeature In oDoc.ComponentDefinition.Features
If oFeature.Type = ObjectTypeEnum.kSplitFeatureObject And oFeature.Suppressed = False
Dim sheetMetalDef As SheetMetalComponentDefinition
sheetMetalDef = oDoc.ComponentDefinition

Try
sheetMetalDef.Unfold
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).Name = "Split"
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).AlignmentType = AlignmentTypeEnum.kVerticalAlignment
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).Activate
Catch
sheetMetalDef.Unfold
sheetMetalDef.FlatPattern.FlatPatternOrientations.ActiveFlatPatternOrientation.Copy
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).Name = "Split"
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).AlignmentType = AlignmentTypeEnum.kVerticalAlignment
sheetMetalDef.FlatPattern.FlatPatternOrientations.Item(2).Activate
End Try
End If Next
0 Likes
Message 3 of 3

L.Greft
Advocate
Advocate

@dalton98 thank you for the response! I tried it and it didn't exactly worked like I expected, when the split is active it does work, but there is no alignment axis selected. But the good thing is that it doesn't result in an error and the flat pattern can still be made.

 

Thank you for the help!

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