kathir Posted June 14 Posted June 14 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 Quote
SLW210 Posted June 14 Posted June 14 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.  Quote
CyberAngel Posted June 18 Posted June 18 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. Quote
ronjonp Posted June 18 Posted June 18 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) ) Â Quote
DATVO Posted 5 hours ago Posted 5 hours ago (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) ) Edited 5 hours ago by DATVO 1 Quote
Tharwat Posted 4 hours ago Posted 4 hours ago 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) ) 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. Quote
DATVO Posted 3 hours ago Posted 3 hours ago 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. Quote
Tharwat Posted 2 hours ago Posted 2 hours ago 1 hour ago, DATVO said:  The command will cancel. ... And the system variable would still remains you set it firstly. Right? Quote
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.