SolidWorks Express
CAD Tips for the week of October 5, 2009
 
Scripted System Variables: We’ve previously discussed the Express Tool System Variable Editor (Sysvdlg), which you can use to save and restore your AutoCAD system variable settings >>
Startup Scripts: As illustrated in the previous tip, script files can be a great way to set things up the way you want them before you start working on a drawing >>
Revert: AutoCAD is generous in the number of commands it provides to recover from errors: Erase, Oops, Undo >>
Losing Your Grips: The GRIPOBJLIMIT system variable, found in AutoCAD 2004 and up, controls how AutoCAD displays grips on selected objects >>
Transparent Typing: If you don’t like seeing your drawing beneath the Mtext Editor window, turn off its transparency by selecting the pull-down menu arrow at the top right of the Mtext Editor >>
   
 
> Scripted System Variables
   
 

We’ve previously discussed the Express Tool System Variable Editor (Sysvdlg), which you can use to save and restore your AutoCAD system variable settings. This tool saves your current settings to a script file. Even if you’re the only one who uses your computer, you will want to create a snapshot of your system variables in case you ever change computers. It can also be helpful to have a backup of your preferred settings in case you run an AutoLISP routine that changes a variable setting but doesn’t change it back. To restore your variables from the script file, just type Script at the command prompt, then browse to the script file.

Once you generate a script file, here are a few things you can do with it to ensure that your variables are set the way you want.

A surefire way to guarantee that your system variables are set correctly is to have your ACAD.LSP file to run the SCR file you created using Sysvdlg. Just add a line to your acad.lsp or acaddoc.lsp file:

(command “script” “c:/path/filename.scr”)

For example:

 (command “script” “c:/my scripts/startup.scr”)

Note: When using file names in AutoLISP you need to either use a single forward slash “/” or a double backward slashes “\\” to represent directory separators. You can omit the path name if the script file resides in one of AutoCAD’s support directories.

If you think that reloading all variables all the time is not necessary, you can reset only certain ones by adding individual lines from the script file, like so:

(setvar "system variable name" system variable value)
(setvar "system variable name" system variable value)
(setvar "system variable name" system variable value)

Another way to run a script file when AutoCAD launches is to set a startup switch. Right–click on the AutoCAD icon installed on your desktop and select Properties. Use a /b startup switch at the end of the string in the Target window to run a script file when AutoCAD launches:

/b C:\path\filename.scr"

Here’s an example of what the entire string in the target box would look like:

"C:\Program Files\AutoCAD 2008\acad.exe" /b “C:\My Documents\Script Files\mysysvars.scr"


Caption: Use the /b startup switch in the Target window to run a script when you start AutoCAD.

Note: Again, you can omit the path if the file resides in AutoCAD’s Support folders. You need to enclose the startup switch value in quotes if it contains spaces.
   
 
> Startup Scripts
   
 

As illustrated in the previous tip, script files can be a great way to set things up the way you want them before you start working on a drawing. Consider using script files to load linetypes, set layer colors, plot styles, and attribute values—anything that you do repeatedly can likely be automated with a script file. When you use the /b startup switch, you can specify only one script file to run. If you have several you want to run, simply write a single script file to run them all.

   
 
> Revert
   
 

AutoCAD is generous in the number of commands it provides to recover from errors: Erase, Oops, Undo. If you use these frequently, you may also benefit from the Express Tool Revert, which works like the Revert commands found in other software programs. It asks whether you want to abandon changes. If you select Yes, Revert closes your drawing without saving it and reopens it as the point of the last Save. Revert is handy for trying out design options. Unlike Undo, there’s no need to indicate the points you want to return to—just make sure you save before starting an iteration.

   
 
> Losing Your Grips
   
 

The GRIPOBJLIMIT system variable, found in AutoCAD 2004 and up, controls how AutoCAD displays grips on selected objects. When GRIPOBJLIMIT is set to zero, grips are always displayed when objects are selected (assuming grips are indeed turned on).


Caption: Grips on selected objects display when the number of objects selected is less than the GRIPOBJLIMIT setting (in this case, 10) or when the setting is 0.

When GRIPOBJLIMIT is set to a nonzero value, no grips are displayed when the number of selected objects exceeds the GRIPOBJLIMIT value.


Caption: Grip display is suppressed when the number of objects selected exceeds the GRIPOBJLIMIT value.

The default setting is 100. That means AutoCAD displays grips when you select one to 100 objects, but displays no grips when you select 101 or more objects. The idea is that when you select lots of objects, you likely aren’t going to be grip editing them. Suppressing the grip display speeds up performance and makes the objects easier to see.

There are a few quirks related to this system variable, however. If you first select enough objects to exceed your GRIPOBJLIMIT setting, then hold down the Shift key to remove some from your selection set so that you have less than the GRIPOBJLIMIT selected, the grips do not reappear.


Caption: Once you exceed the GRIPOBJLIMIT limit with a selection set, the grips are gone for good—even when the number of objects in the set drops below GRIPOBJLIMIT.

When the opposite occurs—you select a number of objects below the cutoff, then add more objects to the set to exceed the GRIPOBJLIMIT setting—the results are as you’d expect in AutoCAD 2006 and up. The grips are visible when you have fewer than the GRIPOBJLIMIT setting selected and suppressed when the set exceeds the setting. However, in AutoCAD 2004 and 2005, grips will always be displayed if your first selection contains fewer objects than specified by the GRIPOBJLIMIT setting, no matter how many more objects you add to that selection set.

Another quirk occurs when you select objects in excess of the GRIPOBJLIMIT setting, then change the properties of the selected objects. For example, you use the Layer toolbar control to move objects to a different layer. The property change occurs as expected, but the grips reappear.

Finally, a bug reported for AutoCAD 2009 affects users who set the PICKADD system variable to zero, which enables them to hold down the Shift key to add objects to a selection set. If you have a large number of grips displayed and then try to clear your selection set by drawing a selection window in a blank area of the drawing, AutoCAD may lock up. Sometimes it returns to normal after a short delay, but sometimes it stays locked for good. The workaround is to use the Esc key to clear selection sets.

This particular problem appears to be fixed in AutoCAD 2010, only to be replaced with a different one. When you display grips for a large number of objects (GRIPOBJLIMIT is set to 0 or to a large number), AutoCAD 2010 takes a very long time to display the selected objects and their grips. For example, a selection that took 1 to 2 seconds in AutoCAD 2008 may take 15 to 25 seconds in AutoCAD 2010.
   
 
> Transparent Typing
   
 


Caption: Drawing objects under the Mtext Editor can make it difficult to see what you’re typing.

If you don’t like seeing your drawing beneath the Mtext Editor window, turn off its transparency by selecting the pull-down menu arrow at the top right of the Mtext Editor. Select Editor Settings, then select Opaque Background.


Caption: Select Opaque Background under Editor Settings.

The opaque background makes your text easier to see against a busy background.


Caption: Mtext Editor with opaque background turned on.

   
 
   
 
 
>> SIGN UP for SolidWorks Express Newsletter and get the tips and tricks delivered into your inbox every two weeks!