taybac213 Posted August 15, 2023 Posted August 15, 2023 (edited) vẽ mline anh hatch.mp4 The above lisp has the function to draw mline and hatch for mline after exiting the command! I want to add functionality: If the checkbox "Enable hatching" is clicked, when executing the command allows to draw mline and hatch. If the "Enable hatch" box is not checked, when executing the command, only draw the mline. As mline command is available in cad. We wish the help of everyone! Edited August 22, 2023 by taybac213 Quote
Steven P Posted August 15, 2023 Posted August 15, 2023 I use something like this for radio buttons: (action_tile "Radio_Name" "(setq A_Variable 0)(setq Another_Variable (A_Function))") For check boxes something like: (action_tile "Check_Box_Name" "(if (= (get_tile \"Check_Box_Name\") \"1\") (setq A_Variable 1) (setq A_Variable 0) )") Remembering to set for both states I think Then later in the code check the value of the variables to do what you want 1 Quote
taybac213 Posted August 15, 2023 Author Posted August 15, 2023 thanks you! Here is a lisp I collected. I don't know how to link when adding that function. Can you help me edit the code again? Quote
Steven P Posted August 15, 2023 Posted August 15, 2023 I'll look at this another time when I have word or something - the tabs in the file make reading the code quite tricky! 1 Quote
BIGAL Posted August 16, 2023 Posted August 16, 2023 Look at a Toggle button for Hatch on or off. 1 Quote
taybac213 Posted August 16, 2023 Author Posted August 16, 2023 I have tried. I try to adjust the code to add that functionality. But I don't have much experience, so all the test runs fail. Hope everyone's help. Quote
taybac213 Posted August 16, 2023 Author Posted August 16, 2023 That button will create 2 choices. Option 1: (Hach mline:end).When executing the command will draw the mline and hatch that mline. Option 2: (Hach mline:form).Copy the hatch pattern in the current drawing to hatch the mline. Quote
BIGAL Posted August 16, 2023 Posted August 16, 2023 Ok easier is use radio buttons, they have inbuilt only 1 can be selected on so have say 3 buttons Just a comment maybe use 2 columns so hatch stuff is in right hand column. Tidy up the dcl. If you post the dcl there are some people here that are very proficient in dcl's. 1 Quote
taybac213 Posted August 17, 2023 Author Posted August 17, 2023 (edited) Thanks!I will try it. If not please help! Edited August 17, 2023 by taybac213 Quote
taybac213 Posted August 17, 2023 Author Posted August 17, 2023 I tried, but due to inexperience, lisp doesn't launch. Looking forward to everyone's help. Thanks. Quote
taybac213 Posted August 19, 2023 Author Posted August 19, 2023 (edited) "MLStyle_Setting : dialog" "{" "initial_focus = \"Accept\";" "label = \"Setting mlines/Options hatch\";" "width = 45;" ": boxed_column { : column {" ": row {" ": text { label = \" Mline hatch\"; }" "}" ": row {" ": text { label = \"Layer\"; }" ": spacer { width = 7; }" ": popup_list { key = \"MLine_Layer\"; width = 22; }" "spacer_1;" ": popup_list { key = \"Hatch_Layer\"; width = 22; }" "spacer_1;" "}" ": row { : column { height = 5; fixed_height = true;" ": row {" ": text { key = \"MLStyle_Style\"; label = \"Style mline: \"; }" ": popup_list { key = \"MLStyles_List\"; edit_width = 20; list = \"Standard\"; value = \"0\"; allow_accept = true; }" "}" ": spacer { height = 0.01; }" ": row {" ": edit_box { label = \"Scanle mline: \"; key = \"Scale_Value\"; edit_width = 11; edit_limit = 12; value = \"\"; }" "}" ": spacer { height = 0.01; }" ": row {" " : column {" ": row {" ": popup_list { label = \"Osnap mline: \"; key = \"Justification_Value\"; edit_width = 10; list = \"\\nTop \\nCenter \\nBottom\"; value = \"\"; }" "}" ": spacer { height = 0.01; }" ": row {" ": toggle { label = \" Closed mline\"; key = \"Mline_Closed\"; value = \"0\";}}}}" "}" ": boxed_column { width = 24;" ": image_button { key = \"Mline_Preview\"; is_tab_stop = false; color = black; height = 4.7; fixed_height = true;}" "spacer_1;" "}" "}" "spacer_1;" ": row {" ": text { key = \"Hatch_Selection\"; label = \"Hatch mline:end\"; fixed_width = true; width = 28; }" ": button { key = \"Hatch_Selection_Button\"; label = \"Option hatch\"; fixed_width = true; width = 1; height = 1; }" "spacer_0;" ; ": toggle { label = \" Enable hatch\"; key = \"enable\"; value = \"0\";}" "spacer_1;" "}" ": spacer { height = 0.01; }" "}" ": row { height = 3.5;" ": spacer { height = 2; width = 2; }" ": button { key = \"Accept\"; label = \"Ok\"; fixed_width = true; width = 10; height = 2; }" ": button { key = \"Cancel\"; label = \"Cancel\"; fixed_width = true; width = 10; height = 2; is_cancel = true; }" ": spacer { width = 1.5; }" "}" "errtile;" "}" dcl built into the lisp I posted Edited August 22, 2023 by taybac213 Quote
Steven P Posted August 19, 2023 Posted August 19, 2023 Not sure I like your formatting - personal preference but I don't like scrolling left to right... See below, replaced a lot of tabs with spaces and I find it easier to read. Also split up lines that contained for example "{row {column" What is it telling you when it doesn't launch or do anything? Are there any error messages? No error messages and the LISP is doing as you ask it to so there is another problem. Looking at re-fomatted DCL code, below, I have 2 spaces indenting for each { and back 2 spaces for each closing } . If there are matching pairs of { } then the last } should be indented 2 spaces in.... which it isn't - I think you have missed closing a column and boxed column? I find it helps to note what each closing bracket is for - just to to help me work it all out "MLStyle_Setting : dialog" "{" "initial_focus = \"Accept\";" "label = \"Setting mlines/Options hatch\";" "width = 45;" ": boxed_column {" " : column {" ": row {" ": text { label = \"Mline hatch\"; }" "}" ; end row ": row {" ": text { label = \"Layer\"; }" ": spacer { width = 7; }" ": popup_list { key = \"MLine_Layer\"; width = 22; }" "spacer_1;" ": popup_list { key = \"Hatch_Layer\"; width = 22; }" "spacer_1;" "}" ; end row ": row {" ": column { height = 5; fixed_height = true;" ": row {" ": text { key = \"MLStyle_Style\"; label = \"Style mline: \"; }" ": popup_list { key = \"MLStyles_List\"; edit_width = 20; list = \"Standard\"; value = \"0\"; allow_accept = true; }" "}" ; end row ": spacer { height = 0.01; }" ": row {" ": edit_box { label = \"Scanle mline: \"; key = \"Scale_Value\"; edit_width = 11; edit_limit = 12; value = \"\"; }" "}" ; end row ": spacer { height = 0.01; }" ": row {" " : column {" ": row {" ": popup_list { label = \"Osnap mline: \"; key = \"Justification_Value\"; edit_width = 10; list = \"\\nTop \\nCenter \\nBottom\"; value = \"\"; }" "}" ; end row ": spacer { height = 0.01; }" ": row {" ": toggle { label = \" Closed mline\"; key = \"Mline_Closed\"; value = \"0\";}}}}" "}" ; end row ": boxed_column { width = 24;" ": image_button { key = \"Mline_Preview\"; is_tab_stop = false; color = black; height = 4.7; fixed_height = true;}" "spacer_1;" "}" ; end boxed column "}" ; end row "spacer_1;" ": row {" ": text { key = \"Hatch_Selection\"; label = \"Hatch mline:end\"; fixed_width = true; width = 28; }" ": button { key = \"Hatch_Selection_Button\"; label = \"Option hatch\"; fixed_width = true; width = 1; height = 1; }" "spacer_0;" ; ": toggle { label = \" Enable hatch\"; key = \"enable\"; value = \"0\";}" "spacer_1;" "}" ; end row ": spacer { height = 0.01; }" "}" ; end row ": row { height = 3.5;" ": spacer { height = 2; width = 2; }" ": button { key = \"Accept\"; label = \"Ok\"; fixed_width = true; width = 10; height = 2; }" ": button { key = \"Cancel\"; label = \"Cancel\"; fixed_width = true; width = 10; height = 2; is_cancel = true; }" ": spacer { width = 1.5; }" "}" ; end row "errtile;" "}" ; end row 1 Quote
taybac213 Posted August 19, 2023 Author Posted August 19, 2023 Can you help me add a function button like I have shown? Something like @BIGAL said. Quote
Steven P Posted August 19, 2023 Posted August 19, 2023 Will get it working first work out why it isn't doing anything just now and then add buttons later. Did you have a look and see where there missing }s should go and a bit more detail about what happens when you run the LISP - error messages, nothing, or whatever? Quote
taybac213 Posted August 19, 2023 Author Posted August 19, 2023 Have you tried running the lisp? This is the lisp I was looking for. It still works Quote
taybac213 Posted August 19, 2023 Author Posted August 19, 2023 I just want to add functionality to it. Quote
BIGAL Posted August 19, 2023 Posted August 19, 2023 (edited) Multi radio buttons.lspThe radio button dcl was made using Multi radio buttons a library routine for any code change (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (setq fo (open (setq fname "C:\\yourdiredtory\\filename.dcl")) "w")) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (setq ans (ah:butts 1 "h" '("Please choose " "No Hatch" "hatch+end" "Hatch" ))) ; ans holds the button picked value You can open the dcl created. Edited August 19, 2023 by BIGAL 1 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.