77marco77
Guest
Hello.
I found this code:
who:
and does what should, that is, add the attribute with tag price, enter item message # and content 100 to one or more selected blocks. the attribute is inserted at the point of insertion of the block (then often just above the design) with half-center justification.
what I would like to understand (and be able to change) are:
I found this code:
HTML:
(defun c:add$ ( / ss i blk blks def attobj)
(and
(setq ss (ssget '((0 . "insert"))))
(setq i (sslength ss))
(while (> i 0)
(setq blk (cdr (assoc 2 (entget (ssname ss (setq i (1- i)))))))
(if (not (vl-position blk blks))(setq blks (cons blk blks)))
)
)
(foreach blk blks
(setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) blk))
(setq attobj
(vla-addattribute def
8
acattributemodelockposition
"enter item #"
(vlax-3d-point 72 84)
"price\u+0020"
"100"
)
)
(vlax-put attobj 'alignment acalignmentmiddle) ;; 4
(command "_.attsync" "_n" blk)
)
(princ)
)
(vl-load-com) (princ)
Add new attribute to multiple existing blocks
Hi there Im a very beginner at using lisp, so help would come in handy. Couldnt find anything on the web for this precise issue. I have a dwg containing hundreds of blocks, each with the same attribute tags and different values (eg Name, Model, Size..). This is my library, which needs to be modif...
www.cadtutor.net
what I would like to understand (and be able to change) are:
- the justification: I would like to know what and where to write by middle center, half left and half right
- the location: we say that (0.0) is the insertion point of the block I would like to add the attribute for example to (0,-10) design unit