TEXT IS MIRROR ON CHANGE UCS

TEXT IS MIRROR ON CHANGE UCS

jaimuthu
Advocate Advocate
492 Views
5 Replies
Message 1 of 6

TEXT IS MIRROR ON CHANGE UCS

jaimuthu
Advocate
Advocate

pick two points and change the ucs plane after line and change ucs Text is mirror or rotate

 

(DEFUN C:CT()

(SETQ

P1(GETPOINT "\n PICK FIRST POINT :")

P2(GETPOINT P1 "\n PICK SECOND POINT :")

ANG(ANGLE P1 P2)

c1(/ 180 pi)

ANG1(* C1 ANG)


)

(COMMAND "UCS" "3" P1 P2 "")

(COMMAND "LINE" P1 P2 "")

(COMMAND "TEXT" "J" "MC" "M2P" P1 P2 8 ANG1 "JAI")

)jai.jpg

0 Likes
Accepted solutions (1)
493 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor

Since you changed the USC after you selected the points you’ll need to translate those initial coordinates from WCS to the current UCS. Read up on trans function 

http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-1A316343-0B68-4DBE-8F49-B4D601CB8FCC...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 6

jaimuthu
Advocate
Advocate

How to use trans function on this program ?

0 Likes
Message 4 of 6

paullimapa
Mentor
Mentor
Accepted solution

Try this modification which is based on your original code.

Using the trans function will locate your drawn LINE at the same coordinates P1 & P2 selected prior to changing the UCS.

Also keep in mind that the resulting rotation angle of the TEXT again is calculated on the current UCS coordinate angle between P1 & P2 prior to changing the UCS. This is what determines (again per your code) the rotation of the placed TEXT.

I purposedly modified the TEXT to show what that rotation angle was for reference.

 

(DEFUN C:CT (/ ANG ANG1 c1 P1 P2 P1w P2w texteval) ; localize variables
 (SETQ
  P1(GETPOINT "\n PICK FIRST POINT :")
  P2(GETPOINT P1 "\n PICK SECOND POINT :")
  ANG(ANGLE P1 P2)
  c1(/ 180 pi)
  ANG1(* C1 ANG)
 )
 ; angle is calculated based on current UCS P1 & P2
 ; translate points from current UCS to World
 (setq P1w (trans P1 1 0) 
       P2w (trans P2 1 0) 
 ) 
 ; change the UCS to another using selected P1 & P2 points
 (COMMAND "_.UCS" "3" P1 P2 "")
 ; translate points from World to new current UCS
 (setq P1 (trans P1w 0 1) 
       P2 (trans P2w 0 1) 
 )
 ; draw line based on these coordinates
 (COMMAND "_.LINE" P1 P2 "")
 ; save current texteval
 (setq texteval (getvar"texteval"))
 ; if 0 change to 1
 (if(zerop texteval)(setvar "TEXTEVAL" 1))
 ; place text in middle of line drawn showing calc rotation
 (COMMAND "_.TEXT" "_J" "_MC" "_M2P" P1 P2 8 ANG1 (strcat "Text Rotation is : " (rtos ANG1 2 1)))
 ; restore original texteval 
 (setvar"texteval"texteval)(princ)
) ; defun

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 6

jaimuthu
Advocate
Advocate

its work great explain thanks 

0 Likes
Message 6 of 6

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes