本帖最后由 羊三丫 于 2019-6-19 08:45 编辑
为了感谢楼主的分享精神,给出更改折弯系数代码如下,亲测有效.希望可以帮到楼主.
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim swSheetMetal As SldWorks.SheetMetalFeatureData
Dim bRet As Boolean
Dim boolstatus As Boolean
Dim swCustBend As SldWorks.CustomBendAllowance
Dim sswComponent As SldWorks.Component
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
boolstatus = swModel.Extension.SelectByID2("钣金", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Set swFeat = swSelMgr.GetSelectedObject5(1)
Set swSheetMetal = swFeat.GetDefinition
Set swCustBend = swSheetMetal.GetCustomBendAllowance
If Not swCustBend.Type = swBendAllowanceKFactor Then
swCustBend.Type = swBendAllowanceKFactor
Call swSheetMetal.SetCustomBendAllowance(swCustBend)
End If
boolstatus = swFeat.ModifyDefinition(swSheetMetal, swModel, sswComponent)
End Sub
|