Changing Sheetmetal KFactor and Bendradius with iLogic

Changing Sheetmetal KFactor and Bendradius with iLogic

t3dris
Contributor Contributor
2,138 Views
3 Replies
Message 1 of 4

Changing Sheetmetal KFactor and Bendradius with iLogic

t3dris
Contributor
Contributor

HI there,

 

I need to set the value of KFactor and Bendradius to a custom user Parameter with an iLogic rule (see pictures Below).

I have searched a lot for that but havent found anything yet.

 

Thanks in advance!

 

BRauto1.PNGBRauto2.PNGKFaktor1.PNGKFaktor2.PNG

0 Likes
2,139 Views
3 Replies
Replies (3)
Message 2 of 4

HermJan.Otterman
Advisor
Advisor

why do you need this?

 

the way it works is create al the possible styles you would use,

then choose the style you want to have

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 4

HermJan.Otterman
Advisor
Advisor

in the Inventor API / Programming help, there is this VBA example

 

Public Sub CreateSheetMetalStyle()
    ' Set a reference to the sheet metal document.
    ' This assumes a part document is active.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.ActiveDocument

    ' Make sure the document is a sheet metal document.
    If oPartDoc.SubType  "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
        MsgBox "A sheet metal document must be open."
        Exit Sub
    End If

    ' Get the sheet metal component definition. Because this is a part document whose
    ' sub type is sheet metal, the document will return a SheetMetalComponentDefinition
    ' instead of a PartComponentDefinition.
    Dim oSheetMetalCompDef As SheetMetalComponentDefinition
    Set oSheetMetalCompDef = oPartDoc.ComponentDefinition

    ' Create a new unfold method.
    Dim okFactorUnfoldMethod As UnfoldMethod
    Set okFactorUnfoldMethod = oSheetMetalCompDef.UnfoldMethods.AddLinearUnfoldMethod("kFactorTest", "0.43")
   
    ' Create a new unfold method using a bend table.
    Dim oTableUnfoldMethod As UnfoldMethod
    On Error Resume Next
    Set oTableUnfoldMethod = oSheetMetalCompDef.UnfoldMethods.AddBendTableFromFile("Table Sample", "C:\Program Files\Autodesk\Inventor 2010\Design Data\Bend Tables\Bend Table (in).txt")
    If Err Then
        MsgBox "Unable to load bend table"
    End If
    On Error Goto 0

    ' Copy a sheet metal style to create a new one. This arbitrarily uses the
    ' first style in the collection.
    Dim oStyle As SheetMetalStyle
    Set oStyle = oSheetMetalCompDef.SheetMetalStyles.Item(1).Copy("Sample Style")

    ' Set the value for the thickness. This is an expression that will be used to
    ' set a parameter when this style is activated.
    oStyle.Thickness = ".1 in"

    ' The name "Thickness" as used below is handled specially when the style
    ' is used so it will behave as expected for all languages.
    oStyle.BendRadius = "Thickness * 1.5"
    oStyle.BendReliefDepth = "Thickness * 1.5"
    oStyle.BendReliefShape = kRoundBendReliefShape
    oStyle.BendReliefWidth = "Thickness / 2"
    oStyle.BendTransition = kArcBendTransition
    oStyle.BendTransitionArcRadius = "Thickness * 2.0"
    oStyle.CornerReliefShape = kRoundCornerReliefShape
    oStyle.CornerReliefSize = "Thickness * 2.0"
    oStyle.MinimumRemnant = "Thickness * 2.0"

    ' Set the material. For this example it arbitrarily uses the first material in the collection.
    oStyle.Material = oPartDoc.Materials.Item(1)

    oStyle.PunchRepresentationType = kFormedFeaturePunchRepresentation
    oStyle.ThreeBendCornerReliefShape = kFullRoundCornerReliefShape
    oStyle.ThreeBendCornerReliefSize = "Thickness * 2.0"

    ' Activate this style.
    oStyle.Activate

    ' This section will override some of the settings defined by the style.
    Dim bOverrideStyle As Boolean
    bOverrideStyle = True
    If bOverrideStyle Then
        ' Set the unfold method to use the unfold method created above.
        oSheetMetalCompDef.UnfoldMethod = okFactorUnfoldMethod

        ' Set the thickness.
        oSheetMetalCompDef.UseSheetMetalStyleThickness = False
        oSheetMetalCompDef.Thickness.Expression = ".12 in"
       
        ' Set the material.
        oSheetMetalCompDef.Material = oPartDoc.Materials.Item(2)
    End If
End Sub

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 4 of 4

t3dris
Contributor
Contributor

I dont want to set up a Sheetmetal rule for each material and each bending tool, for one this allows for user mistakes and on the other hand i would need over 50 of these rules.

 

I wrote an iLogic rule to automatically calculate the proper kFactor for our machines from the set material and tool radius and so on, the user has to define those when saving a sheetmetal part. it works flawlessly and is a great help in our daily workflow. The problem are older parts. For those i wrote an iLogic rule to create user parameters which are needed to start the calculation and a rule which adds the triggers accordingly. The only part missing is to set the Bendingradius to "BRauto" and the KFactor to "KFaktor" which are the Parameters i calculate.

0 Likes