How to rotate model normal to selected face?
Once you have selected the required face you can rotate the model view normal to it as follows:
swModel.Extension.RunCommand swCommands_e.swCommand_NormalTo, “”
Running the command when the view is already normal to the face will rotate model to view the reverse of the face.
I think you need IModelDoc2::ShowNamedView2. This requires two arguments, VName and ViewId. In the remarks it says:
"To orient the selected face to its Normal To view, specify *Normal To for VName and -1 for ViewId."
Hope this helps.
Video Tutorials for the SolidWorks API
swModel.ViewZoomtofit2swModel.ShowNamedView2 "*Normal To", -1
swModel.ShowNamedView2 "*Normal To", -1
I want like this:
Yes. It that I looked for. Thanks.
I am trying the same thing and its not working. A bit new to this, i am getting an error:
Have you added SolidWorks Commands Type Library to your macro references?
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("", "FACE", -5.02656833063497E-02, 2.87839470405515E-03, 5.46658357132515E-02, False, 0, Nothing, 0)
Part.Extension.RunCommand swCommands_e.swCommands_NormalTo, ""
check this one, and "swCommands", you missed a "s"
"Ctrl+8" does it!?
You suggest to send messages to the program as keyboard keys?
Incidentally I've had to use SendKeys() for that kind of thing in the past.
The suggestion I provided I never actually tested. Indeed it doesn't work on my end either, though I don't know why. Seems like a bug or oversight to me.
I thought Ctrl+8 was the default shortcut for "normal to".
But you can change it here: #tools;#costomize;#Keybord
I need to achieve this procedure through API, not through the user and keyboards.
Retrieving data ...