乐筑天下

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

[编程交流] DCL的滑动问题!!

[复制链接]

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:02:24 | 显示全部楼层 |阅读模式
嘿,我的幻灯片可以工作,但当你点击ok按钮进行计算时,幻灯片就会消失。为什么会这样?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:12:13 | 显示全部楼层
你可以把DCL和处理DCL的LISP部分贴出来吗?我来看看
回复

使用道具 举报

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:19:07 | 显示全部楼层
嘿,你好,李。麦克,这是Lisp程序。嘿,李,我也刚刚遇到了另一个问题。我有两个编辑框来收集信息。
外形尺寸
对象间距
现在我可以以十进制形式输入,但我们不使用十进制形式。有没有办法将框中的输入更改为英尺和英寸?这被认为是一种节省时间的方法,如果它是十进制的,那么它就达不到目的了。
 
  1. (defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls dstx spax
  2.       )
  3. (setq dialogLoaded T
  4. dialogShow T)
  5. (if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file
  6. (progn
  7. (princ "\nERROR: Cannot load space.DCL");_error trapping
  8. (setq dialogLoaded nil)
  9. ) ;_ end of progn
  10. ) ;_ end of if
  11. (setq what_next 2);_this is a variable for the loop
  12. (while (>= what_next 2);_this is the loop
  13. (if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed
  14. dialogLoaded
  15. ) ;_ end of and
  16. (progn
  17. (princ "\nERROR: Cannot show dialog space");_error trap if there is a problem
  18. ) ;_ end of progn
  19. ) ;_ end of if
  20. (if (and dialogLoaded dialogShow)
  21. (progn
  22. ;;; below is where you assign values to tiles and other stuff
  23. (if rtvls
  24. (progn
  25. (set_tile "end1" (rtos(nth 0 rtvls)5 4))
  26. (set_tile "sp" (rtos(nth 1 rtvls)2 0))
  27. (set_tile "sp2" (rtos(nth 2 rtvls)4 4))
  28. (set_tile "oa" (rtos(nth 3 rtvls)4 4))
  29. (set_tile "end2" (rtos(nth 4 rtvls)5 4))
  30. (set_tile "sd" (rtos(nth 5 rtvls)4 4))
  31. );_progn
  32. (progn
  33. (set_tile "end1" "")
  34. (set_tile "sp" "")
  35. (set_tile "sp2" "")
  36. (set_tile "oa" "")
  37. (set_tile "end2" "")
  38. (set_tile "sd" "")
  39. (set_tile "ss" "")
  40. );_progn
  41. );_if
  42. (setq dialogShow nil)
  43. (setq w (dimx_tile "im1")
  44. h (dimy_tile "im1"))
  45. (slide_image 0 0 w h "space")
  46. (end_image)
  47.        (if dstx (set_tile "x" dstx)(set_tile "x" ""))
  48. (if spax (set_tile "y" spax)(set_tile "y" ""))
  49. (action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button make dlg go bye-bye
  50. ;;; if user clicks ok  button assign tile values to variables
  51. (action_tile "accept"
  52. (strcat
  53. "(progn"
  54. "(setq dstx (get_tile "x"))"
  55. "(setq spax (get_tile "y"))"
  56. "(if (not (member "" (list dstx spax)))"
  57. "(progn"
  58. "(done_dialog 4)"
  59. ")" ;_progn
  60. "(alert "Please enter values")"
  61. ")" ;_if
  62. ")" ;_progn
  63. ) ;_end strcat
  64. ) ;_ end of action_tile
  65. (setq what_next (start_dialog))
  66. ) ;_ end of progn
  67. ) ;_ end of if
  68. (cond
  69. ((= what_next 4)
  70. (setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named qdx_wld
  71. );_end cond
  72. );_end while
  73. (unload_dialog dcl_id)
  74. ) ;_

 
这是dcl
 
  1. space :dialog {
  2. label = "The Spacing Chart!" ;
  3. : row {
  4. :boxed_column {
  5. label = "ENTER DIMENSIONS EXACTLY";
  6. :edit_box {
  7. key="x";
  8. label="What is your Overall Diemsnion of Object?" ;
  9. edit_width=14;
  10. alignment=centered;
  11. }
  12. :edit_box {
  13. key="y" ;
  14. label = "What is your Desired Spacing on Object?";
  15. edit_width=14;
  16. }
  17. }
  18. :boxed_column {
  19. :edit_box {
  20. label="Displays Overall in Feet & inches";
  21. key="sd";
  22. edit_width=14;
  23. alignment=centered;
  24. }
  25. }}
  26. :row {
  27. :column {
  28. width=10;
  29. alignment=centered;
  30. label="End Space 1";
  31. :edit_box {
  32. edit_width=6;
  33. key="end1" ;
  34. }
  35. }
  36. :column {
  37. width=3;}
  38. :column {
  39. width=10;
  40. label="# of Spaces";
  41. :edit_box {
  42. edit_width=6;
  43. key="sp";
  44. }
  45. }
  46. :row {
  47. :column{
  48. width=15;
  49. :text {key="tt" ; value="SPACES @";
  50. alignment=centered;}}
  51. }
  52. :column {
  53. width=10;
  54. label="Space Size";
  55. :edit_box {
  56. edit_width=6;
  57. key="sp2";
  58. }
  59. }
  60. :row {
  61. :column{
  62. width=15;
  63. :text {key="eq" ; value="EQUALS";
  64. alignment=centered;}}
  65. }
  66. :column {
  67. width=10;
  68. label="Overall Middle";
  69. :edit_box {
  70. edit_width=12;
  71. key="oa";
  72. }
  73. }
  74. :column {
  75. width=3;}
  76. :column {
  77. width=10;
  78. alignment=centered;
  79. label="End Space 2";
  80. :edit_box {
  81. key="end2" ;
  82. edit_width=6;
  83. }
  84. }}
  85. :row {
  86. :boxed_column {
  87. label="Written by: Brandon DeLoach and Joe Barrertt     <2009>" ;}
  88. }
  89. : image {
  90. key = "im1";
  91. height = 30;
  92. aspect_ratio = 1.5;
  93. color = 0;
  94. allow_accept = true;
  95. }
  96. : row {          // defines the OK/Cancel button row
  97. : spacer { width = 20; }
  98. : button {    // defines the OK or calculate button
  99.    label = "Calculate";
  100.    is_default = true;
  101.    key = "accept";
  102.    width = 8;
  103.    fixed_width = true;
  104. }
  105. : button {    // defines the Cancel button
  106.    label = "Cancel";
  107.    is_cancel = true;
  108.    key = "cancel";
  109.    width = 8;
  110.    fixed_width = true; }
  111. : spacer { width = 20;}
  112. }
  113. }
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:24:52 | 显示全部楼层
快速浏览一下,我认为在LISP代码中,需要包含以下内容:
 
  1. [b][color=Red](start_image "im1")[/color][/b]
  2. (setq w (dimx_tile "im1")
  3.      h (dimy_tile "im1"))
  4. (slide_image 0 0 w h "space")
  5. (end_image)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:32:10 | 显示全部楼层
对于编辑框情况,您将从编辑框中检索字符串,然后需要检索用户输入并将其转换为程序所需的单位。。。
 
我有两种可能。。。可能有两个编辑框,用于英尺和英寸。。。或者可以使用substr(或类似的另一个函数)去掉“and”。
回复

使用道具 举报

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:42:15 | 显示全部楼层
因此,我想没有办法只更改该编辑框的RTO,它就这样?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:43:04 | 显示全部楼层
Rtos?我想你的意思是“distof”,
 
编辑框返回一个字符串,可以使用以下方法将其正确转换为实数:
 
  1. (distof [string] 3)

 
否则,我会按照以下思路思考:
 
  1. feet : dialog {
  2. label = "Edit Box Test";
  3.    : row {
  4.        : edit_box {
  5.        label = "Feet:";
  6.        mnemonic = "F";
  7.        key = "edit_feet";
  8.        alignment = centered;
  9.        edit_limit = 3;
  10.        edit_width = 3;
  11.        value = "2";
  12.        }
  13.        : edit_box {
  14.        label = "Inches:";
  15.        mnemonic = "I";
  16.        key = "edit_inches";
  17.        alignment = centered;
  18.        edit_limit = 3;
  19.        edit_width = 3;
  20.        value = "3";
  21.        }
  22.    }
  23.    ok_cancel;
  24. }

 
在VLIDE中预览
回复

使用道具 举报

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 15:53:00 | 显示全部楼层
好的,现在有了(distof),这将必须在我的输入/输出表上。我一直在尝试,但每次都会出现错误
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 16:01:51 | 显示全部楼层
隐马尔可夫模型。。。我不使用“输入/输出”表,但需要在其中收集编辑框的值。
回复

使用道具 举报

24

主题

111

帖子

87

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
120
发表于 2022-7-6 16:08:29 | 显示全部楼层
我试过了,但还是没有运气,它出现了一个糟糕的nump nil错误,所以我将发布所有3个代码,看看你能做什么。
 
 
这是主lisp文件
 
  1.      ; THIS PROGRAM IS TO DETERMINE SPACES AND ENDS GIVEN
  2.     ; A KNOWN SPACE AND AN OVERALL DIMENSION.
  3.     ;
  4.     ; AN EXAMPLE IS THE SPACING OF STUDS AT 24" O.C.
  5.     ; ON AN EMBED ANGLE
  6.     ;
  7.     ;
  8.     ;Again this program is written by Joe Barrett and Brandon DeLoach, Atchley Steel's Boppsy Twins.
  9.     ;on or about February 25, 2009
  10. ;
  11.     ;dst1 = end to end of material
  12.     ;dst3 = initial number of spaces times the space
  13.     ;dst4 = final number of spaces times the space
  14.     ;endl = left end dimension
  15.     ;endr = right end dimension
  16.     ;num1 = initial number of spaces (exact)
  17.     ;num2 = initial number of spaces minus the fraction
  18.     ;num3 = initial number of spaces minus 1 plus the fraction
  19.     ;num4 = final number of spaces required
  20.     ;rem1 = working number to determine endspaces
  21.     ;spa1 = spacing of whatever
  22. (defun c:spc ()
  23. (space:DialogInput)
  24. (princ)
  25. );_defun
  26. (defun space (dst1 spa1 / dst4 endl endr num1 num2 num3 num4 rem1)
  27.    
  28. (setq num1 (/ dst1 spa1))
  29. (setq num2 (fix (+ num1 0.50)))
  30. (setq num3 (- num2 1))
  31. (setq dst3 (* spa1 num3))
  32. (setq rem1 (* (- num1 num2) spa1))
  33. (if (< rem1 6)
  34.    (setq num4 num3)
  35.    (setq num4 num2)
  36. )
  37. (setq dst4 (* num4 spa1))
  38. (setq endl (/ (- dst1 dst4) 2))
  39. (setq endr (- dst1 dst4 endl))
  40. (setq ret (list endl num4 spa1 dst4 endr dst1 spa1))
  41. )
  42.    

 
这是输入/输出表
 
  1. (defun space:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls w h  dstx spax
  2.       )
  3. (setq dialogLoaded T
  4. dialogShow T)
  5. (if (= -1 (setq dcl_id (load_dialog "SPACE.DCL")));_looks for and loads the dcl file
  6. (progn
  7. (princ "\nERROR: Cannot load space.DCL");_error trapping
  8. (setq dialogLoaded nil)
  9. ) ;_ end of progn
  10. ) ;_ end of if
  11. (setq what_next 2);_this is a variable for the loop
  12. (while (>= what_next 2);_this is the loop
  13. (if (and (not (new_dialog "space" dcl_id));_if everything is found let the program proceed
  14. dialogLoaded
  15. ) ;_ end of and
  16. (progn
  17. (princ "\nERROR: Cannot show dialog space");_error trap if there is a problem
  18. ) ;_ end of progn
  19. ) ;_ end of if]
  20.     (start_image "im1")
  21. (setq dialogShow t)
  22. (setq w (dimx_tile "im1")
  23. h (dimy_tile "im1"))
  24. (slide_image 0 0 w h "space")
  25.   (end_image)
  26. (if (and dialogLoaded dialogShow)
  27. (progn
  28. ;;; below is where you assign values to tiles and other stuff
  29. (if rtvls
  30. (progn
  31. (set_tile "end1" (rtos(nth 0 rtvls)5 4))
  32. (set_tile "sp" (rtos(nth 1 rtvls)2 0))
  33. (set_tile "sp2" (rtos(nth 2 rtvls)4 4))
  34. (set_tile "oa" (rtos(nth 3 rtvls)4 4))
  35. (set_tile "end2" (rtos(nth 4 rtvls)5 4))
  36. (set_tile "sd" (rtos(nth 5 rtvls)4 4))
  37. );_progn
  38. (progn
  39. (set_tile "end1" "")
  40. (set_tile "sp" "")
  41. (set_tile "sp2" "")
  42. (set_tile "oa" "")
  43. (set_tile "end2" "")
  44. (set_tile "sd" "")
  45. );_progn
  46. );_if
  47.        (if dstx (set_tile "x" dstx)(set_tile "x" ""))
  48. (if spax (set_tile "y" spax)(set_tile "y" ""))
  49. (action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button end dialog
  50.                                                            ;;; if user clicks ok  button assign tile values to variables
  51. (action_tile "accept"
  52. (strcat
  53. "(progn"
  54. "(setq dstx (get_tile "x"))"
  55. "(setq spax (get_tile "y"))"
  56. "(if (not (member "" (list dstx spax)))"
  57. "(progn"
  58. "(done_dialog 4)"
  59. ")" ;_progn
  60. "(alert "Please enter values")"
  61. ")" ;_if
  62. ")" ;_progn
  63. ) ;_end strcat
  64. ) ;_ end of action_tile
  65. (setq what_next (start_dialog))
  66. ) ;_ end of progn
  67. ) ;_ end of if
  68. (cond
  69. ((= what_next 4)
  70. (setq rtvls (space (atof dstx)(atof spax))));_do this if user clicks the button named quit dialog
  71. );_end cond
  72. );_end while
  73. (unload_dialog dcl_id)
  74. ) ;_ end of defun

 
