wipo 发表于 2022-7-5 19:59:55

需要木材lisp R的帮助

我有几个lisp例程,我以前在我以前的工作中使用过。我试图在我的新工作站加载它们,但当我在命令行中键入时,它会告诉我
; 错误:没有函数定义:$START需要做什么才能使其工作。Thx提前。
 

(defun C:LUMBER ()LUMBER
($start)
(setq lay (getvar "clayer"))
($setvar "clayer" lay)
(defun D90 () (* pi 0.5))
(defun D270 () (* pi 1.5))
(setq OLD_ERR *error*
*error* STLP:ERR
)
($setvar "cmdecho" 0)
(if set2layr
   (set2layr "S-DETL-WOOD" "S")
)
(if (not L_THK)
   (setq L_THK 2.0)
)
(if (not L_DEP)
   (setq L_DEP 4.0)
)
(if (not LL_THK)
   (setq LL_THK 2.0)
)
(if (not LL_DEP)
   (setq LL_DEP 2.0)
)
(if (not LR_THK)
   (setq LR_THK 2.0)
)
(if (not LR_DEP)
   (setq LR_DEP 2.0)
)
(if (not TOG_LVIEW)
   (setq TOG_LVIEW 2)
)
(if (not TOG_MTYPE)
   (setq TOG_MTYPE 2)
)
(if (not TOG_DTYPE)
   (setq TOG_DTYPE 0)
)
(if (not TOG_LLEFT)
   (setq TOG_LLEFT 0)
)
(if (not TOG_LRIGHT)
   (setq TOG_LRIGHT 0)
)
(if (not LUM_GAP)
   (setq LUM_GAP 0.0)
)
(setq dcl_id (load_dialog "lumber.dcl"))
(if (not (new_dialog "lumber" dcl_id))
   (exit)
)
(set_tile "edt_thk" (rtos L_THK 4 4))
(set_tile "edt_dep" (rtos L_DEP 4 4))
(set_tile "edt_gap" (rtos LUM_GAP 4 4))
(if (= TOG_LLEFT 1)
   (set_tile "tog_lleft" "2")
)
(if (= TOG_LRIGHT 1)
   (set_tile "tog_lright" "2")
   ($finish)
)
(defun SET:VIEW (VW)
   (cond
   ((= VW 1)
      (mode_tile "rad_mb2" 1)
      (mode_tile "rad_mb3" 1)
      (mode_tile "rad_mb4" 1)
      (mode_tile "rad_sgl" 1)
      (setq TOG_MTYPE 1)
      (set_tile "rad_mb1" "2")
      (if (= TOG_DTYPE 0)
(progn
   (setq TOG_DTYPE 1)
   (set_tile "rad_dbl" "2")
)
      )
   )
   ((= VW 2)
      (mode_tile "rad_mb2" 0)
      (mode_tile "rad_mb3" 0)
      (mode_tile "rad_mb4" 0)
      (mode_tile "rad_sgl" 1)
      (if (= TOG_DTYPE 0)
(progn
   (setq TOG_DTYPE 1)
   (set_tile "rad_dbl" "2")
)
      )
   )
   (T
      (mode_tile "rad_mb2" 0)
      (mode_tile "rad_mb3" 0)
      (mode_tile "rad_mb4" 0)
      (mode_tile "rad_sgl" 0)
   )
   )
)
(cond
   ((= TOG_LVIEW 0) (set_tile "rad_thk" "2"))
   ((= TOG_LVIEW 1) (set_tile "rad_dep" "2"))
   ((= TOG_LVIEW 2) (set_tile "rad_sec" "2"))
)
(cond
   ((= TOG_MTYPE 1) (set_tile "rad_mb1" "2"))
   ((= TOG_MTYPE 2) (set_tile "rad_mb2" "2"))
   ((= TOG_MTYPE 3) (set_tile "rad_mb3" "2"))
   ((= TOG_MTYPE 4) (set_tile "rad_mb4" "2"))
)
(SET:VIEW TOG_LVIEW)
(cond
   ((= TOG_DTYPE 0) (set_tile "rad_sgl" "2"))
   ((= TOG_DTYPE 1) (set_tile "rad_dbl" "2"))
   ((= TOG_DTYPE 2) (set_tile "rad_tpl" "2"))
)
(defun CK:LLEFT ()
   (if (= TOG_LLEFT 1)
   (progn
(mode_tile "edt_lthk" 0)
(mode_tile "edt_ldep" 0)
   )
   (progn
(mode_tile "edt_lthk" 1)
(mode_tile "edt_ldep" 1)
   )
   )
   (set_tile "edt_lthk" (rtos LL_THK 4 4))
   (set_tile "edt_ldep" (rtos LL_DEP 4 4))
)
(defun CK:LRIGHT ()
   (if (= TOG_LRIGHT 1)
   (progn
(mode_tile "edt_rthk" 0)
(mode_tile "edt_rdep" 0)
   )
   (progn
(mode_tile "edt_rthk" 1)
(mode_tile "edt_rdep" 1)
   )
   )
   (set_tile "edt_rthk" (rtos LR_THK 4 4))
   (set_tile "edt_rdep" (rtos LR_DEP 4 4))
)
(CK:LLEFT)
(CK:LRIGHT)
(action_tile "edt_thk" "(setq L_THK (distof $value))")
(action_tile "edt_dep" "(setq L_DEP (distof $value))")
(action_tile
   "tog_lleft"
   "(setq TOG_LLEFT (atoi $value)) (CK:LLEFT)"
)
(action_tile "edt_lthk" "(setq LL_THK (distof $value))")
(action_tile "edt_ldep" "(setq LL_DEP (distof $value))")
(action_tile
   "tog_lright"
   "(setq TOG_LRIGHT (atoi $value)) (CK:LRIGHT)"
)
(action_tile "edt_rthk" "(setq LR_THK (distof $value))")
(action_tile "edt_rdep" "(setq LR_DEP (distof $value))")
(action_tile "rad_thk" "(setq TOG_LVIEW 0) (SET:VIEW 0)")
(action_tile "rad_dep" "(setq TOG_LVIEW 1) (SET:VIEW 1)")
(action_tile "rad_sec" "(setq TOG_LVIEW 2) (SET:VIEW 2)")
(action_tile "rad_mb1" "(setq TOG_MTYPE 1)")
(action_tile "rad_mb2" "(setq TOG_MTYPE 2)")
(action_tile "rad_mb3" "(setq TOG_MTYPE 3)")
(action_tile "rad_mb4" "(setq TOG_MTYPE 4)")
(action_tile "edt_gap" "(setq LUM_GAP (distof $value))")
(action_tile "rad_sgl" "(setq TOG_DTYPE 0)")
(action_tile "rad_dbl" "(setq TOG_DTYPE 1)")
(action_tile "rad_tpl" "(setq TOG_DTYPE 2)")
(action_tile "accept" "(done_dialog 4)")
(action_tile "cancel" "(done_dialog 0)")
(setq DO_NEXT (start_dialog))
(if (= DO_NEXT 4)
   (progn
;;; Set finished size
   (if (> 7.0 L_THK)
(setq L_THK1 (- L_THK 0.5))
(setq L_THK1 (- L_THK 0.75))
   )
   (if (> 7.0 L_DEP)
(setq L_DEP1 (- L_DEP 0.5))
(setq L_DEP1 (- L_DEP 0.75))
   )
   (if (> 7.0 LL_THK)
(setq LL_THK1 (- LL_THK 0.5))
(setq LL_THK1 (- LL_THK 0.75))
   )
   (if (> 7.0 LL_DEP)
(setq LL_DEP1 (- LL_DEP 0.5))
(setq LL_DEP1 (- LL_DEP 0.75))
   )
   (if (> 7.0 LR_THK)
(setq LR_THK1 (- LR_THK 0.5))
(setq LR_THK1 (- LR_THK 0.75))
   )
   (if (> 7.0 LR_DEP)
(setq LR_DEP1 (- LR_DEP 0.5))
(setq LR_DEP1 (- LR_DEP 0.75))
   )
   (cond
((= TOG_LVIEW 0)
;;;Plan on thickness
(cond
   ((= TOG_DTYPE 0) (LMB:THICK1))
   ((= TOG_DTYPE 1) (LMB:THICK2))
   ((= TOG_DTYPE 2) (LMB:THICK3))
)
)
((= TOG_LVIEW 1)
;;;Plan on Depth
(cond
   ((= TOG_DTYPE 0) (LMB:DEPTH1))
   ((= TOG_DTYPE 1) (LMB:DEPTH2))
   ((= TOG_DTYPE 2) (LMB:DEPTH3))
)
)
((= TOG_LVIEW 2)
;;;Section
(cond
   ((= TOG_DTYPE 0) (LMB:SECT1))
   ((= TOG_DTYPE 1)
    (if (= TOG_LLEFT 1)
      (LMB:SECT2L)
      (LMB:SECT2)
    )
   )
   ((= TOG_DTYPE 2) (LMB:SECT3))
)
)
   )
   )
)
(princ)
)
;;; Single Line on Thickness
(defun LMB:THICK1 (/ PT1 PT2 PT3 PT4 D2)
(setq PT1 (getpoint "\nLeft Center Placement Point: "))
(setq PT2 (getpoint PT1 "\nLumber Length-Angle: "))
(setq ANG (angle PT1 PT2))
(command "._line" PT1 PT2 "")
(setq EL1 (entlast))
(setq D2 (+ L_THK1 LUM_GAP))
(cond
   ((= TOG_MTYPE 2)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
   )
   ((= TOG_MTYPE 3)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
   )
   ((= TOG_MTYPE 4)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 3))
    )
   )
)
)
;;; Double Line on Thickness
(defun LMB:THICK2 (/ PT1 PT2 PT3 PT4 D2)
(setq PT1 (getpoint "\nLower Left Placement Point: "))
(setq PT2 (getpoint PT1 "\nLumber Length-Angle: "))
(setq ANG (angle PT1 PT2))
(setq PT3 (polar PT2 (+ ANG (D90)) L_THK1)
PT4 (polar PT1 (+ ANG (D90)) L_THK1)
)
(command "._pline" PT1 "w" 0 0 PT2 PT3 PT4 "c")
(setq EL1 (entlast))
(setq D2 (+ L_THK1 LUM_GAP))
(cond
   ((= TOG_MTYPE 2)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
   )
   ((= TOG_MTYPE 3)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
   )
   ((= TOG_MTYPE 4)
    (command "._copy" EL1 "" PT1 (polar PT1 (+ ANG (D90)) D2))
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
    (command "._copy"
      EL1
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 3))
    )
   )
)
)
;;; Section Double Line
(defun LMB:SECT2 (/ PT1 PT2 PT3 PT4 D2)
(setq PT1 (getpoint "\nLower Left Placement Point: ")
ANG (getangle PT1 "\nRotation Angle: ")
PT2 (polar PT1 ANG L_DEP1)
PT3 (polar PT2 (+ ANG (D90)) L_THK1)
PT4 (polar PT1 (+ ANG (D90)) L_THK1)
)
(command "._pline" PT1 "w" 0 0 PT2 PT3 PT4 "c")
(setq EL1 (entlast))
(command "._line" PT1 PT3 "")
(setq EL2 (entlast))
(command "._line" PT2 PT4 "")
(setq EL3 (entlast))
(command "._change" EL2 EL3 "" "p" "c" "1" "")
(setq D2 (+ L_THK1 LUM_GAP))
(cond
   ((= TOG_MTYPE 2)
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) D2)
    )
   )
   ((= TOG_MTYPE 3)
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) D2)
    )
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
   )
   ((= TOG_MTYPE 4)
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) D2)
    )
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 2))
    )
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 (+ ANG (D90)) (* D2 3))
    )
   )
)
)
;;; Section Double Line w/Ledgers
(defun LMB:SECT2L (/ PT1 PT2 PT3 PT4 D2)
(setq PT1 (getpoint "\nLower Left Placement Point: "))
(setq ANG 0.0)
(setq PT2 (polar PT1 ANG LL_THK1))
(setq PT3 (polar PT2 (+ ANG (D90)) LL_DEP1))
(setq PT4 (polar PT1 (+ ANG (D90)) LL_DEP1))
(command "._pline" PT1 "w" 0 0 PT2 PT3 PT4 "c")
(command "._line" PT1 PT3 "")
(setq EL2 (entlast))
(command "._line" PT2 PT4 "")
(setq EL3 (entlast))
(command "._change" EL2 EL3 "" "p" "c" "1" "")
(setq PT1 PT2)
(setq PT2 (polar PT1 ANG L_THK1)
PT3 (polar PT2 (+ ANG (D90)) L_DEP1)
PT4 (polar PT1 (+ ANG (D90)) L_DEP1)
)
(command "._pline" PT1 PT2 PT3 PT4 "c")
(setq EL1 (entlast))
(command "._line" PT1 PT3 "")
(setq EL2 (entlast))
(command "._line" PT2 PT4 "")
(setq EL3 (entlast))
(command "._change" EL2 EL3 "" "p" "c" "1" "")
(setq D2 (+ L_THK1 LUM_GAP))
(cond
   ((= TOG_MTYPE 2)
    (command "._copy" EL1 EL2 EL3 "" PT1 (polar PT1 ANG D2))
    (setq PT1 (polar PT2 ANG D2))
   )
   ((= TOG_MTYPE 3)
    (command "._copy" EL1 EL2 EL3 "" PT1 (polar PT1 ANG D2))
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 ANG (* D2 2))
    )
    (setq PT1 (polar PT2 ANG (* D2 2)))
   )
   ((= TOG_MTYPE 4)
    (command "._copy" EL1 EL2 EL3 "" PT1 (polar PT1 ANG D2))
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 ANG (* D2 2))
    )
    (command "._copy"
      EL1
      EL2
      EL3
      ""
      PT1
      (polar PT1 ANG (* D2 3))
    )
    (setq PT1 (polar PT2 ANG (* D2 3)))
   )
)
(setq PT2 (polar PT1 ANG LR_THK1))
(setq PT3 (polar PT2 (+ ANG (D90)) LR_DEP1))
(setq PT4 (polar PT1 (+ ANG (D90)) LR_DEP1))
(command "._pline" PT1 "w" 0 0 PT2 PT3 PT4 "c")
(command "._line" PT1 PT3 "")
(setq EL2 (entlast))
(command "._line" PT2 PT4 "")
(setq EL3 (entlast))
(command "._change" EL2 EL3 "" "p" "c" "1" "")
)
;;; Double Line on Depth
(defun LMB:DEPTH2 (/ PT1 PT2 PT3 PT4)
(setq PT1 (getpoint "\nLower Left Placement Point: "))
(setq PT2 (getpoint PT1 "\nLumber Length-Angle: "))
(setq ANG (angle PT1 PT2))
(setq PT3 (polar PT2 (+ ANG (D90)) L_DEP1)
PT4 (polar PT1 (+ ANG (D90)) L_DEP1)
)
(command "._pline" PT1 "w" 0 0 PT2 PT3 PT4 "c")
(setq EL1 (entlast))
)

