Mirror: Rotation and X Scale

Mirror: Rotation and X Scale

renanemeyer
Advocate Advocate
3,600 Views
23 Replies
Message 1 of 24

Mirror: Rotation and X Scale

renanemeyer
Advocate
Advocate

Hello everybody.
I come to clarify a doubt, if anyone has any better ideas I also accept suggestions.

I often use the mirror in autocad, but in the mirror upwards it assigns a rotation 180 or when the mirror is on the side it assigns -1 in Scale X.
See the example photo

 

renanemeyer_0-1629984404335.png

 

I thought about creating a lisp that would take everything from this layer and adjust these mirrors to rotation 0 and X Scale = 1, but I come to ask if anyone already has something I can base myself on or could help me stop this repetitive work .

 

Thanks in advance


 

 
 
 
 
 
0 Likes
Accepted solutions (1)
3,601 Views
23 Replies
Replies (23)
Message 21 of 24

ВeekeeCZ
Consultant
Consultant

So you will select possibly multiple block sets (with horizontal and leader lines).

Then you want to specify what

- point and keyword (H/V)?,

- or just keyword and mirror it around the edge of the bounding box?

- or two points to spefify axis? (one, and second with ortho?)

0 Likes
Message 22 of 24

ВeekeeCZ
Consultant
Consultant
Accepted solution

... or simply like this.

 

(defun c:MirrSetH ( / s p r i d d10 d11 m b)
  
  (if (and (setq s (ssget "_:L"))
	   (setq p (getpoint "\nSpecify point: "))
	   (setq r (ssget "_P" '((0 . "~INSERT"))))
	   (vl-cmdf "_.mirror" r "" "_non" p "_non" "@0,1" "_n")
	   )
    (repeat (setq i (sslength s))
      (and (setq d (entget (ssname s (setq i (1- i)))))
	   (= "LINE" (cdr (assoc 0 d)))
	   (setq d10 (cdr (assoc 10 d)))
	   (setq d11 (cdr (assoc 11 d)))
	   (equal (cadr d10) (cadr d11) 1e-6)
	   (setq m (trans (mapcar '/ (mapcar '+ d10 d11) '(2 2)) 0 1))
	   (setq b (ssget "_CP" (list (polar d10 (/ pi 2) 0.05) (polar d11 (/ pi 2) 0.05) (polar d11 (/ pi 2) -0.05) (polar d10 (/ pi 2) -0.05)) '((0 . "INSERT"))))
	   (command "_.copy" b "" "_d" "_non" (list (* 2 (- (car p) (car m))) 0.)))))
  (princ)
  )


(defun c:MirrSetV ( / s p r i d d10 d11 m b)
  
  (if (and (setq s (ssget "_:L"))
	   (setq p (getpoint "\nSpecify point: "))
	   (setq r (ssget "_P" '((0 . "~INSERT"))))
	   (vl-cmdf "_.mirror" r "" "_non" p "_non" "@1,0" "_n")
	   )
    (repeat (setq i (sslength s))
      (and (setq d (entget (ssname s (setq i (1- i)))))
	   (= "LINE" (cdr (assoc 0 d)))
	   (setq d10 (cdr (assoc 10 d)))
	   (setq d11 (cdr (assoc 11 d)))
	   (equal (cadr d10) (cadr d11) 1e-6)
	   (setq m (trans (mapcar '/ (mapcar '+ d10 d11) '(2 2)) 0 1))
	   (setq b (ssget "_CP" (list (polar d10 (/ pi 2) 0.05) (polar d11 (/ pi 2) 0.05) (polar d11 (/ pi 2) -0.05) (polar d10 (/ pi 2) -0.05)) '((0 . "INSERT"))))
	   (command "_.copy" b "" "_d" "_non" (list 0. (* 2 (- (cadr p) (cadr m))))))))
  (princ)
  )

 

Message 23 of 24

renanemeyer
Advocate
Advocate

 Dear @ВeekeeCZ  congratulations!
You solved a code that I've been trying to solve for days, it was very well thought out and the idea of ​​vertical/horizontal too
Excellent logic, thank you very much

Message 24 of 24

ВeekeeCZ
Consultant
Consultant

Glad to help, @renanemeyer 

Yeah, I know what youre talking about. Sometimes the fresh eyes do wonders.