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

Text field attribute value

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
kostastomp
10691 Views, 7 Replies

Text field attribute value

kostastomp
Enthusiast
Enthusiast

Hello

I am trying to build a block with some attributes, whose values are combined in an mtext.

The attributes are:

PREFIX_COMMENT

NUMBER_OF_BARS

DIAMETER

SPACING

 

What I want is a text that will have the following syntax

PREFIX_COMMENT NUMBER_OF_BARS ∅ DIAMETER / SPACING

 

For example

bottom 2 ∅12 / 15

 

But for some reason I don't get what I want.

Here is how I try to do it (and fail)

 

1) Create the attributes (I have tried both with default value and without, no luck)

2) Create the text (have tried both Mtext and simple Text)

3) While editing the text I select Insert Field, select Field category: Objects, Field Names: Object, select the attribute, set the property to "value", click ok

4)

   a) If I have set initial values at the attributes, these values appear at the text, but they do not update

   b) If I hane not set initial values at the attributes (left them empty), I get "- - - -" hyphens.

 

Once this is accomplished,how can I include a result of a calcuation in the text (for example NUMBER_OF_BARS * pi * (DIAMETER^2) / 4 / SPACING

for an output like this:

bottom 2 ∅12 / 15 ( 15.072 cm²/m)

 

Any ideas?

 

I.png

 

II.png

 

0 Likes

Text field attribute value

Hello

I am trying to build a block with some attributes, whose values are combined in an mtext.

The attributes are:

PREFIX_COMMENT

NUMBER_OF_BARS

DIAMETER

SPACING

 

What I want is a text that will have the following syntax

PREFIX_COMMENT NUMBER_OF_BARS ∅ DIAMETER / SPACING

 

For example

bottom 2 ∅12 / 15

 

But for some reason I don't get what I want.

Here is how I try to do it (and fail)

 

1) Create the attributes (I have tried both with default value and without, no luck)

2) Create the text (have tried both Mtext and simple Text)

3) While editing the text I select Insert Field, select Field category: Objects, Field Names: Object, select the attribute, set the property to "value", click ok

4)

   a) If I have set initial values at the attributes, these values appear at the text, but they do not update

   b) If I hane not set initial values at the attributes (left them empty), I get "- - - -" hyphens.

 

