Jump to content

Learning to work with DCL - image / chose


CafeJr

Recommended Posts

You did not follow any of my replies to you in this thread at all .

 

There are lots of mistakes and needed codes to add to make it to work. why is that ?

Link to comment
Share on other sites

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • CafeJr

    22

  • Tharwat

    14

  • Lee Mac

    1

  • harleyfr3ak

    1

Top Posters In This Topic

Posted Images

You did not follow any of my replies to you in this thread at all .

 

There are lots of mistakes and needed codes to add to make it to work. why is that ?

 

I had wrote your previows code Tharwat!... But I did some changes only to test the items... to try to find the error... You can see that the defun showimage is there yet!...

 

I'm sure that there has a lot of mistakes... he he he... It is a work from a Beginner!...

 

I'll use this code to insert these blocks as a standard in electrical drawings!...

Link to comment
Share on other sites

Here is the main principle of writing the codes to toggle radio buttons with slide files so just continue with the rest of radio buttons as shown in the following example.

 

NOTE: Don't forget to localize the variable 'files' .

 

You have a few mistakes in the dcl file , so correct them as following :

 

is_enable = true ; [color=red]MUST BE[/color]  is_enabled = true ;
key = img;  [color=red]MUST BE[/color]  key = "img";

Edited by Tharwat
Link to comment
Share on other sites

Here I am posting alone :D , anyway try this complete one and let me know .

 

NOTE: Please arrange the name of files and add if any file name is missing to not in its correct place .

 

[ UNTESTED ]

 

(defun c:deti (/ dcl_id tipo bitola bitolas sobe desce userclick showimage files)
;;; Modified by Tharwat 28.06.2015	;;
 (if (and (< 0 (setq dcl_id (load_dialog "Deti.dcl")))
          (new_dialog "Deti" dcl_id)
          )
   (progn
     (defun showimage (file / a b)
       (start_image "img")
       (fill_image
         0
         0
         (setq a (dimx_tile "img"))
         (setq b (dimy_tile "img"))
         0
         )
       (slide_image 0 0 a b file)
       (end_image)
       )
     (setq bitola  "3/4\""
           bitolas '("1/2\"" "3/4\"" "1\"" "1.1/2\"" "2\"" "2.1/2\""
                     "3\"" "4\""
                     )
           sobe    0
           desce   0
           files   '("C:\\Lisp\\Desenvolvimento\\Slides\\slide-C.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-E.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-X.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-LB.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-LL.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-LR.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-T.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide-BR.sld"
                     "C:\\Lisp\\Desenvolvimento\\Slides\\slide.sld"
                     )
           )
     (start_image "im")
     (fill_image 0 0 (dimx_tile "im") (dimy_tile "im") 5)
     (end_image)
     (start_list "Bitolas")
     (mapcar 'add_list bitolas)
     (end_list)
     (showimage  "C:\\Lisp\\Desenvolvimento\\Slides\\slide-C.sld")
     (action_tile
       "rb1"
       "(setq tipo \"C\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1)(showimage (car files))"
       )
     (action_tile
       "rb2"
       "(setq tipo \"E\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1) (showimage (cadr files))"
       )
     (action_tile
       "rb3"
       "(setq tipo \"LB\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (caddr files))"
       )
     (action_tile
       "rb4"
       "(setq tipo \"LL\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0) (showimage (nth 3 files))"
       )
     (action_tile
       "rb5"
       "(setq tipo \"LR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (nth 4 files))"
       )
     (action_tile
       "rb6"
       "(setq tipo \"T\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (nth 5 files))"
       )
     (action_tile
       "rb7"
       "(setq tipo \"X\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1)(showimage (nth 6 files))"
       )
     (action_tile
       "rb8"
       "(setq tipo \"BR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (nth 7 files))"
       )
     (action_tile
       "rb9"
       "(setq tipo \"LUR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (nth 8 files))"
       )
     (action_tile "cancel" "(done_dialog)")
     (action_tile
       "accept"
       "(setq userclick t Sobe (atoi $value) Desce (atoi $value) Bitola (atof (get_tile \"Bitolas\"))) (done_dialog)"
       )
     (start_dialog)
     (unload_dialog dcl_id)
     )
   (if (< 0 dcl_id)
     (unload_dialog dcl_id)
     )
   )

 (if userclick
   (if (and (= desce 1) (= sobe 1))
     (alert "ERRO: Selecione apenas Sobe ou Desce!")
     (progn
       (setq bitola (nth (fix bitola) bitolas))
       (if (= sobe 1)
         (setq blockname (strcat tipo
                                 "-S"
                                 (if (= tipo "BR")
                                   " - Bucha de Redução Sobe"
                                   (if (= tipo "LUR")
                                     " - Luva de redução Sobe"
                                     " - Condulete"
                                     )
                                   )
                                 )
               )
         (if (= desce 1)
           (setq blockname (strcat tipo
                                   "-D"
                                   (if (= tipo "BR")
                                     " - Bucha de Redução Desce"
                                     (if (= tipo "LUR")
                                       " - Luva de redução Desce"
                                       " - Condulete"
                                       )
                                     )
                                   )
                 )
           (setq
             blockname (strcat
                         tipo
                         (if (= tipo "BR")
                           " - Bucha de redução"
                           (if (= tipo "LUR")
                             " - Luva de redução"
                             " - Condulete"
                             )
                           )
                         )
             )
           )
         )
       (command "_.-Insert"
                blockname
                "\\"
                1.
                1.
                0.
                (strcat tipo "-%%C" bitola)
                )
       )
     )
   )
 (princ)
 )

