mtext boundary

Discussion in 'AutoCAD' started by hamid2, Jan 13, 2005.

  1. hamid2

    hamid2 Guest

    Hello everyone;

    How to get the mtext boundary? I need to draw a rectangle around mtext. I know AutoCAD saves it but where? any idea?

    Thanks
     
    hamid2, Jan 13, 2005
    #1
  2. hamid2

    Doug Broad Guest

    Use the getboundingbox method. Convert the results of the
    lower left corner and upper right corner from safearrays to
    lists.
     
    Doug Broad, Jan 13, 2005
    #2
  3. hamid2

    Joe Burke Guest

    If you're not sure how to do what Doug mentioned, here's some functions which return
    bounding box points.

    Note, if the mtext is at an odd angle the bounding box is not rotated likewise.

    Hi Doug.

    Joe Burke

    (defun GetLL (vobj / mn mx)
    (vla-getboundingbox vobj 'mn 'mx)
    (vlax-safearray->list mn)
    )
    (defun GetUR (vobj / mn mx)
    (vla-getboundingbox vobj 'mn 'mx)
    (vlax-safearray->list mx)
    )
    (defun GetUL (vobj / mn mx)
    (vla-getboundingbox vobj 'mn 'mx)
    (list
    (car (vlax-safearray->list mn))
    (cadr (vlax-safearray->list mx))
    '0.0
    )
    )
    (defun GetLR (vobj / mn mx)
    (vla-getboundingbox vobj 'mn 'mx)
    (list
    (car (vlax-safearray->list mx))
    (cadr (vlax-safearray->list mn))
    '0.0
    )
    )
     
    Joe Burke, Jan 13, 2005
    #3
  4. hamid2

    Jimmy D Guest

    Or (in 'vanilla' lisp):

    (defun MTBox()
    (setq MTxt (entget (car (entsel"\nSelect Mtext:..."))))
    (setq UpperCorner (cdr (assoc 10 MTxt)))
    (setq TxtLength (cdr (assoc 42 MTxt)))
    (setq TxtHeight (cdr (assoc 43 MTxt)))
    (setq LowerCorner (list (+ (car UpperCorner) TxtLength) (- (cadr UpperCorner) TxtHeight)))
    (command "rectangle" UpperCorner LowerCorner)
    (princ)
    );end defun


    Jim
     
    Jimmy D, Jan 13, 2005
    #4
  5. hamid2

    James Allen Guest

    You may prefer (textbox) with a little post-processing if your text may be
    rotated.
    --
    James Allen, EIT
    Malicoat-Winslow Engineers, P.C.
    Columbia, MO


    know AutoCAD saves it but where? any idea?
     
    James Allen, Jan 15, 2005
    #5
  6. hamid2

    Joe Burke Guest

    James,

    Texbox doesn't work with mtext, text and attributes only.

    Joe Burke
     
    Joe Burke, Jan 15, 2005
    #6
  7. hamid2

    James Allen Guest

    Hmph! That's good to know. (Shows how much I've actually used it...)
    I don't see that documented; guess I just missed it. ;)

    James


     
    James Allen, Jan 19, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.