Mirror text position of dimnestion

Mirror text position of dimnestion

sergiu_ciuhnenco
Advocate Advocate
1,249 Views
6 Replies
Message 1 of 7

Mirror text position of dimnestion

sergiu_ciuhnenco
Advocate
Advocate

Need a help from you guys !!!!
Can't figure out it : When I mirror a dimension, if the dimension have  a reset position text it not mirror in oposite side the text , Just look in autocad and you will understand ,
Thanks in advance !
 

0 Likes
Accepted solutions (1)
1,250 Views
6 Replies
Replies (6)
Message 2 of 7

scot-65
Advisor
Advisor
Without opening your drawing...
Dimension is upside-down after a flip?

Snippet:
(setpropertyvalue (ssname s n) "HorizontalRotation"
(- (abs (getpropertyvalue (ssname s n) "HorizontalRotation")) pi) )

Where s is a selection set and n is the index position of the selection set.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 7

devitg
Advisor
Advisor

Hi Scot-65 , please clear it 

 

setpropertyvalue 
0 Likes
Message 4 of 7

marko_ribar
Advisor
Advisor
Accepted solution

Here you are... Not thoroughly tested thou, but it work for me...

 

(defun c:mirrdim ( / adoc dim n e p1 p2 a mirrbp mirrp txtp txtnp k )

  (vl-load-com)

  (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
  (setq dim (car (entsel "\nPick dimension to mirror it...")))
  (setq n (cdr (assoc 2 (entget dim))))
  (setq e (tblobjname "BLOCK" n))
  (setq k 0)
  (while (/= (cdr (assoc 0 (entget (setq e (entnext e))))) "MTEXT")
    (setq k (1+ k))
  )
  (cond
    ( (= k 6)
      (setq e (tblobjname "BLOCK" n))
      (repeat 6
        (setq e (entnext e))
      )
      (setq p1 (cdr (assoc 10 (entget e))) p2 (cdr (assoc 11 (entget e))))
      (setq a (angle p1 p2))
      (repeat 2
        (setq e (entnext e))
      )
      (setq mirrbp (mapcar (function /) (mapcar (function +) (cdr (assoc 10 (entget e))) (cdr (assoc 11 (entget e)))) (list 2.0 2.0 2.0)))
      (setq mirrp (inters mirrbp (polar mirrbp (+ a (* 0.5 pi)) 1.0) p1 p2 nil))
      (setq txtp (safearray-value (variant-value (vla-get-textposition (vlax-ename->vla-object dim)))))
      (setq txtnp (inters txtp (polar txtp (+ a (* 0.5 pi)) 1.0) p1 p2 nil))
    )
    ( (= k 5)
      (setq e (tblobjname "BLOCK" n))
      (repeat 3
        (setq e (entnext e))
      )
      (setq mirrbp (mapcar (function /) (mapcar (function +) (cdr (assoc 10 (entget e))) (cdr (assoc 11 (entget e)))) (list 2.0 2.0 2.0)))
      (repeat 2
        (setq e (entnext e))
      )
      (setq p1 (cdr (assoc 10 (entget e))) p2 (cdr (assoc 11 (entget e))))
      (setq a (angle p1 p2))
      (setq mirrp (inters mirrbp (polar mirrbp (+ a (* 0.5 pi)) 1.0) p1 p2 nil))
      (setq txtp (safearray-value (variant-value (vla-get-textposition (vlax-ename->vla-object dim)))))
      (setq txtnp (inters txtp (polar txtp (+ a (* 0.5 pi)) 1.0) p1 p2 nil))
    )
  )
  (vla-put-textposition (vlax-ename->vla-object dim) (vlax-3d-point txtnp))
  (vl-cmdf "_.MIRROR" dim "" "_non" (trans mirrbp dim 1) "_non" (trans mirrp dim 1) "_Y")
  (vla-endundomark adoc)
  (princ)
)

HTH., M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 5 of 7

sergiu_ciuhnenco
Advocate
Advocate

Thanks , It work fine !!!!

0 Likes
Message 6 of 7

sergiu_ciuhnenco
Advocate
Advocate

Sorry Scot I coul'nt understand how to snippet it Man Embarassed

0 Likes
Message 7 of 7

scot-65
Advisor
Advisor
Wrap it inside a loop that is inside a ssget with a dimension filter.
-or-
While (entsel... for a real-time update.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes