I've been using this lisp I found here for awhile now and it did what I needed mostly. Now I have blocks with multiple tags with some using multiline text that I'd like to be able to select with this lisp. I'd like to create a list of the block name and it's attribute tags. So I can select a specific tag for a specific block and either step through my selection or apply to all of the same block within the drawing.
I've found plenty of examples to change a tag value or extract a tag name to a file but I'm looking to keep the block and it's tags associated to apply the tcount to. So I'm looking for some examples of this if any exist or a direction on how to approach this.
Here an example of what I want to see at the command line with what I'm trying to accomplish.
"Select tag - Block : Block1 Tags [A/B/C/D]:"
Hi christopher,
Is this what you are looking for:
(defun c:gettag ( / b-obj b-name attlist taglist tagstr) (setq b-obj (vlax-ename->vla-object (car (entsel "\nSelect Block:")))) (setq b-name (vla-get-name b-obj)) (setq attlist (vlax-safearray->list (variant-value (vla-getattributes b-obj)))) (foreach n attlist (setq taglist (cons (vla-get-tagString n) taglist));get the tag attribute data ) (setq taglist (reverse taglist)) (setq tagstr (mapcar '(lambda (x) (strcat x "/")) taglist)) (setq tagstr (apply 'strcat tagstr)) (setq tagstr (vl-string-right-trim "/" tagstr)) (princ (strcat "\n" b-name " Tags" ": [" tagstr "]" )) (princ) )
Try to add
(vl-load-com)
in front of everything.
I'm not sure if this is what you are looking for, because I don't understand exactly ho you want to combine this with lisp which you are already using.
This routine is going to print tags in selected block.
Ah yes I forget about that one sometimes. Yes that is how I wanted the data to display on the command line.
I want to apply it to the selected blocks. I have blocks that have tags for orientation which are typically a identifier and then a value or part number. The lisp I was using doesn't have anything to recognize multiple tags or tags that use multiline text. Since different blocks have different tag names I wanted to be able to specify which tag I wanted the tcount to add numbers to.
Christopher,
Sorry I didn't answer earlier.
I have modified tcount_att routine, now it will edit only attributes with tag that user is providing.
I don't know how exactly would you like to provide tag name, this is something that we could work on.
to use function call command like this:
(tcount_att-tag "TAG-NAME")
Hope this is going to help you.