joemcanciller Posted September 10, 2018 Posted September 10, 2018 Hi guys. Im new with this lisp thing. Is it possible to create mleader with default text using lisp? For example, I want the text to be "Aluminum" without typing in CAD. Im stucked with this code. It allows me to create the leader only without the text. Thanks in advance. (defun c:xm () (setvar 'CMDECHO 0) (command "-layer" "m" "text" "c" "4" "" "" "cmleaderstyle" "standard") (setvar 'CMDECHO 1) (initcommandversion) (command ".mleader") (while (> (getvar 'cmdactive) 0) (command pause) ) (princ) )[/CODE] Quote
SLW210 Posted September 10, 2018 Posted September 10, 2018 Please read the [URL="http://www.cadtutor.net/forum/showthread.php?t=9184"]Code Posting Guidelines and have your Code to be included in Code Tags. 1 Quote
dlanorh Posted September 10, 2018 Posted September 10, 2018 (edited) (defun c:mla ( / ml_txt) (setq ml_txt "Aluminium") (command "_mleader" pause pause ml_txt) );end_defun Welcome to CADTutor. This should do it. This is for a straight 2 point multileader. If your mleader is more than a straight line then add extra pauses. eg: (defun c:mla ( / ml_txt) (setq ml_txt "Aluminium") (command "_mleader" pause pause pause ml_txt) );end_defun The pause allows you to select a point as per the mleader command. You will need to set the required multi-leader style before typing "mla" to start. Edited September 10, 2018 by dlanorh 1 Quote
joemcanciller Posted September 11, 2018 Author Posted September 11, 2018 13 hours ago, SLW210 said: Please read the [URL="http://www.cadtutor.net/forum/showthread.php?t=9184"]Code Posting Guidelines[/URL] and have your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE][/CODE] = [CODE]Your Code Here[/CODE] Thanks for the reminder. Ill do better next time. :) Quote
joemcanciller Posted September 11, 2018 Author Posted September 11, 2018 (edited) 13 hours ago, dlanorh said: (defun c:mla ( / ml_txt) (setq ml_txt "Aluminium") (command "_mleader" pause pause ml_txt) );end_defun Welcome to CADTutor. This should do it. This is for a straight 2 point multileader. If your mleader is more than a straight line then add extra pauses. eg: (defun c:mla ( / ml_txt) (setq ml_txt "Aluminium") (command "_mleader" pause pause pause ml_txt) );end_defun The pause allows you to select a point as per the mleader command. You will need to set the required multi-leader style before typing "mla" to start. Thaaaanks!. It helps me alot! Edited September 11, 2018 by joemcanciller Quote
dlanorh Posted September 11, 2018 Posted September 11, 2018 4 hours ago, joemcanciller said: Thaaaanks!. It helps me alot! Your welcome. Quote
joemcanciller Posted September 13, 2018 Author Posted September 13, 2018 On 11/09/2018 at 14:17, dlanorh said: Your welcome. Hello again, Im thinking something with your code. Is it possible to have a drop down list in the text? Like selecting text to display from the list of texts, so that I can work with only one command "c:mla" then select text to display for example. Thanks in advance. :) Quote
dlanorh Posted September 13, 2018 Posted September 13, 2018 5 minutes ago, joemcanciller said: Hello again, Im thinking something with your code. Is it possible to have a drop down list in the text? Like selecting text to display from the list of texts, so that I can work with only one command "c:mla" then select text to display for example. Thanks in advance. It is quite easy and can be done using dynamic input/command line or via DCL. If there are more than 3-5 to select from then DCL is probably the better option. Quote
joemcanciller Posted September 13, 2018 Author Posted September 13, 2018 16 minutes ago, dlanorh said: It is quite easy and can be done using dynamic input/command line or via DCL. If there are more than 3-5 to select from then DCL is probably the better option. Is DCL same with LISP? I have no idea, sorry :( Can you set an example? Much appreciated man. Quote
joemcanciller Posted September 13, 2018 Author Posted September 13, 2018 2 hours ago, dlanorh said: It is quite easy and can be done using dynamic input/command line or via DCL. If there are more than 3-5 to select from then DCL is probably the better option. Thanks again! I did it! I discovered something new! :))) Quote
dlanorh Posted September 13, 2018 Posted September 13, 2018 (edited) 4 hours ago, joemcanciller said: Is DCL same with LISP? I have no idea, sorry Can you set an example? Much appreciated man. DCL is Dialog Control Language. If you know VBA it's akin to a form, only you have to construct it yourself if you want something more than basic. popup : dialog { label = "Popup List" ; : popup_list { label = "Choose Text : "; key = "selection"; value = "5" ; edit_width = 20; } ok_cancel ; } This is a DCL dialog, shamelessly stolen from the AfraLisp site and adapted. You can save it as a seperate file (*.DCL) or write it as a temp file from lisp. Once loaded you supply and fill the list and dictate what happens when OK or Cancel is pressed, and what happens when a selection is made from the list. You then display the dialog and wait for the user to interact. Edited September 13, 2018 by dlanorh 1 Quote
BIGAL Posted September 13, 2018 Posted September 13, 2018 (edited) Rather than writing a DCL for every program about picking from lists you use a library approach. I posted earlier today an example using lee-macs listboxV1-2.lsp. Edited September 13, 2018 by BIGAL 1 Quote
joemcanciller Posted September 19, 2018 Author Posted September 19, 2018 On 13/09/2018 at 17:54, dlanorh said: DCL is Dialog Control Language. If you know VBA it's akin to a form, only you have to construct it yourself if you want something more than basic. popup : dialog { label = "Popup List" ; : popup_list { label = "Choose Text : "; key = "selection"; value = "5" ; edit_width = 20; } ok_cancel ; } This is a DCL dialog, shamelessly stolen from the AfraLisp site and adapted. You can save it as a seperate file (*.DCL) or write it as a temp file from lisp. Once loaded you supply and fill the list and dictate what happens when OK or Cancel is pressed, and what happens when a selection is made from the list. You then display the dialog and wait for the user to interact. Thanks for the help. This is what i've got. Im happy learning this thing. :) Quote
Romuald Ferreux Posted November 26, 2019 Posted November 26, 2019 Hi every body, I try to build the same thing but i have not undertand how can i defined the list and assign the value as a variable. Thank's a lot for you help Quote
BIGAL Posted November 27, 2019 Posted November 27, 2019 (edited) Here is an example this uses the approach of a library function that it loads the create dcl as required. Change last 2 numbers for width and height to suit Code ; code use (if (not AHlstbox)(load "Listbox-AH.lsp")) (setq ans (ahlstbox "Pick a number" (list "150" "200" "225" "250" "300" "375" "450" "600") 20 10))) ; ans is returned = item selected of the list (defun c:mla ( / ml_txt) (if (not AHlstbox)(load "Listbox-AH.lsp")) (setq ans (ahlstbox "Pick a number" (list "AL150" "AL200" "AL225" "AL250" "AL300" "AL375" "AL450" "AL600") 20 10))) (command "_mleader" pause pause pause ans) );end_defun Listbox-AH.lsp Edited November 27, 2019 by BIGAL Quote
Romuald Ferreux Posted November 27, 2019 Posted November 27, 2019 Hi Bigal, thx a lot for your help! The only Thing is the selected value in the pickbox works but the mleader function is not loaded Quote
BIGAL Posted November 28, 2019 Posted November 28, 2019 Romuald that's your task put the two together Quote
DATVO Posted October 20, 2023 Posted October 20, 2023 On 9/19/2018 at 12:41 PM, joemcanciller said: Thanks for the help. This is what i've got. Im happy learning this thing. Hi, i'm new with lisp program. Could you please post your lisp code ? Quote
BIGAL Posted October 22, 2023 Posted October 22, 2023 (edited) This is an example of list box select. You may need to make the wdith bigger for above values. Listbox-AH.lsp Edited October 22, 2023 by BIGAL Quote
DATVO Posted October 22, 2023 Posted October 22, 2023 11 hours ago, BIGAL said: This is an example of list box select. You may need to make the wdith bigger for above values. Listbox-AH.lsp 1.28 kB · 0 downloads Thanks so much for your help ! 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.