automatic tags in blocks

automatic tags in blocks

silvestresallesjunior4
Enthusiast Enthusiast
1,840 Views
3 Replies
Message 1 of 4

automatic tags in blocks

silvestresallesjunior4
Enthusiast
Enthusiast

my english is not very well but let's go.

Hello. I need to do some lisp routines:
First create attributes for the preselected blocks. Enter the block and paste one (attref), it automatically and for the selected blocks.
Second: Fill in the tag of these attributes with the possibility of filling in a prefix. This prefix must be the same for all selected blocks. The suffix, on the other hand, must be done by automatically sequencing numerically with individual intervals.
Finally, I need to extract these attributes with the leader or similar command to show which attribute the block belongs to.
Can someone help me?

0 Likes
1,841 Views
3 Replies
Replies (3)
Message 2 of 4

john.uhden
Mentor
Mentor

We had a discussion not too long ago about adding attributes (as you call them attrefs) to existing block references.  I didn't think it could be done, but some smarter person showed that it could.  My reaction is that you should define each block with the attribute you would like, so that even if it is empty you know that it is there.  I don't think AutoCAD provides a means of prefixing attributes, so I think you will need some AutoLisp add-on to accomplish that.  It's not very difficult (well maybe except for a beginner).  More important is how you want to determine which block reference gets what suffix.

If you are willing to try, we are willing to help.  I am personally not in favor of this fine forum just giving away solutions to people who simply state "they need ..."  Though there are many here who enjoy doing just that.

John F. Uhden

0 Likes
Message 3 of 4

Moshe-A
Mentor
Mentor

@silvestresallesjunior4  hi,

 

First create attributes for the preselected blocks.
the best way to add attributes to a block is to redefine the block.

Enter the block and paste one (attref), it automatically and for the selected blocks.
when you add new attributes to an existing block they are added to all inserts automatically (with ATTSYNC, BATTMAN commands) with default value. to add attributes to some of the inserts you could set the attribute value to null string (empty value) for those inserts you do not want attributes.

Second: Fill in the tag of these attributes with the possibility of filling in a prefix. This prefix must be the same for all selected blocks.
this of course can be done with attribute or simple text

The suffix, on the other hand, must be done by automatically sequencing numerically with individual intervals.
yes, this could be done but how do you expect to control the order?

Finally, I need to extract these attributes with the leader or similar command to show which attribute the block belongs to.
this can be done with DATAEXTRACTION command.
??
moshe

 

Message 4 of 4

silvestresallesjunior4
Enthusiast
Enthusiast

 

 

Hi how are you? THANKS FOR THE FEEDBACK,

To understand my need I will explain my work ...

From the layout, I distribute equipment creating a flow in an architectural project ... this in floor plan 2d.



Making an analogy, imagine that these devices are mobile, that each furniture is a block (chair, table, sofa ...) ... After I finish the layout I need to place a tag in each block. The tag has a prefix that identifies which region the block belongs to, eg: (WED 001, WED 002 ... COZ 001, COZ 002 ...). WED: ROOM, COZ: KITCHEN. The Number (suffix) is sequential.

The way I imagine it is possible to tie the tag to the block would be through attributes, however the layouts I work with do not have assigned blocks, so I wanted to find a way to select these blocks and create an attref within each block. This automatically stops the selected blocks.

Later I need another command that auto-populates this attribute by entering a prefix (QUA, COZ ...) automatically filling in the suffix (001, 002 ...)



Finally, I need to extract these attributes with the leader or similar command to show which attribute the block belongs to. This is important so that when printing the project people know which tag of each piece of equipment

 

0 Likes