Creating a Mleader with MText in different position

Creating a Mleader with MText in different position

Anonymous
Not applicable
717 Views
3 Replies
Message 1 of 4

Creating a Mleader with MText in different position

Anonymous
Not applicable

Hello All,

 

I ´d like to know if there is any way to put the Mtext under the Landing Line of a MLeader. And if so How can I put it in a lisp.

 

I am criating a Lisp to get the coordinates and write them in a Mtext of a leader, but I need to put this text under the Landing Line and this landing line must have the lenght of the text.

 

Anyone could help me?

 

Thanks in advance

0 Likes
718 Views
3 Replies
Replies (3)
Message 2 of 4

ronjonp
Advisor
Advisor

Perhaps an mleaderstyle like attached with an overline on the text?

Message 3 of 4

Anonymous
Not applicable

Hello @Anonymous

Was it something like that?

(vl-load-com)
(defun c:Coo (/ arr aspc lead mtxt pt1 pt2 ptlst tstr)
  (if (and (setq pt1 (getpoint "\nEspecifique o local da coordenada: "))
           (setq ptlst (cons pt1 ptlst))
           (setq pt2 (getpoint pt1 "\nEspecifique o início do texto: "))
           (setq pt2 (list (car pt2) (cadr pt2) (caddr pt1)))
           (setq ptlst (cons pt2 ptlst))
      )
    (progn
      (or *adoc (setq *adoc (vla-get-activedocument (vlax-get-acad-object))))
      (setq aspc (vla-get-activeSpace *adoc)
            aspc (cond ((= aspc 1)
                        (vla-get-modelSpace *adoc)
                       )
                       ((= aspc 0)
                        (if (= (getvar "CVPORT") 1)
                          (vla-get-block (vla-get-activelayout *adoc))
                          (vla-get-modelSpace *adoc)
                        )
                       )
                 )
      )
      (vla-startundomark *adoc)
      (setq ptlst (reverse ptlst)
            tstr  (strcat (strcat "N: " (rtos (car pt1) 2 2))
                          (strcat "\\PE: " (rtos (cadr pt1) 2 2))
                          (strcat "\\PZ=" (rtos (caddr pt1) 2 4))
                  )
            mtxt  (vla-addmtext aspc (vlax-3d-point pt2) 0.0 tstr)
      )
      (vla-put-attachmentpoint mtxt acattachmentpointmiddleleft)
      (vla-put-height mtxt (getvar 'DIMTXT))
      (vla-put-insertionpoint mtxt (vlax-3d-point pt2))
      (setq ptlst (apply 'append ptlst)
            arr   (vlax-make-safearray vlax-vbdouble (cons 0 (- (length ptlst) 1)))
      )
      (vlax-safearray-fill arr ptlst)
      (setq lead (vla-addleader aspc (vlax-make-variant arr) mtxt aclinewitharrow))
      (vla-put-verticaltextposition lead acvertcentered)
      (vla-update lead)
      (vla-regen *adoc acactiveviewport)
      (vla-endundomark *adoc)
    )
  )
  (princ)
)
(prompt "\nType >>COO<<")

 

 

0 Likes
Message 4 of 4

pbejse
Mentor
Mentor

What is the format of the coordinates as MTEXT?

X,Y,Z

 

or

 

N: 

E:

Elev:

 

or

 

X

Y

Z

 

0 Likes