AnsweredAssumed Answered

SolidWorks VBA Macro - Hide Sketch Entities

Question asked by Darren Smith on Dec 2, 2019
Latest reply on Dec 3, 2019 by Dan Eldred

Can anybody help?

 

I have the following macro....

 

Dim swApp As Object

Sub HideSketchEntities()
    Dim swModel As ModelDoc2
   
    Dim swModelDocExt As ModelDocExtension

    Dim swSketchMgr As SketchManager

    Set swApp = Application.SldWorks

    Set oDoc = swApp.ActiveDoc

    swModelDocExt = oDoc.Extension

    swSketchMgr = oDoc.SketchManager

    status = swModelDocExt.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)

    swModel.BlankSketch
End Sub

 

I want to run (as a test) the macro to hide all sketch1 entities (lines arcs etc)

 

Can somebody tell me what is wrong with the above macro?

 

Many thanks in advance!

 

Darren

Outcomes