AutoCAD Civil 3D General Discussion

AutoCAD Civil 3D General Discussion

Reply
Contributor
kdixon
Posts: 22
Registered: ‎10-26-2006
Message 1 of 5 (945 Views)
Accepted Solution

USING AN EXPRESSION IN A SLOPE LABEL

945 Views, 4 Replies
02-09-2011 03:04 PM

I am trying to add a custom surface label to a drawing. The Label will be used to calculate an ‘LS’ value between two points on a surface. The ‘LS’ value is dependant on two pieces of input information: Surface Slope Distance, and Surface Slope (%).  I am using standard surface labels {Surface Slope Distance} and {Surface Slope} in the drawings currently, and they are working fine with no problems. The problem comes when I try to create the 3rd custom label to calculate the ‘LS’ value using the values of the standard {Surface Slope Distance} and {Surface Slope} labels.

 

The ‘LS’ Calculation is a fairly complicated formula which varies depending on the % Surface Slope; Here is the formula for each slope range:

 

0.00% < Surface Slope <= 1.00% :

 

‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.2] *[SIN(ATAN(Surface Slope)]

 

1.00%< Surface Slope <= 3.00%:

 

‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.3] *[SIN(ATAN(Surface Slope)]

 

3.00%< Surface Slope <= 5.00%:

 

‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.4] *[SIN(ATAN(Surface Slope)]

 

5.00%< Surface Slope <= 9.00%:

 

‘LS’ = 0.03 + 10.8*[(Surface Slope Length / 22.13)^0.5] *[SIN(ATAN(Surface Slope)]

 

Surface Slope > 9.00%

 

‘LS’ = 10.8*[(Surface Slope Length / 22.13)^0.5] *[(SIN(ATAN(Surface Slope))/22.13]^0.6

 

The label that I am trying to make will show an arrow in the direction of flow (higher elevation to lower) between two points, showing:

 

i) Surface Slope (%)

ii) Surface Slope Length (m)

iii) Calculated ‘LS’ Value

 

I have created an expression in Surface Slope Labels containing the above formula using an IF statement. The formula seems to work accurately 90% of the time, but I am noticing deviation in the output when:

 

- the Surface Slope Length values are small (<~25m),

- the Surface Slopes are high (>~3.00%)

 

 

The strangest issue I have been having is that the label gives different output values when the arrows are drawn in opposite directions between the same two points. Ie: When drawn from point A to B the ‘LS’ Value may be 0.28, however when drawn from the same Point B to A the ‘LS’ Value is0.26. At first I thought this could have been due to the slopes being read into the formula as +’ve or –‘ve causing the errors. I changed my code to take the absolute value by using the following if statement:

 

SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))

 

However, the output is still different between the same two points in different directions.

 

If anyone is able to offer any suggestions at all please let me know. I have copied my code down below. Thanks very much in advance to anyone with any suggestions!

 

IF(0.00<{Surface Slope}<=0.01, 0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8), IF({Surface Slope}<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8),IF({Surface Slope}<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(IF({Surface Slope}>0,{Surface Slope},-1*{Surface Slope})))*10.8),IF({Surface Slope}<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(IF({Surface Slope}>0,1*{Surface Slope},-1*{Surface Slope})))*10.8),IF(1.0>{Surface Slope}>0.09, ((({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(IF({Surface Slope}>0,1*{Surface Slope},-1*{Surface Slope})))/0.0896)^0.6),0)))))

 

 

Getting the absolute value for the slope this way seems to work correctly:

 

IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8), IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(1.0>ABS({Surface Slope})>0.09, ((({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))/0.0896)^0.6),0)))))

Thanks for getting back to me so quickly. I am now using the ABS function, and everything is working fine.

 

It turns out that I didn’t need to use the ABS function in an IF statement. For example in:

 

SIN(ATAN((IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope})))

 

The ABS({Surface Slope}) will always return a value greater than zero, so the statement isn’t really needed. I found that I just needed to use SIN(ATAN(ABS({Surface Slope})) to get the same result.

 

I think that the error in my original code was in the beginning of each of my statements in not taking the ABS value of the Surface Slope when testing it against the 5 different ranges of potential slope values for the formula(s).  i.e. IF(0.00<ABS({Surface Slope})<=0.01, ….. instead of IF(0.00<{Surface Slope}<=1.00,….

 

Thanks again for pointing out the ABS function and for your insight with this. I didn’t know the ABS function could be used in the Expressions tool as it wasn’t one of the functions listed on the drop-down menu along with IF, SIN, ATAN, etc.

 

I’ve posted the working code below that I am now using if anyone else is interested.  

 

IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(1.0>ABS({Surface Slope})>0.09, (({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(ABS({Surface Slope})))/0.0896)^0.6,0)))))

