Jump to content

Help with block scale and rotate(again)


hildebran

Recommended Posts

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!

Link to comment
Share on other sites

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)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...