Eduardo Celiz Posted May 12, 2020 Share Posted May 12, 2020 Hello, I am trying to program this lisp but not that the dcl table keeps the data assigned in a first selection, I would like you to help me in correcting this in such a way that it does not return the dcl with the same values that are assigned by default, I hope you can help me. (defun c:TEST () (vl-load-com) ;INICIO DEL DCL (setq esca nil ly nil userclick nil esc nil lay nil flag 4) (setq esca (list "1:10" "1:20" "1:25" "1:50" "1:75" "1:100" "1:150" "1:200" "1:250" "1:500" "1:750" "1:1000" "1:1250" "1:2000" "1:2500" "1:5000")) (setq pres (list "0" "0.0" "0.00" "0.000" "0.0000" "0.00000" "0.000000")) (setq titulo "\"TEST\"") (setq dir (getvar "TEMPPREFIX")) (setq FichDlg (strcat dir "temGRi.dcl")) (setq openFile (open FichDlg "w")) (write-line "cambiapunto:dialog{" openFile) (write-line (strcat "label =" titulo";") openFile) (write-line " fixed_width = 30;" openFile) (write-line " alignment = centered;" openFile) (write-line ":boxed_column{" openFile) (write-line ":row{" openFile) (write-line ":column{" openFile) (write-line ":boxed_row{label= \"Ubicacion de Textos\";//Inica columna" openFile) (write-line " : radio_button {label = \"Lados Exter.\"; key = \"lados\";}" openFile) (write-line " : radio_button {label = \"Ejes Inter.\"; key = \"ejes\";}" openFile) (write-line " }" openFile) (write-line ":boxed_column{label= \"Opciones de Seleccion\";//Inica columna" openFile) (write-line " :column {" openFile) (write-line " :popup_list{label= \"&Escala: \" ;key = \"escala\" ;width=20;height=10;fixed_width = true;}" openFile) (write-line " :popup_list{label= \"&Presicion:\" ;key = \"presicion\" ;width=20;height=10;value=2;fixed_width = true;}" openFile) (write-line ":row{" openFile) (write-line " :button{label= \"&Seleccionar Vista\" ;key= \"seleccionar\" ;width=10;fixed_width=true;alignment = centered;}" openFile) (write-line " :button{label= \"&Aceptar\" ;key= \"aceptar\" ;width=10;fixed_width=true;alignment = centered;}" openFile) (write-line " }" openFile) (write-line " }" openFile) (write-line "}" openFile) (write-line "}" openFile) (write-line " }//Fin de Columna" openFile) (write-line " :boxed_row{" openFile) (write-line " :button{label= \"&Cerrar\" ;key = \"Cancel\" ;is_cancel=true;fixed_width=true;}" openFile) (write-line " }" openFile) (write-line " }" openFile) (write-line " }" openFile) (close openFile) (while (setq flag 4) ;;Carga el fichero de dialogo (setq dcl_id (load_dialog FichDlg)) (while (> flag 2) ;;cargar el cuadro de dialogo en pantalla (if (not (new_dialog "cambiapunto" dcl_id))(exit )) (start_list "escala") (mapcar 'add_list esca) (end_list) (start_list "presicion" 3) +(mapcar 'add_list pres) (end_list) (action_tile "escala" "(setq data_pl (get_tile \"escala\"))") (action_tile "lados" "(setq xy \"lad\")") (action_tile "ejes" "(setq xy \"eje\")") (action_tile "aceptar" ;if O.K. pressed "(done_dialog) (setq userclick T)" ;close dialog, set flag );action tile (action_tile "cancel" ;if cancel button pressed "(done_dialog) (setq userclick nil)" ;close dialog, lower flag );action_tile (action_tile "aceptar" (strcat "(progn (setq esc (nth (fix(atof (get_tile \"escala\"))) esca)) (setq pre (nth (fix(atof (get_tile \"presicion\"))) pres))" "(done_dialog) (setq userclick T) )";fin progn );fin strcat );fin action (action_tile "seleccionar" "(done_dialog 4)" ) (setq flag (start_dialog)) (if (= flag 4) (setq lte(car(entsel "Seleccionar Poligono: "))) ) );fin while dcl (unload_dialog dcl_id) (princ);FIN DEL DCL );fin while );fin defun Quote Link to comment Share on other sites More sharing options...
rlx Posted May 12, 2020 Share Posted May 12, 2020 maybe try to localize your variables? (defun c:TEST ( / esca ly userclick esc lay flag pres titulo dir FichDlg openFile) (vl-load-com) ;INICIO DEL DCL (setq esca nil ly nil userclick nil esc nil lay nil flag 4) (setq esca (list "1:10" "1:20" "1:25" "1:50" "1:75" "1:100" "1:150" "1:200" "1:250" "1:500" "1:750" "1:1000" "1:1250" "1:2000" "1:2500" "1:5000")) (setq pres (list "0" "0.0" "0.00" "0.000" "0.0000" "0.00000" "0.000000")) (setq titulo "\"TEST\"") (setq dir (getvar "TEMPPREFIX")) (setq FichDlg (strcat dir "temGRi.dcl")) (setq openFile (open FichDlg "w")) ..... Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 12, 2020 Share Posted May 12, 2020 You can set the default value of a tile so what you do is check if its nil and set to a start value . Download "Multi radio Buttons.lsp" from "Download" area it has an example of setting defaults. Quote Link to comment Share on other sites More sharing options...
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.