Hi team,
In drawing document I would like create a Macro for change component layer, I would like set what the component and what Layer. I'm a beginner in macro creation, if someone can create a macro example for me I will stay grateful.
I'm sending a simple video where I change the layer manually.
You need to use this property: 2019 SOLIDWORKS API Help - Layer Property (IDrawingComponent)
To get the pointer to the selected drawing component, take a look at this example: Macro to copy path of SOLIDWORKS component to clipboard
You do not need the full macro, rather look at the portion of the code in this block which gets the pointer to seelcted drawing component and assigns it to swDrawComp:
ElseIf TypeOf swModel Is SldWorks.DrawingDoc Then
So, basically you can just then call swDrawComp.Layer = "Your Layer"