CAD Administrators - Lock System\Doc Props

Since there isn't a group for CAD admins I am hoping someone can help me out. While I was at SW2011 in San Antonio I attend the the CAD managers bootcamp. I heard one of the Admin say they had a script that would allow the user to change the System options, but it would not save them when he closed his SW.

I am in need of something like this, maybe even a locking system that keeps users from making changes to certain areas of the System options. The old AutoCAD guys are making changes to Drawings that are effecting everyone in the organization, and don't care, because that is what they are used to. I need to find away to stop these types of behaviors from trickling down to the rest of the Engineering group.

Any insight on scripts or other methods of administrating items to stop issues like this or others.

Thanks,

Scott

SolidworksAdministration
Answers 12
SF
SF 2011-03-16 Best Answer

I have lots of insight into this.

Are you talking about your drawing templates getting changed?  That is simply a matter of placing them on a network drive and giving no one except yourself write access.

If you want to be able to control the solidworks settings accross your group, you have to be a little creative.  Here is a suggestion.  You will need to author a bat file to make these changes.  I implemented the changes when we moved to SW 2010, so I ran the bat file after the installation

Create a bat file which runs a regedit command and then starts the Solidworks application.  You may need to copy a file with the registry settings from a netwoked drive before you run the regedit command; this ensures that you can just make changes to that .reg file in order to affect the users.  ALL solidworks settings are controlled by registry settings, so if you can edit the registry every time they start Solidworks, then you wield the power.  Start with simple registry settings, like controlling the file locations.  Don't worry about any other user customizations.

Replace the Solidworks shortcuts with your own Solidworks shortcut that link to your "bat" file (write a separate script to do the replacing, then have your users run the script).  To make everything look nice, remember to find the Solidworks icon in your new shortcut.

If you want everything to look even nicer, find a program that converts bat files to .exe files that run in the background--many freeware programs out there that will do this: I have one called Bat_To_Exe_Converter.  Users will not even notice that you are editing the registry (unless you have UAC on in Windows 7).

Note, that this does not lock users from making changes in their system settings, but it will restore settings to the way you want them every time they start Solidworks.

Sample bat script to edit the registry and then start SW.

xcopy  "W:\1 SW Standardinst„llningar\EDM\Profile Company\solidworks_settings_Co.reg" /Y >> start.log
regedit.exe /s solidworks_settings_Co.reg >> start.log
start SLDWORKS.exe >> start.log
exit

Sample reg file entries to control file locations

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks 2010\ExtReferences]

"Weldment Profile Folders"="W:\\1 SW Standardinställningar\\EDM\\Profile Company\\Weldment Profiles;W:\\1 SW Standardinställningar\\Övriga Templates\\Egna Weldments"

"Document Template Folders"="W:\\1 SW Standardinställningar\\EDM\\Profile Company\\Document Templates"

"Custom Property Folders"="W:\\1 SW Standardinställningar\\EDM\\Profile Company\\Custom Property Files"

"BOM Template Folders"="W:\\1 SW Standardinställningar\\EDM\\Profile Company\\BOM"

SF
SF 2011-03-16

This is the kind of information I am in search of... Thank you!

None of the users are changing the physical Templates, but changing their colors, etc... and its being saved into the Parts and Drawings. Then when a user that is used to SW opens this filem, they have to reset all the colors or has to figure out what is what. I want to stop this behavior from happening. Unfortunately the true fix of training a user on what not to do is not going to work most likely and will tick him off and potentially other users. I want to stop that from happening to some degree... of course if I lock him out from making changes then I know he will be mad, but I think its the better choice.

I do realize all the settings are in the Registry, and I know most of the settings in there just not sure what to pick and how it will effect the install.

I have never written any script files, is there a site to refer to help write scripts?

Do you have any examples other than what you posted, that you can send me?

Thanks for your reply it was exactly what I was hoping hear!

Cheers,

Scott

SF
SF 2011-03-16

I don't know if there is a setting that controls whether or not users may use custom colors on parts, so you may be sol on that one.  But there is a lot of other stuff that you can control!

You are going to have to practice and learn the scripting in order to make it work at your company.  Learn these three commands and practice them inside the command window (type cmd from the search window in Windows 7)

xcopy

regedit

start

Google them or do whatever you need to do to learn them.  Try to make it so that you can copy a ".reg" file from a network drive to the Solidworks run directory, edit the registry, and then start solidworks (use my example), all from within the cmd window.  Then, take the text you used to run those commands from within the cmd window, and paste them into a text file and give it the extension ".bat".  One row for each command you want to execute.  Voila, your first script.

The file that you process in the regedit command contains the registry settings that you want to apply before Solidworks starts.  I have an example attached.  One way to get the settings from Solidworks is to use the Copy settings wizzard.  They have the extension .sldreg, but are really the same as a .reg file.  There is a great program called DiffUtils that can find differences in files, so you can use the copy settings wizzard, start solidworks, make some changes to the settings, then use copy settings wizzard again to create a different file, then compare them.  You will see exactly which row or rows you will need to have in your .reg file.

I am making some assumtions here that you have used the cmd window before and can do things like change directories.  If you can't do that, get with one of your IT whizes at your company because they are usually Pros at this.

MA
MA 2011-03-16

How about putting read only protection on the template files?

PM
PM 2011-03-16

Scott,

  Have you looked into setting up your Drafting Standards file(s) to control document settings?  You can also use this to reset them to your company standards and I have a macro that will load a Drafting Standards file into a drawing to either bring it up out of the dark ages (stupid legacy drawings) or reset something I changed for the time being.

  As far as Preventing someone making those changes, there really isn't a way to do that without some heavy macro that listens to SolidWorks for "bad" changes etc and prevents them from being changed.  You can always "reset" system options by the registry method you have here already, but Document settings are completely different ball game.

