Zorg Posted May 22, 2009 Posted May 22, 2009 I had a lisp a few years ago that set the rotation of all the attributes within blocks to 0. Does anyone have a lisp like that? Or even better, if the command line would prompt for a rotation? Many thanks in advance, Z Quote
Freerefill Posted May 22, 2009 Posted May 22, 2009 I was going to modify this for you, but that would be too easy~ This has the core functionality, you can modify it as you wish (defun c:cr( / ss obj) (vl-load-com) (if (ssget "X" (list (cons 0 "INSERT")(cons 2 "CAMERA"))) ; Selection set. Edit to define which blocks will be rotated (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (if (= (vla-get-HasAttributes obj) :vlax-true) (foreach attVar (vlax-invoke obj 'GetAttributes) (if (not (= (vla-get-TagString attVar) "3")) (vla-put-Rotation attVar 0) ; You can add a (getreal) function and put the input in place of "0" ) ) ) ) (vla-delete ss) ) ) (princ) ) If that's no good, here's another one I wrote a year or so ago. I'm not 100% positive it works the way it should (sometimes flips everything 180 degrees..) but the goal was to make it work like the TORIENT express tool. Give it a whirl~ (defun c:or() ; Get selection set (setq selSet (ssget (list (cons -4 "<OR") (cons 0 "INSERT") (cons 0 "TEXT") (cons 0 "MTEXT") (cons 0 "ATTDEF") (cons -4 "OR>")))) ; Get rotation (setq absRot_Rad (getangle "\nSelect rotation: ")) (if (< (ucsang) 0) (setq ucsangle (+ (ucsang) pi)) (setq ucsangle (ucsang))) (setq absRot (+ absRot_Rad ucsangle)) ; For each block in selection set, update rotation of block with returned rotation (setq selVar 0) (repeat (sslength selSet) (setq ent (cadr (car (ssnamex selSet selVar)))) (setq entLst (entget ent)) (setq entLst (subst (cons 50 absRot) (assoc 50 entLst) entLst)) (entmod entLst) (entupd ent) (setq selVar (1+ selVar)) ) (princ) ) (defun ucsang() (setq ucsX (getvar "UCSXDIR")) (setq ucsY (getvar "UCSYDIR")) (cond ((/= 0 (car ucsX)) (setq ucsDir (getvar "UCSXDIR")) (setq angangx (atan (/ (cadr ucsDir) (car ucsDir)))) ) (t (setq ucsDir (getvar "UCSYDIR")) (setq angangy (- (atan (/ (cadr ucsDir) (car ucsDir))) (/ pi 2.0))) ) ) ) ; Returns current rotation angle in radians of UCS w/respect to WCS Quote
Zorg Posted May 22, 2009 Author Posted May 22, 2009 lovely, cheers dude! i'm still trying to wrap my head around lisp so i'll give it ago! thanks again man Quote
Zorg Posted May 22, 2009 Author Posted May 22, 2009 The second one just seems to rotate everything the same way the rotate tool does but without selecting an insertion point i'll investigate Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 ASMI has one I think: http://www.asmitools.com/Files/Lisps/Atron.html Theres a few more there to do stuff to attributes too Quote
Zorg Posted May 22, 2009 Author Posted May 22, 2009 ASMI has one I think: http://www.asmitools.com/Files/Lisps/Atron.html Theres a few more there to do stuff to attributes too ha! thats brilliant! ..and the site! Quote
Lee Mac Posted May 22, 2009 Posted May 22, 2009 ha! thats brilliant! ..and the site! Yeah, ASMI has a great site there - so many good LISPs Quote
Zorg Posted May 22, 2009 Author Posted May 22, 2009 Yeah, ASMI has a great site there - so many good LISPs i think i found about 5 that will increase my effiency at work in the space of 10 minutes! :D thanks man! 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.