Jump to content

moving attribute to Z coordinate


iztok13

Recommended Posts

Hello,

 

I was wondering if there is any lisp program to move attribute to Z-coordinate.

I have attribute (block) wich have number as "TOČKA" and Z coordinate like "H". So I need this attribute to move on H witch is Z coordinate ?

 

this is an example of attribute blocks

point attr.dwg

 

 

thx for any help...

Link to comment
Share on other sites

(defun C:TEST (/ ss en p1)
 (if (setq ss (ssget '((0 . "INSERT") (2 . "TYXH"))))
   (repeat (setq i (sslength ss))
     (setq en (vlax-ename->vla-object (ssname ss (setq i (1- i))))
           p1 (vlax-get en 'InsertionPoint)
     )
     (foreach x (vlax-invoke en 'getattributes)
       (if (eq (vla-get-TagString x) "H")
         (vlax-put en 'InsertionPoint (list (car p1) (cadr p1) (atof (vla-get-TextString x))))
       )
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

This will process one block name at the time.

(defun C:TEST (/ at tag ea ss en p1 i)
 (if
   (and
     (setq at (car (nentsel "\nSelect attribute representing Z value: ")))
     (eq (cdr (assoc 0 (setq ea (entget at)))) "ATTRIB")
     (setq tag (cdr (assoc 2 ea)))
   )
    (if (setq ss (ssget (list
                          (cons 0 "INSERT")
                          (assoc 2 (entget (cdr (assoc 330 ea))))
                        )
                 )
        )
      (repeat (setq i (sslength ss))
        (setq en (vlax-ename->vla-object (ssname ss (setq i (1- i))))
              p1 (vlax-get en 'InsertionPoint)
        )
        (foreach x (vlax-invoke en 'getattributes)
          (if (eq (vla-get-TagString x) tag)
            (vlax-put en 'InsertionPoint (list (car p1) (cadr p1) (atof (vla-get-TextString x))))
          )
        )
      )
    )
 )
 (princ)
)

Link to comment
Share on other sites

  • 6 years later...
4 hours ago, Fredricc said:

Is it possible to do this on all points on all choosen visible layers ? 

 

Not enough information supplied, so the short answer would be probably

Link to comment
Share on other sites

all points and lines and everything you can see in 2d vision would be lighted up with a attribute of the z coordinate, and be placed in a separate layer

Link to comment
Share on other sites

5 hours ago, Fredricc said:

all points and lines and everything you can see in 2d vision would be lighted up with a attribute of the z coordinate, and be placed in a separate layer

You want to convert every object in the drawing to a block?  What Elevation would you put in the attribute for a line the beginning or the end?  For what purpose?

Link to comment
Share on other sites

i posted some stuff a while ago, but havent figure out how to do it yet. 

 

 

this link is showing what i mean

 

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...