乐筑天下

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

[编程交流] Lisp赢得#039;t运行

[复制链接]

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 11:24:56 | 显示全部楼层 |阅读模式
Buzzard在过去的一段时间里一直在帮我做这些事情。我做了一些修改。有人能告诉我为什么这个不能运行吗?
字母S。lsp
字母S。dcl
CCC_排水。txt文件
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 11:36:39 | 显示全部楼层
伍德曼78,
 
如图所示,在红色标记之间留出空间:
 
  1. You have this:
  2. (defun C:ESS (/SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)
  3. You should have this:
  4. (defun C:ESS ([color=red]/ S[/color]IZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 11:43:03 | 显示全部楼层
此外,当您使用时:
这是放置在变量SUS中的列表。
为什么其他变量名都没有被使用呢。
  1. Change this:
  2. (defun ESS_SAVE (/ SUS[color=red] SUCE SUOM SUSM SUAB SUAD SUCL SUCR[/color])
  3. To this:
  4. (defun ESS_SAVE (/ SUS)

 
不要重新发明轮子。
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 11:57:54 | 显示全部楼层
再一次
 
添加此选项,以便在取消时恢复变量。
 
  1. (action_tile "cancel" "(done_dialog)(setq userclick nil)[color=red](ESS_RESTORE)[/color]")

 
到目前为止,我还没有复习完所有的例行公事。
请检查您的所有功能。
我稍后再给你打电话。
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 12:00:00 | 显示全部楼层
我进一步检查,发现了另一个问题。
变量后面有一个引号。
 
  1. These quotes need to be removed, Its a variable.
  2. (setq a  (strcat "CCC_DR_"SIZE[color=red]"[/color])
  3.        b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE[color=red]"[/color])
  4.        lw 30)

 
这些已不在程序中。
  1. Remove this:
  2. (defun C:ESS ([color=black]/ SIZE[/color]$ SIZE PT01 PT02 a b lw [color=red]DEGREES RADIANS[/color])

 
 
我还想指出,由于您使用的是ACAD 2010,而且在我看来,您有早期版本中未使用的变量或命令,因此我能够为您测试的数量将受到限制。
我想,我不太确定我是否捕捉到了所有内容,但对我来说似乎没问题,尽管线型中的文本没有
似乎正在展示。你必须告诉我这件事。
 
 
这是lisp以及前面提到的所有更改。
看起来你打破了这里的记录。
  1. ;//////////////////////////////////////////////////////////////////////////
  2. ;
  3. ; Start-Up Function
  4. ;
  5. (defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw)
  6. (ESS_SAVE)
  7. (princ))
  8. ;
  9. ;//////////////////////////////////////////////////////////////////////////
  10. ;
  11. ; Save User Settings Function.
  12. ;
  13. (defun ESS_SAVE (/ SUS)
  14. (setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
  15. (setq TERR$ *error*)
  16. (setq *error* ESS_ETRAP)
  17. (ESS_MF)
  18. (princ))
  19. ;
  20. ;//////////////////////////////////////////////////////////////////////////
  21. ;
  22. ; Main Function
  23. ;
  24. (defun ESS_MF ()
  25. (or S:SIZE (setq S:IZE 0))
  26. (setq S1_list '( "1500mm"  "1350mm" "1200mm" "1050mm" "900mm" "750mm" "675mm" "600mm" "525mm" "450mm" "375mm" "300mm" "225mm" "150mm"))
  27. (setq dcl_id (load_dialog "ESS.dcl"))
  28. (if (not (new_dialog "ESS" dcl_id))
  29.    (progn (ALERT "Can not find your dcl file")
  30.      (exit)))
  31. (start_list "S1")
  32. (mapcar 'add_list S1_list)
  33. (end_list)
  34. (if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
  35. (action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")
  36. (action_tile "accept"
  37.    (strcat
  38.     "(progn
  39.      (setq S:IZE (atoi (get_tile "S1")) SIZE:DEF S:IZE)"
  40.     "(done_dialog)(setq userclick T))"))
  41. (start_dialog)
  42. (unload_dialog dcl_id)
  43. (if userclick
  44.    (ESS_VARIABLE))
  45. (princ))
  46. ;
  47. ;//////////////////////////////////////////////////////////////////////////
  48. ;
  49. ; ESS_VARIABLE Function
  50. ;
  51. (defun ESS_VARIABLE ()
  52. (progn
  53.    (setq SIZE$ (fix S:IZE))
  54.    (setq SIZE$ (nth S:IZE S1_list))
  55.    (cond
  56.      ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
  57.      ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
  58.      ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
  59.      ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
  60.      ((= SIZE$  "900mm")(setq SIZE$  "900"))
  61.      ((= SIZE$  "750mm")(setq SIZE$  "750"))
  62.      ((= SIZE$  "675mm")(setq SIZE$  "675"))
  63.      ((= SIZE$  "600mm")(setq SIZE$  "600"))
  64.      ((= SIZE$  "525mm")(setq SIZE$  "525"))
  65.      ((= SIZE$  "450mm")(setq SIZE$  "450"))
  66.      ((= SIZE$  "375mm")(setq SIZE$  "375"))
  67.      ((= SIZE$  "300mm")(setq SIZE$  "300"))
  68.      ((= SIZE$  "225mm")(setq SIZE$  "225"))
  69.      ((= SIZE$  "150mm")(setq SIZE$  "150"))))
  70. (setq SIZE SIZE$)
  71. (ESS_OUTPUT)
  72. (princ))
  73. ;
  74. ;//////////////////////////////////////////////////////////////////////////
  75. ;
  76. ; ESS_OUTPUT Function
  77. ;
  78. (defun ESS_OUTPUT ()
  79. (if (null (tblsearch "STYLE" "CCC_Services"))
  80.    (entmake
  81.      (list
  82.        (cons 0 "STYLE")
  83.        (cons 100 "AcDbSymbolTableRecord")
  84.        (cons 100 "AcDbTextStyleTableRecord")
  85.        (cons 2 "CCC_Services")
  86.        (cons 3 "Verdana.ttf")
  87.        (cons 40 0)
  88.        (cons 70 0))))
  89. (setq a  (strcat "CCC_DR_"SIZE)
  90.        b  (strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE)
  91.        lw 30)
  92. (if (null (tblsearch "LTYPE" a))
  93.    (command "_.-linetype" "_l" a "CCC_Drainage.lin" ""))
  94. (if (null (tblsearch "LAYER" b))
  95. (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" ))
  96. (command "_-color"  "bylayer")
  97. (command "._-linetype"  "s"  "bylayer" "")   
  98. (setvar "cmdecho" 0)
  99. (setvar "angbase" 0.0000)
  100. (setvar "angdir"  0)
  101. (setvar "orthomode" 0)
  102. (setvar "osmode"    16383)
  103. (command "_.-layer" "_S" b "")
  104. (setvar "plinegen" 1)
  105. (command "._pline")
  106. (ESS_RESTORE)
  107. (princ))
  108. ;
  109. ;//////////////////////////////////////////////////////////////////////////
  110. ;
  111. ; Degrees to Radians Function
  112. ;
  113. (defun ESS_DTR (DEGREES)
  114. (* pi (/ DEGREES 180.0)))
  115. ;
  116. ;//////////////////////////////////////////////////////////////////////////
  117. ;
  118. ; Radians to Degrees Function
  119. ;
  120. (defun ESS_RTD (RADIANS)
  121. (* 180.0 (/ RADIANS pi)))
  122. ;
  123. ;//////////////////////////////////////////////////////////////////////////
  124. ;
  125. ; Restore User Settings Function.
  126. ;
  127. (defun ESS_RESTORE ()
  128. (setq *error* TERR$)
  129. (if SUS (mapcar 'setvar SUS_LIST SUS))
  130. (princ "\nProgram completed and will now restore the user settings and exit.")
  131. (princ))
  132. ;
  133. ;/////////////////////////////////////////////////////////////////////////////
  134. ;
  135. ; Error Trap Function.
  136. ;
  137. (defun ESS_ETRAP (ERRORMSG)
  138. (command nil nil nil)
  139. (if (not (member ERRORMSG '("console break" "Function cancelled")))
  140.    (princ (strcat "\nError:" ERRORMSG)))
  141. (if SUS (mapcar 'setvar SUS_LIST SUS))
  142. (princ "\nAn *error* has occured!")
  143. (princ "\nThe program will now restore the user settings and exit.")
  144. (terpri)
  145. (setq *error* TERR$)
  146. (princ))
  147. ;
  148. ;//////////////////////////////////////////////////////////////////////////

 
当你把东西粘贴到你的程序中时,请检查是否有不属于那里的东西。
回复

使用道具 举报

8

主题

50

帖子

42

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 12:15:50 | 显示全部楼层
 
超级Lisp程序
 
但如果我们能为每个层指定自己的颜色,那就太好了。
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 12:16:52 | 显示全部楼层
谢谢Buzzard,此lisp的线型中没有文本。在其他一些地方,它工作得很好。
 
再次感谢
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 12:25:49 | 显示全部楼层
这很好,但我忘了删除度到弧度和弧度到度函数,因为它们没有被使用。如果你有机会,就把他们干掉。
 
当你有时间的时候,把它去掉。
  1. ;//////////////////////////////////////////////////////////////////////////
  2. [color=red];[/color]
  3. [color=red]; Degrees to Radians Function[/color]
  4. [color=red];[/color]
  5. [color=red](defun ESS_DTR (DEGREES)[/color]
  6. [color=red](* pi (/ DEGREES 180.0)))[/color]
  7. [color=red];[/color]
  8. [color=red];//////////////////////////////////////////////////////////////////////////[/color]
  9. [color=red];[/color]
  10. [color=red]; Radians to Degrees Function[/color]
  11. [color=red];[/color]
  12. [color=red](defun ESS_RTD (RADIANS)[/color]
  13. [color=red] (* 180.0 (/ RADIANS pi)))[/color]
  14. [color=red];[/color]
  15. [color=red];//////////////////////////////////////////////////////////////////////////[/color]
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 02:09 , Processed in 0.394894 second(s), 68 queries .

© 2020-2025 乐筑天下

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