hildebran Posted January 13, 2012 Posted January 13, 2012 Greetings all, i work with AUtoCAD MEP and use "devices" regularly. We normally convert the consultants electrical blocks to devices and do what we do but on this project half of the the consultants blocks are mirrored. The problem occurs when the conversion to MEP device happens. The devices are created 180 degrees out of rotation from the original block. This means the roughly 1200 devices of 20 different types need to be manually rotated. Ugh! I saw this thread below which is the closest i have found to a solution. http://www.cadtutor.net/forum/showthread.php?54913-Rotate-multiple-blocks-around-their-individual-origin-point I dont know LISP other than a minor tweak here and there. What im hoping someone has is a LISP routine the cloely does the following. Select blocks with negative "x" scale get rotation value "RO" get scale value "SC" While there are blocks with a negative "x" scale invert scale rotate 180 degrees relative to original rotation value"RO" Thanks for you time all! Quote
Lee Mac Posted January 13, 2012 Posted January 13, 2012 Maybe: (defun c:test ( / e i s ) (if (setq s (ssget "_X" '((0 . "INSERT") (-4 . "<") (41 . 0.0)))) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i)))) e (subst (cons 41 (abs (cdr (assoc 41 e)))) (assoc 41 e) e) e (subst (cons 50 (+ pi (cdr (assoc 50 e)))) (assoc 50 e) e) ) (entmod e) ) ) (princ) ) Quote
hildebran Posted January 13, 2012 Author Posted January 13, 2012 Lee, its a miracle! Ive tested it a few time and see nothing but what i was hoping to see. Thank you so much! Quote
monkey7 Posted January 13, 2012 Posted January 13, 2012 Darn, beat me to it. Using about a tenth of the lines I needed. *goes sulk in corner and analyse the code above* Quote
hildebran Posted January 13, 2012 Author Posted January 13, 2012 I appreciate it Monkey7! It took him 7 minutes to reply to my thread so he clearly gave noone a chance! Quote
Lee Mac Posted January 14, 2012 Posted January 14, 2012 Sorry guys, I've had too much practice Glad it works how you want it too 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.