Author Topic: using vla-addmtext to insert mtext with a sheet set filed  (Read 2181 times)

0 Members and 1 Guest are viewing this topic.

Tortiz

  • Guest
using vla-addmtext to insert mtext with a sheet set filed
« on: March 25, 2014, 12:06:18 PM »
I am using Lee Mac example to add mtext with a field but can't get it to work. I know it in the field format but I haven't been able to find an example that shows me the correct format. can anyone tell me what I'm doing wrong?

   (vla-addmtext
     (vla-get-block
       (vla-item
         (vla-get-layouts
      (vla-get-activedocument
        (vlax-get-acad-object)
      )
         )
         (nth Cnt (layoutlist))
       )
     )
     (vlax-3D-point 15 11)
     0.0
    ' %<\AcSm Subset.Name \f "%tc1">%

   )
   (setq Cnt (+ Cnt 1))

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: using vla-addmtext to insert mtext with a sheet set filed
« Reply #1 on: March 25, 2014, 12:23:32 PM »
The easiest way to get a fieldcode correct is to create one in a piece of text, then use
Code: [Select]
(vla-fieldcode (vlax-ename->vla-object (car (entsel))))to extract the code exactly how it would be formatted.

FWIW, I'd step through the layout data, would be a lot faster...

Code: [Select]
(vlax-for layout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
  (if (not (eq (vla-get-name layout) "Model"))
    (vla-put-textheight
      (vla-addmtext
(vla-get-block layout)
(vlax-3d-point '(0. 0. 0.))
0.
"%<\\AcSm.16.2 SheetSet.ProjectName \\f \"%tc1\">%"
      )
      0.1
    )
  )
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Tortiz

  • Guest
Re: using vla-addmtext to insert mtext with a sheet set filed
« Reply #2 on: March 25, 2014, 12:43:11 PM »
Thanks...

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox