I'm trying to change the thickness and the radius of the sheet metal folder (not the sheet metal features inside the sheet metal folder). Consequently, the changes in the folder data will propagate to the sheet metal features hence why I'm doing it. I tried the following code:
<p></p><p>' Preconditions:</p><p></p><p></p><p>' (1) Part document containing sheet metal part is open.</p><p></p><p></p><p>' (2) Sheet-Metal feature is selected.</p><p></p><p></p><p>'</p><p></p><p></p><p>' Postconditions: Default bend radius value is doubled.</p><p></p><p></p><p>'</p><p></p><p></p><p>'-----------------------------------------------</p><p></p><p></p><p>Option Explicit</p><p></p><p></p><p></p><p></p><p></p><p>Sub main()</p><p></p><p></p><p> Dim swApp As SldWorks.SldWorks</p><p></p><p></p><p> Dim swModel As SldWorks.ModelDoc2</p><p></p><p></p><p> Dim swSelMgr As SldWorks.SelectionMgr</p><p></p><p></p><p> Dim swFeat As SldWorks.Feature</p><p></p><p></p><p> Dim swSheetMetal As SldWorks.SheetMetalFeatureData</p><p></p><p></p><p> Dim bRet As Boolean</p><p></p><p></p><p> Set swApp = Application.SldWorks</p><p></p><p></p><p> Set swModel = swApp.ActiveDoc</p><p></p><p></p><p> Set swSelMgr = swModel.SelectionManager</p><p></p><p></p><p> Set swFeat = swSelMgr.GetSelectedObject5(1)</p><p></p><p></p><p> Set swSheetMetal = swFeat.GetDefinition</p><p></p><p></p><p> </p><p></p><p></p><p> Debug.Print "Feature = " & swFeat.Name</p><p></p><p></p><p> Debug.Print " Thickness (Before) = " & swSheetMetal.Thickness * 1000# & " mm"</p><p></p><p></p><p> </p><p></p><p></p><p> ' Rollback to change default bend radius</p><p></p><p></p><p> bRet = swSheetMetal.AccessSelections(swModel, Nothing): Debug.Assert bRet</p><p></p><p></p><p> </p><p></p><p></p><p> ' Double the default bend radius value</p><p></p><p></p><p> swSheetMetal.Thickness = 50.8 / 1000#</p><p> </p><p> Debug.Print " Thickness (After) = " & swSheetMetal.Thickness * 1000# & " mm"</p><p> </p><p> ' Apply changes</p><p></p><p></p><p></p><p></p><p> bRet = swFeat.ModifyDefinition(swSheetMetal, swModel, Nothing): Debug.Assert bRet</p><p></p><p></p><p> Debug.Print bRet</p><p></p><p>End Sub</p>
But for some reasons it doesn't work although Bret is true at the end. When I edit the sheet metal folder, the thickness value is not changed. Any help would be appreciated
SolidworksApi macros