×
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

Macro coding with 3D sketches + Planes
2

Macro coding with 3D sketches + Planes

Macro coding with 3D sketches + Planes

(OP)
I've been trying to for quite sometime now to make solidworks 2007 (current now with SP2) to allow me to select a plane that was created inside a 3dsketch. code is as follows

*Nothing is selected as this point

   swModel.Extension.SelectByID2 "Plane3@Reference Planes", "SKETCHSURFACES", 0, 0, 0, True, 1, Nothing, swSelectOptionDefault

This line selected the plane inside the 3D sketch named Reference Planes.

Debug.Print swSelMgr.GetSelectedObjectType2(1)

This line of code outputs the object type number...=133
As a side note, this number is not documented anywhere...

At this point I attempt to create a new 2d sketch from this plane. (Not editing on this plane inside the 3d sketch, but creating a totally new 2d sketch using this plane as a reference)

Now this is where it gets wierd....It wont allow me to do that. However!!!!! If I step though the macro and sit it at the debug.print line, alt-tab back to solid works...manually click on plane3@reference planes so its also the only thing selected...then BAM getselectedobjecttype now = 134 and the macro works + creates that plane!

Anyone have any ideas or anything?

Thanks!!
Chuck

RE: Macro coding with 3D sketches + Planes

(OP)
*Scratches head*
I hope I don't have everyone stumped :(

RE: Macro coding with 3D sketches + Planes

How much code do you have?  Can you post it along with the file you're trying to run it on?  Mooload.com works well for posting files.

RE: Macro coding with 3D sketches + Planes

(OP)
What it boils down to is that solidworks will not allow me to do this:
swModel.Extension.SelectByID2 "Plane1@3D Reference Planes", "SKETCHSURFACES", 0, 0, 0, True, 1, Nothing, swSelectOptionDefault

object type = 133


but it wont let me do this
swModel.Extension.SelectByID2 "Plane1@3D Reference Planes", "EXTSKETCHSURFACES", 0, 0, 0, True, 1, Nothing, swSelectOptionDefault

object type should = 134

RE: Macro coding with 3D sketches + Planes


Hello BitwiseNova,

We found a few SPRs with the API for 3D Sketches and 3D Sketch Planes in 2007. You may want to contact your reseller or the SolidWorks API support group, it sounds like a an SPR.

Best regards,

Joseph

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