AnsweredAssumed Answered

SolidWorks VBA Macro - Hide Sketch Entities

Question asked by Darren Smith on Dec 2, 2019
Latest reply on Dec 10, 2019 by Alex Burnett

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)

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!