Organic Posted December 1, 2013 Share Posted December 1, 2013 (edited) A while back I modified the following lisp by Jimmy Bergmark ;;; By Jimmy Bergmark ;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved ;;; Website: www.jtbworld.com ;;; E-mail: info@jtbworld.com ;;; rotate selected text objects to specified angle (defun c:txtrot (/ sset i ed ang) (if (setq sset (ssget '((-4 . "<OR") (0 . "MTEXT") (0 . "TEXT") (-4 . "OR>") ) ) ) (progn (setq ang (getangle "Specify rotation angle <0>: ")) (if (null ang) (setq ang 0) ) (repeat (setq i (sslength sset)) (setq ed (entget (ssname sset (setq i (1- i))))) (entmod (subst (cons 50 ang) (assoc 50 ed) ed ) ) ) ) ) (princ) ) into (defun c:txtrotmod (/ sset i ed ang) (if (setq sset (ssget '((-4 . "<OR") (0 . "MTEXT") (0 . "TEXT") (-4 . "OR>") ) ) ) (progn (setq ang (getorient "Specify rotation angle: ")) ;; getorient always takes EAST as 0 degrees ;; regardless of the base angle direction in the ;; drawing file (if (null ang) (setq ang 0) ) (repeat (setq i (sslength sset)) (setq ed (entget (ssname sset (setq i (1- i))))) (entmod (subst (cons 50 ang) (assoc 50 ed) ed ) ) ) ) ) (princ) The lisp rotates text to have the same rotation angle as the angle between two picks made. My hack to fix the rotation and ensure it always rotates correctly is about the limit of my lisp skills (or lack of), so I am hoping someone can help me with the following separate extensions of the second lisp: Extension 1: The user selects two points like normal and the text is rotated, although if those points are part of a line/polyline/arc, the lisp should then get the endpoints of the entity and place the text above (offset 0.1 distance above etc) it. Extension 2 (separate lisp): The user selects two points like normal although the text is not only rotated, although also placed halfway between the selected points and placed slightly above the imaginary line connecting those two points (offset 0.1 distance above etc). If anyone has time and feels like trying to extend the second lisp above to achieve those extensions it would be much appreciated Cheers, Organic Edited December 1, 2013 by Organic Quote Link to comment Share on other sites More sharing options...
Organic Posted December 1, 2013 Author Share Posted December 1, 2013 For the first one: I think the justification of the text/mtext would need to be changed to middle centre or similar first? Then the X distance could be from the perpendicular of the line to the centre of the text? The text is placed halfway along the entity (a line in this case). For the second one: where Y is the distance between the two pick points (not necessarily snapped to an entity like a line as shown in the picture) and the text is then placed halfway between the two pick points, while still being offset X distance from the chord between the two pick points. Quote Link to comment Share on other sites More sharing options...
Organic Posted December 5, 2013 Author Share Posted December 5, 2013 Would it be possible to code this in VBA or would it only be possible in lisp? I know a little VBA so might try that if it is doable Quote Link to comment Share on other sites More sharing options...
jvillarreal Posted December 5, 2013 Share Posted December 5, 2013 http://lee-mac.com/curvealignedtext.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.