乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 32|回复: 15

[编程交流] 如果..返回对话框。。需要hel

[复制链接]

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 11:34:45 | 显示全部楼层 |阅读模式
在下面的代码中,我有这个,如果喜欢的话
 
我想用返回Edit1框(如果为空)进行编译并在那里获得焦点的东西来替换“退出”。Edit1位于DCL对话框中。可能需要重新启动对话框。
 
 
 
  1. ;-------------start dialog------------
  2. (setq dcl_id (load_dialog "hello_sp.dcl")) ; Load the DCL file.
  3. (if (not (new_dialog "hello_sp" dcl_id))   ; Initialize the dialog.
  4.    (exit)                                ; Exit if this doesn't
  5.                                          ; work.
  6. )
  7. ;------------  set values in dialog box----
  8. (set_tile "discesa" (rtos a1 2 2))
  9. (set_tile "masetto1" (rtos a2 2 2))
  10. (set_tile "salita" (rtos miodist 2 2))
  11. (set_tile "tolleranza" (rtos tolleranza 2 2))
  12. (set_tile "orriz" (rtos d1 2 2))
  13. (set_tile "note_" "Ricordati bracci per il Q.E. e dorsali")
  14. (set_tile "grand_dist" (rtos tot2 2 2))
  15. (set_tile "grand_dist_" "GRAND TOTAL (SQ)")
  16.    
  17. (set_tile "Text1" "Numero Braccio")
  18. (set_tile "Edit1" "")
  19. (set_tile "Text2" "Diametro Tubo [*=25]")
  20. (set_tile "Edit2" "")
  21. (set_tile "Text3" "Tipo Linea")
  22. (set_tile "Edit3" "")
  23. ; Dialog Actions
  24. (action_tile "Edit1" "(setq Edit1 $value)")
  25. (action_tile "Edit2" "(setq Edit2 $value)")
  26. (action_tile "Edit3" "(setq Edit3 $value)")
  27. ;------------  end - set values in dialog box----
  28. (start_dialog)                          ; Display the dialog   ; box.
  29. (if (= Edit1 "")
  30.   (progn
  31.   (Alert "Campo No. braccio non puo essere vuoto")
  32.   (exit)))
  33.   
  34. (unload_dialog dcl_id)                  ; Unload the DCL file.
  35. (princ)
回复

使用道具 举报

2

主题

74

帖子

72

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 11:40:06 | 显示全部楼层
  1. (action_tile "Edit1"
  2. "(if (= (setq Edit1 $value) "")
  3.     (progn
  4.     (Alert "The field is empty")
  5.     (mode_tile "Edit1" 2)
  6.     )
  7. )"
  8. )
回复

使用道具 举报

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 11:44:36 | 显示全部楼层
我复制了你的代码
  1. (action_tile "Edit1"
  2. "(if (= (setq Edit1 $value) "")
  3.     (progn
  4.     (Alert "The field is empty")
  5.     (mode_tile "Edit1" 2)
  6.     )
  7. )"
  8. )
并更换
我在构建输出中得到了这个错误。
 
 
回复

使用道具 举报

2

主题

74

帖子

72

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 11:49:34 | 显示全部楼层
当然,因为你传递了一个斜杠,这是必要的,因为反逗号“被认为是字符串中的反逗号,字符串的一部分,而不是其末端
不要受斜杠和反逗号的影响,因为习惯性的格式是在action\u tile中写的,所以可以这样写
  1. (action_tile
  2. "Edit1"
  3. (vl-prin1-to-string
  4.    (quote
  5.      (if (= (setq Edit1 $value) "")
  6. (progn
  7.   (Alert "The field is empty")
  8.   (mode_tile "Edit1" 2)
  9. )
  10.      )
  11.    )
  12. )
  13. )

 
为了好,有必要在Ok上这样写
 
  1. (action_tile
  2. "accept"
  3. (vl-prin1-to-string
  4.    (quote
  5.      (if Edit1
  6. (done_dialog)
  7. (progn
  8.   (Alert "The field of Edit1 is empty")
  9.   (mode_tile "Edit1" 2)
  10. )
  11.      )
  12.    )
  13. )
  14. )
回复

使用道具 举报

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 11:51:40 | 显示全部楼层
我无法让它工作。“if”命令没有注意到edit1为空,程序正常运行。
 
