hln_zqy 发表于 2007-11-7 23:57:00

如何通过变量传递给块赋属性(本论坛中的“VxSetAtts 设置块中属性”函数)

<p>;;;给块赋属性,如何将bb的值赋给(vxsetatts obj val)中的val,执行以下程序,系统提示 "Error 此类型的 LISP 值不能强制转换成 VARIANT:&nbsp; BB"<br/>(defun c:sz()<br/>&nbsp; (setq aa (vlax-ename-&gt;vla-object (car (entsel))))<br/>&nbsp; (setq bb (getstring "\n新流水号为:"))<br/>&nbsp; (setq c (vxsetatts aa '(("WATERNUM" . bb) ("OBJNAME" . "市政市容管理局"))))<br/>)<br/>(defun VxSetAtts (Obj Lst / AttVal)<br/>&nbsp; (mapcar<br/>&nbsp;&nbsp;&nbsp; '(lambda (Att)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (setq AttVal (cdr (assoc (vla-get-TagString Att) Lst)))<br/>(vla-put-TextString Att AttVal)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp;&nbsp; )<br/>&nbsp;&nbsp;&nbsp; (vlax-invoke Obj "GetAttributes")<br/>&nbsp; )<br/>&nbsp; (vla-update Obj)<br/>&nbsp; (princ)<br/>)<br/>请老师帮忙解决!<a href="mailto:zqy@ntup.com">zqy@ntup.com</a></p>
页: [1]
查看完整版本: 如何通过变量传递给块赋属性(本论坛中的“VxSetAtts 设置块中属性”函数)