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

Sheet Metal aktiv unfold rule

w.pepping
Advocate

Sheet Metal aktiv unfold rule

w.pepping
Advocate
Advocate

How can I find the aktiv unfold rule.

Now I use the 'InUse' code, but then I get 2 rules. 1 is the rule of the shet metal rule and 1 is the aktiv unfold rule.

I hope someone knows how to do this.

 

Wim

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes
Reply
443 Views
3 Replies
Replies (3)

CadUser46
Collaborator
Collaborator

I think this is what you might be looking for.

 

Private Sub FlatStyle()

    Dim oDoc As Inventor.PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oCompDef As SheetMetalComponentDefinition
    Set oCompDef = oDoc.ComponentDefinition
    
    Dim oName As String
    oName = oCompDef.ActiveSheetMetalStyle.Name
    
End Sub

 

 

 

 


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes

w.pepping
Advocate
Advocate
That is not what I am looking for. If there are 2 or more rules then I can't find a way to find thar rule with a straight code. If the aktive rule is different from the selected unfold rule in the aktiv sheet metal style then it is not sure wich one you get.

With this code I get the aktiv unfold rule but I hope there is a better way.


Function kFactor(ByVal oSheetMetalCompDef As SheetMetalComponentDefinition) Dim strFindK As String = String.Empty Dim oUnfoldMethod As UnfoldMethod = Nothing Dim countUnfolds As Integer = 0 For Each oUnfoldMethod In oSheetMetalCompDef.UnfoldMethods If oUnfoldMethod.InUse Then countUnfolds = countUnfolds + 1 Next For Each oUnfoldMethod In oSheetMetalCompDef.UnfoldMethods If oUnfoldMethod.InUse Then If countUnfolds > 1 Then If Not oUnfoldMethod.Name.ToString = oSheetMetalCompDef.ActiveSheetMetalStyle.UnfoldMethod.Name.ToString Then Select Case oUnfoldMethod.UnfoldMethodType Case UnfoldMethodTypeEnum.kBendTableUnfoldMethod strFindK = oUnfoldMethod.Name.ToString Case UnfoldMethodTypeEnum.kLinearUnfoldMethod If oUnfoldMethod.kFactor.ToString.EndsWith("ul") Then strFindK = oUnfoldMethod.kFactor.Remove(oUnfoldMethod.kFactor.Length - 3, 3) Else strFindK = oUnfoldMethod.kFactor.ToString End If Case UnfoldMethodTypeEnum.kCustomEquationUnfoldMethod strFindK = "Equation" End Select End If Else Select Case oUnfoldMethod.UnfoldMethodType Case UnfoldMethodTypeEnum.kBendTableUnfoldMethod strFindK = oUnfoldMethod.Name.ToString Case UnfoldMethodTypeEnum.kLinearUnfoldMethod If oUnfoldMethod.kFactor.ToString.EndsWith("ul") Then strFindK = oUnfoldMethod.kFactor.Remove(oUnfoldMethod.kFactor.Length - 3, 3) Else strFindK = oUnfoldMethod.kFactor.ToString End If Case UnfoldMethodTypeEnum.kCustomEquationUnfoldMethod strFindK = "Equation" End Select End If End If Next Return strFindK End Function

 

Get control of your sheet metal files.
Download the app from matprop.com
0 Likes

CadUser46
Collaborator
Collaborator

Im really not sure what you are trying to achieve.  Are you trying to see if the user has locally edited the sheet metal style so its now different from the library?


Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro
0 Likes