Link to comment
Share on other sites

Here I am posting alone :D , anyway try this complete one and let me know .

 

...

 

 

Tharwat!... I have no words to show you how I'm grateful to your support and help!... Sorry about delay to answer you, but I was so far from the computer this weekend!...

Link to comment
Share on other sites

Tharwat!... I have no words to show you how I'm grateful to your support and help!... Sorry about delay to answer you, but I was so far from the computer this weekend!...

Nice, you are most welcome :thumbsup:

 

Did you get it solved as you expected ?

Link to comment
Share on other sites

Here is the main principle of writing the codes to toggle radio buttons with slide files so just continue with the rest of radio buttons as shown in the following example.

 

NOTE: Don't forget to localize the variable 'files' .

 

You have a few mistakes in the dcl file , so correct them as following :

 

is_enable = true ; [color=red]MUST BE[/color]  is_enabled = true ;
key = img;  [color=red]MUST BE[/color]  key = "img";

 

Done!... ;) Thanks to your correction!...

Link to comment
Share on other sites

Hi,

 

What is the use of the two toggles Sobe and Desce ?

And also the popup_list ?

 

Only to answer you!...

 

The two toggles are to select a variation of some blocks, some of them could be to up (sobe) or down (desce), from the level where it is inserted the block.

 

The popup_lis is only a way to represent the diameter that shall to be filled the attribute field property.

Link to comment
Share on other sites

Nice, you are most welcome :thumbsup:

 

Did you get it solved as you expected ?

 

Yes, I'm studying the code right now to try to learn something there!... He he he... The images are now working!... The code are running until to the check toggles (up and down) and stop!... I'm trying to fix it!... He he he...

 

:notworthy:

Edited by CafeJr
Link to comment
Share on other sites

Yes, I'm studying the code right now to try to learn something there!... He he he... The images are now working!... The code are running until to the check toggles (up and down) and stop!... I'm trying to fix it!... He he he...

 

:notworthy:

 

Just feel free to ask if you have any question. :)

Link to comment
Share on other sites

Just feel free to ask if you have any question. :)

 

Tharwat,

 

The first objective from this Thread was to learn how work with radio_button and image linking it! I got it!... Thanks again!...

 

About the code, I'm debugging it and (I don't know why) after the OK (accept) the variables Sobe and Desce it is filled up with 1, has no where to the code write it!...

 

I was using:

  (action_tile "tog1" "(setq Sobe (atoi $value))")
 (action_tile "tog2" "(setq Desce (atoi $value))")

 

You changed it to:

(action_tile
       "accept"
       "(setq userclick t Sobe (atoi $value) Desce (atoi $value) Bitola (atof (get_tile \"Bitolas\"))) (done_dialog)"
       )

 

I change it back and now it works...

Link to comment
Share on other sites

(action_tile
       "accept"
       "(setq userclick t Sobe (atoi $value) Desce (atoi $value) Bitola (atof (get_tile \"Bitolas\"))) (done_dialog)"
       )

I change it back and now it works...

 

Replace my above modification to the following and try again.

 

(action_tile "accept" "(setq userclick t Sobe (atoi (get_tile \"tog1\")) Desce (atoi (get_tile \"tog2\")) Bitola (atof (get_tile \"Bitolas\"))) (done_dialog)")

Link to comment
Share on other sites

Thanks again to your support!... :thumbsup:

 

Good , so there is no need to include the action tiles for the two toggles in the program.

 

Hope you pay a little bit more attention to my name next time. :)

Link to comment
Share on other sites

Good , so there is no need to include the action tiles for the two toggles in the program.

 

Hope you pay a little bit more attention to my name next time. :)

 

Opsss... Sorry... Typing too fast to thank you, Fixed!!!...

Link to comment
Share on other sites

I did some changes.

 

Update:

