I'm trying to toggle to true the override default parameter of the bend allowance box of the sheet metal features inside the sheet metal folder.
I thought I could a property to do this inside the custom bend allownce but there is no such thing in the api.

have
To add to this macro
Change all sheet metal features radius add-in [FREE]
i use this and it work!
''''''''''''''''''''''
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim FeatureData As SldWorks.SheetMetalFeatureData
Dim Feature As SldWorks.Feature
Dim Component As SldWorks.Component
Dim bData As SldWorks.CustomBendAllowance
Dim nam As String
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
' Get the selected feature
Set Feature = Part.SelectionManager.GetSelectedObject6(1, -1)
' Get the name of the selected feature
nam = Feature.GetTypeName
' Get the feature definition
Set FeatureData = Feature.GetDefinition
' Get whether to use default bend allowance to determine the current state
'Dim useCustom As Boolean
'useCustom = FeatureData.UseDefaultBendAllowance
' Get the custom bend allowance object
Set bData = FeatureData.GetCustomBendAllowance
Dim bType As Long
bType = bData.Type
' Set the bend allowance type to deduction
bData.Type = swBendAllowanceDeduction
' Set the value of the bend deduction
bData.KFactor = 0.23
'FeatureData.UseDefaultBendAllowance = False
' Set the value of the bend deduction
Call FeatureData.SetCustomBendAllowance(bData)
' Modify the feature definition
boolstatus = Feature.ModifyDefinition(FeatureData, Part, Component)
End
End Sub
''''''''''''''''''''''''''''
It did not work
codes are not correct
batch select folder
select all part change k-factor,
how public
In your code why is this line:
'FeatureData.UseDefaultBendAllowance = False
been commented out?
I think that's the line I've been missing?
I have not tried your code yet. I've messed some commits on my github but I have the right piece saved at my home computer. Will try that and tell you.
I was able to change the kfactor of the sheet metal features inside the sheet metal folder by the ISheetMetalFolder.
Here's an excerpt of my code:
<p>FeatureManager swFeatureManager = swModelDoc.FeatureManager;</p><p> var swFeatures = swFeatureManager.GetFeatures(false);</p><p> var swSheetMetalFolder = (SheetMetalFolder)swFeatureManager.GetSheetMetalFolder();</p><p> if (!(swSheetMetalFolder == null))</p><p> {</p><p> Feature swSheetMetalFolderFeature = swSheetMetalFolder.GetFeature(); </p><p> SheetMetalFeatureData swSheetMetalFeatureDataFromFolder = swSheetMetalFolderFeature.GetDefinition();</p><p> CustomBendAllowance swCustomBendAllowance = swSheetMetalFeatureDataFromFolder.GetCustomBendAllowance();</p><p> swCustomBendAllowance.Type = (int)swBendAllowanceTypes_e.swBendAllowanceKFactor;</p><p> swCustomBendAllowance.KFactor = (double)KFactor;</p><p> swSheetMetalFeatureDataFromFolder.SetCustomBendAllowance(swCustomBendAllowance);</p><p> bool FeatureResult = swSheetMetalFolderFeature.ModifyDefinition((object)swSheetMetalFeatureDataFromFolder, swModelDoc, null);}</p>Thanks for the help Alex !
add macro
add .swp