Set LayerMgr = Drawing.GetLayerManager
Yes, that is the command I'm using but when I say: LayerMgr.SetCurrentLayer ("-Per Standard-") it doesn't change anything. Could you verify that you can actually set the active layer to the "Per Standard" layer?
Dose the Layer -Per Standard- show up in the list of layers
I don't hve a layer call -Per Standerd- try Per Standerd
have one called Rev A
Dim swApp As SldWorks.SldWorksDim LayerMgr As SldWorks.LayerMgrDim draw As SldWorks.ModelDoc2Sub main()
Set swApp = Application.SldWorksSet draw = swApp.ActiveDocSet LayerMgr = draw.GetLayerManager LayerMgr.SetCurrentLayer ("Rev A")End Sub
ok, too bad that isn't what I'm trying to do... now I know how to do -None-, but any ideas for the -Per Standard- layer? it shows in the drop down like this:
set the Layer to the -Per Standard-
this should give you the name
The reason is that Per Standard isn't actually a layer. Try placing something on it. All it will do is automatically place the item selected onto the standard layer (typically -None-) which can be changed in settings, so trying to do it by API is invalid.
If you want to do it the closing you can come is to find out the standard layer and get its name then set it that way.
I know it isn't actually a 'layer' but neither is -None- really, and we can set that with "", so I figured they should have something for this.... you know, like Black is actually not a color but a lack of color... but I digress.
Anyway... what I'm trying to use this for is to bring old drawings up to date with a macro. I can set the Drafting Standard information, but in order to really use that you need to use the -Per Standard- layer as you said. My VAR put in a SR for me, so we'll see what they say.
As stated the layer -Per Standard- is pre-defined so just try changing a line or something to the -Per Standard- Layer and see where it goes. Then set them all to that layer in your macro. I don't believe the setting is retro-active so if you later change the -Per Standard- it will not go back and update anything before the change. I cannot confirm this but that is what I suspect as there is no internal layer ID for the per standard layer so I see no way of SW easily tracking the difference.
Is this SPR fixed already?
I can't figure out how to set -Per Standard- as current layer.
not that I see, you are more than welcome to add your name to the list!!!
I'm having issues with this as well, no -Per Standard- option for Layers (despite the wonderful Help file...). I've config'd them in the Doc Options, but when working they default to the active layer. Tried in both SW2012 and 2013. Where can I sign up!?
You'll have to go to the Customer Portal > Knoledge Base and search for SPR 537857. Click on the link to open it and on the left pannel there is a few options, just make sure you select the "Yes, but notify me when this is fixed. (SPR only)" radio button and submit. That adds your name to the votes and they will notify you when it is fixed.
In the mean time you'll have to set the -Per Standard- layer manually with the toolbar, then you won't have the issue of SW not following what you set up in the document options.
Thanks, and I'll have to look into that. As for the temporary fix, what are you meaning? I cannot find any way to set a lay Per Std, either with the toolbar, the item properties, doc properties, or general properties. I've tried creating a layer named that, in hopes SW would just recognize it - didn't work (didn't think it would, but worth a shot!). If you have a method please detail!
if you are in your drawing and turn on your "layer" toolbar (if it isn't already active) you should see the top most layer is -Per Standard-, if you select it you should get your document settings followed. This is how my "layer" toolbar looks all the time:
haHA, got it! I was looking in the Line Format menu, under Layer Properties. It wasn't showing up there, but neither was -none- so I didn't figure it should. But I didn't have a choice any other location to edit this, even looking through the Customize Commands and running macros - thanks!
So.......apparently nobody else had voted for this SPR in two years and it automatically therefore goes "Closed (Inactive)" which is interesting since a few other people on the forums have expressed the need to do this also, yet SW has no way to do this through API.
PLEASE VOTE FOR THIS SPR!!!
2009-2016... not too bad I guess
Well good thing is that it is finally coming. I was in really bad need for this last night.
Retrieving data ...