I have a little problem while using function InsertWeldmentTrimFeature. I know here are a lot of guys that's probably everyday use function but I'm very new in solidworks Api that's why I need your help.
Basicly problem is probably because I define Body array wrong way but the way I understand it it schould work. Here's code I use. I don't have an acces to the oryginal code That I have written at work but here's more less what I mean.
In the instruction I found that I need to define body array for trimming bodies and for bodies that will be trimmed. Can you explain me why I doesn't work the way I wrote it and what schould it look like?
Dim swSelMgr as sldworks.selectionmgr
Dim swFeatureMgr as sldworks.Featuremanager
Dim vBodyToTrim as variant
Dim swBodyToTrim as sldworks.body2
Dim vBodyTrimming as variant
Dim swBodyTrimming as sldworks.body2
Dim swFeature as sldworks.Feature
Dim boolstatus as boolean
Dim Options as Long
Set swapp = application.sldworks
Set swModel = swapp.activedoc
Set swselmgr = swmodel.selectionmanager
Set swFeaturemgr = swmodel.featuremanager
'Here I select structural member with selectbyid2 and mark it accordingg to instruction
Set swBodyToTrim = swselmgr.getselectedobject6(1, -1)
vBodyToTrim(0) = swBodyToTrim
Set swBodyTrimming = swselmgr.getselectedobject6(2, -1)
vBodyTrimming(0) = swBodyTrimming
Options = swWeldmentTrimExtendOption_AllowTrimmedExtensionTrim + swWeldmentTrimExtendOption_AllowTrimmingExtensionTrim + swWeldmentTrimExtendOption_CopedCut + swWeldmentTrimExtendOption_WeldGap
Set swFeature = swfeaturemgr.InsertWeldmentTrimFeature2(1, Options, 0.01, (vBodyToTrim), (vBodyTrimming))