Jump to content

Add checkbox function together


taybac213

Recommended Posts

 

The above lisp has the function to draw mline and hatch for mline after exiting the command!

drawingmlineandhatch.jpg.5b4e1e293f398ec7c9c2b8466acb6fd1.jpg

 

 

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!

  

 

htmline.jpg.4dea858a17b2b888c5b316840443c9c3.jpg

 

 

 

 

 

 

Edited by taybac213
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Ok easier is use radio buttons, they have inbuilt only 1 can be selected on so have say 3 buttons 

image.png.4e8d50732981c94c9b5616255b375cf2.png

 

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.

  • Like 1
Link to comment
Share on other sites

"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 by taybac213
Link to comment
Share on other sites

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

 

  • Like 1
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by BIGAL
  • Like 1
Link to comment
Share on other sites

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