Problem with Sketching in the Desired Plane
Problem with Sketching in the Desired Plane
(OP)
I have been using a macro that I wrote in SW2006 for about a year. This macro sketches and then extrdudes a solid in the Right Plane.
It was functioning well until today when I interrupted the execution of the macro by shutting down solidworks in a cntrl - alt - del shutdown.
When SW got up and running, a message appeared on the screen saying OpenGL was modified. (I dont know what was modified exactly or how it happened.) Now the same macro sketches in the front plane instead of the right plan. I double checked the macro, and right plane is selected in the macro during the sketching, but that is not what happens during execution.
Is there some sort of over ride that happened? Can someone direct me where to look?
Thanks
It was functioning well until today when I interrupted the execution of the macro by shutting down solidworks in a cntrl - alt - del shutdown.
When SW got up and running, a message appeared on the screen saying OpenGL was modified. (I dont know what was modified exactly or how it happened.) Now the same macro sketches in the front plane instead of the right plan. I double checked the macro, and right plane is selected in the macro during the sketching, but that is not what happens during execution.
Is there some sort of over ride that happened? Can someone direct me where to look?
Thanks






RE: Problem with Sketching in the Desired Plane
I suspect that it has something to do with the command:
boolstatus = Part.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
If I remove the word "Right Plane" and just replace it with "Right" it works. What could have happened to change the name of the plane?
The tree in the model never did say "Right Plane" just "Right" - so how can this function be turned off or on?
RE: Problem with Sketching in the Desired Plane
RE: Problem with Sketching in the Desired Plane
This same macro used to draw it in the right plane.
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim InsertPart As Object ' Added to be able to assemble the document
Dim swFrame As SldWorks.Frame
Dim swStatBar As SldWorks.StatusBarPane
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swFrame = swApp.Frame
Set swStatBar = swFrame.GetStatusBarPane
Pi = 4 * Atn(1)
On Error Resume Next
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swFrame = swApp.Frame
Set swStatBar = swFrame.GetStatusBarPane
Set Part = swApp.NewDocument("C:\Program Files\SolidWorks\data\templates\Part.prtdot", 0, 0#, 0#)
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
boolstatus = Part.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
Part.InsertSketch2 True
Part.CreateArcVB Xcenter / 1000, 100 / 1000, 0, 25 / 1000, 75 / 1000, 0, 50 / 1000, 100 / 1000, 0, 1
Part.SketchAddConstraints "sgFIXED"
Part.InsertSketch2 True
boolstatus = Part.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
End Sub
As i said in my earlier question, something changed in my configuration - OpenGL - whatever that is so that the "right plane" is no longer recognized in the code and it defaults to the front plane.
If i remove the word Plane from "right plane", it will go on the right plane. It didnt used to do this.