How do i Select all entities in a sketch(lines, arcs, splines- all geometry) and convert all en ...
How do i Select all entities in a sketch(lines, arcs, splines- all geometry) and convert all entities in the sketch to Construction Geometry in a Macro?
Why you need a macro; edit the sketch, do ctrl + A (select all) and then pick the construction icon.
RW
RW2017-02-14
I want to do it in a macro.
DG
DG2017-02-14
I just recorded the macro and got the required codes (yes did some cleanup). Change as needed.
<p>Option Explicit</p><p>Dim swApp As SldWorks.SldWorks</p><p>Dim Part As SldWorks.ModelDoc2</p><p>Sub main()</p><p>Set swApp = Application.SldWorks</p><p>Set Part = swApp.ActiveDoc</p><p>Part.Extension.SelectByID2 "Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0 'Change sketch name</p><p>Part.EditSketch</p><p>Part.Extension.RunCommand swCommands_Edit_Select_All, ""</p><p>Part.SketchManager.CreateConstructionGeometry</p><p>Part.ClearSelection2 True</p><p>Part.SketchManager.InsertSketch True</p><p>End Sub</p>
RW
RW2017-02-14
I don't care WHAT the OTHERS SAY about you, you are the man!
Thanks so much
DJ
DJ2023-03-07
For anyone looking for a macro that does the same operation, but in the opposite direction (changing construction entities to normal entities), then this does that as well - it basically flips the entities between the two states. This is very handy if you have some 1000 parts that need to be imported for plasma cutting and the marking sketches need to be normal lines, rather than construction. Big thanks to Deepak for the answer!
Why you need a macro; edit the sketch, do ctrl + A (select all) and then pick the construction icon.
I want to do it in a macro.
I just recorded the macro and got the required codes (yes did some cleanup). Change as needed.
I don't care WHAT the OTHERS SAY about you, you are the man!
Thanks so much
For anyone looking for a macro that does the same operation, but in the opposite direction (changing construction entities to normal entities), then this does that as well - it basically flips the entities between the two states. This is very handy if you have some 1000 parts that need to be imported for plasma cutting and the marking sketches need to be normal lines, rather than construction. Big thanks to Deepak for the answer!