CADkitt Posted November 29, 2010 Posted November 29, 2010 (edited) So I have a library full of exported blocks (wblock) Now I wanted to add an attribute to those blocks with the part name so I can use eattext. (since we use 2d blocks and they have multiple views I couldn't use the block names) And since I am not working in a block but a dwg file of and exported block. I couldn't use any standard attribute lisps. I can't even use attedit since that asks for a block too. So while I was making this post I figured it out by myself so here is the code: To add an attribute to the center of a drawing or a block if your in the block editor: (command "-Attdef" "I" "P" "L" "" "partnr" "enter part number" "partnr" "style" "style1" (getvar "viewctr") "0") to delete the old attribute ( I modified a block delete routine: (defun C:delblk3 (blk / SS FILTER SSLEN ENT) (progn (setq FILTER (list (cons 0 "ATTDEF") (cons 2 blk) ) SS (ssget "_X" FILTER) ) (if SS (progn (vl-load-com) (repeat (setq SSLEN (sslength SS)) (vlax-invoke-method (vlax-ename->vla-object (ssname ss (setq SSLEN (1- SSLEN)))) 'Delete) ) ) ) ) ) (c:delblk3 "partnr") ;; call it with this line. Sharing it because 90% is from here anyway, I hope someone finds it helpfull Edited November 29, 2010 by CADkitt Quote
Recommended Posts
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.