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

Can I do a little subtraction or addition inside a block?

18 REPLIES 18
Reply
Message 1 of 19
Anonymous
1545 Views, 18 Replies

Can I do a little subtraction or addition inside a block?

This is a block I double click and enter values.

 

265i739B757EC9E14FC1


A is the number of the first String
B is the number of the last String

I'd like C to be the difference: B-A

or the user could enter A and C, and it would do the quick addition of A+C to fill in B.

This is a block that I place a number of times in an electrical drawing, and the numbers need to be unique for each instance of the block..

Can AutoCAD calculate the third number like this if the user enters two? I don't see how to do this with Attributes..

Do I have to do it a different way with Tables or some such?

 

Or must I just keep doing the mental math?

18 REPLIES 18
Message 2 of 19
ojuris
in reply to: Anonymous

here example

You may change values for attributes A and B

 

Juris

Message 3 of 19
sgrya1
in reply to: ojuris

Can I ask how that was done?

Message 4 of 19
ojuris
in reply to: sgrya1

I made block vith attributes, then open attribute C

In Value box I press right button of mouse and choose    Insert field

Then You can insrt 1 value from some object or make expressions (Formula) or do other things

 

Regards

Juris

Message 5 of 19
Anonymous
in reply to: Anonymous
Message 6 of 19
Anonymous
in reply to: Anonymous

Juris..  thanks for this example.. and explanation...

 

kuiva..  great find of a blog post..  thanks for the background info..

 

this is exactly what I was hoping to do..

 

thanks everyone!

 

-ethan

Message 7 of 19
Anonymous
in reply to: Anonymous

Rats!  Looks like I spoke too soon

 

283iBA54043D6DF37892

Using this feature to insert fields, I'm able to do some great stuff..

 

I can auto-fill modules / string from my sheet set properties, and I can do a simple calc inside the block....

 

But...... since I insert the block more than 1 time in the single line..  potentially 10x or more of these blocks....  the calculator seems to break on future insertions.. 

 

anybody got any ideas?  block with built in formula attached.

Message 8 of 19
Anonymous
in reply to: Anonymous

The file I attached doesn't show what I’m trying to do very well.. here's one that shows multiple instances in use..

 

It works at this point if I dup the existing block within the drawing, but not if I try to put it on tool palette and insert it..

 

problem seems to be that the default values that get forced from the command prompt doesn’t work if with formulas

Message 9 of 19
Anonymous
in reply to: Anonymous

This example looks promising because I have the same problem, but I can not find "Operator". I select "Field Category" = "All" and then click on "Object", but the Property List is empty.

 

Actually, I want to measure a distance, round the value by some calculations and then strech a part of the block according to the result. I still wonder if this is possible at all.

Message 10 of 19
Anonymous
in reply to: Anonymous

so..  I've definitely got some properties within my block..  the one's I'm using in the formula are named attributes..

 

478i1B56A97C89525038

Message 11 of 19
Anonymous
in reply to: Anonymous

I found my mistake: I had a dynamic parameter named LENGTH and also an attribute named LENGTH. This leads to problems.

 

Now there is only one question left: what can I do with the formula editor and what can I not do? I was told that I can do ABS() and SIN() but when I tried INT() it did not work. I want to round a value to the next 5 mm, so I need something like

(INT(value / 5) + 1) * 5

 

Message 12 of 19
Charles_Shade
in reply to: Anonymous

Interesting! I knew that you could not have Attribs with the same Tag but did not relaize that the Parameters within the DynBlk need to be unique also; in regards to the Attribs.

 

Good catch of a nearly hidden potential problem.

Message 13 of 19
Joe-Bouza
in reply to: Anonymous

is there a limint to the possible input values? If yes, what is the range of values?

Joe Bouza
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.

EESignature

Message 14 of 19
ojuris
in reply to: Anonymous

hi!

 

1. I think Your formula is wrong, because if Your value is 5, then result is 10 (may be this is result what You need - I don`t know)

 

2. In auto cad field try that formula

   round((value+2.49)/5)*5

 

 

Juris

Message 15 of 19
Anonymous
in reply to: ojuris

2.49 or whatever, this is minor stuff. But how do you know that "round" exists and "int" does not exist??? And what about maximum of bracket levels? Where can I find a list of valid expressions? Is it somewhere hidden in the ACAD help files?

Message 16 of 19
ojuris
in reply to: Anonymous
Message 17 of 19
Anonymous
in reply to: ojuris

Now I got it. With other words: The formular editor uses the same syntax as KAL, the pocket calculator which can easily be found in the ACAD help.

 

The only trick is the access to dynamic parameters. I select "BlockPlaceHolder" from the Field Names list, select the dynamic parameter, copy the content of the Field expression window into the clipboard, select "Formula" from the Field Names list, paste the clipboard into the Formular field and add further stuff around it.

Message 18 of 19
Anonymous
in reply to: Anonymous

gret link Kuiva

 

http://cadingandcoding.blogspot.com/2008/10/explor​ing-autocad-field-capabilities-by.html

 

does anyone know of a way where I can have a diesel expresion that will prompt for an object and get a value.

example I would like to have the area of a pline as the value in the attribute.

but rather than having the user added the field I want to keep it simple and just have the user select a pline.

Message 19 of 19
Anonymous
in reply to: ojuris

I am trying to create a similar block where B-A exists in the default value of the block attribute rather than entering the value after the block is inserted.

This way the end user simply inserts the block in a drawing and enters the attribute value for B and A

 

So what I did was in my attribute default definition for C

I have added the formula that gets the attribute values and adds them up.

This does not work.

 

Anyone have any ideas on how to create a block where the end user inserts a block and only enters values for A and B rather than creating or editing fields, every time a new block is inserted

 

Help!!!!

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

Post to forums  

”Boost

 

”Tips

 

”Services