Jump to content

text/mtext to mleader without first point selection


Recommended Posts

Posted
(defun c:am (/ newleader pt1 pt2 ss txt x w rjp-getbbwdth)
 (vl-load-com)
 (defun rjp-getbbwdth (obj / out ll ur)
   (vla-getboundingbox obj 'll 'ur)
   (setq out (mapcar 'vlax-safearray->list (list ll ur)))
   (distance (car out) (list (caadr out) (cadar out)))
 )
 (if (setq ss (ssget '((0 . "*TEXT"))))
   (progn (setq txt (apply
	       'strcat
	       (mapcar
		 'cdr
		 (vl-sort
		   (mapcar '(lambda (x)
			      (cons (vlax-get x 'insertionpoint)
				    (strcat (vlax-get x 'textstring) " ")
			      )
			    )
			   (setq
			     ss	(mapcar
				  'vlax-ename->vla-object
				  (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
				)
			   )
		   )
		   (function (lambda (y1 y2) (< (cadr (car y2)) (cadr (car y1))))
		   )
		 )
	       )
	     )
	 w   (car (vl-sort (mapcar 'rjp-getbbwdth ss) '>))
	 txt (apply 'strcat
		    (mapcar 'chr (reverse (cdr (reverse (vl-string->list txt)))))
	     )
   )
   (mapcar 'vla-delete ss)
   )
 )
 (if (and (setq pt1 (getpoint "\nSpecify leader arrowhead location: "))
   (setq pt2 (getpoint pt1 "\nSpecify landing location: "))
     )
   (progn (command "._MLEADER" pt1 pt2 "")
   (setq newleader (vlax-ename->vla-object (entlast)))
   (vla-put-textstring newleader txt)
   (vla-put-textwidth newleader w)
   )
 )
 (princ)
)

so there is a code that takes text / mtext and turns it into mleader. I want Lisp to take the first point automatically from the  mtext(I have shown in the screenshot below), and I want to specify the second point myself.

ronjonp didn't reply to my messages so I had to start a new thread. I myself have been trying to study the code for 2 weeks now, my thoughts are that it is necessary to somehow replace "pt1" in this code, but I don’t know how and with what.

121632850_.thumb.png.2bbe3eacc3021ef2b432c475d2841215.png

  • 1 year later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...