Jump to content

2d attribute to 3d block


davidkalapa

Recommended Posts

1.png.59f8350b6290c7219b298b879a33527b.pngi want to transfer the highet attribute of a block to its  block position z geometry that currently as the value of 0  

how can I  do it ? 

Link to comment
Share on other sites

Its easy enough to do so just select the attributed block then retrieve the attribute with tag name HEIGHT then modify the Z coordinates of the block.

Did you write any codes in regard to this goal?

Link to comment
Share on other sites

Try the following [ untested ] codes and let me know. 

(defun c:Test (/ int sel ent get obj att pos ins)
  ;;------------------------------------------------------------;;
  ;;	Author: Tharwat Al Choufi - Date: 10.Apr.2022		;;
  ;;	website: https://autolispprograms.wordpress.com		;;
  ;;------------------------------------------------------------;;
  (and
    (princ "\nSelect attributed blocks < M1502_P > : ")
    (setq int -1
          sel (ssget '((0 . "INSERT") (66 . 1) (2 . "M1502_P")))
    )
    (while (setq int (1+ int)
                 ent (ssname sel int)
           )
      (and (setq get (entget ent)
                 obj (vlax-ename->vla-object ent)
                 pos (assoc 10 get)
                 ins (mapcar '+ (cdr pos) '(0. 0.))
           )
           (vl-some (function (lambda (u)
                                (and (= (vla-get-tagstring u) "HEIGHT")
                                     (setq att (vla-get-textstring u))
                                )
                              )
                    )
                    (vlax-invoke obj 'GetAttributes)
           )
           (entmod
             (subst (cons 10 (append ins (list (distof att)))) pos get)
           )
      )
    )
  )
  (princ)
) (vl-load-com)

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...