Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am not strong at modifying lisp. I have the routine below, it works fine except that when any type of lines are drawn at an angle over 180 dgrees. Then it puts in text upside down. I know that logically i should have an if statement that says if the angle is 180 or greater that i should subtract 180 to get the angle i should use. Any help would be greatly appreciated.
Thanks,
(vl-load-com) (defun c:gcs-TextinLine() (glt-TextinLine 0.09375 ) (princ) ) (defun glt-TextinLine (standtext / _cmdecho _osmode lineent lineobj p1 lineangle textheight textent) ;you need to clear out old variables ;(rtd ) this subroutine converts radians to degrees. (defun rtd (a) (/ (* a 180.0) pi)) ;(dgtr ) this subroutine converts degrees to radians (defun dtr (a) (* pi (/ a 180.0))) (setq _cmdecho (getvar "cmdecho")) ;save the user's settings and restore at end (setvar "cmdecho" 0) (setq lineent (entsel "\nSelect Line at location of text string")) ;select the line (setq lineobj (vlax-ename->vla-object (car lineent))) ;get the line object (setq p1 (cadr lineent)) ;get the point where the user clicked (setq lineangle (rtd (vla-get-angle lineobj))) ;get the angle (setq textheight (* (getvar "dimscale") standtext)) ;calculate the text height (command ".dtext" "j" "mc" p1 textheight lineangle) ;start the text command and fill in the values (while (eq 1 (logand 1 (getvar "CMDACTIVE"))) ;wait til the command is no longer active (command pause) ) (setq textent (entlast)) ;get the text entity (command ".trim" textent "" lineent "") ;trim the line using the text (setvar "cmdecho" _cmdecho) ;restore the user's setting (princ) )
Solved! Go to Solution.