乐筑天下

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

[编程交流] 旧代码:“cmdecho”错误

[复制链接]

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-5 23:17:03 | 显示全部楼层 |阅读模式
你好
我有一些代码,可能是这个网站上的人写的,我想稍微修改一下。然而,我遇到了麻烦。该命令运行良好,但只是在pline命令之后爆炸,并且不会重置系统变量。代码如下:
 
  1. ;//////////////////////////////////////////////////////////////////////////
  2. ;
  3. ; Start-Up Function
  4. ;
  5. (defun C:ESS (/ SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
  6. (setq SUCE (getvar "cmdecho"))
  7. (setq SUOM (getvar "orthomode"))
  8. (setq SUSM (getvar "osmode"))
  9. (setq SUAB (getvar "angbase"))
  10. (setq SUAD (getvar "angdir"))
  11. (setq SUCL (getvar "clayer"))
  12. (setq SUCR (getvar "cecolor"))  
  13. (ESS_MF)
  14. (princ)
  15. )
  16. ;
  17. ;//////////////////////////////////////////////////////////////////////////
  18. ;
  19. ; Main Function
  20. ;
  21. (defun ESS_MF (/ SIZE$ SIZE MIDPT PLEN PT01  PT02 a b COLR SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
  22. (setq temperr *error*)
  23. (setq *error* ESS_ETRAP)
  24. (entmake
  25. (list
  26.    (cons 0 "STYLE")
  27.    (cons 100 "AcDbSymbolTableRecord")
  28.    (cons 100 "AcDbTextStyleTableRecord")
  29.    (cons 2 "CCC_Services")
  30.    (cons 3 "Verdana.ttf")
  31.    (cons 40 0)
  32.    (cons 70 0)
  33. )
  34. )
  35. (setq S1_list '( "1500mm"  "1350mm" "1200mm" "1050mm" "900mm" "750mm" "675mm" "600mm" "525mm" "450mm" "375mm" "300mm" "225mm" "150mm"))
  36. (setq dcl_id (load_dialog "ESS.dcl"))
  37. (if
  38.    (not
  39.      (new_dialog "ESS" dcl_id)
  40.    )
  41.    (progn
  42.      (ALERT "Can not find your dcl file")
  43.      (exit)
  44.    )
  45. )
  46. (start_list "S1")
  47. (mapcar 'add_list S1_list)
  48. (end_list)
  49. (if SIZE:DEF
  50.    (set_tile "S1" (itoa SIZE:DEF))
  51. )
  52. (action_tile "cancel"
  53.   "(done_dialog)(setq userclick nil)"
  54. )
  55. (action_tile "accept"
  56.    (strcat
  57.     "(progn
  58.      (setq S:IZE (atoi (get_tile "S1")) SIZE:DEF S:IZE)"
  59.     "(done_dialog)(setq userclick T))"
  60.    )
  61. )
  62. (start_dialog)
  63. (unload_dialog dcl_id)
  64. (if userclick
  65.    (ESS_VARIABLE)
  66. )
  67. (princ)
  68. )
  69. ;
  70. ;//////////////////////////////////////////////////////////////////////////
  71. ;
  72. ; ESS_VARIABLE Function
  73. ;
  74. (defun ESS_VARIABLE ()
  75. (progn
  76.    (setq SIZE$ (fix S:IZE))
  77.    (setq SIZE$ (nth S:IZE S1_list))
  78.    (cond
  79.      ((= SIZE$ "1500mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E1500")(setq LTYP "E1500"))
  80.      ((= SIZE$ "1350mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E1350")(setq LTYP "E1500"))
  81.      ((= SIZE$ "1200mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E1200")(setq LTYP "E1500"))      
  82.      ((= SIZE$ "1050mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E1050")(setq LTYP "E1500"))
  83.      ((= SIZE$ "900mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E900")(setq LTYP "E1500"))
  84.      ((= SIZE$ "750mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E750")(setq LTYP "E1500"))
  85.      ((= SIZE$ "675mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E675")(setq LTYP "E1500"))      
  86.      ((= SIZE$ "600mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E600")(setq LTYP "E1500"))
  87.      ((= SIZE$ "525mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E525")(setq LTYP "E1500"))
  88.      ((= SIZE$ "450mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E450")(setq LTYP "E1500"))
  89.      ((= SIZE$ "375mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E375")(setq LTYP "E1500"))      
  90.      ((= SIZE$ "300mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E300")(setq LTYP "E1500"))
  91.      ((= SIZE$ "225mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E225")(setq LTYP "E1500"))      
  92.      ((= SIZE$ "150mm")(setq SIZE$ "Existing_Drainage_Storm_Sewer_Concrete_E150")(setq LTYP "E1500"))
  93.    )
  94. )
  95. (setq SIZE SIZE$)
  96. (ESS_OUTPUT)
  97. (princ)
  98. )
  99. ;
  100. ;//////////////////////////////////////////////////////////////////////////
  101. ;
  102. ; ESS_OUTPUT Function
  103. ;
  104. (defun ESS_OUTPUT ()
  105. (setq a (strcat "CCC_DR_"LTYP)
  106.        b (strcat "CCC_SERVICES_"SIZE)
  107. )
  108. (if
  109.    (not
  110.      (tblsearch "LTYPE" a)
  111.    )
  112.    (command "_.-linetype" "_l" a "CCC_Drainage_Existing Storm.lin" "")
  113. )
  114. (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" )
  115. (command "_-color"  "bylayer")
  116. (command "._-linetype"  "s"  "bylayer" "")
  117. (setvar "angbase" 0.0000)
  118. (setvar "cmdecho" 1)
  119. (setvar "angdir"  0)
  120. (setvar "clayer" b)
  121. (setvar "orthomode" 0)
  122. (setvar "osmode"    16383)
  123. (setvar "angbase" 0.0000)
  124. (command "_.-layer" "_S" b "")
  125. ;(setvar "plinegen" 1)
  126. (command "._pline")
  127.   (setvar "osmode" 16383)
  128. (setq *error* temperr)
  129. (setvar "cmdecho" SUCE)
  130. (setvar "orthomode" SUOM)
  131. (setvar "osmode" SUSM)
  132. (setvar "angbase" SUAB)
  133. (setvar "angdir" SUAD)
  134. (setvar "clayer" SUCL)
  135. (setvar "cecolor" SUCR)
  136. (princ)
  137. )
  138. ;
  139. ;//////////////////////////////////////////////////////////////////////////
  140. ;
  141. ; Error Trap Function
  142. ;
  143. (defun ESS_ETRAP (errmsg)
  144. (command nil nil nil)
  145. (if
  146.    (not
  147.      (member errmsg '("console break" "Function Cancelled"))
  148.    )
  149.    (princ (strcat "\nError:" errmsg))
  150. )
  151. (setvar "cmdecho"   SUCE)
  152. (setvar "orthomode" SUOM)
  153. (setvar "osmode"    SUSM)
  154. (setvar "angbase"   SUAB)
  155. (setvar "angdir"    SUAD)
  156. (princ "\nError, Restoring ESS_VARIABLEs.")
  157. (terpri)
  158. (setq *error* temperr)
  159. (princ)
  160. )
  161. ;
  162. ;//////////////////////////////////////////////////////////////////////////

 
以下是end命令的转储,其中包含错误:
  1. Current layer:  "CCC_SERVICES_Existing_Drainage_Storm_Sewer_Concrete_E1500"
  2. Enter an option
  3. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  4. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _S
  5. Enter layer name to make current or <select object>:
  6. CCC_SERVICES_Existing_Drainage_Storm_Sewer_Concrete_E1500 Enter an option
  7. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  8. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
  9. Command: ._pline
  10. Specify start point:[color="red"] AutoCAD variable setting rejected: "cmdecho" nil[/color]
  11. Specify start point:
  12. Current line-width is 0.000
  13. Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
  14. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  15. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  16. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:

 
如果有人能帮我解决这个错误,我将不胜感激。
 
谢谢
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-5 23:25:40 | 显示全部楼层
有些变量两次本地化,因此atempt无法恢复环境:
  1. (defun ESS_MF (/ SIZE$ SIZE MIDPT PLEN PT01  PT02 a b COLR [color=red][s]SUCE SUOM SUSM SUAB SUAD SUCL SUCR[/s][/color])

 
你希望用这段代码实现什么?允许用户交互绘制多段线?
  1. (command "._pline")
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-5 23:30:51 | 显示全部楼层
对让用户绘制多段线并在完成时重置系统变量。这是一个稍有不同的代码版本,但它在pline命令后爆炸,并且不会重置系统变量。有人能帮忙吗?
 
  1. ;//////////////////////////////////////////////////////////////////////////
  2. ;
  3. ; Start-Up Function
  4. ;
  5. (defun C:PRWMDIA (/ HOLE$ SIZE$ HOLE SIZE PT01 PT02 a b lw DEGREES RADIANS)
  6. (PRWMDIA_SAVE)
  7. (princ))
  8. ;
  9. ;//////////////////////////////////////////////////////////////////////////
  10. ;
  11. ; Save User Settings Function.
  12. ;
  13. (defun PRWMDIA_SAVE (/ SUS SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
  14. (setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
  15. (setq TERR$ *error*)
  16. (setq *error* PRWMDIA_ETRAP)
  17. (PRWMDIA_MF)
  18. (princ))
  19. ;
  20. ;//////////////////////////////////////////////////////////////////////////
  21. ;
  22. ; Main Function
  23. ;
  24. (defun PRWMDIA_MF ()
  25. (setq T1_list '("Type A" "Type B"))
  26. (setq S1_list '("300mm" "250mm" "200mm" "150mm" "100mm"))
  27. (setq dcl_id (load_dialog "PRWMDIA.dcl"))
  28. (if (not (new_dialog "PRWMDIA" dcl_id))
  29.    (progn (ALERT "Can not find your dcl file")
  30.      (exit)))
  31. (start_list "T1")
  32. (mapcar 'add_list T1_list)
  33. (end_list)
  34. (start_list "S1")
  35. (mapcar 'add_list S1_list)
  36. (end_list)
  37. (if HOLE:DEF (set_tile "T1" (itoa HOLE:DEF)))
  38. (if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
  39. (action_tile "cancel" "(done_dialog)(setq userclick nil)")
  40. (action_tile "accept"
  41.    (strcat
  42.     "(progn
  43.      (setq H:OLE (atoi (get_tile "T1")) HOLE:DEF H:OLE)"
  44.     "(setq S:IZE (atoi (get_tile "S1")) SIZE:DEF S:IZE)"
  45.     "(done_dialog)(setq userclick T))"))
  46. (start_dialog)
  47. (unload_dialog dcl_id)
  48. (if userclick
  49.    (PRWMDIA_VARIABLE))
  50. (princ))
  51. ;
  52. ;//////////////////////////////////////////////////////////////////////////
  53. ;
  54. ; PRWMDIA_VARIABLE Function
  55. ;
  56. (defun PRWMDIA_VARIABLE ()
  57. (progn
  58.    (setq HOLE$ (fix H:OLE))
  59.    (setq HOLE$ (nth H:OLE T1_list))
  60.    (cond
  61.      ((= HOLE$ "Type A"))
  62.      ((= HOLE$ "Type B"))))
  63. (setq HOLE HOLE$)
  64. (progn
  65.    (setq SIZE$ (fix S:IZE))
  66.    (setq SIZE$ (nth S:IZE S1_list))
  67.    (cond
  68.      ((= SIZE$  "300mm")(setq SIZE$  "300D"))
  69.      ((= SIZE$  "250mm")(setq SIZE$  "250D"))
  70.      ((= SIZE$  "200mm")(setq SIZE$  "200D"))
  71.      ((= SIZE$  "150mm")(setq SIZE$  "150D"))
  72.      ((= SIZE$  "100mm")(setq SIZE$  "100D"))))
  73. (setq SIZE SIZE$)
  74. (PRWMDIA_OUTPUT)
  75. (princ))
  76. ;
  77. ;//////////////////////////////////////////////////////////////////////////
  78. ;
  79. ; PRWMDIA_OUTPUT Function
  80. ;
  81. (defun PRWMDIA_OUTPUT ()
  82. (if (null (tblsearch "STYLE" "CCC_Services"))
  83.    (entmake
  84.      (list
  85.        (cons 0 "STYLE")
  86.        (cons 100 "AcDbSymbolTableRecord")
  87.        (cons 100 "AcDbTextStyleTableRecord")
  88.        (cons 2 "CCC_Services")
  89.        (cons 3 "Verdana.ttf")
  90.        (cons 40 0)
  91.        (cons 70 0))))
  92. (setq a  (strcat "CCC_WM_"SIZE"_"HOLE)
  93.        b  (strcat "CCC_SERVICES_PROPOSED_Watermain_Ductile_Iron_"SIZE"_"HOLE)
  94.        lw 30)
  95. (if (null (tblsearch "LTYPE" a))
  96.    (command "_.-linetype" "_l" a "CCC_Watermain_DI.lin" ""))
  97. (if (null (tblsearch "LAYER" b))
  98. (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "30" b "_LW" "0.3" b "" ))
  99. (command "_-color"  "bylayer")
  100. (command "._-linetype"  "s"  "bylayer" "")   
  101. (setvar "cmdecho" 0)
  102. (setvar "angbase" 0.0000)
  103. (setvar "angdir"  0)
  104. (setvar "orthomode" 0)
  105. (setvar "osmode"    16383)
  106. (command "_.-layer" "_S" b "")
  107. (setvar "plinegen" 1)
  108. (command "._pline")
  109. (PRWMDIA_RESTORE)
  110. (princ))
  111. ;
  112. ;//////////////////////////////////////////////////////////////////////////
  113. ;
  114. ; Degrees to Radians Function
  115. ;
  116. (defun PRWMDIA_DTR (DEGREES)
  117. (* pi (/ DEGREES 180.0)))
  118. ;
  119. ;//////////////////////////////////////////////////////////////////////////
  120. ;
  121. ; Radians to Degrees Function
  122. ;
  123. (defun PRWMDIA_RTD (RADIANS)
  124. (* 180.0 (/ RADIANS pi)))
  125. ;
  126. ;//////////////////////////////////////////////////////////////////////////
  127. ;
  128. ; Restore User Settings Function.
  129. ;
  130. (defun PRWMDIA_RESTORE ()
  131. (setq *error* TERR$)
  132. (if SUS (mapcar 'setvar SUS_LIST SUS))
  133. (princ "\nProgram completed and will now restore the user settings and exit.")
  134. (princ))
  135. ;
  136. ;/////////////////////////////////////////////////////////////////////////////
  137. ;
  138. ; Error Trap Function.
  139. ;
  140. (defun PRWMDIA_ETRAP (ERRORMSG)
  141. (command nil nil nil)
  142. (if (not (member ERRORMSG '("console break" "Function cancelled")))
  143.    (princ (strcat "\nError:" ERRORMSG)))
  144. (if SUS (mapcar 'setvar SUS_LIST SUS))
  145. (princ "\nAn *error* has occured!")
  146. (princ "\nThe program will now restore the user settings and exit.")
  147. (terpri)
  148. (setq *error* TERR$)
  149. (princ))
  150. ;
  151. ;//////////////////////////////////////////////////////////////////////////
回复

使用道具 举报

4

主题

194

帖子

192

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 23:36:03 | 显示全部楼层
伍德曼78,
 
这些条件语句是螺母,每个(第一个示例和第二个示例)只需要1行代码。
  1. (setq SIZE$ (strcat "Existing_Drainage_Storm_Sewer_Concrete_E" (itoa(atoi SIZE$)))
  2.      LTYP "E1500")
  3. )

 
 
  1. (setq  SIZE$ (strcat (itoa(atoi SIZE$)) "D"))

 
布鲁斯
回复

使用道具 举报

4

主题

194

帖子

192

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 23:40:16 | 显示全部楼层
在运行函数之前,似乎没有在SUS变量列表中定义系统变量值,因此没有保存任何原始系统设置。您定义了系统设置列表“SUS_list”,以更改但不更改其原始值。您应该在定义系统设置列表的同时定义SUS变量。
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-5 23:44:55 | 显示全部楼层
谢谢斯诺努特。如何定义SUS变量。
回复

使用道具 举报

4

主题

194

帖子

192

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 23:50:50 | 显示全部楼层
用当前函数替换现有函数。
 
我没有测试任何东西,只是看到了这个错误。
 
  1. (defun PRWMDIA_SAVE (/  SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
  2.    (setq SUS_list '(cmdecho orthomode osmode blipmode clayer angbase angdir cecolor)
  3.          SUS       (mapcar 'getvar SUS_list)
  4.          TERR$ *error*
  5.          *error* PRWMDIA_ETRAP
  6.          )
  7.      (PRWMDIA_MF)
  8.      (princ)
  9.    )

 
然后,要重置系统变量,您需要使用它。
 
  1.    (mapcar 'setvar SUS_list SUS)
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-5 23:58:10 | 显示全部楼层
谢谢Snownut,
 
我做了这些更改,但系统变量仍然没有重置:
 
  1. ;//////////////////////////////////////////////////////////////////////////
  2. ;
  3. ; Start-Up Function
  4. ;
  5. (defun C:PRWMDIA (/ HOLE$ SIZE$ HOLE SIZE PT01 PT02 a b lw DEGREES RADIANS)
  6. (PRWMDIA_SAVE)
  7. (princ))
  8. ;
  9. ;//////////////////////////////////////////////////////////////////////////
  10. ;
  11. ; Save User Settings Function.
  12. ;
  13. (defun PRWMDIA_SAVE (/ SUS SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
  14. ;(setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
  15. ;(setq TERR$ *error*)
  16. ;(setq *error* PRWMDIA_ETRAP)
  17. [color="red"]    (setq SUS_list '(cmdecho orthomode osmode blipmode clayer angbase angdir cecolor))
  18.          SUS       (mapcar 'getvar SUS_list)
  19.          TERR$ *error*
  20.          *error* PRWMDIA_ETRAP[/color]
  21. (PRWMDIA_MF)
  22. (princ))
  23. ;
  24. ;//////////////////////////////////////////////////////////////////////////
  25. ;
  26. ; Main Function
  27. ;
  28. (defun PRWMDIA_MF ()
  29. (setq T1_list '("Type A" "Type B"))
  30. (setq S1_list '("300mm" "250mm" "200mm" "150mm" "100mm"))
  31. (setq dcl_id (load_dialog "PRWMDIA.dcl"))
  32. (if (not (new_dialog "PRWMDIA" dcl_id))
  33.    (progn (ALERT "Can not find your dcl file")
  34.      (exit)))
  35. (start_list "T1")
  36. (mapcar 'add_list T1_list)
  37. (end_list)
  38. (start_list "S1")
  39. (mapcar 'add_list S1_list)
  40. (end_list)
  41. (if HOLE:DEF (set_tile "T1" (itoa HOLE:DEF)))
  42. (if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
  43. (action_tile "cancel" "(done_dialog)(setq userclick nil)")
  44. (action_tile "accept"
  45.    (strcat
  46.     "(progn
  47.      (setq H:OLE (atoi (get_tile "T1")) HOLE:DEF H:OLE)"
  48.     "(setq S:IZE (atoi (get_tile "S1")) SIZE:DEF S:IZE)"
  49.     "(done_dialog)(setq userclick T))"))
  50. (start_dialog)
  51. (unload_dialog dcl_id)
  52. (if userclick
  53.    (PRWMDIA_VARIABLE))
  54. (princ))
  55. ;
  56. ;//////////////////////////////////////////////////////////////////////////
  57. ;
  58. ; PRWMDIA_VARIABLE Function
  59. ;
  60. (defun PRWMDIA_VARIABLE ()
  61. (progn
  62.    (setq HOLE$ (fix H:OLE))
  63.    (setq HOLE$ (nth H:OLE T1_list))
  64.    (cond
  65.      ((= HOLE$ "Type A"))
  66.      ((= HOLE$ "Type B"))))
  67. (setq HOLE HOLE$)
  68. (progn
  69.    (setq SIZE$ (fix S:IZE))
  70.    (setq SIZE$ (nth S:IZE S1_list))
  71.    (cond
  72.      ((= SIZE$  "300mm")(setq SIZE$  "300D"))
  73.      ((= SIZE$  "250mm")(setq SIZE$  "250D"))
  74.      ((= SIZE$  "200mm")(setq SIZE$  "200D"))
  75.      ((= SIZE$  "150mm")(setq SIZE$  "150D"))
  76.      ((= SIZE$  "100mm")(setq SIZE$  "100D"))))
  77. (setq SIZE SIZE$)
  78. (PRWMDIA_OUTPUT)
  79. (princ))
  80. ;
  81. ;//////////////////////////////////////////////////////////////////////////
  82. ;
  83. ; PRWMDIA_OUTPUT Function
  84. ;
  85. (defun PRWMDIA_OUTPUT ()
  86. (if (null (tblsearch "STYLE" "CCC_Services"))
  87.    (entmake
  88.      (list
  89.        (cons 0 "STYLE")
  90.        (cons 100 "AcDbSymbolTableRecord")
  91.        (cons 100 "AcDbTextStyleTableRecord")
  92.        (cons 2 "CCC_Services")
  93.        (cons 3 "Verdana.ttf")
  94.        (cons 40 0)
  95.        (cons 70 0))))
  96. (setq a  (strcat "CCC_WM_"SIZE"_"HOLE)
  97.        b  (strcat "CCC_SERVICES_PROPOSED_Watermain_Ductile_Iron_"SIZE"_"HOLE)
  98.        lw 30)
  99. (if (null (tblsearch "LTYPE" a))
  100.    (command "_.-linetype" "_l" a "CCC_Watermain_DI.lin" ""))
  101. (if (null (tblsearch "LAYER" b))
  102. (command "_.-layer" "_N" b "_M" b "_L" a b "_C" "30" b "_LW" "0.3" b "" ))
  103. (command "_-color"  "bylayer")
  104. (command "._-linetype"  "s"  "bylayer" "")   
  105. (setvar "cmdecho" 0)
  106. (setvar "angbase" 0.0000)
  107. (setvar "angdir"  0)
  108. (setvar "orthomode" 0)
  109. (setvar "osmode"    16383)
  110. (command "_.-layer" "_S" b "")
  111. (setvar "plinegen" 1)
  112. (command "._pline")
  113. (PRWMDIA_RESTORE)
  114. (princ))
  115. ;
  116. ;//////////////////////////////////////////////////////////////////////////
  117. ;
  118. ; Degrees to Radians Function
  119. ;
  120. (defun PRWMDIA_DTR (DEGREES)
  121. (* pi (/ DEGREES 180.0)))
  122. ;
  123. ;//////////////////////////////////////////////////////////////////////////
  124. ;
  125. ; Radians to Degrees Function
  126. ;
  127. (defun PRWMDIA_RTD (RADIANS)
  128. (* 180.0 (/ RADIANS pi)))
  129. ;
  130. ;//////////////////////////////////////////////////////////////////////////
  131. ;
  132. ; Restore User Settings Function.
  133. ;
  134. (defun PRWMDIA_RESTORE ()
  135. (setq *error* TERR$)
  136. [color="red"]  (mapcar 'setvar SUS_LIST SUS)[/color]
  137. (princ "\nProgram completed and will now restore the user settings and exit.")
  138. (princ))
  139. ;
  140. ;/////////////////////////////////////////////////////////////////////////////
  141. ;
  142. ; Error Trap Function.
  143. ;
  144. (defun PRWMDIA_ETRAP (ERRORMSG)
  145. (command nil nil nil)
  146. (if (not (member ERRORMSG '("console break" "Function cancelled")))
  147.    (princ (strcat "\nError:" ERRORMSG)))
  148. (if SUS (mapcar 'setvar SUS_LIST SUS))
  149. (princ "\nAn *error* has occured!")
  150. (princ "\nThe program will now restore the user settings and exit.")
  151. (terpri)
  152. (setq *error* TERR$)
  153. (princ))
  154. ;
  155. ;//////////////////////////////////////////////////////////////////////////

 
我在运行命令后查看了命令行转储,看起来程序似乎在运行pline命令之前完成。
  1. Enter name list of layers(s) for lineweight 0.30mm
  2. <CCC_SERVICES_PROPOSED_Watermain_Ductile_Iron_300D_Type A>:
  3. CCC_SERVICES_PROPOSED_Watermain_Ductile_Iron_300D_Type A Enter an option
  4. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
  5. eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
  6. Command: _-color
  7. Enter default object color [Truecolor/COlorbook] <BYLAYER>: bylayer
  8. Command: ._-linetype
  9. Current line type:  "ByLayer"
  10. Enter an option [?/Create/Load/Set]: s
  11. Specify linetype name or [?] <ByLayer>: bylayer
  12. Enter an option [?/Create/Load/Set]:
  13. Command:
  14. Program completed and will now restore the user settings and exit.
  15. Specify start point:
  16. Current line-width is 0.000
  17. Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
  18. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  19. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
  20. Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:

 
再次感谢您的帮助。谢谢
回复

使用道具 举报

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 00:01:33 | 显示全部楼层
如果有人能帮我,我将不胜感激!
回复

使用道具 举报

4

主题

194

帖子

192

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 00:09:47 | 显示全部楼层
伍德曼78,
 
右括号放错了地方。
 
应该是;
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 00:09 , Processed in 0.714668 second(s), 72 queries .

© 2020-2025 乐筑天下

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