Author Topic: Finding Entity from ObjectID  (Read 7566 times)

0 Members and 1 Guest are viewing this topic.

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Finding Entity from ObjectID
« Reply #15 on: June 23, 2011, 11:53:55 AM »
Hi,

You can try this way (it returns an ename)

Code: [Select]
(cdr
  (assoc 331
(entget
   (cdr
     (assoc 360
    (entget
      (cdr
(assoc 360
       (entget
(cdr
   (assoc 360
  (entget
    (cdr
      (assoc 360
     (entget
       (car (nentsel "\nSelect a field: ")))
      )
    )
  )
   )
)
       )
)
      )
    )
     )
   )
)
  )
)
Speaking English as a French Frog

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Finding Entity from ObjectID
« Reply #16 on: June 23, 2011, 12:16:46 PM »
The upper code is from this quite old one:

Code: [Select]
;;; FLD-OBJ -Gilles Chanteau- 16/12/06
;;; Highlights the linked object to the selected field
;;; An option allows to create a line from the fied to the object
;;; Works with fields in tables and blocks

(defun c:fld-obj (/ ent txt elst dic chp obj)
  (while
    (not
      (and (setq ent (nentsel "\nSelect a field: "))
   (setq txt (car ent))
   (setq elst (entget txt))
   (member (cdr (assoc 0 elst)) '("*TEXT" "ATTRIB"))
      )
    )
     (princ "\nNone field selected.")
  )
  (if (and (setq dic (cdr (assoc 360 elst)))
   (setq dic (cdr (assoc 360 (entget dic))))
   (setq chp (cdr (assoc 360 (entget dic))))
   (= (cdr (assoc 0 (entget chp))) "FIELD")
   (setq chp (cdr (assoc 360 (entget chp))))
      )
    (if (setq obj (cdr (assoc 331 (entget chp))))
      (progn
(redraw obj 3)
(initget "Yes No")
(if
  (= "Yes"
     (getkword "\nLink the object to the text ? [Yes/No] <No>: ")
  )
   (entmake (list '(0 . "LINE")
  (cons 10
(if (< 2 (length ent))
  (setq pt
(mapcar '+
(cdr (assoc 10 (entget (car (last ent)))))
(cdr (assoc 10 elst))
)
  )
  (setq pt (cdr (assoc 10 elst)))
)
  )
  (cons 11 (cdr (assoc 10 (entget obj))))
    )
   )
)
      )
      (princ "\nThe field isn't linked to an object.")
    )
    (princ "\nthe textdo not contains a field.")
  )
  (princ)
)
Speaking English as a French Frog

SOFITO_SOFT

  • Guest
Re: Finding Entity from ObjectID
« Reply #17 on: June 23, 2011, 04:45:54 PM »
Sofito,
To easily recreate the scenario, on a 64-bit machine, create an MText field referencing say, the area, of an LWPolyline. Then attempt to retrieve the LWPolyline object/entity from only the MText field.
Lee
Hello....
I already do, even with the volume of a 3dsolid ( attached ) .... was messing with something more formalized table included. I tried to make the table and fill it in as Rabbit makes ....
Thanks, Greetings