Highest Distance Value

Highest Distance Value

Anonymous
Not applicable
2,316 Views
24 Replies
Message 1 of 25

Highest Distance Value

Anonymous
Not applicable
Hello,

First time posting here. I am trying to setup a field or something similar that will display the longest distance of 6 different lines within a block. Then I want to extract the longest distance use it to calculate the slope. The part im struggling with is getting the max value from the variable lines within the block.

Something like =(MAX (Distance1 Distance2 ... Distance 6))*.125

I cant get this code to work in the formula portion of the field and I have no experience with LISP. I am still trying to wrap my head around the coding for LISP . I tried to find an answer before posting, any help would be appreciated.
0 Likes
Accepted solutions (1)
2,317 Views
24 Replies
Replies (24)
Message 21 of 25

Anonymous
Not applicable

I didn't know you could do absolute value in the field formula... This is great! I think this is exactly what I need to make this thing work. When I get a chance I'll start writing out the n6 formula and post back. Thats going to be a lot of parenthesis. 

 

max(d1,d2,d3,d4,d5,d6)=.5[(.5[(.5[(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])+d4+|(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])-d4|])+d5+|(.5[(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])+d4+|(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])-d4|])-d5|])+d6+|(.5[(.5[(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])+d4+|(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])-d4|])+d5+|(.5[(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])+d4+|(.5[(.5(d1+d2+|d1-d2|))+d3+|(.5(d1+d2+|d1-d2|))-d3|])-d4|])-d5|])-d6|]

 

I think I did all the subtitution. This is going to be alot of linking to objects.

0 Likes
Message 22 of 25

ВeekeeCZ
Consultant
Consultant
Accepted solution

This is definitely unnecessarily complicated! See the excel file.

 

And read more about field functions here

 

BTW Nice thing about Excel is that both Excel and Autocad are using same syntax. So since in autocad is very difficult maintain parenthesis, I recommend to copy-paste the formula into Autocad and just replace cell names with real fields.

Message 23 of 25

Anonymous
Not applicable

Very nice work! Plugged everything in and it works. 

0 Likes
Message 24 of 25

dbroad
Mentor
Mentor

Such coding to workaround a missing maximum function for 6 values, requires each of the first 4 distance parameters to be entered 8 times and the next 2 to be entered 4 times.  The string length of such a field code exceeds AutoCAD's abilities to solve it.  A maximum of four values is the most that evaluated this way unless the code can be simplified further.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 25 of 25

dbroad
Mentor
Mentor

I retract that statement.  Great solution @ВeekeeCZ.  The formula can be entered as sub-formulas with each part small enough to not exceed the string size limitation of the field.  This is much better than trying to implement the solution with lisp.

Architect, Registered NC, VA, SC, & GA.
0 Likes