camel_racer Posted February 18, 2011 Posted February 18, 2011 (edited) This is probably a long shot - but is there a way to do a block count (bcount) so that it will include any attributes that the block has in it as well? I realise that there is data extraction but i am looking for something a little less clunky than a full data extraction. A long-shot I realise, but would be super useful. Thanks! EDIT- AutoCAD 2011 Edited February 18, 2011 by camel_racer Quote
Sittingbull Posted February 18, 2011 Posted February 18, 2011 Maybe make a template for your data extraction, to filter out what you need? Other than that, i came across a lot of posts on this site, about block counting and att extraction. Maybe if you explain what you want from this attributes or blocks, people could assit you even better. SB Quote
Freerefill Posted February 18, 2011 Posted February 18, 2011 This is what I use for attribute extraction. It returns a list of the block attributes, and you could just wrap it in a (length) to figure out how many there are. (defun blkAtts(ent / e) (if (= -1 (vlax-get (setq e (vlax-ename->vla-object ent)) 'hasattributes)) (reverse (mapcar 'vlax-vla-object->ename (vlax-invoke e 'GetAttributes)))) ) Quote
Tyke Posted February 18, 2011 Posted February 18, 2011 I have a VBA routine that does other things but which also pops up a window where all blocks with attributes in the drawing are listed together with their attribute tags, but it doesn't return a count of the blocks or the content of the attributes. Is that the kind of thing you are looking for? Quote
Lee Mac Posted February 18, 2011 Posted February 18, 2011 (length (vlax-invoke obj 'getattributes)) Quote
camel_racer Posted February 23, 2011 Author Posted February 23, 2011 hey guys.. sorry for the super late reply... didnt wanna be one of those guys who gets his answers & dissapears... so thanks heaps for the feedback. I will try out that Freerefill. Just to explain a little more what I am trying to achieve... We have a system at work which uses hundreds of different (stock) parts to build a structure then custom parts to create the infills or cladding to go on that structure. All the stock parts have booking codes assigned to them as attributes and all the infills / cladding will have attributes such as material, finish, width, height, etc. Because there will always be different blocks in each drawing setting up a template will not work. My aim is to reduce the human error in the bill of material process so that information will not be missed with the jumble of blocks that come up in our data extractions (such as "arc", "rotated dimension" and dozens of others). The idea being that I select the blocks in a drawing (like a "bcount" or lee macs "count") and when I hit enter it will give me a table which will include any attributes those blocks contain. Sorry for the essay. Thanks again guys - always so helpful! Quote
alanjt Posted February 23, 2011 Posted February 23, 2011 So, by that, you would need an attribute itemization of each individual block, regardless of how many instance of a block exist in the drawing - since each attributed block instance might have different attribute values. Correct? eg. Block1 - att1value att2value att3value Block1 - att1value att2value att3value Block2 - att1value att2value att3value Quote
stevesfr Posted February 23, 2011 Posted February 23, 2011 Alan, yes, I'd like to see that also. Just what is needed for pipe / material / length work. Steve Quote
Lee Mac Posted February 23, 2011 Posted February 23, 2011 Something along these lines? http://lee-mac.com/sumattributes.html Not sure if its suitable - it assumes the tags have numerical values to sum. Quote
camel_racer Posted February 23, 2011 Author Posted February 23, 2011 So, by that, you would need an attribute itemization of each individual block, regardless of how many instance of a block exist in the drawing - since each attributed block instance might have different attribute values. Correct? eg. Block1 - att1value att2value att3value Block1 - att1value att2value att3value Block2 - att1value att2value att3value Yeah that would be fine if they came through individually, I can create something to re group hem once in excel. Quote
camel_racer Posted February 23, 2011 Author Posted February 23, 2011 Something along these lines? http://lee-mac.com/sumattributes.html Not sure if its suitable - it assumes the tags have numerical values to sum. The attributes will be mainly alpha-numeric Quote
Lee Mac Posted February 24, 2011 Posted February 24, 2011 Updated my site, this might be of interest: http://lee-mac.com/countattributevalues.html 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.