95
477
383
后起之秀
使用道具 举报
47
257
216
(defun c:mx ()(setq obj (ssget ))(setq P1 ( getpoint "\nPick basepoint : "))(setq P2 ( getpoint "\nPick X-value point : "))(if (acet-sys-shift-down);If shift-down(command "_.Move" obj "" P1 ".x" P1 P2);If not shift-down(command "_.Move" obj "" P1 ".x" P2 P1));;(princ))
;;------------------------=={ Dynamic Text Align }==---------------------------;;;; ;;;; Allows the user to dynamically align text to any angle. User is prompted to ;;;; make a selection of Text or MText objects to align, and pick an alignment ;;;; point, or select a text object to use for alignment. The selection of text ;;;; is then aligned by either x or y coordinate, or dynamically stretched ;;;; depending on the mode chosen. ;;;; ;;;; The mode can be switched upon pressing TAB during alignment. Text and MText ;;;; entities will be aligned in accordance with their respective justifications. ;;;; ;;;; The user can also specify a fixed text spacing, by pressing 'S' during text ;;;; alignment. Holding Shift whilst aligning Text will alter Text Rotation, the ;;;; user can also refine Rotation by pressing 'R' during text alignment. Text ;;;; Justfication can be altered by pressing 'J' during text alignment. ;;;; ;;;; ;;;; Object Alignment Mode:- ;;;; -------------------------- ;;;; Text can be aligned to an object by pressing 'O' during text alignment. In ;;;; this mode, the text spacing along the object can be adjusted by pressing ;;;; 'S' and the text offset from the object can also be altered by pressing 'O'. ;;;; ;;;; Text Rotation can be aligned to the tangent vector of the object at the ;;;; point of alignment by holding Shift during text placement. The user can ;;;; furthermore specify a text rotation by pressing 'R'. ;;;; ;;;; The order of the text entities along the object can be Reversed by pressing ;;;; 'V' during Text placement. The original order of these entities is ;;;; determined by the drawing direction of the object. ;;;; ;;;;-------------------------------------------------------------------------------;;;; ;;;; FUNCTION SYNTAX: TXALIGN ;;;; ;;;; Notes:- ;;;; --------- ;;;; Shift Functionality requires the user to have Express Tools installed. ;;;; ;;;;-------------------------------------------------------------------------------;;;; ;;;; Author: Lee Mac, Copyright © October 2009 - www.lee-mac.com ;;;; ;;;;-------------------------------------------------------------------------------;;;; ;;;; Version: ;;;; ;;;; 1.0: 12/10/2009 - First Release ;;;;-------------------------------------------------------------------------------;;;; 1.1: 14/10/2009 - Added ability to Specify fixed text spacing ;;;;-------------------------------------------------------------------------------;;;; 1.2: 15/10/2009 - Added Stretch Mode ;;;; - Upgraded User messaging ;;;;-------------------------------------------------------------------------------;;;; 1.3: 18/10/2009 - Added Rotation Functionality ;;;;-------------------------------------------------------------------------------;;;; 1.4: 20/10/2009 - Added functionality to align text to object. ;;;;-------------------------------------------------------------------------------;;;; 1.5: 23/10/2009 - Added Justification Options. ;;;;-------------------------------------------------------------------------------;;;; 1.6: 28/10/2009 - Added Option to Select Text object at Alignment Point ;;;; prompt ;;;;-------------------------------------------------------------------------------;;(defun c:TxAlign (/ ;; --=={ Local Functions }==-- *error* GetProp Text_Rotation Text_Offset Text_Stretch ;; --=={ Local Variables }==-- ANG BAR BDIS BPT BSANG BSDIS BSPT CANG CLST CMODE CODE CODEC COL CPT DATA DATAC DER DIS DOC DSPC ENT ET FOO FOOC GR GRC I IPT J JLST K MLST MSG MSGC OBJLST PLST PROP PT PTO RANG RLST SS TMPLST ;; --=={ Global Variables }==-- ; *txMode ~ Mode Setting ; *txSpc ~ Default Text Spacing ; *txRot ~ Default Text Rotation ; *txOff ~ Default Text Curve Offset ; *txJus ~ Default Text Justification ) (vl-load-com) (defun *error* (err) (and doc (vla-EndUndoMark doc)) (and rLst (mapcar (function (lambda (values) (vlax-put (car values) (cadr values) (cadddr values)) (vlax-put (car values) 'Rotation (caddr values)))) rLst)) (or (wcmatch (strcase err) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\nError: " err))) (redraw) (princ)) (defun GetProp (object_list) (mapcar (function (lambda (object / prop) (setq prop (if (eq "AcDbText" (vla-get-ObjectName object)) (if (eq acAlignmentLeft (vla-get-Alignment object)) 'InsertionPoint 'TextAlignmentPoint) 'InsertionPoint)) (list object prop (vlax-get object 'Rotation) (vlax-get object prop)))) object_list)) (defun Text_Rotation (/ oStr msgR grR codeR dataR rPt rAng) (setq oStr "") (princ (setq msgR (strcat "\nSpecify Text Rotation [Reset] <" (vl-princ-to-string *txRot) "> : "))) (while (progn (setq grR (grread 't 15 0) codeR (car grR) dataR (cadr grR))