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:
If swView.GetName2 <> sheetNames(i - 1) Then bRet = swModelExt.SelectByID2(swView.GetName2, "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0) ViewLayer = swLayerMgr.AddLayer("Views", "", 0, 0, 0) swDraw.ChangeComponentLayer "Views", False bRet = swModel.DeSelectByID(swView.GetName2, "DRAWINGVIEW", 0, 0, 0) End If
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.