CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products []
Cesky English Deutsch
 Visitors: 2782 

CAD tip CAD tip # 10015:

Question CAD 
 %  platform  category 
Q - question

How to select and modify objects in all layouts of the DWG?

A - answer AutoCAD commands for interactive object selection and object editing always works with the current space only - i.e. with the modelspace or a specific layout of the drawing you work with. If you want to edit/modify selected objects in the drawing model and all its layouts, you can use the selection function from the AutoCAD LISP API.

Filtered selection of objects from the whole DWG drawing database can be performed with the LISP function (ssget "X") - specifically e.g. all circles anywhere in the drawing can be selected using:

(ssget "_X" '((0 . "CIRCLE")))

or all objects with the assigned color "red" using:

(ssget "_X" '((62 . 1)))

or all objects in the layer "ABC" using:

(ssget "_X" '((8 . "ABC")))

You can also use combinations of the AND, OR, XOR and NOT conditions plus individual object properties (lookup their codes in the DXF specification). E.g. (0 . "LINE,SPLINE,LWPOLYLINE") or simply (0 . "*LINE") selects all types of line entities, the condition (0 . "CIRCLE")(62 . 1) selects only red circles, or (-4 . "< NOT") (0 . "TEXT") (-4 . "NOT>") selects all but single-line texts.

This construction can be then used in combination with the function for grip-selection of objects - (sssetfirst) - and with the Properties palette (Ctrl+1), where you can modify the requested property in all selected objects. So e.g. recoloring of all otherwise not recolored dimensions in the model and in all layouts can be done from the Properties palette after you select all such dimensions using the command:

(sssetfirst nil (ssget "_X" '((0 . "Dimension")(62 . 256))))

Using the Properties palette, you can modify any property common to all selected drawing entities.

If you don't want to code the selection filter manually, you can use a enhanced Express Tools command SSX, which can be downloaded from - copy it to the "Express" folder in your AutoCAD installation directory. The command SSX will then guide you through the selection condition and keeps the filtered objects selected for grip-editing -- then you just change the requested common property in the Properties palette - e.g. the color.

100% *  CAD 
20.9.2014    7149×  
Prices - CAD eShop:
applies to: AutoCAD ·

See also:
Tip 11967:How to apply a changed drawing template (DWT) to existing drawings?
Tip 11794:Undocumented code in field expression - MText contents without control characters.
Tip 11608:Trim to rectangle - cut out a part of a DWG drawing.
Tip 10167:Keyboard shortcuts in Autodesk Fusion 360.
Tip 9949:One layout view doesn't display border, cannot be selected.

Back   All CAD Tips All CAD tips&tricks

Autodesk Application Manager hangs reporting no updates. « | » Ctrl+drag to copy a layout in AutoCAD 2015.

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   

Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info

Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.