我复制了以下代码:
然后像这样插入它:
 
  1. ;-------------start dialog------------
  2. (setq dcl_id (load_dialog "hello_sp.dcl")) ; Load the DCL file.
  3. (if (not (new_dialog "hello_sp" dcl_id))   ; Initialize the dialog.
  4.    (exit)                                ; Exit if this doesn't
  5.                                          ; work.
  6. )
  7. ;------------  set values in dialog box----
  8. (set_tile "discesa" (rtos a1 2 2))
  9. (set_tile "masetto1" (rtos a2 2 2))
  10. (set_tile "salita" (rtos miodist 2 2))
  11. (set_tile "tolleranza" (rtos tolleranza 2 2))
  12. (set_tile "orriz" (rtos d1 2 2))
  13. (set_tile "note_" "Ricordati bracci per il Q.E. e dorsali")
  14. (set_tile "grand_dist" (rtos tot2 2 2))
  15. (set_tile "grand_dist_" "GRAND TOTAL (SQ)")
  16.    
  17. (set_tile "Text1" "Numero Braccio")
  18. (set_tile "Edit1" "")
  19. (set_tile "Text2" "Diametro Tubo [*=25]")
  20. (set_tile "Edit2" "")
  21. (set_tile "Text3" "Tipo Linea")
  22. (set_tile "Edit3" "")
  23. ; Dialog Actions
  24. (action_tile "Edit1" "(setq Edit1 $value)")
  25. (action_tile "Edit2" "(setq Edit2 $value)")
  26. (action_tile "Edit3" "(setq Edit3 $value)")
  27. ;------------  end - set values in dialog box----
  28. (start_dialog)                          ; Display the dialog   ; box.
  29. [color=Red](action_tile
  30. "Edit1"
  31. (vl-prin1-to-string
  32.    (quote
  33.      (if (= (setq Edit1 $value) "")
  34.    (progn
  35.      (Alert "The field is empty")
  36.      (mode_tile "Edit1" 2)
  37.    )
  38.      )
  39.    )
  40. )[/color]
  41. [color=Red])
  42. [/color]   
  43. ;(if (= Edit1 "")
  44. ;  (progn
  45. ; (Alert "Campo No. braccio non puo essere vuoto")
  46.   ;(exit)))
  47.   
  48. (unload_dialog dcl_id)                  ; Unload the DCL file.
  49. (princ)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:55:37 | 显示全部楼层
我想:
 
  1. (action_tile "Edit1"
  2. (vl-prin1-to-string
  3.    (quote
  4.      (progn
  5.        (if (= (setq Edit1 $value) "")
  6.          (progn
  7.            (Alert "The field is empty") (mode_tile "Edit1" 2)))))))
回复

使用道具 举报

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 12:00:22 | 显示全部楼层
李,我把你的代码放在下面,但“如果”没有“注意”Edit1框是空的。
 
