Is this starting from a pre-define workbook/worksheet or a blank workbook/worksheet?īigal- that's great. With regard to the excel part, what do you expect the excel sheet to look like? I have noted that one of the block tags in the example drawing you sent is named "FIND#" not "FIND", which is correct? foreach loop for data display only can be removed later (if (> (length tmp) 0) (setq com_data (cons tmp com_data))) (defun C:ATOUT ( / adoc osm axss tmp com_data tot) (if (> (length lst) 1) (setq lst (reverse lst))) R_lst (list "TAG" "PN" "FIND" "SORT" "QUANTITY") (setq att_lst (vlax-invoke obj 'getattributes) (defun get-all-atts ( obj / att_lst r_lst lst tag ) I've probably done it the same way you have, but i've also adjusted the main routine to account for a nil return from the sub function (block has none of the tags).
There was a lot of superfluous code and I think this was interfering with what was collected and printing to excel. (setq com_data (cons (get-all-atts a) com_data)) (vlax-for a (setq axss (vla-get-activeselectionset adoc))
(cond ( (ssget "_X" (list (cons 0 "INSERT")(cons 66 1))) This will get you all attributed blocks in the drawing (setq adoc (vla-get-activedocument (vlax-get-acad-object)) (defun C:ATOUT ( / adoc axss com_data tot) (setq lst (cons (cons tag (vla-get-textstring att)) lst)) (setq lst (cons (cons (strcat "*CONSTANT*: " tag) (vla-get-textstring att)) lst)) (setq att_lst (append (vlax-invoke obj 'getattributes) (setq catt_lst (vlax-invoke obj 'getconstantattributes))) (defun get-all-atts ( obj / att_lst catt_lst lst tag ) Get all tags and values from block including constant attributes in following form: This now contains an invisible constant attribute (TAG "BLK_NAME" VALUE "TEST") I've attached the drawing you sent with a modified test block. The code below will get every attributed block in the drawing and extract every tag and value pair in the block in the format :
any help on this would be great.Īlso in the end i want to combine this excel file with another one, similar to the way the data extraction command allows you to include outside data, any help with how to get that working would be appreciated as well.
TAG is the name of a tag that i want included in the list, i am not sure why it is printing like that, and N/a is where the handle used to go but i cant seem to get rid of it printing it. it originaly was to print the block name and handle, i have no need for those so i have been attempting to remove them but now when i run the script it creates a sheet like this: but now i need help, i have attached a copy of my code (largely borrowed from various people).
so i have set to the task of recreating the wizard for the command line, more or less that is. the issue is that i need to essentially run the data extraction wizard from the command line, witch as far as i am aware (PLEASE CORRECT ME IF I'M WRONG) can not be done. most of it is done however i have run into a wall on the last part witch is exporting a bill of materials. So i am trying to create an entire system so that i can engineer an electronic schematic with about 3 button presses.