2 Replies Latest reply on Jul 11, 2018 5:16 PM by Nilesh Patel

    How to edit the bend angle of IOneBendFeatureData?

    克 争 孙

      Hi. I want to know if it is possiable to edit the bend angle of a onebendfeaturedata and how to do? I used IFeature->GetDefinition() get onebendfeaturedata object, and edit the bend angle of the onebendfeaturedata and use IFeature->IModifyDefinition2 update the feature. the method return ture but it didn't work.

        • Re: How to edit the bend angle of IOneBendFeatureData?
          Fifi Riri


          What kind of feature is it? Base Flange/Tab, Edge-Flange, Sketched-Bend...

          Could you post your code

          • Re: How to edit the bend angle of IOneBendFeatureData?
            Nilesh Patel



            Codes below work fine for me. I am changing 90 degree bend to 95 degree.


            Option Explicit
            Sub main()
                Dim swApp               As SldWorks.SldWorks
                Dim swModel             As ModelDoc2
                Dim swSelMgr            As SelectionMgr
                Dim swFeat              As Feature
                Dim swOneBendFeatData   As OneBendFeatureData
                Set swApp = Application.SldWorks
                Set swModel = swApp.ActiveDoc
                Set swSelMgr = swModel.SelectionManager
                Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
                If swFeat.GetTypeName2 = "OneBend" Or swFeat.GetTypeName2 = "SketchBend" Or swFeat.GetTypeName2 = "ToroidalBend" Then
                    Set swOneBendFeatData = swFeat.GetDefinition
                    swOneBendFeatData.AccessSelections swModel, Nothing
                    Debug.Print swOneBendFeatData.BendAngle
                    swOneBendFeatData.BendAngle = 1.65806
                    swFeat.ModifyDefinition swOneBendFeatData, swModel, Nothing
                    Debug.Print swOneBendFeatData.BendAngle
                End If
            End Sub


            Get and Set value of IOneBendFeatureData::BendAngle is in radian.