Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
w.pepping
in reply to: CadUser46

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