Jump to content

Recommended Posts

Posted

Hi all,

I have a lisp which get the X & Y coordinates with leader, text. But it would be very useful if the coordinates comes with MLEADER (Text/Arrow height - 2.5).

Please help me out here anyone

Posted

What LISP?

 

Get the X&Y coordinates of what?

 

Can you post a drawing? Preferably a before and after example and a list of the steps you take.

 

 

See if this recommendation works for you.   There are some LISPs in the thread as well.

 

Posted
On 6/14/2025 at 3:18 AM, kathir said:

Hi all,

I have a lisp which get the X & Y coordinates with leader, text. But it would be very useful if the coordinates comes with MLEADER (Text/Arrow height - 2.5).

Please help me out here anyone

Welcome to the forum!

 

If I understand your issue, you give the function a point, and it creates a leader to the point, along with a label with the coordinates. What you want now is a multileader instead of a plain leader.

 

I wrote a LISP function that creates a multileader. It's on the forum somewhere. Surely there are other versions. It's not as simple as calling a command, you have to define an entity. With that, it should be easy to insert the coordinates as the text.

Posted

Here's some old code to place an mleader with X Y coordinates. They do not automatically update if moved.

(defun c:lp (/ ml mle p1 p2)
  (if (and (setq p1 (getpoint "\nPick point to label: "))
	   (setq p2 (getpoint (setq p1 (trans p1 0 1)) "\nPick point to label: "))
      )
    (progn (command "._mleader" p1 (trans p2 0 1) "")
	   (setq ml (vlax-ename->vla-object (setq mle (entlast))))
	   (entmod (subst (cons 8 "northing_easting") (assoc 8 (entget mle)) (entget mle)))
	   (vla-put-textstring ml (strcat "E " (rtos (car p1) 2 2) "\\\PN " (rtos (cadr p1) 2 2)))
    )
  )
  (princ)
)

 

  • 1 month later...
Posted (edited)

Here's the code. I hope this helps you. The MLeader style follows your current style.

Looking for tools to speed up your workflow? Explore this resource: https://lispautocad.gumroad.com/l/eezilo

 

(defun C:DV_MLP (/ pt x y text)
  (vl-load-com)
  (setvar "CMDECHO" 0)
  (setq pt (getpoint "\nPick point: "))
  (if pt
    (progn
      (setq x (rtos (car pt) 2 3))   
      (setq y (rtos (cadr pt) 2 3))
      (setq text (strcat "(" x " ; " y ")"))
      (command "._MLEADER" pt pause text)
    )
    (princ "\nNo Point selected!")
  )
  (setvar "CMDECHO" 1)
  (princ)
)

spacer.png

Edited by DATVO
  • Like 1
Posted
45 minutes ago, DATVO said:

Here's the code. I hope this helps you. The MLeader style follows your current style.

Looking for tools to speed up your workflow? Explore this resource: https://lispautocad.gumroad.com/l/eezilo

 

(defun C:DV_MLP (/ pt x y text)
  (vl-load-com)
  (setvar "CMDECHO" 0)
  (setq pt (getpoint "\nPick point: "))
  (if pt
    (progn
      (setq x (rtos (car pt) 2 3))   
      (setq y (rtos (cadr pt) 2 3))
      (setq text (strcat "(" x " ; " y ")"))
      (command "._MLEADER" pt pause text)
    )
    (princ "\nNo Point selected!")
  )
  (setvar "CMDECHO" 1)
  (princ)
)

spacer.png

Good start.

A few points if you like:

- what would happen if a user pressed ESC while Mleader command is active?

- What's the need of function vl-load-com in your routine?

- You assumed that the system variable CMDECHO was set to 1 but it could be the contrary.

Posted
16 minutes ago, Tharwat said:

- You assumed that the system variable CMDECHO was set to 1 but it could be the contrary.

First, the code sets CMDECHO to 0 to prevent program from displaying commands like MLEADER or its interactions in the command line. This helps keep cleaner while the program runs. At the end of the program, the code resets CMDECHO to 1, which is AutoCAD's default setting.

 

20 minutes ago, Tharwat said:

 

- What's the need of function vl-load-com in your routine?

I copied my old file into this one, so I probably forgot to remove that line. But in this code, it's not necessary. 🤣

 

17 minutes ago, Tharwat said:

- what would happen if a user pressed ESC while Mleader command is active?

The command will cancel.

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...