mapman1 Posted June 4, 2009 Posted June 4, 2009 First time scripting........ I have an attributed block, (two attributes, floating). The attributes are on their own layers. The block can be any desired rotation. The attributes need to be (0) rotation for ease of reading. I am trying to use -attedit in a script to rotate all attributes back to zero without losing existing data in the various tag fields and without changing the existing rotation value of the block. When the script gets to where it needs to select all the objects...........the script stops. Select is where I have the problem. Help would be appreciated. See below. ;repetitive attribute editing ;command -attedit ;edit attributes one at a time? Y ;enter block name Hydrant_4inch ;enter attribute tag HN4IN ;enter attribute value * ;select objects select Previous ;enter an option (Angle) A ;enter a value (zero rotation) 0 ;enter an option (Next) N Quote
ronjonp Posted June 4, 2009 Posted June 4, 2009 Make sure this lisp is loaded...then all you have to do is add the lines below to your script: (defun attstozerorotation (blockname / e ss) (vl-load-com) (if (setq ss (ssget "_x" (list (cons 0 "INSERT") (cons 2 blockname)))) (while (setq e (ssname ss 0)) (foreach att (vlax-invoke (vlax-ename->vla-object e) 'getattributes) (vl-catch-all-apply 'vlax-put (list att 'rotation 0.0)) ) (ssdel e ss) ) ) (princ) ) ;;Lines to add to script...use your block names ;;one block (attstozerorotation "blockname") ;;many blocks (mapcar 'attstozerorotation '("blockname1" "blockname2" "blockname3")) 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.