Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Block name out of table cell

1 REPLY 1
SOLVED
Reply
Message 1 of 2
mracad
1747 Views, 1 Reply

Get Block name out of table cell

With the great help of this forum, I was able to write a program that creates a parts list with the block inserted into a cell. Now I am wondering how to read the block name in a cell. I know I have the name when I build the table, but sometimes I have to make changes to the table by hand. What I am working on is writing the finished table out to an excel file. I will be inserting an image of the block into Excel, so I need the name of the block.
1 REPLY 1
Message 2 of 2
Lee_Mac
in reply to: mracad

mracad wrote:
Now I am wondering how to read the block name in a cell.

 

Try the following function:

 

;; Block Name from Table Cell  -  Lee Mac
;; obj     - [vla] Table Object
;; row/col - [int] Zero-based row & column indexes

(defun LM:blocknamefromtablecell ( obj row col / 64p doc )
    (setq 64p (wcmatch (getenv "PROCESSOR_ARCHITECTURE") "*64*")
          doc (vla-get-activedocument (vlax-get-acad-object))
    )
    (eval
        (list 'defun 'LM:blocknamefromtablecell '( obj row col )
            (list 'if '(= acblockcell (vla-getcelltype obj row col))
                (list 'vla-get-name
                    (list
                        (if (and 64p (vlax-method-applicable-p doc 'objectidtoobject32))
                            'vla-objectidtoobject32
                            'vla-objectidtoobject
                        )
                        doc
                        (list
                            (if (and 64p (vlax-method-applicable-p obj 'getblocktablerecordid32))
                                'vla-getblocktablerecordid32
                                'vla-getblocktablerecordid
                            )
                            obj row col
                        )
                    )
                )
            )
        )
    )
    (LM:blocknamefromtablecell obj row col)
)

 

Call the above with the VLA Table Object and zero-based row & column index.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost