这是守则;
(setq Tobjs (vla-Explode Tvlaobj))
(setq ObjectsAsList (vlax-safearray->list (vlax-variant-value Tobjs ) ) )
(foreach % ObjectsAsList
(setq TSublayerNew (vla-get-layer %))
(cond ((eq TSublayerNew TLaynemeShort)
(command "_.AREA" "_O" %)
(setq Teee (getvar 'area))
(setq Ttvm (+ Ttvm Teee))
(princ (strcat (rtos Teee 2 0) " | "))
(setq Tcntr (+ Tcntr 1))
)
)
)
(setq TNumF Ttvm)
(princ (strcat (rtos TNumF 2 2)))
如果匹配条件,我希望将Block(Tobjs)中所有Region和Solids的Total区域变为变量TNumF,
它会出错:错误的参数值:AutoCAD命令:#
请帮助
提前致谢
答案 0 :(得分:1)
这是因为%是实体作为vla-object,但是命令需要实体,所以试试这个代码:
(command "_.AREA" "_O" (vlax-vla-object->ename % ))