Here is the Code;
(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)))
I want to get the Total area for all Region and Solids in Block (Tobjs) into variable TNumF, if it matches the condition,
it give an error: bad argument value: AutoCAD command: #
please help
Thanks in advance
It's because % is entity as vla-object, but command needs entity, so try this code:
(command "_.AREA" "_O" (vlax-vla-object->ename % ))