Formula in attribute of a block

Formula in attribute of a block

rodrigo.gower
Enthusiast Enthusiast
1,403 Views
3 Replies
Message 1 of 4

Formula in attribute of a block

rodrigo.gower
Enthusiast
Enthusiast

Estoy intentando crear un bloque que contenga cierto atributos que son valores numéricos. Lo que busco que yo pueda defirnir estos valores pero que algunos sean calculados mediante "formulas". Por ejemplo yo definir un atributo A y un atributo B, y que el bloque entregue el valor númerico de A+B de manera automática. Ví en un video de youtube que esto se podía hacer pero no se mostraba la elaboración del bloque, solo que la persona ingresaba el valor del atributo y al regenerar dos veces se le actualizaba al valor calculado mediante "formula" el otro atributo, lo que sería para el ejemplo que estoy dando el valor de "A+B".

Espero alguien me pueda colaborar.

Saludos.

 

*Moderator edit* translated to English. Please submit your questions in English>

I'm trying to create a block that contains certain attributes that are numeric values. What I'm looking for is that I can define these values but that some of them are calculated using "formulas". For example, I define an attribute A and an attribute B, and the block automatically delivers the numerical value of A+B. I saw in a youtube video that this could be done but it did not show the elaboration of the block, only that the person entered the value of the attribute and when regenerating twice the other attribute was updated to the value calculated by "formula", which would be for the example I am giving the value of "A+B".

I hope someone can help me.

Best regards.

 

rodrigogower_0-1711395911581.png

 

0 Likes
Accepted solutions (1)
1,404 Views
3 Replies
Replies (3)
Message 2 of 4

Ed__Jobe
Mentor
Mentor
Accepted solution

You can do that with fields. Attached is a sample. The easiest way to create the fields is to start the way you have done, but instead of writing "A + B", right click where A would be and select "Insert Field". You are inserting a field within a field. Now select Object for the type and then select the first attribute. Now select Value in the center column for the property and then select OK to add the field. Now type "+", then right click and insert another field. This time choose Object and then select the second attribute and the Value property. Now you are done with the SUM field. In essence, you have FIELD + FIELD.

 

The downside to using fields is that if you change either A or B, then you have to issue the UPDATEFIELD command. If you use a dynamic block, you can use lookup lists and custom variables to calculate and even change the operand.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 4

rodrigo.gower
Enthusiast
Enthusiast

Thank you very much for your response, it was very helpful. I would like to know now what would be the correct way to "update" these values, since when inserting the block it asks me again to define the values. If I insert many blocks (which is what I will have to do), how can I "copy" what was already done with the initial block? I ask this because the block will be a node that will contain information to export in GIS format.

I reiterate my gratitude.

 

0 Likes
Message 4 of 4

Ed__Jobe
Mentor
Mentor

Rather than insert the blocks, just copy them to a new location. You could also make a tool on a palette with the values assigned and then you just drag the block where you want it. If you do that, be sure to set the layer, and other properties. You can change the A and B attributes, but don't change the result attribute.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature