Hi,
I have been attempting to automate the conversion of old documents to the become in line with new formats using API but have found that there is an issue around assigning layers.
The process I'm going through is as follows:
1. Run a macro to delete current layers, then assign the new ones in the correct order and with the correct properties (colour, style, thickness)
2. Load/reload the desired sheet format (looking to automate this step later)
3. Load the desired Drafting Standard (.swstd)
Now, from what I can determine it appears that although the layer options are listed in the files document options, the drafting standard doesn't actually retain/apply these settings when loaded. As such, in my view the conversion in incomplete.
My question is, given that we now have the destination layers set from the first macro and the drafting standard isn't doing what I need in assigning the features to layers, is there any way to re-apply all the layer settings using API?
So, as an example is there a way to set the layer "-None-" to "Dims" (an the other layer settings) using a macro?
Yes you would use .SetUserPreferenceString which is part of the modeldocextension method. 2014 SOLIDWORKS API Help - SetUserPreferenceString Method (IModelDocExtension)
For the example above use:
bRet = swModel.Extension.SetUserPreferenceString(swUserPreferenceStringValue_e.swDetailingLayer, swUserPreferenceOption_e.swDetailingLinearDimension, "DIMS")