(vl-load-com)
(defun c:deti (/	 dcl_id	   tipo	     bitola    bitolas
       Sobe	 Desce	   userclick showimage files Path
      )
;;; Modified by Tharwat 28.06.2015	;;
 (if (and (< 0 (setq dcl_id (load_dialog "Deti.dcl")))
   (new_dialog "Deti" dcl_id)
     )
   (progn
     (defun showimage (file / a b)
(start_image "img")
(fill_image
  0
  0
  (setq a (dimx_tile "img"))
  (setq b (dimy_tile "img"))
  0
)
(slide_image 0 0 a b file)
(end_image)
     )
     (setq bitola  "3/4\""
    bitolas '("1/2\""	 "3/4\""    "1\""      "1.1/2\""
	      "2\""	 "2.1/2\""  "3\""      "4\""
	     )
    Sobe    0
    Desce   0
    Path "C:\\************"
    files   '("slide-C.sld"	;0
	      "slide-E.sld"	;1
	      "slide-X.sld"	;2
	      "slide-LB.sld"	;3
	      "slide-LL.sld"	;4
	      "slide-LR.sld"	;5
	      "slide-T.sld"	;6
	      "slide-BR.sld"	;7
	      "slide-LUR.sld"	;8
	      "slide-LBS.sld" 	;9
	      "slide-LBD.sld" 	;10
	      "slide-LLS.sld" 	;11
	      "slide-LLD.sld" 	;12
	      "slide-LRS.sld" 	;13
	      "slide-LRD.sld" 	;14
	      "slide-TS.sld"  	;15
	      "slide-TD.sld"  	;16
	      "slide-BRS.sld" 	;17
	      "slide-BRD.sld" 	;18
	      "slide-LURS.sld"	;19
	      "slide-LURD.sld"	;20
	     )
     )
     (set_tile "rb1" "1")
     (start_image "im")
     (fill_image 0 0 (dimx_tile "im") (dimy_tile "im") 5)
     (end_image)
     (start_list "Bitolas")
     (mapcar 'add_list bitolas)
     (end_list)
     (showimage (strcat Path
"slide-C.sld")
     )
     (action_tile
"rb1"
"(setq tipo \"C\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1)(showimage (strcat Path (car files)))"
     )
     (action_tile
"rb2"
"(setq tipo \"E\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1) (showimage (strcat Path (cadr files)))"
     )
     (action_tile
"rb3"
"(setq tipo \"X\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1)(showimage (strcat Path (caddr files)))"
     )
     (action_tile
"rb4"
"(setq tipo \"LB\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)  (showimage (strcat Path (nth 3 files)))"
     )
     (action_tile
"rb5"
"(setq tipo \"LL\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0) (showimage (strcat Path (nth 4 files)))"
     )
     (action_tile
"rb6"
"(setq tipo \"LR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (strcat Path (nth 5 files)))"
     )
     (action_tile
"rb7"
"(setq tipo \"T\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (strcat Path (nth 6 files)))"
     )
     (action_tile
"rb8"
"(setq tipo \"BR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (strcat Path (nth 7 files)))"
     )
     (action_tile
"rb9"
"(setq tipo \"LUR\")(mode_tile \"tog1\" 0)(mode_tile \"tog2\" 0)(showimage (strcat Path (nth 8 files)))"
     )
     (action_tile
"tog1"
"(set_tile \"tog2\" \"0\")(showimage (strcat Path (if (= (atoi (get_tile \"rb4\")) 1)(nth 9 files)
				(if (= (atoi (get_tile \"rb5\")) 1)(nth 11 files)
				(if (= (atoi (get_tile \"rb6\")) 1)(nth 13 files)
				(if (= (atoi (get_tile \"rb7\")) 1)(nth 15 files)
				(if (= (atoi (get_tile \"rb8\")) 1)(nth 17 files)
				(if (= (atoi (get_tile \"rb9\")) 1)(nth 19 files)
				)
				)
				)
				)
				)
			)
		)
	)"
)
     (action_tile
"tog2"
"(set_tile \"tog1\" \"0\")(showimage (strcat Path (if (= (atoi (get_tile \"rb4\")) 1)(nth 10 files)
				(if (= (atoi (get_tile \"rb5\")) 1)(nth 12 files)
				(if (= (atoi (get_tile \"rb6\")) 1)(nth 14 files)
				(if (= (atoi (get_tile \"rb7\")) 1)(nth 16 files)
				(if (= (atoi (get_tile \"rb8\")) 1)(nth 18 files)
				(if (= (atoi (get_tile \"rb9\")) 1)(nth 20 files)
				)
				)
				)
				)
				)
			)
		)
	)"
)
     (action_tile "cancel" "(done_dialog)")
     (action_tile
"accept"
"(setq userclick t Sobe (atoi (get_tile \"tog1\")) Desce (atoi (get_tile \"tog2\")) Bitola (atof (get_tile \"Bitolas\"))) (done_dialog)"
     )
     (start_dialog) 
     (unload_dialog dcl_id)
   )
   (if	(< 0 dcl_id)
     (unload_dialog dcl_id)
   )
 )

 (if userclick
   (if	(and (= desce 1) (= sobe 1))
     (alert "ERRO: Selecione apenas Sobe ou Desce!")
     (progn
(setq bitola (nth (fix bitola) bitolas))
(if (= sobe 1)
  (setq	blockname (strcat tipo
			  "-S"
			  (if (= tipo "BR")
			    " - Bucha de Redução Sobe"
			    (if	(= tipo "LUR")
			      " - Luva de redução Sobe"
			      " - Condulete"
			    )
			  )
		  )
  )
  (if (= desce 1)
    (setq blockname (strcat tipo
			    "-D"
			    (if	(= tipo "BR")
			      " - Bucha de Redução Desce"
			      (if (= tipo "LUR")
				" - Luva de redução Desce"
				" - Condulete"
			      )
			    )
		    )
    )
    (setq
      blockname	(strcat
		  tipo
		  (if (= tipo "BR")
		    " - Bucha de redução"
		    (if	(= tipo "LUR")
		      " - Luva de redução"
		      " - Condulete"
		    )
		  )
		)
    )
  )
)
(command "_.-Insert"
	 blockname
	 "\\"
	 1.
	 1.
	 0.
	 (strcat tipo "-%%C" bitola)
)
     )
   )
 )
 (princ)
)

 

DCL:

Deti	: dialog { 					  //dialog name
		label = "Detalhamento de instalação"	; //give it a label
	: row { 					  //*define row
	:boxed_radio_column { 				  //define radio column
		label = "Ti&po:"			; //give it a label
	: radio_button { 				  //define radion button
	key = "rb1" 				; //give it a name
		label = "&C" 				; //give it a label
		value = "1" 				; //switch it on
	is_enabled = true ;
	} 					  //end definition
	: radio_button { 				  //define radio button
		key = "rb2" 				; //give it a name
		label = "&E" 				; //give it a label
		} 					  //end definition
: radio_button { 				  //define radion button
		key = "rb3" 				; //give it a name
		label = "&X" 				; //give it a label
		} 					  //end definition
	: radio_button { 				  //define radio button
		key = "rb4" 				; //give it a name
		label = "L&B" 				; //give it a label
		} 					  //end definition
	: radio_button { 				  //define radio button
		key = "rb5" 				; //give it a name
		label = "L&L" 				; //give it a label
		} 					  //end definition
	: radio_button { 				  //define radio button
		key = "rb6" 				; //give it a name
		label = "L&R" 				; //give it a label
		}					  //end definition
	: radio_button { 				  //define radion button
		key = "rb7" 				; //give it a name
		label = "&T" 				; //give it a label
		} 					  //end definition
: radio_button { 				  //define radion button
		key = "rb8" 				; //give it a name
		label = "BR" 				; //give it a label
		} 					  //end definition
: radio_button { 				  //define radion button
		key = "rb9" 				; //give it a name
		label = "LUR" 				; //give it a label
		} 					  //end definition
: boxed_row {					
	label = "Sobe / Desce"			;
:toggle {					
	alignment = centered			;
	label = "&Sobe"				;
	key = "tog1"				;
	value = "0"				;
}
	:toggle {
	alignment = centered			;
	label = "&Desce"			;
	key = "tog2"				;
	value = "0"				;
	}
}
	} 						  //end radio column
	: boxed_column { 				  //*define boxed column
		label = "Bitol&a"			; //*give it a label
	: popup_list { 					  //*define popup list
	alignment = centered;
	key = "Bitolas"				; //*give it a name
		value = "1" 				; //*initial value
		} 					  //*end list 


:image {height = 3; width = 0;aspect_ratio=0.8;color=0;fixed_height=true;key = "img";}
	
}	 					  //*end boxed column


	}  						  //*end row
	
	ok_cancel 					; //predifined OK/Cancel
	: row { 					  //define row
	: image { 					  //define image tile
	key = "im" 				; //give it a name
		height = 1.0 				; //and a height
		width = 2.0 				; //and now a width
		} 					  //end image
	: paragraph { 					  //define paragraph
	: text_part { 					  //define text
		label = "Elaborado por:"		; //give it some text
	} 					  //end text
	: text_part { 					  //define more text
		label = "José Roberto dos Santos Junior."; //some more text - Credits to Kenny Ramage
		} 					  //end text
		} 					  //end paragraph
      		} 					  //end row

	}						  //end dialog

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