AnsweredAssumed Answered

How do I use swCommands_Insert_Sketch_Import?

Question asked by Shea Benter on Sep 12, 2019
Latest reply on Sep 17, 2019 by Shea Benter

I'm trying to create a macro that will automate the insert>sketch from drawing process.  I have everything working except the action of selecting all of the elements on the drawing.  When using the function normally, the user starts a sketch in their model, activates the function, changes windows and uses a selection box to select the entities.  For some reason sketchboxselect is returning a boolean of False.  If I pause the macro at that point, I can drag my own selection box and it works.  Is sketchboxselect the wrong command, or am I using it wrong here? 

 

I tried recording a macro, but it didn't capture any of this.

 

Here is the relevant code.  The omitted code opens the source drawing referenced here as DrawFileName.  The destination part/assembly is referenced as ModelFileName.

 

'activate model and start sketch on front plane
swApp.ActivateDoc2 ModelFileName, False, longstatus
boolstatus = swModel.Extension.SelectByID2(planeName, "PLANE", 0, 0, 0, False, 0, Nothing, 0)
swModel.SketchManager.InsertSketch True

 

'activate Insert>Sketch from Drawing command, make drawing active, select all sketch elements.
swApp.RunCommand swCommands_e.swCommands_Insert_Sketch_Import, ""
swApp.ActivateDoc2 DrawFileName, False, longstatus
boolstatus = swDraw.Extension.SketchBoxSelect("0.0", "0.0", "0.0", "1.0", "1.0", "0.0") 'I did verify these coordinates

 

'change back to model and exit sketch
swApp.ActivateDoc2 ModelFileName, False, longstatus
swModel.SketchManager.InsertSketch True

Outcomes