SF
SF 2011-03-16

Let me ask this in return.

If the Templates are Read-only and the user starts a New Part. Can that user still not make changes to the System and Doc Props and save them in the part file?

The Problem is not in the Template its mostly in the Parts/Drawings/Assemblies that are being made from the templates.

I don't think protecting the Templates will really help. If there were users making changes and saving off the Templates that would be different.

If I am wrong in my logic please let me know... Thanks for your Reply!

Scott

TH
TH 2011-03-16

I do the same thing for my legacy SolidWorks files, only my macro doesn't load the drafting standard.  I run the macro, then load the drafting standard separately. But now that you mention it, Paul, that's a great idea having the macro load the standards.  What is the method used to load the standards?

My macro takes care of a lot of the other display settings that the drafitng standard doesn't touch.  For instance, Annotations display settings are set by my macro, and now that line thicknesses are document specific, I recenly added that.

PM
PM 2011-03-16

Here is what I have for my load drafting standard macro.  The section for setting the layer to -Per Standard- doesn't work yet because SW has not provided that API.  I also have another for re-loading the sheet format.

<p>Option Explicit</p><p>Dim swApp           As SldWorks.SldWorks<br>Dim swModel         As SldWorks.ModelDoc2<br>Dim swModExt        As SldWorks.ModelDocExtension<br>Dim bRetVal         As Boolean<br>Dim LayerMgr        As Variant<br>Dim LayerName       As String<br>Dim msgtext         As String<br>Sub main()</p><p>Set swApp = Application.SldWorks<br>Set swModel = swApp.ActiveDoc<br>Set swModExt = swModel.Extension<br>Set LayerMgr = swModel.GetLayerManager</p><p>'set layer to "Per Standard" to use the drafting standard settings<br>'LayerName = LayerMgr.GetCurrentLayer<br>'MsgBox LayerName<br>'LayerMgr.SetCurrentLayer ("?")</p><p></p><p>' Load custom drafting standard<br>bRetVal = swModExt.LoadDraftingStandard("<em style="text-decoration: underline; ">path to file</em>.sldstd")</p><p>If bRetVal Then<br>    MsgBox ("Drafting Standard Set")<br>Else<br>    msgtext = MsgBox("ERROR", vbExclamation)<br>End If</p><p>End Sub</p>
SF
SF 2011-03-16

How does your macro work?

We do have a Drafting Standard file, that was created before I join the company last year. Problem is it s linked during the setup of SW, but anyone can still go in an change the standard that fits their design technique. Biggest problem we have here is that we have bought up a lot of companies and those companies employees have to blend into Berry. Berry doesn't have a direct standard and Management is not pushing anything so its hard to get this worked out, because no one can agree what is right. So it comes down to a few people to make choice for everyone and hopefully it stays, but in most cases it doesn't users change it to fit their need.

I personally don't care between divisions, because we all handle things little different between our Divisions... but the general process and standards should be up held. Protecting those standards is what one item I need to do.

The other is make some (not all) System Options\Doc Props read-only... There has to be an easy way to find these keys in teh Registry and protect them. The only other draw back I know of is... our IMS (your going enjoy this) thinks its a good idea to give ALL the users whether PC savy or not Admin rights to their machine. This causes a lot of grief for them and I think it is going to for me. So I have to find away to make the key only accessible by either IMS or myself, not the Admin user.

My knowledge of Networking is limited so this is a new area for me, but I do enough to be dangerous like most people.

I appreciate everyone's reply including yours...  I hope we can find some sort of solution. I have a VM setup to do all my tests on.

Thanks,

Scott

PM
PM 2011-03-16

Basically my macro just loads the Drafting Standards file to set all the document properties to company defaults (code is above).  Same thing as going through all the settings manually and putting them back to what it should be, just one click rather than pulling out a book of screen shots and reviewing each one (don't miss those days!!!!)

As far as I know there is no way (other than heavy api I mentioned) to prevent changing settings (in system or document options) after a user has the file started or the software is installed.  Probably best bet is "you don't follow the standards, go find somewhere else to not follow them" kinda thing.... but I digress.

All users are admins here too, it isn't much of an issue because they aren't the ones generating final released drawings, that's my team and we do follow our CAD standards.  Although admin rights has caused other issues...don't let your kids install whatever games they want, or download free screen-savers on your laptop :-)

For system settings you could use the copy settings and set a task to run at login that sets the registry back to your default settings or try and protect them.  But you can't stop them from changing document settings once they start working on it that I know of.

SF
SF 2011-03-17

How about Design Checker?  This can check that a drawing standard file is correct.  Even nicer if you have Enterprise PDM, because you can automate the system to check this.

SF
SF 2011-06-06

I know its been awhile since I brought this up, but I finally got my VM working with SW 2011 installed on it.

I made a *.bat file and I want it to copy the original reg settings ever time SW is started from the shortcut.

I don't know if my Bat file is incorrect, or if I am not setting up the shortcut properly.

<p>Here is a copy of my bat file:</p><p>xcopy  "<a href="" data-community-id="1">\\evvfile\solidworks$\2011\Settings\STD_SW</a> _Settings_64-bit.sldreg" /Y >> start.log<br>regedit.exe /s STD_SW _Settings_64-bit.sldreg >> start.log<br>start "D:\Program Files\Solidworks 2011\SolidWorks\SLDWORKS.exe" >> start.log<br>exit</p>

If the BAT file needs changing please let me know. I also would like to know how you setup a Shortcut to start a bat, then start SW?

Thanks,

Scott Baugh