×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Problem with Sketching in the Desired Plane

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

RE: Problem with Sketching in the Desired Plane

(OP)
A little more info:

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

Can you post your code?

RE: Problem with Sketching in the Desired Plane

(OP)
When i run this macro in my current sw2006, sketch1 is created in the front plane even tho the macro tells it to draw the sketch in the right 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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources