Hey guys,
I'm trying to write a simple macro that, when run, takes the active document and places it 'origin-on-origin' as the base component in a newly created assembly.
I think I'm calling AddComponent4 improperly. When I run this, I get 'Object variable ... not set' message.
Any idea what I may be doing wrong here?
Thanks,
Sean
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssy As AssemblyDoc
Dim modPath As String
Dim swComponent As SldWorks.Component2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
modPath = swModel.GetTitle
Debug.Print "Path name equals " & modPath; "."
swApp.NewAssembly
Set swComponent = swAssy.AddComponent4(modPath, 0, 0, 0, 0)
End Sub
SolidworksApi macros