Sambuddy Posted August 7, 2024 Posted August 7, 2024 (edited) I was trying to append data so that if there is more than one tag under the table, excel would insert it under a new row, but does not seem to work. Any ideas would help! My basis was @Lee Mac and the lisp "Global Attribute Extractor & Editor". the table looks like this: (defun get-block-attributes (block) (setq attr-list (LM:getattributevalues block)) (setq result '()) (foreach attr attr-list (let ((tag (car attr)) (value (cdr attr))) (if (wcmatch tag "R-TECH*") (setq result (append result (list (list tag value))))))) result) (if selection (progn (setq workbook (vlax-invoke-method (vlax-get-property excel 'Workbooks) 'Add)) (setq sheet (vlax-get-property (vlax-get-property workbook 'Sheets) 'Item (vlax-make-variant 1 vlax-vbInteger))) (setq row 1) (repeat (sslength selection) (setq ent (ssname selection (setq idx (1+ idx)))) (setq blk (vlax-ename->vla-object ent)) (setq attributes (get-block-attributes blk)) ;; Debugging information (princ (strcat "\nProcessing block: " (vla-get-Name blk))) (foreach attr attributes (let ((tag (car attr)) (value (cadr attr))) ;; Debugging information (princ (strcat "\nWriting to Excel - Tag: " tag " Value: " value)) (write-to-excel sheet row 1 (vla-get-Name blk)) (write-to-excel sheet row 2 tag) (write-to-excel sheet row 3 value) (setq row (1+ row)))))) (alert "No blocks selected.")) Edited August 14, 2024 by Sambuddy Quote
BIGAL Posted August 7, 2024 Posted August 7, 2024 Post a dwg it looks like just rearrange the way the table is made. Make sure it has a correct table in it row & column sizes etc. Quote
Sambuddy Posted August 8, 2024 Author Posted August 8, 2024 (edited) On 07/08/2024 at 19:54, BIGAL said: Post a dwg it looks like just rearrange the way the table is made. Make sure it has a correct table in it row & column sizes etc. I am not using an AutoCAD standard table, if that is what you mean. it is a bunch of lines and text attributes turned to a block. This block is then replicated as many times as required to makeup the entire table. Reason: sometimes there is one technology (R-TECH1) and sometimes multiple technology for a specific antenna specs, hence the need for this block to remain as a dynamic block with multiple visibilities. You then would copy and paste the block to fill up the other antennas on this table. Edited August 14, 2024 by Sambuddy Quote
BIGAL Posted August 9, 2024 Posted August 9, 2024 Still post a sample dwg very hard to fudge something that matches what you have. Yes can export to Excel direct. Quote
Sambuddy Posted August 9, 2024 Author Posted August 9, 2024 (edited) On 08/08/2024 at 20:15, BIGAL said: Still post a sample dwg very hard to fudge something that matches what you have. Yes can export to Excel direct. Please see the dwg sample @BIGAL Edited August 14, 2024 by Sambuddy Quote
BIGAL Posted August 9, 2024 Posted August 9, 2024 (edited) It may not be straight forward as your using 2 types of blocks to make the quasi "Table" will have to think about it. The Type and Equipmet blocks. Edited August 9, 2024 by BIGAL Quote
Sambuddy Posted August 14, 2024 Author Posted August 14, 2024 @BIGAL Please do not break your head over this, I am not using VBA to update my data once transferred. I created a bunch of functions to sort them nce they are in excel space so no need to manipulate data on lisp. Thanks for your response anyways! Quote
BIGAL Posted August 15, 2024 Posted August 15, 2024 (edited) I don't have a problem working with say block or text in rows and columns the problem is in the 2 blocks and acting as merged cells. Need to almost rebuild a new copy that can be defined in Excel. May need to use a bounding box to find objects at some X or Y value. Moved it up in my To do list. Got a commercial problem to solve 1st. Thinking more it may be easier to just write new code to make it a Table. Edited August 15, 2024 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.