Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Expressions

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
StumpMasterFlex
898 Views, 11 Replies

Expressions

Hello, not sure what i am doing.  I have basic computer programming skills from college 15 years ago.

I am trying to create a smart label using expressions.   I want to label a structure the following based on inner diameter

< = 1200, i want the label to display 701.010

>1200 & < = 1500, i want the label to display 701.011

etc

 

This is what I came up with but it won't work

IF(({Inner Structure Diameter}<=1200,701.010),IF({Inner Structure Diameter}>=1200&<=1500,701.011))

 

I have research on line but not sure I understand fully.  If we can get one to work we can use this type of labeling in other formats.

 

Any suggestions

Kindest Regards
Michael,
Civil Design Technologist (Exploration Technologist)
Civil 3D 2013
Windows 8
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
32. GB
64-bit Oepration System, x64-based processor
No Pen or Touch Input
11 REPLIES 11
Message 2 of 12
jmayo-EE
in reply to: StumpMasterFlex

I don't think you can nest IF statements.

 

Make one exp for < and another for >. Bothe return a Space character if false, the diameter if true.

 

In the labels style have two componets. Both display but only the true staement will display text.

John Mayo

EESignature

Message 3 of 12

Try this

 

IF(({Inner Structure Diameter}<=1200,701.010),701.011)

Or in pseudocode if Inner St Dia <=1200 then 701.01 else 701.011

You might be able to nest if statements, and if so

IF({Inner Structure Diameter}<1200,701.010,IF({Inner Structure Diameter}=1200,701.011,701.012))

If Inner St Dia <1200 then 701.01, elseif Inner St Dia = 1200 then 701.011 else 701.012 (when St Inner Dia >1200)

Eric Collins, P.Tech.(Eng.)

Win 10
Intel i7 9700 @ 3 GHz
16 GB RAM
Civil 3D 2019
Message 4 of 12
fcernst
in reply to: StumpMasterFlex

IF({Inner Structure Diameter}<=1200,701.010,IF({Inner Structure Diameter}<=1500,701.011,”Out of Range”))



Fred Ernst, PE
C3D 2024
Ernst Engineering
www.ernstengineering.com
Message 5 of 12
jmayo-EE
in reply to: fcernst

I never mind being proven wrong. Kudos Eric and Fred. Thanks.

John Mayo

EESignature

Message 6 of 12
StumpMasterFlex
in reply to: fcernst

Hi Fred, thanks for taking the time help,

 

Does this work for you?  I am getting a the following error.

parse error, undefined symbol "Out

 

I think I need an out of range expression?

Kindest Regards
Michael,
Civil Design Technologist (Exploration Technologist)
Civil 3D 2013
Windows 8
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
32. GB
64-bit Oepration System, x64-based processor
No Pen or Touch Input
Message 7 of 12

Hi Eric, funny I worked with an Eric Collins in Alberta in the Oil Patch.  Thanks for taking the time to respond.

 

I can't seem to get the expression to return any value but 701.010.  I just copied and pasted yours and it still only returns 701.010 no matter what the inner structure width is.

Kindest Regards
Michael,
Civil Design Technologist (Exploration Technologist)
Civil 3D 2013
Windows 8
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
32. GB
64-bit Oepration System, x64-based processor
No Pen or Touch Input
Message 8 of 12
fcernst
in reply to: StumpMasterFlex

What value do you want to return if your diameter is out of this range?



Fred Ernst, PE
C3D 2024
Ernst Engineering
www.ernstengineering.com
Message 9 of 12
StumpMasterFlex
in reply to: fcernst

IF({Inner Structure Diameter}<=1200,701.010,IF({Inner Structure Diameter}<=1500,701.011,701.012))

 

It still only returns 701.010.  I checked the parts list and the diameters are all different. 

 

Thanks anyways.

Kindest Regards
Michael,
Civil Design Technologist (Exploration Technologist)
Civil 3D 2013
Windows 8
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
32. GB
64-bit Oepration System, x64-based processor
No Pen or Touch Input
Message 10 of 12
fcernst
in reply to: StumpMasterFlex

Yes, it works for me.

 

I am in Imperial units, so my structure diameters are in inches and I am using feet in testing this expression now.

 

What happens if you change your 1200 to 1.2 and your 1500 to 1.5 (for meters)? 



Fred Ernst, PE
C3D 2024
Ernst Engineering
www.ernstengineering.com
Message 11 of 12
StumpMasterFlex
in reply to: fcernst

IT WORKS.  Your Genius.  Thank you so much.

 

As I slowly poor you a beer and cheers.

Kindest Regards
Michael,
Civil Design Technologist (Exploration Technologist)
Civil 3D 2013
Windows 8
Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
32. GB
64-bit Oepration System, x64-based processor
No Pen or Touch Input
Message 12 of 12

BTW, I prefer to build formulae like this in Excel as it is easier to test there and get all the parentheses straight...

Eric Collins, P.Tech.(Eng.)

Win 10
Intel i7 9700 @ 3 GHz
16 GB RAM
Civil 3D 2019

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

Post to forums  

Rail Community


Autodesk Design & Make Report