Author Topic: Update fields in all layouts  (Read 1235 times)

0 Members and 1 Guest are viewing this topic.

scottcd

  • Newt
  • Posts: 52
Update fields in all layouts
« on: January 06, 2012, 08:45:08 AM »
I have the following code:

Code: [Select]
(defun c:nuf ()
  (vl-load-com)
  (vlax-for layout (vla-get-Layouts
     (vla-get-activedocument (vlax-get-acad-object))
   )
    (if (= (vla-get-ModelType layout) :vlax-false)
(command "updatefield" all "")
      )
    )
  )
  (princ)
)

but not working - how can I get the fields on each layout to be updated ?

Thanks in advance

Scott
AutoCAD Dos R9 - 2018 and BricCAD 18.2

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Update fields in all layouts
« Reply #1 on: January 06, 2012, 08:59:03 AM »
This code worked for me ....  :-)

Code: [Select]
(defun c:TesT (/ spc ss)
  (setq spc (getvar 'ctab))
  (foreach x (layoutlist)
    (setvar 'ctab x)
    (if (setq ss (ssget "_x" (list '(0 . "MTEXT")(cons 410 x))))
      (command "_.updatefield" ss "")
    )
  )
  (setvar 'ctab spc)
  (princ)
)
« Last Edit: January 06, 2012, 09:27:01 AM by Tharwat »

scottcd

  • Newt
  • Posts: 52
Re: Update fields in all layouts
« Reply #2 on: January 06, 2012, 09:40:33 AM »
 :-)

Thank you thats great
AutoCAD Dos R9 - 2018 and BricCAD 18.2