Sweety Posted September 1, 2010 Share Posted September 1, 2010 Hello everyone. I got the DXF codes of a MTEXT , but I couldn't find the end point of the MTEXT. The start is the DXF code 10 and it's available in among codes except 20 & 30. Could any one clear it for me please ? ((-1 . <Entity name: 7ee394e0>) (0 . "MTEXT") (5 . "18C") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 7ee394f0>) (102 . "}") (330 . <Entity name: 7ee37cf8>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbMText") (10 6.62577 15.8186 0.0) (40 . 0.2) (41 . 5.35401) (46 . 0.0) (71 . 1) (72 . 5) (1 . "dfgdfg") (7 . "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0) (42 . 0.748568) (43 . 0.26221) (50 . 0.0) (73 . 1) (44 . 1.0)) Thanking you all. Sweety. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 1, 2010 Share Posted September 1, 2010 Hello everyone. I got the DXF codes of a MTEXT , but I couldn't find the end point of the MTEXT. The start is the DXF code 10 and it's available in among codes except 20 & 30. Could any one clear it for me please ? ... Maybe there's some confusion about the points you're looking for... there are no start and end points for text entities. There are only an insertion point, and bounding box points (min and max). DXF code 10 is the insertion point. This point may be located in a different location about the text entity, relative to the justification. Let me know if this does not make sense. If you are looking for the 'extents' of the text entity, then consider looking into the vla-getboundingbox function. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 1, 2010 Share Posted September 1, 2010 Look into DXF 42, 43 of the MText. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 1, 2010 Share Posted September 1, 2010 Look into DXF 42, 43 of the MText. Good point, Lee. Those ... combined with polar, and the centroid, and eureka! Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted September 1, 2010 Share Posted September 1, 2010 Sweety, Are you trying to make a polyline around text? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 1, 2010 Share Posted September 1, 2010 A little food for thought: ;;-----------------------=={ Box Text }==---------------------;; ;; ;; ;; Frames Text or MText objects with an LWPolyline, with ;; ;; optional offset. Works in all UCS/Views. ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; (defun c:BT nil (c:BoxText)) (defun c:BoxText nil ;; © Lee Mac 2010 ( (lambda ( ss off i / e ) (if ss (while (setq e (ssname ss (setq i (1+ i)))) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (assoc 8 (entget e)) (cons 90 4) (cons 70 1) (cons 38 (caddr (cdr (assoc 10 (entget e))))) (assoc 210 (entget e)) ) (mapcar '(lambda ( x ) (cons 10 x)) (LM:GetTextBox e off)) ) ) ) ) ) (ssget '((0 . "TEXT,MTEXT"))) (setq *o* (cond ( (getdist (strcat "\nSpecify Offset <" (rtos (setq *o* (cond ( *o* ) ( (* 0.5 (getvar 'TEXTSIZE)) )) ) ) "> : " ) ) ) ( *o* ) ) ) -1 ) (princ) ) ;;---------------------=={ Get Text Box }==-------------------;; ;; ;; ;; Returns a point list describing a rectangle framing the ;; ;; specified text or mtext entity with optional offset ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;; <Inspired by Gilles Chanteau> ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; ent - Text or MText ename ;; ;; off - offset (may be zero) ;; ;;------------------------------------------------------------;; ;; Returns: List of Points (in OCS) describing text frame ;; ;;------------------------------------------------------------;; (defun LM:GetTextBox ( ent off / dx lst base rotn norm w h matrix ) ;; © Lee Mac 2010 (setq dx (lambda ( x l ) (cdr (assoc x l)))) (if (setq lst (cond ( (eq "TEXT" (dx 0 (setq l (entget ent)))) (setq base (dx 10 l) rotn (dx 50 l)) ( (lambda ( data ) (mapcar (function (lambda ( funcs ) (mapcar (function (lambda ( func ) ((eval (car func)) ((eval (cdr func)) data) off) ) ) funcs ) ) ) (list (list (cons '- 'caar ) (cons '- 'cadar )) (list (cons '+ 'caadr) (cons '- 'cadar )) (list (cons '+ 'caadr) (cons '+ 'cadadr)) (list (cons '- 'caar ) (cons '+ 'cadadr)) ) ) ) (textbox l) ) ) ( (eq "MTEXT" (dx 0 l)) (setq norm (dx 210 l) base (trans (dx 10 l) 0 norm) rotn (angle '(0. 0. 0.) (trans (dx 11 l) 0 norm)) w (dx 42 l) h (dx 43 l) ) ( (lambda ( org ) (mapcar (function (lambda ( o ) (mapcar '+ org o)) ) (list (list (- off) (- off)) (list (+ w off) (- off)) (list (+ w off) (+ h off)) (list (- off) (+ h off)) ) ) ) ( (lambda ( j ) (list (cond ( (member j '(2 5 ) (/ w -2.) ) ( (member j '(3 6 9)) (- w) ) ( 0. ) ) (cond ( (member j '(1 2 3)) (- h) ) ( (member j '(4 5 6)) (/ h -2.) ) ( 0. ) ) ) ) (dx 71 l) ) ) ) ) ) (progn (setq matrix (list (list (cos rotn) (sin (- rotn)) 0.) (list (sin rotn) (cos rotn) 0.) (list 0. 0. 1.) ) ) (mapcar (function (lambda ( point ) (mapcar '+ (mapcar (function (lambda ( r ) (apply '+ (mapcar '* r point))) ) matrix ) (reverse (cdr (reverse base))) ) ) ) lst ) ) ) ) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted September 2, 2010 Share Posted September 2, 2010 I use this for TEXT only (not MTEXT ) It takes into consideration x scale ( 41 ) factors, text rotation ( 50 ) and font character spacing. It does not take into account ( 51 ) oblique angles. [b][color=BLACK]([/color][/b]defun txt_bndy [b][color=FUCHSIA]([/color][/b]en / ed p10 xsc trt td t10 t11 dif d11 ll lr ur ul[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq ed [b][color=NAVY]([/color][/b]entget en[b][color=NAVY])[/color][/b] p10 [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 10 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] xsc [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 41 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] trt [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 50 ed[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq td ed td [b][color=NAVY]([/color][/b]subst [b][color=MAROON]([/color][/b]cons 11 [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 10 td[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]assoc 11 td[b][color=MAROON])[/color][/b] td[b][color=NAVY])[/color][/b] td [b][color=NAVY]([/color][/b]subst '[b][color=MAROON]([/color][/b]50 . 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]assoc 50 td[b][color=MAROON])[/color][/b] td[b][color=NAVY])[/color][/b] td [b][color=NAVY]([/color][/b]subst '[b][color=MAROON]([/color][/b]71 . 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]assoc 71 td[b][color=MAROON])[/color][/b] td[b][color=NAVY])[/color][/b] td [b][color=NAVY]([/color][/b]subst '[b][color=MAROON]([/color][/b]72 . 4[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]assoc 72 td[b][color=MAROON])[/color][/b] td[b][color=NAVY])[/color][/b] td [b][color=NAVY]([/color][/b]subst '[b][color=MAROON]([/color][/b]73 . 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]assoc 73 td[b][color=MAROON])[/color][/b] td[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]entmake td[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq td [b][color=NAVY]([/color][/b]entget [b][color=MAROON]([/color][/b]entlast[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] t10 [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 10 td[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] t11 [b][color=NAVY]([/color][/b]cdr [b][color=MAROON]([/color][/b]assoc 11 td[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] dif [b][color=NAVY]([/color][/b]mapcar '- t10 t11[b][color=NAVY])[/color][/b] d11 [b][color=NAVY]([/color][/b]mapcar '- p10 dif[b][color=NAVY])[/color][/b] ll p10 ul [b][color=NAVY]([/color][/b]polar ll [b][color=MAROON]([/color][/b]+ [b][color=GREEN]([/color][/b]* pi 0.5[b][color=GREEN])[/color][/b] trt[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]* [b][color=GREEN]([/color][/b]cadr dif[b][color=GREEN])[/color][/b] -2.[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] lr [b][color=NAVY]([/color][/b]polar ll [b][color=MAROON]([/color][/b]+ [b][color=GREEN]([/color][/b]* pi 0.0[b][color=GREEN])[/color][/b] trt[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]* [b][color=GREEN]([/color][/b]car dif[b][color=GREEN])[/color][/b] -2.[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] ur [b][color=NAVY]([/color][/b]polar lr [b][color=MAROON]([/color][/b]+ [b][color=GREEN]([/color][/b]* pi 0.5[b][color=GREEN])[/color][/b] trt[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]* [b][color=GREEN]([/color][/b]cadr dif[b][color=GREEN])[/color][/b] -2.[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]entdel [b][color=NAVY]([/color][/b]entlast[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]grdraw ll ul 4 3[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]grdraw ll lr 4 3[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]grdraw ur lr 4 3[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]grdraw ur ul 4 3[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] It also make autocad do most of the actual work. -David Quote Link to comment Share on other sites More sharing options...
autolisp Posted September 4, 2010 Share Posted September 4, 2010 A little food for thought: ;;-----------------------=={ Box Text }==---------------------;; ;; ;; ;; Frames Text or MText objects with an LWPolyline, with ;; ;; optional offset. Works in all UCS/Views. ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; (defun c:BT nil (c:BoxText)) (defun c:BoxText nil ;; © Lee Mac 2010 ( (lambda ( ss off i / e ) (if ss (while (setq e (ssname ss (setq i (1+ i)))) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (assoc 8 (entget e)) (cons 90 4) (cons 70 1) (cons 38 (caddr (cdr (assoc 10 (entget e))))) (assoc 210 (entget e)) ) (mapcar '(lambda ( x ) (cons 10 x)) (LM:GetTextBox e off)) ) ) ) ) ) (ssget '((0 . "TEXT,MTEXT"))) (setq *o* (cond ( (getdist (strcat "\nSpecify Offset <" (rtos (setq *o* (cond ( *o* ) ( (* 0.5 (getvar 'TEXTSIZE)) )) ) ) "> : " ) ) ) ( *o* ) ) ) -1 ) (princ) ) ;;---------------------=={ Get Text Box }==-------------------;; ;; ;; ;; Returns a point list describing a rectangle framing the ;; ;; specified text or mtext entity with optional offset ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;; <Inspired by Gilles Chanteau> ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; ent - Text or MText ename ;; ;; off - offset (may be zero) ;; ;;------------------------------------------------------------;; ;; Returns: List of Points (in OCS) describing text frame ;; ;;------------------------------------------------------------;; (defun LM:GetTextBox ( ent off / dx lst base rotn norm w h matrix ) ;; © Lee Mac 2010 (setq dx (lambda ( x l ) (cdr (assoc x l)))) (if (setq lst (cond ( (eq "TEXT" (dx 0 (setq l (entget ent)))) (setq base (dx 10 l) rotn (dx 50 l)) ( (lambda ( data ) (mapcar (function (lambda ( funcs ) (mapcar (function (lambda ( func ) ((eval (car func)) ((eval (cdr func)) data) off) ) ) funcs ) ) ) (list (list (cons '- 'caar ) (cons '- 'cadar )) (list (cons '+ 'caadr) (cons '- 'cadar )) (list (cons '+ 'caadr) (cons '+ 'cadadr)) (list (cons '- 'caar ) (cons '+ 'cadadr)) ) ) ) (textbox l) ) ) ( (eq "MTEXT" (dx 0 l)) (setq norm (dx 210 l) base (trans (dx 10 l) 0 norm) rotn (angle '(0. 0. 0.) (trans (dx 11 l) 0 norm)) w (dx 42 l) h (dx 43 l) ) ( (lambda ( org ) (mapcar (function (lambda ( o ) (mapcar '+ org o)) ) (list (list (- off) (- off)) (list (+ w off) (- off)) (list (+ w off) (+ h off)) (list (- off) (+ h off)) ) ) ) ( (lambda ( j ) (list (cond ( (member j '(2 5 ) (/ w -2.) ) ( (member j '(3 6 9)) (- w) ) ( 0. ) ) (cond ( (member j '(1 2 3)) (- h) ) ( (member j '(4 5 6)) (/ h -2.) ) ( 0. ) ) ) ) (dx 71 l) ) ) ) ) ) (progn (setq matrix (list (list (cos rotn) (sin (- rotn)) 0.) (list (sin rotn) (cos rotn) 0.) (list 0. 0. 1.) ) ) (mapcar (function (lambda ( point ) (mapcar '+ (mapcar (function (lambda ( r ) (apply '+ (mapcar '* r point))) ) matrix ) (reverse (cdr (reverse base))) ) ) ) lst ) ) ) ) sorry for bad english dear sir very good lisp but i want something more see attched file Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 4, 2010 Share Posted September 4, 2010 Convert it to MText then 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.