get and set state of rotate about scene floor
Posted: Tue Nov 16, 2021 12:40 pm
I am trying to make a macro that will rotate my model about each axis. So far I have it working with the following code. Eventually each axis will be assigned its own hotkey so I can nudge the rotation of my model with high precision.
However, there is a problem if the model is set to "Rotate about scene floor". The rotateAboutAxis calls go wonky, resulting in incorrect rotation of the model. The simplest fix would be to set "Rotate about scene floor" to false before calling rotateAboutAxis, and then restore its value after the call.
How can I do this? Macro recorder does not register changing the value of "Rotate about scene floor", so my hopes are not high.
Code: Select all
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swConfig As SldWorks.Configuration
Dim swActiveView As SldWorks.ModelView
Dim swScene As SldWorks.swScene
Dim i As Integer
Dim a As Double
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swActiveView = swModel.ActiveView
Set swConfig = swModel.GetActiveConfiguration
Set swScene = swConfig.GetScene
a = 0.015707
For i = 1 To 200
'swScene.FloorAlignment = swSceneFloorAlign_e.swSceneFloorAlign_VIEW 'had no effect
swActiveView.RotateAboutAxis a, 0, 0, 0, 1, 0, 0
Next i
For i = 1 To 200
'swScene.FloorAlignment = swSceneFloorAlign_e.swSceneFloorAlign_VIEW
swActiveView.RotateAboutAxis a, 0, 0, 0, 0, 1, 0
Next i
For i = 1 To 200
'swScene.FloorAlignment = swSceneFloorAlign_e.swSceneFloorAlign_VIEW
swActiveView.RotateAboutAxis a, 0, 0, 0, 0, 0, 1
Next i
End Sub
How can I do this? Macro recorder does not register changing the value of "Rotate about scene floor", so my hopes are not high.