As i'll have to do several weeks of weldments I've decided to write a few macros to make my live easier. At the moment my test macro creates flange as an offset feature onto the selected surface.
Now when I want the Macro to assign a material to that newly created body I'll have to know the name of the new feature, right?
so my idea atm is:
step 1: browse feature tree for features named flange-n find first available number
create new flange (sheet metal without merging)
assign material to new flange.
the interesting bits of code:
Code: Select all
Dim myFeature As Object
Set myFeature = Part.FeatureManager.InsertSheetMetalBaseFlange2(dblthickness, False, 0.003, 0.02, 0.01, False, 0, 0, 1, customBendAllowanceData, False, 0, 0.0001, 0.0001, 0.5, True, False, True, True)
boolstatus = Part.Extension.SelectByID2("Sheet<1>", "SUBWELDFOLDER", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Base-Flange1", "SOLIDBODY", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Base-Flange1", "SOLIDBODY", 0, 0, 0, False, 0, Nothing, 0)
Part.SetMaterialPropertyName2 "Default<As Machined>", "C:/Program Files/SOLIDWORKS Corp/SOLIDWORKS/lang/english/sldmaterials/SOLIDWORKS DIN Materials.sldmat", "1.0045 (S355JR)"
Also that feature overwrites the standard thickness for sheet metal parts, so lets say i create one flange with 5 and one with 10. and ill have two with 10mm. any ideas how to solve that?