Author Topic: IF / THEN Statements with Civil3D  (Read 5056 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
IF / THEN Statements with Civil3D
« on: July 22, 2009, 02:24:56 PM »
I am trying to create an expression which is tied to a label style. What I want it to do, is take the

Point Elevation
- (User Defined Property) - 4.6
------------------------
Result

However, if I do not put in a Number in the User Defined Property I want it to Either A.) Not shown a result. or B.) Give me a N/A or 0.00 result


Thanks for the help!
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #1 on: July 22, 2009, 02:33:16 PM »
I am trying to create an expression which is tied to a label style. What I want it to do, is take the

Point Elevation
- (User Defined Property) - 4.6
------------------------
Result

However, if I do not put in a Number in the User Defined Property I want it to Either A.) Not shown a result. or B.) Give me a N/A or 0.00 result


Thanks for the help!

Not sure if this produces the result you want; however you might set upper and lower bounds for that user defined property....


Let me run a couple of tests....and report back
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #2 on: July 22, 2009, 02:38:26 PM »
First
create a user defined classification (INPUT)

you will want TWO expressions

The FIRST One to evaluate your input  (evaluate user input)

ABS(userinput<=0)=0

and should that value be less than or equal to 0, then have it return Zero...
then create the SECOND expresion, that calls the first to perform the math....and return the resultant for your use in the label

{evaluate user input}-4.6
« Last Edit: July 22, 2009, 02:49:00 PM by mjfarrell »
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
Re: IF / THEN Statements with Civil3D
« Reply #3 on: July 22, 2009, 02:43:45 PM »
lol Say What?! lol :-o

Here is what I have in my equation:
IF({Point Elevation}-INV8>=1000.0,0, 0)

And no matter what, it returns 0.00.
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #4 on: July 22, 2009, 02:51:10 PM »
Try the above...it seems to produce what you are after for me.

This is the fun stuff I rarely get a chance to include in my normal training classes.   :-)

(Note to James Cannon: this IS NOT a sales pitch)
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
Re: IF / THEN Statements with Civil3D
« Reply #5 on: July 22, 2009, 02:56:26 PM »
Lets say this.
Point Elevation is 800.00
User-Defined is 4.5
--------------------------
Result would = 795.50

Now,
Point Elevation is 800.00
User-Defined is 0.0
--------------------------
Result would show 0.00 or NA

The problem is with the first example using the IF Equation above, no matter what, it returns a 0.00 value and not a 795.50 result.
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #6 on: July 22, 2009, 03:02:05 PM »
uh huh....did you try what I outlined?

it does the following


user defined property can be anything....as long as it is an integer...

if that number is less than or equal to 0 it returns ZERO

the second exprssion uses that Value, and then does the math...and returns the resultant...

Your confusion is leading me to believe I don't quite understand what you are after....causing me to confuse, instead of illuminate.


I guess I'm having a tough time understanding why you want to return a zero, if the point elevation is 800.00 and the user enters nothing, or zero?  Isn't the elevation still 800.00?

your math is confusing me....

where

(800.00-4.76)=795.24 and you want the 795.24 to display

where
(800.00-0)=0  and you want this to be zero NOT 800.00 which my logic based brain doesn't get. ?
« Last Edit: July 22, 2009, 03:10:43 PM by mjfarrell »
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
Re: IF / THEN Statements with Civil3D
« Reply #7 on: July 22, 2009, 03:09:53 PM »
OK GOTCHA. Making sure there is no way to return "Letter Format" Just intergers?
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #8 on: July 22, 2009, 03:13:02 PM »
OK GOTCHA. Making sure there is no way to return "Letter Format" Just intergers?

Correct, the exprssion generator/evaluator will only return integers:


Format Result As
Specifies how the expression results are formatted.

Double: This value is formatted using the Unitless type.
NoteThe following are all of type Double but are formatted according to the settings on the Ambient Settings tab in the Drawing settings:
Angle
Area
Coordinate
Dimension
Direction
Distance
Elevation
Grade/Slope
Latitude
Longitude
Station
Volume
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2603
  • I can't remeber what I already asked! I need help!
Re: IF / THEN Statements with Civil3D
« Reply #9 on: July 22, 2009, 03:18:11 PM »
Sounds good. Thank you for your help!
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #10 on: July 22, 2009, 03:42:15 PM »
Sounds good. Thank you for your help!

No, no, Thank you!

I don't get to play around with this sort of thing near enough with the typical students I work with.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

ChristopherF

  • Newt
  • Posts: 55
Re: IF / THEN Statements with Civil3D
« Reply #11 on: July 22, 2009, 05:12:49 PM »
You can get the NA with an additional text label component and using two expressions to control the text height of the label components, one for the NA and one for the adjusted value. The concept is similar to getting the bearing labels in the attached drawing to show NORTH, SOUTH, EAST and WEST instead of the numeric values.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: IF / THEN Statements with Civil3D
« Reply #12 on: July 22, 2009, 06:39:50 PM »
Be your Best


Michael Farrell
http://primeservicesglobal.com/