Attribut extracting

Discussion in 'AutoCAD' started by MarcelGoulet, Apr 20, 2004.

  1. MarcelGoulet

    MarcelGoulet Guest

    Hi,

    Whit lisp, If I have a block that contain one attribut, the tag name is LEVEL, how can I put the attribut value in a variable when I select the bloc in the drawing ?

    Also, if i want to change the font of the attribut, is it possible using lisp ?

    Thanks.
     
    MarcelGoulet, Apr 20, 2004
    #1
  2. Here is one for you. For the second part, look at the text style
    property to change the font.

    ;;;Ken Alexander 4/20/2004
    ;;;Get value of attribute
    (defun c:get_att_val (/ util obj pnt att attval)
    (or *acadobj*
    (setq *acadobj* (vlax-get-acad-object))
    )
    (or *actdoc*
    (setq *actdoc* (vla-get-activedocument *acadobj*))
    )
    (setq util (vla-get-utility *actdoc*))
    (vl-catch-all-apply 'vla-getentity
    (list util 'obj 'pnt "\nSelect Insert: "))
    (if (and obj
    (vlax-property-available-p obj 'hasattributes)
    (= (vla-get-hasattributes obj) :vlax-true)
    )
    (progn
    (setq att (safearray-value
    (vlax-variant-value (vla-getattributes obj))
    )
    )
    (foreach item att
    (if (= "LEVEL" (vla-get-tagstring item))
    (setq attval (vla-get-textstring item))
    )
    )
    )
    (princ "\nInvalid Selection: ")
    )
    (princ)
    )



    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    is LEVEL, how can I put the attribut value in a variable when I select
    the bloc in the drawing ?
     
    Ken Alexander, Apr 20, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.