Author Topic: Field to Attributed Block  (Read 1201 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
Field to Attributed Block
« on: November 03, 2020, 01:07:03 PM »
I have the following code that will select a viewport and take the custom scale field into another text, attribute text.

I have a scale block that has 3 attributes.
FULL
HALF
DOUBLE

I did not know what would be the best way to have this routine from one click of the viewport fill out the other 2 attributes.

Code: [Select]
(defun c:test (/ vpObj fldObj vpID util fldtxt)
  (vl-load-com)
  (setq vpObj  (vlax-ename->vla-object
(car (nentsel "\nSelect the viewport: "))
       )
fldObj (vlax-ename->vla-object (car (nentsel "\nSelect the Field: ")))
vpID   (vla-get-objectid vpObj)
  )
  (if (> (vl-string-search "x64" (getvar "platform")) 0)
    (progn
      (setq util (vla-get-Utility
   (vla-get-activedocument (vlax-get-acad-object))
)
    vpID (vlax-invoke-method
   util
   "GetObjectIdString"
   vpObj
   :vlax-False
)
      )
    )
    (setq vpID (vl-princ-to-string (vla-get-Objectid vpObj)))
  )
         (setq fldtxt (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                              vpID
                              ">%).CustomScale \\f \"%lu2%ct1%ps\%qf2816\">%"
                      )
  )
  (vla-put-textstring fldObj fldtxt)
  (vla-update fldObj)
  (vla-regen (vla-get-activedocument (vlax-get-acad-object))
     1
  )
  (princ))

thanks for any direction!
Civil3D 2020