Jump to content

Recommended Posts

Posted

I am trying to track down a lisp routine that will flip text 180 degrees. For background information, I have a drawing with a ton of MTEXT items in it, all at different angles (for subdivision lot layout elevation and data). I need to add 180 degrees to the angle of each MTEXT to 'flip' it the other direction for viewing purposes.

 

I have looked online and all the information I could find on various sites would change ALL the text to the same angle or were not comprehensive for multiple entities, would only work for one piece of MTEXT.

 

I would also like to do it this way, with some form of LISP routine rather then say creating a new textstyle that sets the orientation opposite or whatever. Anyway, I've looked quite a bit for this and can't come up with anything. Also, the one that is included in the Express Tools (ie: rotate text) required a specific angle. Currently I am rotating them manually and individually via the INSERT snap and the typical Rotate command (PITA)!

 

To summarize, I am trying to find a LISP that will add 180 degrees to multiple Text or MTEXT entities and rotate them via their insert point.

 

Has anyone come across something like this in their travels?

Posted

Quick one:

 

(defun c:FlipTxt (/ i ss e eLst)

 (if (setq i -1 ss (ssget "_:L" '((0 . "TEXT,MTEXT"))))
   (while (setq e (ssname ss (setq i (1+ i))))
     (setq eLst (entget e))
     (entmod (subst (cons 50 (+ pi (cdr (assoc 50 eLst))))
                    (assoc 50 eLst) eLst))))

 (princ))

Posted

Works perfectly, thanks a bunch!! That is exactly what I was looking for. :)

  • 2 years later...
Posted

This is great. Can you add a user specified angle instead of 180?

 

Thanks,

Vince

Posted

Welcome to CADTutor Vince :beer:

 

Try the following simple program:

 

(defun c:rt ( / a e i r s )
   (if (and
           (setq a (getangle "\nSpecify Angle: "))
           (setq s (ssget "_:L" '((0 . "TEXT,MTEXT"))))
       )
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
                 r (assoc 50 e)
           )
           (entmod (subst (cons 50 (+ (cdr r) a)) r e))
       )
   )
   (princ)
)

 

This is a very old thread!

Posted

That works! Yeah, I found the thread in a Yahoo search.

 

Thanks for the code.

Vince

Posted

That is a good lisp. I normally use the following lisp (not written by me) for contour label orientating although it takes a couple more steps.

 

;;  SpinText.LSP
;;  To Rotate Text and/or Mtext entities by the same amount
;;  about each one's individual insertion point.
;;  Kent Cooper, November 2008

(defun C:SpinText (/ ttype selmode trotd trotr textset titem tdata)
 (initget "Text Mtext Both")
 (setq ttype (getkword "Type[s] of text - Text/Mtext/Both (T/M/B) <B>: "))
 (if (or (not ttype) (= ttype "Both")) (setq ttype "*TEXT"))
 (initget "All User")
 (setq
   selmode (getkword "Selection - All in drawing/User selected (A/U) <A>: ")
   trotd (getreal "Rotation (from current) in degrees <180>: ")
   trotr
     (if trotd
       (/ (* trotd pi) 180)
       pi
     ); end if and trotr
 ); end setq
 (if (/= selmode "User")
   (setq textset (ssget "_X" (list (cons 0 ttype))))
   (setq textset (ssget (list (cons 0 ttype))))
 ); end if
 (while (> (sslength textset) 0)
   (setq
     titem (ssname textset 0)
     tdata (entget titem)
     tdata (subst (cons 50 (+ (cdr (assoc 50 tdata)) trotr)) (assoc 50 tdata) tdata)
   ); end setq
   (entmod tdata)
   (entupd titem)
   (ssdel titem textset)
 ); end while
); end defun
(prompt "Type SpinText to rotate Text and/or Mtext entities about their insertion points.")

  • 4 years later...
Posted
Welcome to CADTutor Vince :beer:

 

Try the following simple program:

 

(defun c:rt ( / a e i r s )
   (if (and
           (setq a (getangle "\nSpecify Angle: "))
           (setq s (ssget "_:L" '((0 . "TEXT,MTEXT"))))
       )
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
                 r (assoc 50 e)
           )
           (entmod (subst (cons 50 (+ (cdr r) a)) r e))
       )
   )
   (princ)
)

 

This is a very old thread!

 

Hi Lisp Legend,

i am new to lisp....i need a help in creating a lisp, actually i have drawing with lot (nearly thousands of text to converted in a single drawing file) of text to be converted from different angles to zero angle & also to change its text height & font style as shown in attached .dwg file,

Another important thing is i need to remove the / symbol from that text & re-arrange as shown in the attached .dwg file.

Kindly look on this & requesting to please provide lisp for this work.

Also i need that P50/ (it may be anything PXX/) text to be removed,

i hope you are understanding my request.......please help

TEXT CONVERTION.dwg

Posted

Stop bringing up old threads, you have already created a new thread for this topic.

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