乐筑天下

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

[编程交流] lisp preform se存在问题

[复制链接]

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 06:57:39 | 显示全部楼层
非常感谢大家帮助我们解决这个问题。
我们发现有效的方法是在break命令中添加if语句:
  1.      (action_tile "Slide12"
  2.       "(progn
  3.           (setq Return$ Slide12$)(setq doAction 'T)
  4.           (done_dialog)
  5.        )"
  6.     )
  7. (action_tile
  8.    "cancel"
  9.      "(done_dialog) (setq doAction nil)")
  10.   (start_dialog)
  11.   (unload_dialog Dcl_Id%)
  12. (if doAction (SmallVLVInsert))
  13. (princ)
  14. );defun c:Smallvalves
  15. ;---------------------------------------------------------------------------------
  16. (done_dialog)
  17. (defun SmallVLVInsert ( / ss p2 p3)
  18. (done_dialog)
  19. (command "attreq" "0")
  20. (if (eq 16384 (logand 16384 (getvar "osmode")))
  21. (setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
  22. (command "snap" "0.0625")
  23. (setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
  24. (if (not (tblsearch "layer" "pid"))
  25. (entmake
  26.    (list
  27.      (cons 0 "Layer")
  28.      (cons 100 "AcDbSymbolTableRecord")
  29.      (cons 100 "AcDbLayerTableRecord")
  30.      (cons 2 "pid")
  31.      (cons 70 0)
  32.      (cons 62 3)
  33.     (cons 6 "Continuous")
  34. )))
  35. (setq Snap (getvar "osmode"))     
  36. (setvar "clayer" "pid")
  37. (command "_insert" Return$ insertpt1 "" "" "")
  38. (while (not ss)
  39. (setq ss (entsel "\nSelect line to break: "))
  40. );while
  41.   (setvar 'osmode 613)
  42.   (setq p3 (getpoint "\nPick valve center:")
  43.         p2 (angle p3 (cadr ss)))
  44. (if ( = slide1$ slide2$ slide3$ slide4$ slide5$ slide6$)
  45.   (progn
  46.       (command "break" ss "f" (polar p3 p2 0.09375)
  47.                               (polar p3 p2 -0.09375))
  48.    )
  49.   (progn
  50.       (command "break" ss "f" (polar p3 p2 0.1172)
  51.                               (polar p3 p2 -0.1172))
  52.    )
  53. )
  54. (setvar "cmdecho" 1)
  55. (princ)
  56. (setvar "osmode" Snap)
  57. );if

 
 
这允许我们只保留一个可变doAction,但如果选择了幻灯片1到6,则允许例程中断较短的长度,并中断另一个较长的长度“ELSE”(在我们的情况下,是幻灯片7到幻灯片12)
 
我将尝试Henrique的第二个变量,以防需要传递两个以上的函数,即this或this,因为它在这里。lsp,但有时我们可能需要让lisp做这个、这个、这个、这个或那个。
在后一种情况下,我认为设置更多的变量会很有用。
 
我会附上lsp和dcl文件,这样如果你们中有人想让我知道如何改进我们的代码,因为这都是自学的,已经让我和其他人的眼睛检查过了。也许更多的人会提供建议。
再次感谢。
 
*附件对我不起作用,我将用代码括号括起来*
 
  1. (defun c:smallvalves (/ Dcl_Id% Folder$ Slides@ Slide1$ Slide2$ Slide3$ Slide4$ Slide5$ Slide6$ Slide7$ Slide8$ Slide9$ Slide10$ Slide11$ Slide12$  
  2. Return$ X# Y#)
  3. (princ "\nSmall Manually Operated Valves")(princ)
  4.    ; Set Default Variables
  5.   (setq Slides@ (list nil "SMALL GATE VALVE" "SMALL BALL VALVE" "SMALL GLOBE VALVE" "SMALL CHECK VALVE" "SMALL BUTTERFLY VALVE" "SMALL NEEDLE VALVE"
  6. "FLANGED SMALL GATE VALVE" "FLANGED SMALL BALL VALVE" "FLANGED SMALL GLOBE VALVE" "FLANGED SMALL CHECK VALVE" "FLANGED SMALL BUTTERFLY VALVE" "FLANGED
  7. SMALL NEEDLE VALVE")
  8.         Slide1$ (nth 1 Slides@)
  9.         Slide2$ (nth 2 Slides@)
  10.         Slide3$ (nth 3 Slides@)
  11.         Slide4$ (nth 4 Slides@)
  12.         Slide5$ (nth 5 Slides@)
  13.         Slide6$ (nth 6 Slides@)
  14.         Slide7$ (nth 7 Slides@)
  15.         Slide8$ (nth 8 Slides@)
  16.         Slide9$ (nth 9 Slides@)
  17.         Slide10$ (nth 10 Slides@)
  18.         Slide11$ (nth 11 Slides@)
  19.         Slide12$ (nth 12 Slides@)
  20.         Folder$ ""
  21.         Return$ ""
  22.   );setq
  23.    ; Load Dialog
  24.   (setq Dcl_Id% (load_dialog "smallvalves.dcl"))
  25.   (new_dialog "smallvalves" Dcl_Id%)
  26.    ; Set Dialog Initial Settings
  27.   (set_tile "Title" "EQUIPMENT - DRUMS AND TANKS")
  28.   (set_tile "SMALL GATE VALVE" Slide1$)
  29.   (set_tile "SMALL BALL VALVE" Slide2$)
  30.   (set_tile "SMALL GLOBE VALVE" Slide3$)
  31.   (set_tile "SMALL CHECK VALVE" Slide4$)
  32.   (set_tile "SMALL BUTTERFLY VALVE" Slide5$)
  33.   (set_tile "SMALL NEEDLE VALVE" Slide6$)
  34.   (set_tile "FLANGED SMALL GATE VALVE" Slide7$)
  35.   (set_tile "FLANGED SMALL BALL VALVE" Slide8$)
  36.   (set_tile "FLANGED SMALL GLOBE VALVE" Slide9$)
  37.   (set_tile "FLANGED SMALL CHECK VALVE" Slide10$)
  38.   (set_tile "FLANGED SMALL BUTTERFLY VALVE" Slide11$)
  39.   (set_tile "FLANGED SMALL NEEDLE VALVE" Slide12$)
  40.    ; Adjust X# and Y# per image_buttom outline to fit slide_image
  41.   (start_image "Slide1")
  42.   (setq X# (- (dimx_tile "Slide1") 2))
  43.   (setq Y# (- (dimy_tile "Slide1") 2))
  44.   (end_image)
  45.   (start_image "Slide1")(slide_image 1 1 X# Y# (strcat Folder$ Slide1$))(end_image)
  46.   (start_image "Slide2")(slide_image 1 1 X# Y# (strcat Folder$ Slide2$))(end_image)
  47.   (start_image "Slide3")(slide_image 1 1 X# Y# (strcat Folder$ Slide3$))(end_image)
  48.   (start_image "Slide4")(slide_image 1 1 X# Y# (strcat Folder$ Slide4$))(end_image)
  49.   (start_image "Slide5")(slide_image 1 1 X# Y# (strcat Folder$ Slide5$))(end_image)
  50.   (start_image "Slide6")(slide_image 1 1 X# Y# (strcat Folder$ Slide6$))(end_image)
  51.   (start_image "Slide7")(slide_image 1 1 X# Y# (strcat Folder$ Slide7$))(end_image)
  52.   (start_image "Slide8")(slide_image 1 1 X# Y# (strcat Folder$ Slide8$))(end_image)
  53.   (start_image "Slide9")(slide_image 1 1 X# Y# (strcat Folder$ Slide9$))(end_image)
  54.   (start_image "Slide10")(slide_image 1 1 X# Y# (strcat Folder$ Slide10$))(end_image)
  55.   (start_image "Slide11")(slide_image 1 1 X# Y# (strcat Folder$ Slide11$))(end_image)
  56.   (start_image "Slide12")(slide_image 1 1 X# Y# (strcat Folder$ Slide12$))(end_image)
  57.     ; Dialog Actions
  58.    (action_tile "Slide1"
  59.       "(progn
  60.           (setq Return$ Slide1$)(setq doAction 'T)
  61.           (done_dialog)
  62.        )"
  63.     )
  64.      (action_tile "Slide2"
  65.       "(progn
  66.           (setq Return$ Slide2$)(setq doAction 'T)
  67.           (done_dialog)
  68.        )"
  69.     )
  70.     (action_tile "Slide3"
  71.       "(progn
  72.           (setq Return$ Slide3$)(setq doAction 'T)
  73.           (done_dialog)
  74.        )"
  75.     )
  76.       (action_tile "Slide4"
  77.       "(progn
  78.           (setq Return$ Slide4$)(setq doAction 'T)
  79.           (done_dialog)
  80.        )"
  81.     )
  82.      (action_tile "Slide5"
  83.       "(progn
  84.           (setq Return$ Slide5$)(setq doAction 'T)
  85.           (done_dialog)
  86.        )"
  87.     )
  88.      (action_tile "Slide6"
  89.       "(progn
  90.           (setq Return$ Slide6$)(setq doAction 'T)
  91.           (done_dialog)
  92.        )"
  93.     )
  94.   (action_tile "Slide7"
  95.       "(progn
  96.           (setq Return$ Slide7$)(setq doAction 'T)
  97.           (done_dialog)
  98.        )"
  99.     )
  100.      (action_tile "Slide8"
  101.       "(progn
  102.           (setq Return$ Slide8$)(setq doAction 'T)
  103.           (done_dialog)
  104.        )"
  105.     )
  106.      (action_tile "Slide9"
  107.       "(progn
  108.           (setq Return$ Slide9$)(setq doAction 'T)
  109.           (done_dialog)
  110.        )"
  111.     )
  112.      (action_tile "Slide10"
  113.       "(progn
  114.           (setq Return$ Slide10$)(setq doAction 'T)
  115.           (done_dialog)
  116.        )"
  117.     )
  118.       (action_tile "Slide11"
  119.       "(progn
  120.           (setq Return$ Slide11$)(setq doAction 'T)
  121.           (done_dialog)
  122.        )"
  123.     )
  124.      (action_tile "Slide12"
  125.       "(progn
  126.           (setq Return$ Slide12$)(setq doAction 'T)
  127.           (done_dialog)
  128.        )"
  129.     )
  130. (action_tile
  131.    "cancel"
  132.      "(done_dialog) (setq doAction nil)")
  133.          
  134.   (start_dialog)
  135.   (unload_dialog Dcl_Id%)
  136. (if doAction (SmallVLVInsert))
  137. (princ)
  138. );defun c:Smallvalves
  139. ;---------------------------------------------------------------------------------
  140. (done_dialog)
  141. (defun SmallVLVInsert ( / ss p2 p3)
  142. (done_dialog)
  143. (command "attreq" "0")
  144. (if (eq 16384 (logand 16384 (getvar "osmode")))
  145. (setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
  146. (command "snap" "0.0625")
  147. (setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
  148. (if (not (tblsearch "layer" "pid"))
  149. (entmake
  150.    (list
  151.      (cons 0 "Layer")
  152.      (cons 100 "AcDbSymbolTableRecord")
  153.      (cons 100 "AcDbLayerTableRecord")
  154.      (cons 2 "pid")
  155.      (cons 70 0)
  156.      (cons 62 3)
  157.     (cons 6 "Continuous")
  158. )))
  159. (setq Snap (getvar "osmode"))     
  160. (setvar "clayer" "pid")
  161. (command "_insert" Return$ insertpt1 "" "" "")
  162. (while (not ss)
  163. (setq ss (entsel "\nSelect line to break: "))
  164. );while
  165.   (setvar 'osmode 613)
  166.   (setq p3 (getpoint "\nPick valve center:")
  167.         p2 (angle p3 (cadr ss)))
  168. (if ( = slide1$ slide2$ slide3$ slide4$ slide5$ slide6$)
  169.   (progn
  170.       (command "break" ss "f" (polar p3 p2 0.09375)
  171.                               (polar p3 p2 -0.09375))
  172.    )
  173.   (progn
  174.       (command "break" ss "f" (polar p3 p2 0.1172)
  175.                               (polar p3 p2 -0.1172))
  176.    )
  177. )
  178. (setvar "cmdecho" 1)
  179. (princ)
  180. (setvar "osmode" Snap)
  181. );if
  182. -------------------------------------------------------------------------------
  183. (defun flansmallInsert ( / ss p4 p5)
  184. (done_dialog)
  185. (command "attreq" "0")
  186. (if (eq 16384 (logand 16384 (getvar "osmode")))
  187. (setvar "OSMODE" (boole 6 (getvar "OSMODE") 16384)))
  188. (command "snap" "0.0625")
  189. (setq insertpt1 (getpoint "\nPick Insertion Point on line: "))
  190. (if (not (tblsearch "layer" "pid"))
  191. (entmake
  192.    (list
  193.      (cons 0 "Layer")
  194.      (cons 100 "AcDbSymbolTableRecord")
  195.      (cons 100 "AcDbLayerTableRecord")
  196.      (cons 2 "pid")
  197.      (cons 70 0)
  198.      (cons 62 3)
  199.      (cons 6 "Continuous")
  200. )))
  201. (setq Snap (getvar "osmode"))
  202.      
  203. (setvar "clayer" "pid")
  204. (command "_insert" Return$ insertpt1 "" "" "")
  205. (while (not ss)
  206. (setq ss (entsel "\nSelect line to break: "))
  207. );while
  208.   (setvar 'osmode 613)
  209.   (setq p5 (getpoint "\nPick valve center:")
  210.         p4 (angle p5 (cadr ss)))
  211. (command "break" ss "f" (polar p5 p4 0.1172)
  212.                        (polar p5 p4 -0.1172))
  213. (setvar "cmdecho" 1)
  214. (princ)
  215. (setvar "osmode" Snap)
  216. );if
  217. -----------------------------------------------------------------------------

 
 
对于dcl
 
  1. //---------------------------------------------------------------------------------------------------------
  2. // MySlideImages
  3. //---------------------------------------------------------------------------------------------------------
  4. smallvalves : dialog {
  5.   key = "Title";
  6.   label = "Small Manually Operated Valves";
  7.   spacer;
  8. : row {
  9.   : column {
  10.     : image_button {
  11.       key = "Slide1";
  12.       height = 3.11;
  13. width = 11.00;
  14. fixed_width = true;
  15. alignment = centered;
  16.       color = -2;
  17. is_cancel = false;
  18.     }
  19.       : text {
  20.         key = "Text1";
  21.         label = "SMALL GATE VLV";
  22. fixed_width = true;
  23. alignment = centered;
  24.       }
  25. :spacer {height = 1;}
  26.     : image_button {
  27.       key = "Slide2";
  28.       height = 3.11;
  29. width = 11.00;
  30. fixed_width = true;
  31. alignment = centered;
  32.       color = -2;
  33.     }
  34.       : text {
  35.         key = "Text2";
  36.         label = "SMALL BALL VLV";
  37. fixed_width = true;
  38. alignment = centered;
  39.       }
  40. :spacer {height = 1;}
  41.     : image_button {
  42.       key = "Slide3";
  43.       height = 3.11;
  44. width = 11.00;
  45. fixed_width = true;
  46. alignment = centered;
  47.       color = -2;
  48.     }
  49.       : text {
  50.         key = "Text3";
  51.         label = "SMALL GLOBE VLV";
  52. fixed_width = true;
  53. alignment = centered;
  54.       }
  55. :spacer {height = 1.2;}
  56.     : image_button {
  57.       key = "Slide4";
  58.       height = 3.11;
  59. width = 11.00;
  60. fixed_width = true;
  61. alignment = centered;
  62.       color = -2;
  63.     }
  64.       : text {
  65.         key = "Text4";
  66.         label = "SMALL CHECK VLV";
  67. fixed_width = true;
  68. alignment = centered;
  69.       }
  70. }
  71.   : column {
  72.     : image_button {
  73.       key = "Slide5";
  74.       height = 3.11;
  75. width = 11.00;
  76. fixed_width = true;
  77. alignment = centered;
  78.       color = -2;
  79.     }
  80.       : text {
  81.         key = "Text5";
  82.         label = "SMALL BUTTERFLY VLV";
  83. fixed_width = true;
  84. alignment = centered;
  85.       }
  86. :spacer {height = 1;}
  87.     : image_button {
  88.       key = "Slide6";
  89.       height = 3.11;
  90. width = 11.00;
  91. fixed_width = true;
  92. alignment = centered;
  93.       color = -2;
  94.     }
  95.       : text {
  96.         key = "Text6";
  97.         label = "SMALL NEEDLE VLV";
  98. fixed_width = true;
  99. alignment = centered;
  100.       }
  101. :spacer {height = 1;}
  102.     : image_button {
  103.       key = "Slide7";
  104.       height = 3.11;
  105. width = 11.00;
  106. fixed_width = true;
  107. alignment = centered;
  108.       color = -2;
  109.     }
  110.       : text {
  111.         key = "Text7";
  112.         label = "FLGD SMALL GATE VLV";
  113. fixed_width = true;
  114. alignment = centered;
  115.       }
  116. :spacer {height = 1.2;}
  117.     : image_button {
  118.       key = "Slide8";
  119.       height = 3.11;
  120. width = 11.00;
  121. fixed_width = true;
  122. alignment = centered;
  123.       color = -2;
  124.     }
  125.       : text {
  126.         key = "Text8";
  127.         label = "FLGD SMALL BALL VLV";
  128. fixed_width = true;
  129. alignment = centered;
  130.       }
  131. }
  132.   : column {
  133.     : image_button {
  134.       key = "Slide9";
  135.       height = 3.11;
  136. width = 11.00;
  137. fixed_width = true;
  138. alignment = centered;
  139.       color = -2;
  140.     }
  141.       : text {
  142.         key = "Text9";
  143.         label = "FLGD SMALL GLOBE VLV";
  144. fixed_width = true;
  145. alignment = centered;
  146.       }
  147. :spacer {height = 1;}
  148.     : image_button {
  149.       key = "Slide10";
  150.       height = 3.11;
  151. width = 11.00;
  152. fixed_width = true;
  153. alignment = centered;
  154.       color = -2;
  155.     }
  156.       : text {
  157.         key = "Text10";
  158.         label = "FLGD SMALL CHECK VLV";
  159. fixed_width = true;
  160. alignment = centered;
  161.       }
  162. :spacer {height = 1;}
  163.     : image_button {
  164.       key = "Slide11";
  165.       height = 3.11;
  166. width = 11.00;
  167. fixed_width = true;
  168. alignment = centered;
  169.       color = -2;
  170.     }
  171. : paragraph {
  172. : text {
  173.         key = "Text11";
  174.         label = "FLGD SMALL";
  175. width = 14;
  176. alignment = centered;
  177.       }
  178. : text {
  179. label = "BUTTERFLY VLV";
  180. width = 18;
  181. alignment = centered;
  182. }
  183. }
  184.     : image_button {
  185.       key = "Slide12";
  186.       height = 3.11;
  187. width = 11.00;
  188. fixed_width = true;
  189. alignment = centered;
  190.       color = -2;
  191.       }  
  192.         : text {
  193.         key = "Text12";
  194.         label = "FLGD SMALL NEEDLE VLV";
  195. fixed_width = true;
  196. alignment = centered;
  197.       }
  198. }
  199.    }
  200. :spacer {height = 2;}
  201.   cancel_button;
  202. }//smallvalves

 
 
非常感谢,没有遇到我们(最终)无法完成的事情,感觉很好。
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:02:19 | 显示全部楼层
不客气,布勒
很高兴你找到了解决方案
 
亨里克
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:08:18 | 显示全部楼层
谢谢你,亨里克。
 
我在前面的另一节中尝试了你不同的变量建议。。
 
其中我添加了(action_tile(setq doAction1'T)
 
然后
 
if(doAction(normalroutine))
if(doAction1(交替例程))
 
 
选择与doAction1关联的动作块仍然会执行normalroutine中的步骤,就好像它根本看不到“aternateroutine”。
 
你知道另一种方法让我的幻灯片根据他们选择的幻灯片进行不同的例程吗?
 
再次感谢!
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:09:41 | 显示全部楼层
bhull1985,
我附上了一个示例DCL和LISP,以及一些注释和根据用户选择执行各种操作的方法。
 
希望有帮助
亨里克
示例_LISP\u DCL。拉链
回复

使用道具 举报

15

主题

243

帖子

228

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 07:13:09 | 显示全部楼层
哦,我知道你是怎么做到的了,亨利!在第一个defun中,加上一个条件语句,这就更有意义了!
非常感谢您的持续帮助,这将使我们能够清理需要不同修剪长度的例程。
我知道我今天要忙什么。。。
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 07:16:51 | 显示全部楼层
不客气,布勒
很高兴我能帮忙
 
亨里克
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:44 , Processed in 0.541277 second(s), 62 queries .

© 2020-2025 乐筑天下

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