Author Topic: Using "field" command  (Read 2077 times)

0 Members and 1 Guest are viewing this topic.

RIOGHAN

  • Guest
Using "field" command
« on: September 20, 2010, 03:41:00 PM »
I came up with this little routine to get a field expression using the field command.  I don't know if it would be of any use to anyone (or if someone else has another way to get a field expression), but I'd thought I'd share. 

Code: [Select]
(defun makefield (/ ss fieldexpr)
  (command "_field"
           (if (= (getvar "cmdactive") 1)
             "0,0"
             )
           )
  (setq ss (ssget "x" '((0 . "MTEXT") (10 0 0 0))))
  (if ss
    (progn
      (setq fieldexpr (vla-fieldcode (vlax-ename->vla-object (ssname ss 0))))
      (vla-erase (vlax-ename->vla-object (ssname ss 0)))
      (setq ss nil)
      )
    (setq fieldexpr nil
          ss nil
          )
    )
  fieldexpr 
  )

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Using "field" command
« Reply #1 on: September 20, 2010, 03:45:26 PM »

RIOGHAN

  • Guest
Re: Using "field" command
« Reply #2 on: September 20, 2010, 03:58:55 PM »
Another:

http://www.theswamp.org/index.php?topic=33884.msg392915#msg392915

Thanks Lee, I did look at that post.  This is more for creating a field expression "on the fly" without having to know what the expression will be or having to select an existing object.