错误:错误的参数类型:stri
我有一段时间fixo为我写的Lisp程序。我一直在尝试在一个dcl,将要求土地所有者的名称和对开本编号,并设置这些层作为名称的一部分。对话框闪烁,一秒钟后关闭。有人能帮忙吗?
;; local defun by CAB (Charles Alan Butler)
(defun LayerMake_CPO (lyrname Color ltype)
(if (tblsearch "LAYER" lyrname)
(command "._Layer" "_Thaw" lyrname "_On" lyrname "_UnLock" lyrname "_Set" lyrname "")
(command "._Layer" "_Make" lyrname "_Color"
(if (or (null color)(= Color "")) "_White" Color) lyrname
"LT" (if (or (null ltype)(= ltype "")) "Continuous" ltype) lyrname "")
)
)
(defun C:CPO (/ *error* ang col clr coords dwo elist midp offsetted ofpt osm p1 p2 p3 pline a b c name folio)
(setq dcl_id (load_dialog "cpo.dcl"))
(if (not (new_dialog "cpo" dcl_id))
(exit)
);if
(action_tile "name" (setq name $value))
(action_tile "folio" (setq folio $value))
;(action_tile "accept" (val1))
(start_dialog)
(unload_dialog dcl_id)
(setq a (strcat "CCC_CPO_"name"_"folio"_Grey_Hatch")
b (strcat "CCC_CPO_"name"_"folio"_Outline_Red")
c (strcat "CCC_CPO_"name"_"folio"_Outline_Black"))
(defun *error* (msg)
(if
(vl-position
msg
'("console break"
"Function cancelled"
"quit / exit abort"
)
)
(princ "Error!")
(princ msg)
)
(if osm (setvar "osmode" osm))
(if clr (setvar "clayer" clr))
(if col (setvar "cecolor" col))
(if dwo (setvar "draworderctl" dwo))
(command "._undo" "_END")
)
(setq osm (getvar "osmode"))
(setq col (getvar "cecolor"))
(setq clr (getvar "clayer"))
(setq dwo (getvar "draworderctl"))
(command "._undo" "_BE")
(setvar "osmode" 2593)
(setvar "cecolor" "bylayer")
(setvar "HPORIGINMODE" 5)
(LayerMake_CPO a "254" "Continuous")
(LayerMake_CPO b "1" "Continuous")
(LayerMake_CPO c "7" "Continuous")
(setvar "clayer" c)
(command "._pline")
(while (= 1 (logand 1 (getvar "cmdactive")))
(command pause))
(setq pline (entlast)
elist (entget pline)
)
(setq elist (entmod (subst (cons 70 1)(assoc 70 elist)elist)));<--close pline
(entmod (subst (cons 43 0)(assoc 43 elist)elist));<--set line width to zero
(setvar "draworderctl" 3)
(command "_.draworder" pline "" "_F");<--set pline's draw order to front
(setq coords (vl-remove-if (function not)
(mapcar (function (lambda (x)
(if (= 10 (car x))(cdr x))))
elist))
)
(setq p3 (caddr coords)
p1 (car coords)
ang (angle p1 p3)
ofpt (polar p3 ang 1.0)
)
(setvar "clayer" "CCC_CPO_Replace with landwoner name_Outline_Red")
(command "._offset" 0.5 pline ofpt "")
(setq offsetted (entlast)
elist (entget offsetted)
)
(if (assoc 62 elist)
(setq elist (subst (cons 62 1)(assoc 62 elist) elist ))
(setq elist (append elist (list '(62 . 1))))
)
(entmod elist)
(command "._pedit" offsetted "_W" 1.0 "")
(command "_.draworder" offsetted "" "_B");<--set pline's draw order to back
(setq coords (vl-remove-if (function not)
(mapcar (function (lambda (x)
(if (= 10 (car x))(cdr x))))
elist))
)
(setq p2 (car coords)
midp (mapcar (function (lambda( a b)(/ (+ a b) 2)))
p1 p2)
)
(setvar "clayer" "CCC_CPO_Replace with landwoner name_Grey_Hatch")
(setvar "hpname" "SOLID")
(command "-hatch" "S" pline "" "")
(setvar "hpname" ".")
;(Alert "Don't forget to change the landowner name & plot number LAYERS in the LAYER window!!!")
(*error* nil)
(princ)
)
谢谢pBe。这很管用。 我现在正在工作。我做了一些额外的改变。我在lisp中添加了一个mleader扩展,以便在闭合pline完成时启动一个mleader来标记地块。它确实可以工作,但当pline完成时,我在命令行中看到以下内容:
命令:nil
输入无效。
然后我右键单击,它继续并创建mleader。有人知道为什么会这样吗?
另一件事是,代码中有一个部分,如果偏移绘制的线,并创建一个选择集,其中最后一个创建的东西,但它不会像应该的那样将其传输到层b。我尝试了一些解决方案,但一直被卡住。
有人能帮忙吗?
谢谢
cpo: dialog
{label = "CPO Layer Creation";
: edit_box
{
label = "Enter landowner name :";
key = "name";
alignment = centered;
edit_limit = 30;
edit_width = 30;
}
: edit_box
{
label = "Enter folio number :";
key = "folio";
alignment = centered;
edit_limit = 10;
edit_width = 30;
}
: button
{
key = "accept";
label = "OK";
is_default = true;
fixed_width = true;
alignment = centered;
}
: errtile
{
width = 34;
}
}
我知道。。。。这就是你看到的零信息的原因
编辑:伍德曼的消息 我意识到你的帖子可能是针对Woodman的,我没有正确地查看或测试代码,但是这不会导致错误消息,因为首先,错误处理程序中没有任何内容会通过接受nil“msg”参数而出错。此外,如果错误处理程序抛出错误,您将收到“在*error*函数内发生错误…”我不认为是这样。
很抱歉插了我的鼻子,但我不想大惊小怪。。。
不用担心,李
随时欢迎你的“鼻子”
你说得对。。但是对于这个特殊的代码,它确实。。因此,以不同的方式定义它将消除这一信息。。(我猜) 谢谢大家。pBe这真的很好。
I know.... thats whats causing that nil message you're seeing
EDIT: Message for Woodman I realise perhaps your post was directed at Woodman and I haven't properly looked at nor tested the code, however that could not cause the error message since firstly there is nothing in the error handler that could error by taking a nil 'msg' argument. Also, if the error handler was throwing the error you would receive 'An error occurred inside the *error* function....' which I don't believe is the case.
Apologies for sticking my nose in, but didn't want a wild goose chase...
页:
[1]
2