Script for Block with Multiple Attribute into Single Attribute Retaining Data

Script for Block with Multiple Attribute into Single Attribute Retaining Data

VinnieESPOENG
Explorer Explorer
1,044 Views
2 Replies
Message 1 of 3

Script for Block with Multiple Attribute into Single Attribute Retaining Data

VinnieESPOENG
Explorer
Explorer

We did a project for a customer that involved taking 30 floors of information, taking text, making it a dynamic block and giving it attributes. After we gave them 3 attributes, pertaining to 3 separate items they liked it and we went about doing this for 30 floors, each floor has 4 different blocks, maybe 40 inserts per floor. 

 

After the customer was delivered CAD files, they sent it to their customer who now just wants 1 attribute per block.

 

Is there anyway to convert a multiple attribute block to a single attribute block while retaining the information stored in the block?

 

Per the example, Node, Network and Link are to be combined into 1 attribute and need to keep the same xx:xxx-xx

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

Libbya
Mentor
Mentor

I'm not sure of a script and if that is specifically what you are after, then you should ask on one of the Customization forums.

 

The following screencast shows a way to combine the values of the existing attributes into the value of a single attribute using fields.  If the block definition is edited in that manner and then attsync run on a file, then all blocks would update accordingly in that file.  Redefine could be used on each file.  That alone might be good enough to satisfy the client.  If not then I imagine that code could be run (again ask on a customization forum) to do a batch conversion of fields to text.  After the fields are converted to text, the prior attributes individual attributes could be deleted with the end result being a single attribute per block that retains the combined value of the three attributes.  Hopefully that helps you toward a solution.

 

 

Message 3 of 3

3wood
Advisor
Advisor

You can try ALTEXT to combine multiple attributes into 1.

Original block has 3 attributes: 

ALTEXT 1-1.JPG

 

Step 1. Save the code below as a *lsp file.

;;; This is an example formula for ALTEXT.vlx
;;; It combines Attribute 1 ~ Attribute 3 with symbols ":" and "-".
(defun ALTEXT_FORMULA ()
  (strcat ALTEXT_ATT_1 ":"  ALTEXT_ATT_2 "-" ALTEXT_ATT_3)
  )

 

Step 2. Use ALTEXT to select blocks and change the first attribute value. Select "Formula" and pick up the lsp file in Step 1 as the formula.

ALTEXT 1-2.JPG

 

Step 3. Result of Step 2. Attribute No. 1 combined the value of all 3 attributes.

ALTEXT 1-3.JPG

 

Step 4. Delete the other 2 attribute definition in the block editor. Then use BATTMAN to synchronize the block inserts in the drawing.

ALTEXT 1-4.JPG

 

Step 5. Final result.

ALTEXT 1-5.JPG

0 Likes