Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Calling
(command "AREA" "O" (car (entsel)))
Sometimes works in modelspace and sometimes doesn't.
Calling this command inside a Block, doesnt work at all and throws: <Bad Entity name: 2A9B500>
and causes kind of infinite loop. However, the command works without problems without blocks (only filtering surfaces). My code for extracting surface areas from blocks and there only this kinds of surface objects inside:
(defun get_block_surface_areas ( / i:BlockObjectName i:BlockObject
i:BlockName i:InsertVLA Total)
(setq InsertSelectionSet (ssget '((0 . "INSERT")))
Counter -1
Total 0
);setq
(while (setq i:InsertObject (ssname InsertSelectionSet (setq Counter (1+ Counter))))
(setq
i:InsertVLA (vlax-ename->vla-object i:InsertObject)
i:BlockName (vla-get-effectivename i:InsertVLA)
i:BlockObject (tblobjname "Block" i:BlockName)
);setq
(while (setq i:BlockObject (entnext i:BlockObject))
(setq i:BlockObjectName (cdr (assoc 0 (entget i:BlockObject))));setq
(if (or (= i:BlockObjectName "PLANESURFACE")
(= i:BlockObjectName "NURBSURFACE")
(= i:BlockObjectName "EXTRUDEDSURFACE")
(= i:BlockObjectName "SURFACE")
(= i:BlockObjectName "REGION")
);or
(progn
(command "AREA" "O" i:BlockObject)
(while (< 0 (getvar 'cmdactive)) (command ""))
(setq Total (+ Total (getvar 'area)))
);progn
);if
);while
);while
);get_block_surface_areas
Where is the problem?
Solved! Go to Solution.