LISP to extract cogo point description and elevation to fill out block attribute

phil_planright
Explorer

LISP to extract cogo point description and elevation to fill out block attribute

phil_planright
Explorer
Explorer

Has anyone got a lisp that enables you to select cogo points and then based on their descriptions fill out attributes in a block.

ie.

cogo point 1 (description="aaa 123" elevation="100.25")

cogo point 2 (description="bbb 123" elevation="300.50")

 

I the need this to fill out a block where the attribute "aaa" is filled out as "100.25" and "bbb" is filled out as "300.50". I would also like if possible to extract the second part of the description ("123") to fill out another attribute in the block.

 

I have a lisp that can extract parts of the cogo point to text, but that is as far as i have gotten with it.

 

At the moment we are manually filling out the blocks, but this becomes quite tedious when there are up to 50+ blocks to fill out.

 

Hopefully someone can help. Thanks.

0 Likes
Reply
619 Views
1 Reply
Reply (1)

hippe013
Advisor
Advisor

Are you just looking into setting the blocks attributes?

 

(defun testSetAtt (block aaaTagString aaaValue bbbTagString bbbValue)
  (setq atts (vlax-safearray->list (vlax-variant-value (vlax-invoke-method blk 'GetAttributes))))
  (foreach att atts
    (cond
      ((= (vlax-get-property att 'TagString) aaaTagString)(vlax-put-property att 'TextString (vl-princ-to-string aaaValue)))
      ((= (vlax-get-property att 'TagString) bbbTagString)(vlax-put-property att 'TextString (vl-princ-to-string bbbValue)))
      )
    )
  )

you  

0 Likes