There is a way through pure lisp without using vla/vlax. The trick is to find those pesky dictionary objects which link the block to its original. E.g. say you have a block Insert's DXF data list:
- Directly after the 102 code (102 . "{ACAD_XDICTIONARY") there should be a code 360 which points to the dictionary object's ename.
- This in turn has another 360 directly following (3 . "AcDbBlockRepresentation")
- This points to another dictionary with a 360 just after (3 . "AcDbRepData")
- This one's a ACDB_BLOCKREPRESENTATION_DATA dictionary. Its got a 340 code at its end.
- Which points to the original block record of which you can get the name from its code 2
Here's some sample defun which takes an INSERT's ename / entget list:
Code:
;; Get Block's effective name without ActiveX
(defun EffectiveName (en / ed d1 d2 d3 br)
(if (= (type en) 'ENAME) ;Check if ename is passed as argument
(setq ed (entget en)) ;Get the dxf data
(setq ed en) ;Else assume dxf data as argument
) ;_ end of if
;; Get the ACAD linking dictionary
(setq d1 (entget (cdr (assoc 360 (member '(102 . "{ACAD_XDICTIONARY") ed)))))
;; Get the ACAD black representation dictionary
(setq d2 (entget (cdr (assoc 360 (member '(3 . "AcDbBlockRepresentation") d1)))))
;; Get the Representation Data Dictionary
(setq d3 (entget (cdr (assoc 360 (member '(3 . "AcDbRepData") d2)))))
;; Get the block record
(setq br (entget (cdr (assoc 340 d3))))
;; Return the block's name
(cdr (assoc 2 br))
) ;_ end of defun