I'm trying to save a subset of the components in an assembly in a step file. Currently I deselect all the components, select only the set I'm interested in, then save the step. My understanding of the Extension.SaveAs() command is that it should save only the selected components. The problem is that sometimes only the selected components are saved, but sometimes (most of the time) the entire assembly is saved. I'm doing this many times in a loop, so it's important that I only save the subset I'm interested in - saving the entire assembly is too slow and produces unwieldy files. I can see that the desired components are being correctly selected in the graphics window. Here's the innermost code:
' Clear selection
' Select moving bits (extremities)
For i = 0 To UBound(exportComponentList)
Set swComp2 = swmodel.GetComponentByName(exportComponentList(i))
bRet = swComp2.Select4(True, Nothing, False)
exportName = workingDir & poseDir & "robot_pose_" & validCnt & ".step"
bRet = swmodel.Extension.SaveAs(exportName, swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, SaveErrors, SaveWarnings)
I've tried using bRet = swmodel.SaveAs3(exportName, 0, 0) too, but I get similar results.
I'm at a bit of a loss here - any suggestions are gratefully received!