×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Civil 3D, Select Objects by Object Data

Civil 3D, Select Objects by Object Data

Civil 3D, Select Objects by Object Data

(OP)
I have been going crazy trying to figure out how to do this.  I would like a LISP routine, called "SELECTOD", which would select all items on the current layer that have a certain field value set in their Object Data.  It would presumably need to prompt for the field name and value.  Everything on the current layer that has this field name and value would then be selected.  I could then do as I wish with it: delete it, move it to another layer, etc.  I can't figure out how to tell the ssget command to use the current layer without specifying its name, and I can't figure out how to tell it the attribute name and value to filter by.  Or should I be using something besides the ssget command?  I would be grateful for the help, thanks!
 

RE: Civil 3D, Select Objects by Object Data

You can get the current layer from the 'clayer' system variable.

An example to select everything on current layer;

(setq CurLayer(getvar "clayer"))
(setq ss (ssget "x" (list (cons 8 CurLayer))))

Not sure what you mean by object data, so this method might not necessarily be expanded to do what you want...

 

RE: Civil 3D, Select Objects by Object Data

(OP)
This does indeed select the current layer.  Thank you very much.  This leaves me with:

(Defun C:SELECTOD ()
    (setq CurLayer(getvar "clayer"))
    (setq ss (ssget "x" (list (cons 8 CurLayer))))
    (sssetfirst nil ss)
(princ))

Now if only I could figure out how to filter this set according to the value of an object data field.  Object data are custom properties that can be assigned to objects in Civil 3D, and perhaps other AutoCAD flavors also.  Thanks.
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources