I need a Macro to create New virtual components in context of the opened assembly and enter the edit mode of that newly created part!!
What have you tried already?
Try this example to create a new virtual component
2016 SOLIDWORKS API Help - Insert New Virtual Component Example (VBA)
Thanks a lot,
I've tried the following:
Option ExplicitDim swApp As SldWorks.SldWorksDim SwAssembly As SldWorks.AssemblyDocDim Part As SldWorks.PartDocDim SwModel As SldWorks.ModelDoc2Dim swComponent As SldWorks.Component2Dim swSelMgr As SldWorks.SelectionMgr
Dim boolstatus As BooleanDim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set SwModel = swApp.ActiveDoc
' Insert New Virtual PartDim swFaceOrPlane As ObjectDim swComponent As Component2longstatus = SwModel.InsertNewVirtualPart(swFaceOrPlane, swComponent)End Sub
the main issue that i can't select the part and enter the edit in context mode directly after the insertion.
Also, if any one can help with a code to select the first and last components in the assembly tree it will be very helpful!!
Thanks in advance!!
Retrieving data ...