Hello everyone,
I am currently writing a macro to move various components in our drawings to new layers. The issue I am running into is with the views. I cannot find a way to move them the a new layer with api. I have tried the following code:
<p>If swView.GetName2 <> sheetNames(i - 1) Then</p><p> bRet = swModelExt.SelectByID2(swView.GetName2, "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)</p><p> ViewLayer = swLayerMgr.AddLayer("Views", "", 0, 0, 0)</p><p> swDraw.ChangeComponentLayer "Views", False</p><p> bRet = swModel.DeSelectByID(swView.GetName2, "DRAWINGVIEW", 0, 0, 0)</p><p>End If</p>This was modified from this help code: http://help.solidworks.com/2017/english/api/sldworksapi/create_layer_for_selected_view_example_vb.htm?verRedirect=1, but it doesn't seem to actually change the layer, although it will correctly select the view.
Any help will be appreciated.
SolidworksApi macros