这是dcl文件
 
  1. space :dialog {
  2. label = "The Spacing Chart!" ;
  3. : row {
  4. :boxed_column {
  5. label = "ENTER DIMENSIONS EXACTLY";
  6. :edit_box {
  7. key="x";
  8. label="What is your Overall Dimension of Object?" ;
  9. edit_width=14;
  10. alignment=centered;
  11. }
  12. :edit_box {
  13. key="y" ;
  14. label = "What is your Desired Spacing on Object?";
  15. edit_width=14;
  16. }
  17. }
  18. :boxed_column {
  19. :edit_box {
  20. label="Displays Overall in Feet & inches";
  21. key="sd";
  22. edit_width=14;
  23. alignment=centered;
  24. }
  25. }}
  26. :row {
  27. :column {
  28. width=10;
  29. alignment=centered;
  30. label="End Space 1";
  31. :edit_box {
  32. edit_width=6;
  33. key="end1" ;
  34. }
  35. }
  36. :column {
  37. width=3;}
  38. :column {
  39. width=10;
  40. label="# of Spaces";
  41. :edit_box {
  42. edit_width=6;
  43. key="sp";
  44. }
  45. }
  46. :row {
  47. :column{
  48. width=15;
  49. :text {key="tt" ; value="SPACES @";
  50. alignment=centered;}}
  51. }
  52. :column {
  53. width=10;
  54. label="Space Size";
  55. :edit_box {
  56. edit_width=6;
  57. key="sp2";
  58. }
  59. }
  60. :row {
  61. :column{
  62. width=15;
  63. :text {key="eq" ; value="EQUALS";
  64. alignment=centered;}}
  65. }
  66. :column {
  67. width=10;
  68. label="Overall Middle";
  69. :edit_box {
  70. edit_width=12;
  71. key="oa";
  72. }
  73. }
  74. :column {
  75. width=3;}
  76. :column {
  77. width=10;
  78. alignment=centered;
  79. label="End Space 2";
  80. :edit_box {
  81. key="end2" ;
  82. edit_width=6;
  83. }
  84. }}
  85. :row {
  86. :boxed_column {
  87. label="Written by: Brandon DeLoach and Joe Barrertt     <2009>" ;}
  88. }
  89. : image {
  90. key = "im1";
  91. height = 30;
  92. aspect_ratio = 1.5;
  93. color = 0;
  94. allow_accept = true;
  95. }
  96. : row {          // defines the OK/Cancel button row
  97. : spacer { width = 20; }
  98. : button {    // defines the OK or calculate button
  99.    label = "Calculate";
  100.    is_default = true;
  101.    key = "accept";
  102.    width = 8;
  103.    fixed_width = true;
  104. }
  105. : button {    // defines the Cancel button
  106.    label = "Cancel";
  107.    is_cancel = true;
  108.    key = "cancel";
  109.    width = 8;
  110.    fixed_width = true; }
  111. : spacer { width = 20;}
  112. }
  113. }
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 21:24 , Processed in 0.331725 second(s), 72 queries .

© 2020-2025 乐筑天下

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