I am trying to write a VBA macro to move and rotate a camera. Since I am new to writing macros, I am basing my test code on an altered version of the "Insert a camera" example:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swCamera As SldWorks.camera
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
' Insert a camera
Set swCamera = swModelDocExt.InsertCamera
swCamera.Type = swCameraType_Floating
'Various test code goes here
End Sub
While I have had success with "swCamera.Pitch =" and "swCamera.Yaw =", I cannot get the swCamera.SetPositionCartesian to work. When I try:
swCamera.SetPositionCartesian(2,3,4)
I get "expected =" and "synax error."
How do I fix this issue? Any help is much appreciated.
SolidworksApi macros