只是想让您知道,您的代码被插入到“开始”对话框和“卸载”对话框命令之间。(我也尝试在开始对话框之前插入)
 
 
这样地:
 
  1. (setq dcl_id (load_dialog "hello_sp.dcl")) ; Load the DCL file.
  2. (if (not (new_dialog "hello_sp" dcl_id))   ; Initialize the dialog.
  3. (exit)                                ; Exit if this doesn't
  4.                                          ; work.
  5. )
  6. ;------------  set values in dialog box----
  7. (set_tile "discesa" (rtos a1 2 2))
  8. (set_tile "masetto1" (rtos a2 2 2))
  9. (set_tile "salita" (rtos miodist 2 2))
  10. (set_tile "tolleranza" (rtos tolleranza 2 2))
  11. (set_tile "orriz" (rtos d1 2 2))
  12. (set_tile "note_" "Ricordati bracci per il Q.E. e dorsali")
  13. (set_tile "grand_dist" (rtos tot2 2 2))
  14. (set_tile "grand_dist_" "GRAND TOTAL (SQ)")
  15. (set_tile "Text1" "Numero Braccio")
  16. (set_tile "Edit1" "")
  17. (set_tile "Text2" "Diametro Tubo [*=25]")
  18. (set_tile "Edit2" "")
  19. (set_tile "Text3" "Tipo Linea")
  20. (set_tile "Edit3" "")
  21. ; Dialog Actions
  22. (action_tile "Edit1" "(setq Edit1 $value)")
  23. (action_tile "Edit2" "(setq Edit2 $value)")
  24. (action_tile "Edit3" "(setq Edit3 $value)")
  25. ;------------  end - set values in dialog box----
  26. (start_dialog)  ; Display the dialog box.
  27. [color=Red](action_tile "Edit1"
  28. (vl-prin1-to-string
  29.    (quote
  30.      (progn
  31.        (if (= (setq Edit1 $value) "")
  32.          (progn
  33.            (Alert "The field is empty") (mode_tile "Edit1" 2)))))))[/color]
  34. ;(if (= Edit1 "")
  35. ;(progn
  36. ;(Alert "Campo No. braccio non puo essere vuoto")
  37. ;(exit)))
  38. (unload_dialog dcl_id)                  ; Unload the DCL file.
  39. (princ)
  40. ;(setq lay "RH MEASURE Layer" );- writes total value to drawing Layer
  41. ;(alert "Inserisci NUMERO BRACCIO /
  42. [*] DIA.TUBO 25 - TIPO LINEA ")
  43. ;(setq braccio (getstring "\nInserisci NUMERO BRACCIO /
  44. [*] DIA.TUBO 25 - TIPO LINEA  :"))  
  45. (and (setq pnt (getpoint "\nPunto di inserimento misura / Specify Text placement point: "))
  46.     (entmakex (list '(0 . "MTEXT")
  47.                     '(100 . "AcDbEntity")
  48.                     '(100 . "AcDbMText")
  49.              ;(cons 8 lay)
  50.                      (cons 1 (strcat "(" Edit1 Edit2 ")" (rtos tot2 2 2) Edit3))
  51.              (cons 7 (getvar 'textstyle))
  52.                      (cons 10 pnt)
  53.              (cons 40 0.08)
  54.               ) ;_ list
  55.     ) ;_ entmakex
  56. ) ;_ and
  57. ;------------------------
  58. )
  59. (princ "\nType sq to run Grand Distance(sq)")
  60. (princ)
回复

使用道具 举报

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 12:03:15 | 显示全部楼层
当我使用它时,它是存在的。
 
  1. (if (= Edit1 "")
  2.   (progn
  3.   (Alert "Campo R non puo essere vuoto")
  4.   (exit)
  5. ))
回复

使用道具 举报

2

主题

74

帖子

72

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:07:10 | 显示全部楼层
sadhu,完全显示DCL和LISP
回复

使用道具 举报

34

主题

123

帖子

90

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
175
发表于 2022-7-6 12:09:41 | 显示全部楼层
 
 
dcl:
  1. hello_sp : dialog {
  2.    
  3.    label = "Sadhu says";
  4.    //first box - ** srl
  5.    : boxed_column {
  6.    label = "** srl";
  7.        //second box - Dati di base
  8.       
  9. //start  line 1
  10. : boxed_column {
  11.    label = "Dati di base";
  12. : row {
  13.    : column {
  14.      width = 10;
  15.      fixed_width = true;
  16.      
  17.      : text {
  18.        key = "discesa_";
  19.        label = "Discesa         ";//
  20.      }
  21.    }
  22.    : text {
  23.        key = "discesa";
  24.        label = "Sanjay";//Prompt from lsp file
  25.       
  26.        width = 18;
  27.    fixed_width_font = true;
  28.    
  29.      }
  30.     }
  31.    
  32. //spacer;
  33. //end line 1
  34. //start  line 1 bis
  35. : row {
  36.    : column {
  37.      width = 10;
  38.      fixed_width = true;
  39.      
  40.      : text {
  41.        key = "tolleranza_";
  42.        label = "Tolleranza     ";//
  43.      }
  44.    }
  45.    : text {
  46.        key = "tolleranza";
  47.        label = "San";//Prompt from lsp file
  48.       
  49.        width = 18;
  50.    fixed_width_font = true;
  51.    
  52.      }
  53.     }
  54.    
  55. //spacer;
  56. //end line 1 bis
  57. //start  line 2
  58. : row {
  59.    : column {
  60.      width = 10;
  61.      fixed_width = true;
  62.      
  63.      : text {
  64.        key = "masetto1_";
  65.        label = "Masetto_1      ";//Prompt from lsp file
  66.      }
  67.    }
  68.    : text {
  69.        key = "masetto1";
  70.        label = "jay";//Prompt from lsp file
  71.       
  72.        width = 18;
  73.    fixed_width_font = true;
  74.    
  75.      }
  76.     }//end line 2
  77.     } //second box - Dati di base
  78. //spacer;
  79. //third box - dati inseriti
  80.   
  81.    : boxed_column {
  82.        label = "Dati inseriti";
  83.         //start salita inserita
  84. : row {
  85.    : column {
  86.      width = 10;
  87.      fixed_width = true;
  88.      
  89.      : text {
  90.        key = "Salita_";
  91.        label = "Salit�* Inserita";//Prompt from lsp file
  92.      }
  93.    }
  94.    : text {
  95.        key = "salita";
  96.        label = "";//Prompt from lsp file
  97.       
  98.        width = 18;
  99.    fixed_width_font = true;
  100.    
  101.      }
  102.     } //end salita inserita
  103.      //start distanza orrizontale
  104. : row {
  105.    : column {
  106.      width = 10;
  107.      fixed_width = true;
  108.      
  109.      : text {
  110.        key = "orriz_";
  111.        label = "Dist Orrizon.  ";//Prompt from lsp file
  112.      }
  113.    }
  114.    : text {
  115.        key = "orriz";
  116.        label = "";//Prompt from lsp file
  117.       
  118.        width = 18;
  119.    fixed_width_font = true;
  120.    
  121.      }
  122.     } //end distanza orrizontale
  123.    
  124.     }  // end third box - dati inseriti
  125. //spacer;
  126. spacer;
  127. spacer;
  128. spacer;
  129.   //start  fourth box Grand
  130.   : boxed_column {
  131.   
  132.   //start  last line Grand
  133. : row {
  134.    : column {
  135.      width = 10;
  136.      fixed_width = true;
  137.      
  138.      : text {
  139.        key = "grand_dist_";
  140.        label = "GRAND  TOTAL   ";//Prompt from lsp file
  141.      }
  142.    }
  143.    : text {
  144.        key = "grand_dist";
  145.        label = "Sanjay";//Prompt from lsp file
  146.       
  147.        width = 18;
  148.    fixed_width_font = true;
  149.    
  150.      }
  151.     }    //end  last line Grand
  152.      }   //endt  fourth box Grand
  153. //start insert numero braccio / tubo / linee
  154. : row {//<
  155.    fixed_width = true;
  156.    : column {
  157.      width = 35;
  158.      fixed_width = true;
  159.      spacer;
  160.      : text {
  161.        key = "Text1";
  162.        label = "";//Text1$ from lsp file
  163.      }
  164.    }
  165.    : edit_box {
  166.      key = "Edit1";//Edit1$ from lsp file
  167.      edit_width = 9.42;
  168.      fixed_width = true;
  169.      allow_accept = true;
  170.      initial_focus = true;
  171.      
  172.    }
  173. }//>
  174. : row {//<
  175.    fixed_width = true;
  176.    : column {
  177.      width = 35;
  178.      fixed_width = true;
  179.      spacer;
  180.      : text {
  181.        key = "Text2";
  182.        label = "";//Text2$ from lsp file
  183.      }
  184.    }
  185.    : edit_box {
  186.      key = "Edit2";//Edit2$ from lsp file
  187.      edit_width = 9.42;
  188.      fixed_width = true;
  189.    }
  190. }//>
  191. : row {//<
  192.    fixed_width = true;
  193.    : column {
  194.      width = 35;
  195.      fixed_width = true;
  196.      spacer;
  197.      : text {
  198.        key = "Text3";
  199.        label = "";//Text3$ from lsp file
  200.      }
  201.    }
  202.    : edit_box {
  203.      key = "Edit3";//Edit3$ from lsp file
  204.      edit_width = 9.42;
  205.      fixed_width = true;
  206.    }
  207. }//>
  208. //end  insert numero braccio / tubo / linee
  209.    
  210.     }    //end  last line Grand
  211. spacer;
  212. spacer;
  213. spacer;
  214. spacer;
  215. spacer;
  216. spacer;
  217. : button {
  218.    key = "accept";
  219.    label = "OK";
  220.    is_default = true;
  221.    width = 18;
  222.    fixed_width = true;
  223.    alignment = centered;
  224. } //end button
  225. //start  note
  226. : row {
  227.    : column {
  228.      width = 10;
  229.      fixed_width = true;
  230.      
  231.      : text {
  232.        key = "note_";
  233.        label = "Note: ";//Prompt from lsp file
  234.         width = 40;
  235.        fixed_width_font = true;
  236.      }
  237.    } //end note
  238. spacer;
  239. spacer;
  240. spacer;
  241. spacer;
  242.             }  //end fourth box Grand
  243.                 } //end first box - rh srl

lisp:红色是我想要替换的(退出)
 
  1. 13
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 02:01 , Processed in 0.674781 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表