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
*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
I hope I don't have everyone stumped :(
RE: Macro coding with 3D sketches + Planes
RE: Macro coding with 3D sketches + Planes
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