Once this is accomplished,how can I include a result of a calcuation in the text (for example NUMBER_OF_BARS * pi * (DIAMETER^2) / 4 / SPACING

for an output like this:

bottom 2 ∅12 / 15 ( 15.072 cm²/m)

 

Any ideas?

 

I.png

 

II.png

 

7 REPLIES 7
Message 2 of 8
Libbya
in reply to: kostastomp

Libbya
Mentor
Mentor

I've never been able to get mtext fields within a block to update.  I would house the fields within another attribute and make sure when inserting the fields into the attribute that the little check box is checked to display value for the block reference.  If you are trying to house the fields within mText in order to prevent users from ruining the fields then there are other ways to accomplish it that work.  

I've never been able to get mtext fields within a block to update.  I would house the fields within another attribute and make sure when inserting the fields into the attribute that the little check box is checked to display value for the block reference.  If you are trying to house the fields within mText in order to prevent users from ruining the fields then there are other ways to accomplish it that work.  

Message 3 of 8
kostastomp
in reply to: Libbya

kostastomp
Enthusiast
Enthusiast

I want to do this in order to have the attributes with even spaces between the words, instead of having 4 attributes in a row. Try to scale them and it is a disaster. But if there is a way to have them in one place as a unit then no problem. Could you explain the method that you mentioned, please?

 

Any ideas about calculation result that I described on my first post?

 

Thanks for your time!

0 Likes

I want to do this in order to have the attributes with even spaces between the words, instead of having 4 attributes in a row. Try to scale them and it is a disaster. But if there is a way to have them in one place as a unit then no problem. Could you explain the method that you mentioned, please?

 

Any ideas about calculation result that I described on my first post?

 

Thanks for your time!

Message 4 of 8
Libbya
in reply to: kostastomp

Libbya
Mentor
Mentor

I am saying to add another single attribute that has the default value set up exactly as you set up the mtext with the fields/symbol.

 

You can create a formula field that contains the attribute values.  Copy the field expression and paste it into the formula field.  

I am saying to add another single attribute that has the default value set up exactly as you set up the mtext with the fields/symbol.

 

You can create a formula field that contains the attribute values.  Copy the field expression and paste it into the formula field.  

Message 5 of 8
kostastomp
in reply to: kostastomp

kostastomp
Enthusiast
Enthusiast

I tried but it didn't happen. Would it be too much if I asked you to upload a file?

 

I just want 4 piece of iinformation toghether as a unit. I don't mind if they are attributes or texts or whatever. 4 inputs one piece output. That' s all.

0 Likes

I tried but it didn't happen. Would it be too much if I asked you to upload a file?

 

I just want 4 piece of iinformation toghether as a unit. I don't mind if they are attributes or texts or whatever. 4 inputs one piece output. That' s all.

Message 6 of 8
Libbya
in reply to: kostastomp

Libbya
Mentor
Mentor

Here's your file.  I did a cursory version.  In order for the block to start working it needs to have a dynamic property changed.  I added a visibility parameter where both visibility states are the same in order to accomplish that.  After touching the visibility grip, the fields will update with a regen after the attribute values have been changed.  To build the formula from the various fields, I created an object field that referenced the block value of the particular attribute I wanted and then copy clipped the 'field expression' into the formulat and added the various operations necessary.

Here's your file.  I did a cursory version.  In order for the block to start working it needs to have a dynamic property changed.  I added a visibility parameter where both visibility states are the same in order to accomplish that.  After touching the visibility grip, the fields will update with a regen after the attribute values have been changed.  To build the formula from the various fields, I created an object field that referenced the block value of the particular attribute I wanted and then copy clipped the 'field expression' into the formulat and added the various operations necessary.

Message 7 of 8
Libbya
in reply to: Libbya

Libbya
Mentor
Mentor
Accepted solution

As a potentially more problem free method, you could use user parameters (create via parameters manager) for the various values.  They can then be edited on the properties palette.  When you edit a user parameter it 'counts' as a dynamic action and so would kickstart the block into working in the same way as the visibility parameter I used in the last example.  You can then place your formula attribute on a locked layer and it will update with changes to the user parameter values after a regen but with the formula attribute on a locked layer, other users cannot mess up your formula field.  

As a potentially more problem free method, you could use user parameters (create via parameters manager) for the various values.  They can then be edited on the properties palette.  When you edit a user parameter it 'counts' as a dynamic action and so would kickstart the block into working in the same way as the visibility parameter I used in the last example.  You can then place your formula attribute on a locked layer and it will update with changes to the user parameter values after a regen but with the formula attribute on a locked layer, other users cannot mess up your formula field.  

Message 8 of 8
kostastomp
in reply to: kostastomp

kostastomp
Enthusiast
Enthusiast

I used parameters both for the "user input" values (prefix, number of bars, diameter, spacing) and for the calculation (result).
For the "end product" (or "block output") I used an attribute. From the attribute properties I checked "preset" (so that when inserting a new block, the user is not asked to enter a value for the attribute, since it will be automatically filled in) and "lock position" (so that it doesn't move relatively to the block insertion point). For the value of the attribute I used the "insert field" commant several times.
While doing it, I decided that I would like more intelligence from the block, but I stumbled on some limitations of autocad. I will write about them tomorrow.

0 Likes

I used parameters both for the "user input" values (prefix, number of bars, diameter, spacing) and for the calculation (result).
For the "end product" (or "block output") I used an attribute. From the attribute properties I checked "preset" (so that when inserting a new block, the user is not asked to enter a value for the attribute, since it will be automatically filled in) and "lock position" (so that it doesn't move relatively to the block insertion point). For the value of the attribute I used the "insert field" commant several times.
While doing it, I decided that I would like more intelligence from the block, but I stumbled on some limitations of autocad. I will write about them tomorrow.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report