CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.096.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.

CAD tip CAD tip # 10015:

Question

CAD 
 %  platform  category 
A
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 DL 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.

ACAD
100% *CAD
20.9.2014    43792×   Expert
applies to: AutoCAD ·

See also:
Tip 14604:QRcode - dynamically generated QR codes in AutoCAD.
Tip 14505:How to set the "Display Plot Styles" option for all layouts at once?
Tip 14481:How to bulk publish a folder of DWG/DXF files to PDF?
Tip 14446:Undocumented options in AutoCAD FIELDs - hyperlinks, hexadecimal or binary format
Tip 14361:Extended ATTOUT/ATTIN for block attribute management in Excel (also for LT).


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
  



Featuring:
Use Google Earth images in your AutoCAD projects with the Plex.Earth Tools More info


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