Author Topic: Connect an object's text/property field to other objects  (Read 233 times)

0 Members and 1 Guest are viewing this topic.

georgecorbett

  • Mosquito
  • Posts: 1
Connect an object's text/property field to other objects
« on: October 03, 2021, 10:22:42 PM »
Hi, I want to rebind the field or copy a property/formatted text of an object then point them to different new objects without having to insert and format it each time.
This is very convenient. Can anyone guide me how? Thanks!

mhupp

  • Newt
  • Posts: 40
Re: Connect an object's text/property field to other objects
« Reply #1 on: October 04, 2021, 11:25:40 AM »
Made this real quick to insert the area of an object. should give you a starting point.

Code: [Select]
(defun C:Obj_Area (/ ent objid pt hgt str)
  (vl-load-com)
  (setq ent (entsel "\nSelect Object"))
  (setq objid (vla-get-ObjectId (vlax-ename->vla-object (car ent))))
  (setq pt (getpoint "\nSelect Point"))
  (setq hgt 0.250)
  (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa objid) ">%).Area>%"))
  (entmake (list (cons 0 "TEXT")
                 (cons 10 pt)
                 (cons 40 hgt)
                 (cons 1 str)
           )
  )
  (princ)
)




BIGAL

  • Swamp Rat
  • Posts: 849
  • 30 + years of using Autocad
Re: Connect an object's text/property field to other objects
« Reply #2 on: October 05, 2021, 11:11:07 PM »
If you pick say a existing text as destination you make a new STR as per mhupp then use vla-put-textstring obj to update it.
A man who never made a mistake never made anything

Lee Mac

  • Seagull
  • Posts: 12526
  • London, England
Re: Connect an object's text/property field to other objects
« Reply #3 on: October 06, 2021, 11:52:01 AM »
Perhaps one of these will help you:

Copy Field
Match Field Formatting