Hi,
I'm using this piece of code, simplified a bit, in a macro:
Dim swSelMgr As SldWorks.SelectionMgr
Set swSelMgr = swModel.SelectionManager
If NamePart.optTop.Value = True Then
partplane = "Top"
Else
If NamePart.optFront.Value = True Then
partplane = "Front"
Else
If NamePart.optRight.Value = True Then
partplane = "Right"
End If
End If
End If
boolstatus = swModel.Extension.SelectByID2(partplane, "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Dim swPlaneFeature As SldWorks.Feature
Set swPlaneFeature = swSelMgr.GetSelectedObject6(1, -1)
Dim swPlane As SldWorks.RefPlane
Set swPlane = swPlaneFeature.GetSpecificFeature2
Dim swAssem As SldWorks.AssemblyDoc
Set swAssem = swModel
lResult = swAssem.InsertNewVirtualPart(swPlane, swVirtComp)
The issue is, when the virtual part is inserted, it already contains a sketch, located on the "Front" plane. When I perform the "insert component" operation manually, it doesn't contain a sketch. Any idea why a sketch is being created by that method?
SolidworksApi macros