Distinguished Mentor
Civil3DReminders
Posts: 910
Registered: ‎03-24-2009
Message 2 of 5 (921 Views)

Re: USING AN EXPRESSION IN A SLOPE LABEL

02-09-2011 10:04 PM in reply to: kdixon

Getting the absolute value for the slope this way seems to work correctly:

 

IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8), IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))*10.8),IF(1.0>ABS({Surface Slope})>0.09, ((({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(IF(ABS({Surface Slope})>0,1*ABS({Surface Slope}),-1*ABS({Surface Slope}))))/0.0896)^0.6),0)))))

Contributor
kdixon
Posts: 22
Registered: ‎10-26-2006
Message 3 of 5 (887 Views)

Re: USING AN EXPRESSION IN A SLOPE LABEL

02-10-2011 09:54 AM in reply to: kdixon

Thanks for getting back to me so quickly. I am now using the ABS function, and everything is working fine.

 

It turns out that I didn’t need to use the ABS function in an IF statement. For example in:

 

SIN(ATAN((IF(ABS({Surface Slope})>0,ABS({Surface Slope}),-1*ABS({Surface Slope})))

 

The ABS({Surface Slope}) will always return a value greater than zero, so the statement isn’t really needed. I found that I just needed to use SIN(ATAN(ABS({Surface Slope})) to get the same result.

 

I think that the error in my original code was in the beginning of each of my statements in not taking the ABS value of the Surface Slope when testing it against the 5 different ranges of potential slope values for the formula(s).  i.e. IF(0.00<ABS({Surface Slope})<=0.01, ….. instead of IF(0.00<{Surface Slope}<=1.00,….

 

Thanks again for pointing out the ABS function and for your insight with this. I didn’t know the ABS function could be used in the Expressions tool as it wasn’t one of the functions listed on the drop-down menu along with IF, SIN, ATAN, etc.

 

I’ve posted the working code below that I am now using if anyone else is interested.  

 

IF(0.00<ABS({Surface Slope})<=0.01,0.03+((({Surface Slope Distance}/22.13)^0.2)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.03, 0.03+((({Surface Slope Distance}/22.13)^0.3)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.05, 0.03+((({Surface Slope Distance}/22.13)^0.4)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(ABS({Surface Slope})<=0.09, 0.03+((({Surface Slope Distance}/22.13)^0.5)*SIN(ATAN(ABS({Surface Slope})))*10.8),

IF(1.0>ABS({Surface Slope})>0.09, (({Surface Slope Distance}/22.13)^0.5)*(SIN(ATAN(ABS({Surface Slope})))/0.0896)^0.6,0)))))

Distinguished Contributor
onsionsi1
Posts: 148
Registered: ‎10-19-2011
Message 4 of 5 (395 Views)

Re: USING AN EXPRESSION IN A SLOPE LABEL

04-05-2013 03:34 PM in reply to: kdixon

What do you mean by (LS) Mr. kdixon

 

Thank you.

Please do not forget approve as solutions and Points
to Remember Please Accept as Solution and Kudos Please
Contributor
kdixon
Posts: 22
Registered: ‎10-26-2006
Message 5 of 5 (389 Views)

Re: USING AN EXPRESSION IN A SLOPE LABEL

04-05-2013 03:54 PM in reply to: kdixon
I'm sorry, this issue was solved some time ago. I have changed the status in the discussion group.

The LS Formula is used to calculate soil loss, which we use in our Erosion Control Reports.

L is the slope length factor, representing the effect of slope length on erosion.
S is the slope steepness, representing the effect of slope steepness on erosion.

We have incorporated this Formula into an expression which we use in a slope label that displays the Length, Slope and resulting LS factor.

Kirk R. Dixon, C.E.T.
Associate / Project Technologist
[cid:image002.png@01CE321D.FF38DC80]Centre Eight Ten * Suite 110 * 7777 - 10th Street NE * Calgary, Alberta * T2E 8X2
Tel: 403.247.2001 (ext. 1123) * Fax: 403.247.2013 * Cel: 403.701.2010 * kdixon@bsei.ca * www.bsei.ca
P Please consider your environmental responsibility before printing any e-mail
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!