TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Tortiz on March 25, 2014, 12:06:18 PM

Title: using vla-addmtext to insert mtext with a sheet set filed
Post by: Tortiz 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))
Title: Re: using vla-addmtext to insert mtext with a sheet set filed
Post by: alanjt 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
    )
  )
)
Title: Re: using vla-addmtext to insert mtext with a sheet set filed
Post by: Tortiz on March 25, 2014, 12:43:11 PM
Thanks...
Title: Re: using vla-addmtext to insert mtext with a sheet set filed
Post by: alanjt on March 25, 2014, 01:04:33 PM
Thanks...
anytime.