I have finally put together a working macro with a GUI that performs the following operations. I use it in conjunction with our drawing standards file to recreate and compare SW templates from scratch and check the system options applied.
- It can switch between system option and, if a file is loaded, dump all its document properties (since they use different API methods to get and set their current values the same enumerator is read in two different ways)
- the macro can read all the enumerators in SW by type. toggle (true, false) for checkboxes, double, integer for option values, strings for system paths et sim and all the fonts settings inside sw. There is also a list of all the enumerators with their mnemonic name so you can guess more or less its purpose.
- once read the settings is possible to dump them in a text file.
- it is possible to paste multiple parameters in a textbox and batch write them in SW or the document. (you need to close sw to save them into the registry or save the template to keep them
The approach is quite rude, but it works for me. looking at the documentation, the SW parameters are divided by type into some enumerato list: double for not integer values (like lengths in meters and angles in radians), integer for sliders or choice from drop down menues, strings for path and labels and multiline text for fonts objects.
The advantage is that enumerators are just numbers and at every version of SW they append the new ones at the end of the list. a deprecated enumerator could be just ignored and you do not need to keep track of every single enumerator, just copy and paste them from the documentation to update the macro. (it is a bit more complex, but it can be done with excel)
I put all the enumerators in a VB dictionary linking the enumerator name and its progressive number automatically. SW publishes the enumerators by their name in alphabetical order, so they get all mixed up without a logic order at every release, and tracing them manually would be a pain.
So at every update I do not need to resort them, since they are not sorted by name in my dictionary, but with their real progressive number which is preserved at every release and unique.
The get result is displayed as text. e.g. the enumerator number 12 for doubles would be
DBL12 = 0.001
for system options and
document_DBL12= 0.001
for its equivalent in document properties.
At this point I simply do not care to sort them by category or try to group them, it is just too difficult and useless since I care to compare and spot the new enumerators at the end of each list when comparing them with an old version SW dump.
I do not care to divide them for parts, assembly or drawings either: I just dump them if the enumerator does not make sense for the current file type, just let it be. The utter mess SW made for their settings is absurd and I am not going to fix it or spend time trying to understand a logic that is simply not there.
Dump, compare, write back.
When I want to write back something I can copy and paste the values from a dump file (e.g. from a old SW version) .
The software will read amd scan every line, recognize the type of enumerator, its number, and check the value against the type before attemping to write it.
(a number for integers and doubles, etc.)
In my test I took 600+ enumerators dumped from sw2023 and write it back into a clean template created with sw 2025.
Then dumped back and compared: it worked.
Unfortunately the code I made during my working hours is property of my company, but I have some proof of concept and mockup to show you. I think I could add to this post later some pic.