Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi again, I would like to globally rotate an attributes text to be horizontal. When a block containing and attribute is inserted at a rotated angle the attributes text is of course also rotated - The tag is called circuit so I tried this - any help would be much appreciated oh and also some lisp to alter the size of the text would also be a big help?
(prompt "\nPick your Blocks..")
(setq ss (ssget '((0 . "insert")))
sl (sslength ss)
ct 0
ctr 0
ang 0.0
)
(repeat sl
(setq e1 (ssname ss ct))
(setq ck 2)
(while (not (equal ck "SEQEND"))
(setq e1 (entnext e1)
e2 (entget e1)
ck (cdr (assoc 0 e2)))
(if (= (cdr (assoc 2 e2)) "CIRCUIT")
(progn
(setq pos (cdr (assoc 10 e2)))
(command "rotate" e2 "" pos ang "" "")
(entmod e2)
(entupd e1)
(setq ctr (+ ctr 1))
)
)
)
having tried this which did not work
(prompt "\nPick your Blocks..")
(setq ss (ssget '((0 . "insert")))
sl (sslength ss)
ct 0
ctr 0
ang 0.0
)
(repeat sl
(setq e1 (ssname ss ct))
(setq ck 2)
(while (not (equal ck "SEQEND"))
(setq e1 (entnext e1)
e2 (entget e1)
ck (cdr (assoc 0 e2)))
(if (= (cdr (assoc 2 e2)) "CIRCUIT")
(progn
(setq e2 (subst (cons 1 ang)(assoc 50 e2)e2))
(entmod e2)
(entupd e1)
(setq ctr (+ ctr 1))
)
)
)
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Try this oldie code of mine
(defun c:ratb (/ objs)
(vl-load-com)
;;; Block Specific Routine ;;;
(setq ang (cond ((getangle (strcat "\nEnter Angle: <"
(angtos (setq ang (cond ( ang ) ( 0.0 )))
) ">: " ))) ( ang )
)
)
(if (ssget "_:L" '((0 . "INSERT") (2 . "CIRCUIT")))
(progn
(vlax-for
att (setq objs (vla-get-ActiveSelectionSet
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(mapcar
'(lambda (a)
(vla-put-rotation a ang)
(vla-put-alignment
a
acAlignmentMiddleCenter)
(vlax-put
a
'TextAlignmentPoint
(vlax-get att 'InsertionPoint))
)
(vlax-invoke att 'Getattributes)
)
)
(vla-delete objs)
)
)
(princ)
)
HTH
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for that at the moment its not finding any of the blocks when I make the selection but will go though the program and see if I can find out why.
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
The irratating thing is that this macro works fine but you have to select each attribute one at a time and do them individually!
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Post the block here. --> make sure its 2009 or lower version.<--
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
here is the block
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
rodb wrote:here is the block
I never expected it had that much attributes in oneblock. you need to explain more on how you wanted the attributes to be rotated.
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Ah, its really only the CIRCUIT attribute tag that I would like to rotate to zero angle the others can remain as they are. It would be more efficient if the program checks to see if the tag needs rotating before rotating it which could be done with an if statement. What I don't understand is why the tag won't rotate when you can alter the contents of the tag easily.
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
rodb wrote:Ah, its really only the CIRCUIT attribute tag that I would like to rotate to zero angle the others can remain as they are. It would be more efficient if the program checks to see if the tag needs rotating before rotating it which could be done with an if statement. What I don't understand is why the tag won't rotate when you can alter the contents of the tag easily.
Are you saying that only rotated blocks will be included
(defun c:ratb (/ ss att)
(vl-load-com)
;;; Block Specific Routine ;;;
(if (setq ss (ssget "_:L" '((0 . "INSERT") (2 . "LED-DOWNLIGHT2"))))
(repeat (sslength ss)
(if (and
(not
(zerop (vla-get-rotation
(setq e (vlax-ename->vla-object (ssname ss 0)))
)
)
)
(Setq
att (vl-some '(lambda (j)
(if (eq (vla-get-tagstring j) "CIRCUIT")
j
)
)
(vlax-invoke
e
'Getattributes
)
)
)
)
(progn
(vla-put-rotation att 0)
(vla-put-alignment att acAlignmentMiddleRight)
)
)
(ssdel (ssname ss 0) ss)
)
)
(princ)
)
Re: rotating attribute text horizontal
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks everyone for your input I got mine working at last, my problem was inserting the angle 0.0 into the circuit tag instead of (50 . 0.0) silly me, works fine now, might just add a line to avoid rotating tags that are already at 0.0. Feel a bit of a fool now!


