CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products []
CZ | EN | DE
Login or
  Visitors: 5647

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))))

Now, using the Properties palette, you can modify any property common to all selected drawing entities, e.g. color, layer, scale, etc.

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 Download - 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    41922×  
Prices - CAD eShop:
applies to: AutoCAD ·

See also:
Tip 13778:How to publish several DWG drawings into one multi-page PDF?
Tip 13694:Individual modification of elements in AutoCAD dynamic arrays.
Tip 13688:How to select all DWG objects of a certain type in AutoCAD LT? (texts, circles...)
Tip 13622:Bulk import pages from a multi-page PDF into AutoCAD.
Tip 12837:RenameCSV - rename layers, blocks, layouts, views, linetypes using Excel tables

Back   All CAD Tips

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   

Extend your AutoCAD LT productivity with our popular add-on
CADstudio LT Extension More info

Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.