微调误差
大家好,我创建了一个LISP,根据用户输入将各种块插入到图形中。
插入块后,需要修剪它们所在的线,使其不会与块本身重叠。
所有的块都有6个单位宽,因此我编写了LISP程序来创建一个圆,临时删除块,并修剪圆内的线。
然而,当CAD达到程序的这一阶段时,我不断收到返回的错误。
任何帮助都将不胜感激。
(defun c:valv (/ *error* oldVars varLst oldos oldlay vchx ln1 pt1 valvno ln1ent ang1 block1 c1)
(defun *error*(msg)
(if oldVars
(mapcar 'setvar varLstoldVars)
); end if
(princ "\nError or Esc pressed... Exit Program. ")
(princ)
); end of *error*
(setq varLst(list "CMDECHO" "OSMODE" "CLAYER" "DIMSCALE")
oldVars(mapcar 'getvar varLst)
); end setq
(setvar "cmdecho" 0)
(setq oldos (getvar "osmode"))
(setq oldlay (getvar "clayer"))
(initget 1 "Ball Butterfly Diaphragm Gate Globe")
(setq vchx (getkword "\nSpecify Valve Type : "))
(while
(and
(/= (setq ln1 (car (entsel "\nSelect Line for Valve: "))) nil)
(/= (setq pt1 (getpoint "\nSelect Point for Valve: ")) nil)
(/= (setq valvno (getstring "\nType Valve Number: ")) "")
) ; end and
(setq ln1ent (entget ln1))
(setq ang1
(angle
(cdr (assoc 10 ln1ent))
(cdr (assoc 11 ln1ent))
) ; end angle
) ; end setq
(setvar "clayer" "4")
(setvar "osmode" 0)
(cond
(
(= vchx "Gate")
(command "_.insert"
"C:\\Users\\Lee Mac\\Documents\\Valves\\GATE VALVE.dwg"
pt1
""
""
(rtd ang1)
valvno
) ; end insert
(setq block1 (entlast))
) ; end condition 1
(
(= vchx "Globe")
(command "_.insert"
"C:\\Users\\Lee Mac\\Documents\\Valves\\GLOBE VALVE.dwg"
pt1
""
""
(rtd ang1)
valvno
) ; end insert
(setq block1 (entlast))
) ; end condition 2
(
(= vchx "Ball")
(command "_.insert"
"C:\\Users\\Lee Mac\\Documents\\Valves\\BALL VALVE.dwg"
pt1
""
""
(rtd ang1)
valvno
) ; end insert
(setq block1 (entlast))
) ; end condition 3
(
(= vchx "Butterfly")
(command "_.insert"
"C:\\Users\\Lee Mac\\Documents\\Valves\\BUTTERFLY VALVE.dwg"
pt1
""
""
(rtd ang1)
valvno
) ; end insert
(setq block1 (entlast))
) ; end condition 4
(
(= vchx "Diaphragm")
(command "_.insert"
"C:\\Users\\Lee Mac\\Documents\\Valves\\DIAPHRAGM VALVE.dwg"
pt1
""
""
(rtd ang1)
valvno
) ; end insert
(setq block1 (entlast))
) ; end condition 5
) ; end cond
; ***TRIM***
(command "_circle"
pt1
"3"
) ; end circle
(setq c1 (entlast))
(command "_zoom"
"W"
(polar
pt1
(/ (* 3 pi) 4)
(/ 3 4)
) ; end polar
(polar
pt1
(/ (* 7 pi) 4)
(/ 3 4)
) ; end polar
) ; end zoom
(entdel block1)
(command "_trim"
c1 ""
l1 ""
) ; end trim
(command "_zoom"
"P"
) ; end zoom
(entdel block1)
(setvar "clayer" oldlay)
(setvar "osmode" oldos)
) ; end while
(setvar "cmdecho" 1)
) ; end program
(defun rtd (a)
(* 180.0 (/ a pi))
) ; end program
提前感谢,
李。 你可以试着在每个街区后面加一个区域。。无需修剪。。。 也许是ln1?
(command "_trim"
c1 ""
ln1 ""
) ; end trim 阿斯米你是一个传奇
你似乎总能发现我愚蠢的错误
谢谢 早上好,李。如果认真的话,你受过很快的训练,但你应该正确地学习以调试你的程序。查看“帮助”>“其他资源”>“开发人员帮助”>“AutoLISP教程”>“使用Visual LISP调试工具”。此外,这是Devid M.Stain的Visual LISP Developer Bible(vla-,vlax-,vlr-),请阅读有关Visual LISP编辑器及其内部调试的部分。 谢谢ASMI,我会调查的
页:
[1]