Community
Dynamic Blocks Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multiple instances of attribute in a dynamic block

11 REPLIES 11
Reply
Message 1 of 12
Mike_Y2
1538 Views, 11 Replies

Multiple instances of attribute in a dynamic block

Hi,

 

I have a dynamic block wich contains 1 attribute. When I insert the block it prompts me to fill in the value for the attribute. However I want the attribute to be shown in 2 places within the block, while only having to set the attribute value once.

 

I have tried coping the attribute but when inserting the block I am prompted for a value for each attribute (I want the values of the 2 attributes to be linked within the block. 

 

Note, the attribute values should not be linked between each instance of the block.

 

Thanks in advance for you help!

Labels (2)
11 REPLIES 11
Message 2 of 12
Libbya
in reply to: Mike_Y2

Every attribute must have a unique tag.  If you want more than one attribute to always display the same value, then use an attribute to house the value.  For all other attributes that should display the same value, use a field that references the attribute that houses the value.  

Message 3 of 12
Mike_Y2
in reply to: Mike_Y2

@Libbya Thanks for the quick reply. Can you explain how do I use a field to link to the value of the attribute?

Message 4 of 12
vinodkl
in reply to: Mike_Y2

Hello @Mike_Y2 

You can do that by creating a custom properties in drawing properties. 

First type in the command "DWGPROPS" and select "custom" tab and "add" a custom name and value.

vinodkl_0-1672989607934.png

Now inside the block editor create a mtext and click on "field" from ribbon. 

vinodkl_1-1672989826586.png

 

Now select the field category as document and you would see the custom property which you had enter in "DWGPROPS" select that and click ok. 

vinodkl_3-1672990187849.png

 

vinodkl_2-1672990012424.png

You can see now that the value entered in the DWGPROPS is displayed in the block. You can now copy this text inside the block as many times as you want and it would not create any problem.

 

Note that you can create multiple custom properties and use then any where in the drawing and they will be update once you update the values in "DWGPROPS" 🙂

--------------------------------------------------------------------------------------------------------------------------
ವಿನೋದ್ ಕೆ ಎಲ್( System Design Engineer)



Likes is much appreciated if the information I have shared is helpful to you and/or others.

Please mark "Accept as Solution" if my reply resolves the issue or answers your question, to help others in the community.
--------------------------------------------------------------------------------------------------------------------------
Message 5 of 12
Mike_Y2
in reply to: Mike_Y2

@vinodkl Thanks for the reply.

I believe your solution would set a value that would be apply to all of the blocks with the custom property.

 

I want to set a value per instance of the dynamic block. for example...

 

Dynamic block instance 1 - Attribute 1 Value = "CP"

Dynamic block instance 2 - Attribute 1 Value = "SP"

Dynamic block instance 3 - Attribute 1 Value = "DR"

 

Within the Dynamic block I want to show the Attribute in 2 different places (bottom left corner of the block and top right corner of the block)

Message 6 of 12
thomas_schlüssi
in reply to: Mike_Y2

If it doesn't bother you, you could use two attributes.
And then a LISP that asks you for a value and that value is then written into both attributes.

 

I'm not able to write LISPs by my self but the LISP should look somthing like this:

1. Ask to pick the block

2. Ask for the value

3. Programm fills both attributes with this value

4. Finished

 

Maybe this helps.

Message 7 of 12
caiokotia
in reply to: Mike_Y2

I have the same problem!

By copying it, the block turns into a real mess. Dynamics works very crazy.

I believe the LISP is a way, but... I even dont know nothing about LISP.

Anyone?

Message 8 of 12
Libbya
in reply to: caiokotia

There's no need for any LISP.  

 

Add an attribute to contain the value.  Add any number of attributes (all with unique tags) that reference that value using an object field.  Make sure the checkbox for showing the value of the block reference is checked.  

Message 9 of 12
timo_jurado
in reply to: Mike_Y2

Hi I think thats not the right solution for the problem described by Mike. We have the same problem and haven´t found a solution yet.

 

Define an attribute for an block and reuse it multiple times inside the specific block instance. This is different to the mentioned option to use an global field parameter.

 

Its neiter possible to create manually an array of the same attribute.

Message 10 of 12
Libbya
in reply to: timo_jurado


@timo_jurado wrote:

Hi I think thats not the right solution for the problem described by Mike. We have the same problem and haven´t found a solution yet.

 

Define an attribute for an block and reuse it multiple times inside the specific block instance. This is different to the mentioned option to use an global field parameter.

 

Its neiter possible to create manually an array of the same attribute.


It sounds like you are advocating using multiple attributes with the same tag.  If so, then that is TERRIBLE advice.  Multiple attributes with the same tag do not function with dynamic parameters/actions.  [shakes head and walks away]

Message 11 of 12
Michiel.Valcke
in reply to: Libbya

unfortunately referencing attribute values in other attributes with fields, from within the same block definition has been very buggy and hasn't worked well in the last x releases. your suggestion should work in theory, but I just set it up in 2024. And the initial placement works, but the attribute with field will not update to match the value of the base attribute. 

EDIT: and I learned something new, what I experienced as buggy behaviour (and never got to the bottom of) just turned out to only work when you're performing a dynamic action. @Mike_Y2@Libbya  thank you.

Message 12 of 12
Mike_Y2
in reply to: Mike_Y2

I have got this to work reliably. Please refer to the post below and remember that you need to perform a dynamic action in order for fields to begin working within a dynamic block. Also you need to use the "Regenall" command. AutoCAD does a regen when you save the document and prior to a print.

 

https://forums.autodesk.com/t5/autocad-lt-forum/repeated-block-attributes/m-p/7411879#M158510 

 

I hope this helps / please mark as solution

Thanks

Mike

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

Post to forums  

Forma Design Contest


AutoCAD Beta