Select all object that have Object Data

Select all object that have Object Data

vladimir.ninic
Enthusiast Enthusiast
878 Views
3 Replies
Message 1 of 4

Select all object that have Object Data

vladimir.ninic
Enthusiast
Enthusiast

I am trying to automate some steps in Autocad Map 3d 2018 using Lisp.

After drawing some polygons and adding some object data to them I would like ti check if there are some objects without object data left.

I would like to select objects without data and change their colour in RED.

Another approach is to select all objects and subtract object with object data from selection.

 

Any ideas? Thnx.

 

0 Likes
879 Views
3 Replies
Replies (3)
Message 2 of 4

norman.yuan
Mentor
Mentor

With AutoCAD's built-in selecting API (COM/.NET/LISP), you cannot select entities with filter applying to ObjectData. So, you have to loop through all entities in order to test whether an entity having object data attached, or object data record from specific table attached.

 

You can also use Map's query API to query the drawing on object data.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 4

mmitchellH6TRW
Enthusiast
Enthusiast

 

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Command: SDO (Select Data Objects)							
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:SDO (/ sa ss index) 
  (setq sa           (ssget "_X")
        ss           (ssadd)
        index        0
  )
  (while (< index (sslength sa)) 
    (if (ade_odgettables (ssname sa index)) 
      (setq ss (ssadd (ssname sa index) ss))
    )
    (setq index (1+ index))
  )
  (sssetfirst nil ss)
  (gc)
  (princ)
)
(princ "\nSDO to Select Data Objects.")
(princ)

 

 

While this code selects all objects with OD data, by making it an else....  it selects all non-OD objects.

 

 

(if (ade_odgettables (ssname sa index)) 
      (princ)
      (setq ss (ssadd (ssname sa index) ss))
    )

 

 

Message 4 of 4

АлексЮстасу
Advisor
Advisor

See https://forums.autodesk.com/t5/autocad-map-3d-forum/applications-for-object-data/m-p/10815438#M59781

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes