You may not even be aware that this problem exists in some of your drawings. To take a peek, click on the Annotation Scale popup located in the AutoCAD status bar. If you get something that looks like the image below, it's time to clean up.

To clean up, you can use the ._SCALELISTEDIT command. This will open the following dialog.

Press the RESET button, answer YES if you get a warning prompt, and you are done.
You may be wondering where all the scales from the first image are in this dialog. Well, this particular drawing contained over 5200 scale list entries and the dialog will not handle that many. In fact I received this error just by executing the ._SCALELISTEDIT command.
So how do you clean a drawing in this shape? Use the command line version of this tool as shown below.
Command: .-scalelistedit
Enter option [?/Add/Delete/Reset/Exit]: _R
Reset scale list to defaults? [Yes/No]: _Y
Scale list reset to default entries.
Enter option [?/Add/Delete/Reset/Exit]: _E
Command:
Two more rules before you start cleaning your drawings.
- Install the latest service pack for your product. This will keep this problem from happening again.
- Clean from the inside out or the bottom up, depending on your point of view. What I mean is to start at the lowest level xref drawing and work your way up to the parent xref drawing.
If Drawing "A" is xrefed into Drawing "B" and Drawing "B" is xrefed into Drawing "C" -- then clean "A", then "B", then "C" - in that order.
You can also create a toolbar button to quickly execute this command, here is the macro:
^c^c.-scalelistedit;_R;_Y;_E;
Labels: AutoCAD 2008, Tips
PermaLink Posted 12/20/2007 12:01:00 PM Comments (2)
I put together some tests to compare the (command) function to two other methods of entity creation, (entmake) and (vla-add...). The test constructs 1,999 line entities using various methods.
I originally posted this on 13 DEC 2007, but after receiving a couple of good comments, I decided to edit this original post rather than make a separate entry. Thanks to the comments by Petri and Matt, I added a couple of new tests to the roundup.
Test1 - Uses the (command) function with CMDECHO set to 1
Test2 - Uses the (command) function with CMDECHO set to 0 and NOMUTT set to 1 (this basically turns the command line off...)
Test3 - Uses the (entmake) function.
Test4 - Uses the (vla-add...) function
Test5 - Uses the (vla-add...) function, but moves (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object))) outside the timer, which make sense because the time to do this task should not be included. Surprisingly, it didn't make much differance at all.
The results are shown below. The times represent the average of 5 consecutive runs.
- Test1 - 11.7 seconds
- Test2 - 5.50 seconds
- Test3 - 0.44 seconds
- Test4 - 0.94 seconds
- Test5 - 0.90 seconds
So (entmake) is still the fastest method, (vla-add...) takes about twice as long as entmake, and the most efficient (command) method about 12X longer on average. Removing the command line echoes from the (command) method speeds this up considerably.
In summary, if you are only drawing few entities, you won't notice any difference by modifying your code. On the other hand, if you code is drawing hundreds of entities, you might consider a change. Keep in mind that these numbers are relative and will vary depending on the system.
The lisp code used is shown below
(defun date2sec ()
(setq s (getvar "DATE"))
(setq seconds (* 86400.0 (- s (fix s))))
)
(defun C:test1 ( / i timer endtimer)
(setvar "cmdecho" 1)
(setq i 1 timer (date2sec))
(while (< i 2000)
(command "._line" (list i i 0.0) (list (+ 2 i)(+ 3 i) 0.0) "")
(setq i (1+ i))
)
(setq endtimer (date2sec))
(alert (rtos (- endtimer timer) 2 8))
)
(defun C:test2 ( / i timer endtimer)
(setvar "cmdecho" 0)
(setvar "nomutt" 1)
(setq i 1 timer (date2sec))
(while (< i 2000)
(command "._line" (list i i 0.0) (list (+ 2 i)(+ 3 i) 0.0) "")
(setq i (1+ i))
)
(setq endtimer (date2sec))
(alert (rtos (- endtimer timer) 2 8))
(setvar "cmdecho" 1)
(setvar "nomutt" 0)
)
(defun C:test3 ( / i timer endtimer)
(setq i 1 timer (date2sec))
(while (< i 2000)
(entmake (list
(cons 0 "LINE")
(cons 10 (list i i 0.0))
(cons 11 (list (+ 2 i)(+ 3 i) 0.0))
)
)
(setq i (1+ i))
)
(setq endtimer (date2sec))
(alert (rtos (- endtimer timer) 2 8))
)
(defun C:test4 ( / i timer endtimer)
(vl-load-com)
(setq i 1 timer (date2sec) ms
(vla-get-modelspace
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(while (< i 2000)
(vla-addline ms
(vlax-3d-point (list i i 0.0))
(vlax-3d-point (list (+ 2 i)(+ 3 i) 0.0))
)
(setq i (1+ i))
)
(setq endtimer (date2sec))
(alert (rtos (- endtimer timer) 2 8))
)
(defun C:test5 ( / i timer endtimer)
(vl-load-com)
(setq ms (vla-get-modelspace
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
(setq i 1 timer (date2sec))
(while (< i 2000)
(vla-addline ms
(vlax-3d-point (list i i 0.0))
(vlax-3d-point (list (+ 2 i)(+ 3 i) 0.0))
)
(setq i (1+ i))
)
(setq endtimer (date2sec))
(alert (rtos (- endtimer timer) 2 8))
)
Labels: AutoCAD, AutoCAD 2008, Programming, Tips
PermaLink Posted 12/14/2007 07:10:00 AM Comments (6)
Starting in AutoCAD 2006, you can specify a highlight color and opacity to your selection areas as illustrated by the green area shown in the example below.
Below is a description of these options and how to change them.
If you want to go through the OPTIONS dialog, open it up and switch to the Selection tab. Click on the Visual Effect Settings button. Everything you need to control is there on the right half of this dialog, shown above.
If you want to change these options with code or a macro, here are the system variable names to do that.
- SELECTIONAREA - turns this feature off (0) or on (1).
- WINDOWAREACOLOR - sets the color used during a window selection (1-255)
- CROSSINGAREACOLOR - sets the color used during a crossing window selection (1-255)
- SELECTIONAREAOPACITY - determines the amount of transparency used by the selection area colors (0-100)

Here is an example of setting these variables using lisp
(setvar "selectionarea" 1)
(setvar "windowareacolor" 30)
(setvar "crossingareacolor" 51)
(setvar "selectionareaopacity" 30)
Labels: AutoCAD, AutoCAD 2008, AutoCAD LT, Programming, Tips
PermaLink Posted 12/12/2007 12:36:00 PM Comments (0)
From the end user perspective there are 3 polyline types listed in the PROPERTIES command, even though there are only two "entity" types.
- polyline - this is an LWPOLYLINE entity, always 2D.
- 2d polyline - this is a POLYLINE entity, also 2D.
- 3d polyline - this is a POLYLINE entity, usually 3D, with each vertex at a different elevation. It is possible to have a "3d polyline" and have each vertex at the same elevation.
If you use the LIST command on any polyline, you will only see the
entity names (POLYLINE or LWPOLYLINE).
POLYLINE entities are the original type. LWPOLYLINE entities were introduced in R14.
If PLINETYPE = 0 (zero), then the PLINE command will create POLYLINE entities.
If PLINETYPE = 1 or 2, then the PLINE command will create LWPOLYLINE entities.
To create 3d polylines, use the 3DPOLY command.
To convert between POLYLINE and LWPOLYLINE entities, use the CONVERTPOLY command.
If you are using Autolisp, you only need to worry about the entity names (POLYLINE and LWPOLYLINE.) A "3d polyline" is simply a POLYLINE entity with a special flag set. When this flag is set, each vertex subentity can be set to a different elevation.
Depending on what else you may be doing, you may also see
names like:
Acad3DPolyline, or AcDb3dPolyline
AcadPolyline, or AcDb2dPolyline
AcadLWPolyline, or AcDbPolyline
Labels: AutoCAD, Programming, Tips
PermaLink Posted 12/06/2007 05:23:00 PM Comments (4)
If you need 3D polylines, and you need a non-continuous linetype, for example to represent the flowline of a ditch - there are a couple of workarounds. Both assume that you have assigned the correct linetype to your 3D polylines.
- Copy all the 3D polylines in place, explode the copies and place them on a new layer. Create a "plot only" layer state that freezes the layer containing the 3D polylines and thaws the layer containing the 2D polylines. Set this layer state current before plotting.
- Before you get ready to plot, save the drawing. Now explode all your 3D polylines, then plot and quit without saving.
Labels: AutoCAD, AutoCAD 2008, Civil, Linetypes, Tips
PermaLink Posted 12/05/2007 08:13:00 PM Comments (0)