CAD Forums > CAD General
Find Drawings Based On Multiple Attributes
(1/1)
M-dub:
I'm not sure if this is possible... easy.
I want to find all drawings that contain a block (any block) with multiple attributes matching certain criteria.
These are instrument bubbles, so for example, I want to find all drawings with "LIC" in one attribute and "3643" in another. The block names may not be the same, nor would the attribute tags.
Lee Mac:
This would certainly be achieveable using ObjectDBX; you could iterate over the drawing database for a number of drawings, and return a list of drawing names which meet a certain criteria - in this case, those which contain blocks with a specific attribute value.
This may even be possible using my existing ObjectDBX Wrapper, (found here).
Lee
M@yhem:
Maybe use DATAEXTRACTION?? I would create a list of all selected blocks and their attribute values. You can sort by the attribute value and export to Excel. Might a quick and dirty way of getting what you need (OOC).
ronjonp:
You could feed something like this to the document object .. returns T or nil.
--- Code: ---(defun _foo (string1 string2 doc / out)
(vlax-for a (vla-get-blocks doc)
(vlax-for b a
(if (and (vlax-property-available-p b 'hasattributes) (minusp (vlax-get b 'hasattributes)))
(setq out (cons (mapcar '(lambda (x) (strcase (vla-get-textstring x)))
(vlax-invoke b 'getattributes)
)
out
)
)
)
)
)
(vl-some '(lambda (x) (and (vl-position (strcase string1) x) (vl-position (strcase string2) x)))
out
)
)
(_foo "LIC" "3643" (vla-get-activedocument (vlax-get-acad-object)))
--- End code ---
Navigation
[0] Message Index
Go to full version