SLW210 发表于 2022-7-5 20:09:29

请阅读代码发布指南并编辑您的帖子,将代码包含在代码标签中。

BIGAL 发表于 2022-7-5 20:20:25

消息就是$start不存在,它可能存在于您的acaddoc中。lsp等,并在启动autocad时加载。你需要找到它。尝试($start)然后看看会发生什么

Dadgad 发表于 2022-7-5 20:29:06

 
SLW210也许这应该是一个粘性?
 
似乎几乎每一个这种类型的第一个帖子,你或其他管理员,或成员
需要提供此链接或澄清此说明。
当我最近想建议一个新手这一点时,我找不到它的链接。

Cad64 发表于 2022-7-5 20:30:12

这已经是一个棘手的问题:http://www.cadtutor.net/forum/forumdisplay.php?21-AutoLISP Visual LISP amp DCL
 
此外,lisp问题应张贴在论坛的Autolisp部分,这是该线程被移动的地方。

Dadgad 发表于 2022-7-5 20:38:41

 
Cad64,对了,现在我看到了,下次我会记得在哪里找到它的,谢谢。

SLW210 发表于 2022-7-5 20:52:09

 
我错过了,它在哪里?
 
通常,当我通过线程时首先检查。
 
所以我为你们修正了这个问题,wipo,添加代码标签并不是那么困难,只是
"YOUR CODE HERE"
 
编辑时,您也可以使用回复框右下角的“Go Advanced”,您将获得自动添加的#
然后复制并粘贴代码。

BIGAL 发表于 2022-7-5 20:53:02

也不确定这条线(defun C:木材()木材v(defun C:木材()
 
嘿,现在轮到你了。

neophoible 发表于 2022-7-5 21:05:42

还有,你有这个文件:“lumber.dcl”吗?例程也需要它来运行。
页: [1]
查看完整版本: 需要木材lisp R的帮助