Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add features to tcount_att

6 REPLIES 6
Reply
Message 1 of 7
christopher.l.evans
313 Views, 6 Replies

Add features to tcount_att

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]:"

6 REPLIES 6
Message 2 of 7
dicra
in reply to: christopher.l.evans

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)
  
  )

 

 

 

Message 3 of 7
christopher.l.evans
in reply to: dicra

Getting an error, error: no function definition: VLAX-ENAME->VLA-OBJECT

Message 4 of 7
dicra
in reply to: christopher.l.evans

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. 

 

Message 5 of 7
christopher.l.evans
in reply to: dicra

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.

Message 6 of 7
dicra
in reply to: christopher.l.evans

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.

Message 7 of 7
christopher.l.evans
in reply to: dicra

Not a problem, I was just expecting some examples to look over during the holidays but I greatly appreciate the help. My thought was to get the tag information for the block, which you provided a routine for already, and store it as you make your selections. Then after you select the variables for the tcount_att step through the blocks you selected and specify a tag to apply the count to.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost