woodman78 发表于 2022-7-6 11:24:56

Lisp赢得#039;t运行

Buzzard在过去的一段时间里一直在帮我做这些事情。我做了一些修改。有人能告诉我为什么这个不能运行吗?
字母S。lsp
字母S。dcl
CCC_排水。txt文件

The Buzzard 发表于 2022-7-6 11:36:39

伍德曼78,
 
如图所示,在红色标记之间留出空间:
 


You have this:
(defun C:ESS (/SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)

You should have this:
(defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)

The Buzzard 发表于 2022-7-6 11:43:03

此外,当您使用时:
这是放置在变量SUS中的列表。
为什么其他变量名都没有被使用呢。

Change this:
(defun ESS_SAVE (/ SUS SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
To this:
(defun ESS_SAVE (/ SUS)

 
不要重新发明轮子。

The Buzzard 发表于 2022-7-6 11:57:54

再一次
 
添加此选项,以便在取消时恢复变量。
 

(action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")

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

The Buzzard 发表于 2022-7-6 12:00:00

我进一步检查,发现了另一个问题。
变量后面有一个引号。
 

These quotes need to be removed, Its a variable.
(setq a(strcat "CCC_DR_"SIZE")
       b(strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE")
       lw 30)

 
这些已不在程序中。

Remove this:
(defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw DEGREES RADIANS)
 
 
我还想指出,由于您使用的是ACAD 2010,而且在我看来,您有早期版本中未使用的变量或命令,因此我能够为您测试的数量将受到限制。
我想,我不太确定我是否捕捉到了所有内容,但对我来说似乎没问题,尽管线型中的文本没有
似乎正在展示。你必须告诉我这件事。
 
 
这是lisp以及前面提到的所有更改。
看起来你打破了这里的记录。

;//////////////////////////////////////////////////////////////////////////
;
; Start-Up Function
;
(defun C:ESS (/ SIZE$ SIZE PT01 PT02 a b lw)
(ESS_SAVE)
(princ))
;
;//////////////////////////////////////////////////////////////////////////
;
; Save User Settings Function.
;
(defun ESS_SAVE (/ SUS)
(setq SUS_LIST (list "cmdecho" "orthomode" "osmode" "blipmode" "clayer" "angbase" "angdir" "cecolor"))
(setq TERR$ *error*)
(setq *error* ESS_ETRAP)
(ESS_MF)
(princ))
;
;//////////////////////////////////////////////////////////////////////////
;
; Main Function
;
(defun ESS_MF ()
(or S:SIZE (setq S:IZE 0))
(setq S1_list '( "1500mm""1350mm" "1200mm" "1050mm" "900mm" "750mm" "675mm" "600mm" "525mm" "450mm" "375mm" "300mm" "225mm" "150mm"))
(setq dcl_id (load_dialog "ESS.dcl"))
(if (not (new_dialog "ESS" dcl_id))
   (progn (ALERT "Can not find your dcl file")
   (exit)))
(start_list "S1")
(mapcar 'add_list S1_list)
(end_list)
(if SIZE:DEF (set_tile "S1" (itoa SIZE:DEF)))
(action_tile "cancel" "(done_dialog)(setq userclick nil)(ESS_RESTORE)")
(action_tile "accept"
   (strcat
    "(progn
   (setq S:IZE (atoi (get_tile \"S1\")) SIZE:DEF S:IZE)"
    "(done_dialog)(setq userclick T))"))
(start_dialog)
(unload_dialog dcl_id)
(if userclick
   (ESS_VARIABLE))
(princ))
;
;//////////////////////////////////////////////////////////////////////////
;
; ESS_VARIABLE Function
;
(defun ESS_VARIABLE ()
(progn
   (setq SIZE$ (fix S:IZE))
   (setq SIZE$ (nth S:IZE S1_list))
   (cond
   ((= SIZE$ "1500mm")(setq SIZE$ "1500"))
   ((= SIZE$ "1350mm")(setq SIZE$ "1350"))
   ((= SIZE$ "1200mm")(setq SIZE$ "1200"))
   ((= SIZE$ "1050mm")(setq SIZE$ "1050"))
   ((= SIZE$"900mm")(setq SIZE$"900"))
   ((= SIZE$"750mm")(setq SIZE$"750"))
   ((= SIZE$"675mm")(setq SIZE$"675"))
   ((= SIZE$"600mm")(setq SIZE$"600"))
   ((= SIZE$"525mm")(setq SIZE$"525"))
   ((= SIZE$"450mm")(setq SIZE$"450"))
   ((= SIZE$"375mm")(setq SIZE$"375"))
   ((= SIZE$"300mm")(setq SIZE$"300"))
   ((= SIZE$"225mm")(setq SIZE$"225"))
   ((= SIZE$"150mm")(setq SIZE$"150"))))
(setq SIZE SIZE$)
(ESS_OUTPUT)
(princ))
;
;//////////////////////////////////////////////////////////////////////////
;
; ESS_OUTPUT Function
;
(defun ESS_OUTPUT ()
(if (null (tblsearch "STYLE" "CCC_Services"))
   (entmake
   (list
       (cons 0 "STYLE")
       (cons 100 "AcDbSymbolTableRecord")
       (cons 100 "AcDbTextStyleTableRecord")
       (cons 2 "CCC_Services")
       (cons 3 "Verdana.ttf")
       (cons 40 0)
       (cons 70 0))))
(setq a(strcat "CCC_DR_"SIZE)
       b(strcat "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_Concrete_"SIZE)
       lw 30)
(if (null (tblsearch "LTYPE" a))
   (command "_.-linetype" "_l" a "CCC_Drainage.lin" ""))
(if (null (tblsearch "LAYER" b))
(command "_.-layer" "_N" b "_M" b "_L" a b "_C" "84" b "_LW" "0.3" b "" ))
(command "_-color""bylayer")
(command "._-linetype""s""bylayer" "")   
(setvar "cmdecho" 0)
(setvar "angbase" 0.0000)
(setvar "angdir"0)
(setvar "orthomode" 0)
(setvar "osmode"    16383)
(command "_.-layer" "_S" b "")
(setvar "plinegen" 1)
(command "._pline")
(ESS_RESTORE)
(princ))
;
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun ESS_DTR (DEGREES)
(* pi (/ DEGREES 180.0)))
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun ESS_RTD (RADIANS)
(* 180.0 (/ RADIANS pi)))
;
;//////////////////////////////////////////////////////////////////////////
;
; Restore User Settings Function.
;
(defun ESS_RESTORE ()
(setq *error* TERR$)
(if SUS (mapcar 'setvar SUS_LIST SUS))
(princ "\nProgram completed and will now restore the user settings and exit.")
(princ))
;
;/////////////////////////////////////////////////////////////////////////////
;
; Error Trap Function.
;
(defun ESS_ETRAP (ERRORMSG)
(command nil nil nil)
(if (not (member ERRORMSG '("console break" "Function cancelled")))
   (princ (strcat "\nError:" ERRORMSG)))
(if SUS (mapcar 'setvar SUS_LIST SUS))
(princ "\nAn *error* has occured!")
(princ "\nThe program will now restore the user settings and exit.")
(terpri)
(setq *error* TERR$)
(princ))
;
;//////////////////////////////////////////////////////////////////////////

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

dober 发表于 2022-7-6 12:15:50

 
超级Lisp程序
 
但如果我们能为每个层指定自己的颜色,那就太好了。

woodman78 发表于 2022-7-6 12:16:52

谢谢Buzzard,此lisp的线型中没有文本。在其他一些地方,它工作得很好。
 
再次感谢

The Buzzard 发表于 2022-7-6 12:25:49

这很好,但我忘了删除度到弧度和弧度到度函数,因为它们没有被使用。如果你有机会,就把他们干掉。
 
当你有时间的时候,把它去掉。
;//////////////////////////////////////////////////////////////////////////
;
; Degrees to Radians Function
;
(defun ESS_DTR (DEGREES)
(* pi (/ DEGREES 180.0)))
;
;//////////////////////////////////////////////////////////////////////////
;
; Radians to Degrees Function
;
(defun ESS_RTD (RADIANS)
(* 180.0 (/ RADIANS pi)))
;
;//////////////////////////////////////////////////////////////////////////
页: [1]
查看完整版本: Lisp赢得#039;t运行