AutoCAD Civil 3D General Discussion

AutoCAD Civil 3D General Discussion

Reply
Valued Contributor
StumpMasterFlex
Posts: 63
Registered: ‎09-25-2013
Message 1 of 12 (368 Views)
Accepted Solution

Expressions

368 Views, 11 Replies
01-30-2014 11:18 AM

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,
Draftsperson (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

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)? 

*Expert Elite*
jmayo
Posts: 3,030
Registered: ‎11-13-2006
Message 2 of 12 (350 Views)

Re: Expressions

01-30-2014 12:24 PM 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, PE
IDSP 2014
Win 7 64, Xeon ES165@3.2Ghz,
64 GB RAM, Quadro K4000 (x2)
Valued Mentor
ericcollins6932
Posts: 334
Registered: ‎05-13-2010
Message 3 of 12 (332 Views)

Re: Expressions

01-30-2014 01:31 PM in reply to: StumpMasterFlex

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 7 Enterprise SP1 64 bit
Intel i7 3770 @ 3.40 GHz
16 GB RAM
Civil 3D 2012 SP2
*Pro
fcernst
Posts: 1,161
Registered: ‎01-07-2011
Message 4 of 12 (325 Views)

Re: Expressions

01-30-2014 01:50 PM 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 2015 SP2
Ernst Engineering
www.ernstengineering.com
*Expert Elite*
jmayo
Posts: 3,030
Registered: ‎11-13-2006
Message 5 of 12 (319 Views)

Re: Expressions

01-30-2014 02:05 PM in reply to: fcernst

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

John Mayo, PE
IDSP 2014
Win 7 64, Xeon ES165@3.2Ghz,
64 GB RAM, Quadro K4000 (x2)
Valued Contributor
StumpMasterFlex
Posts: 63
Registered: ‎09-25-2013
Message 6 of 12 (296 Views)

Re: Expressions

01-31-2014 05:01 AM 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,
Draftsperson (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
Valued Contributor
StumpMasterFlex
Posts: 63
Registered: ‎09-25-2013
Message 7 of 12 (294 Views)

Re: Expressions

01-31-2014 05:03 AM in reply to: ericcollins6932

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,
Draftsperson (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
*Pro
fcernst
Posts: 1,161
Registered: ‎01-07-2011
Message 8 of 12 (286 Views)

Re: Expressions

01-31-2014 05:48 AM in reply to: StumpMasterFlex

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

Fred Ernst, PE
C3D 2015 SP2
Ernst Engineering
www.ernstengineering.com
Valued Contributor
StumpMasterFlex
Posts: 63
Registered: ‎09-25-2013
Message 9 of 12 (277 Views)

Re: Expressions

01-31-2014 06:27 AM 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,
Draftsperson (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
*Pro
fcernst
Posts: 1,161
Registered: ‎01-07-2011
Message 10 of 12 (271 Views)

Re: Expressions

01-31-2014 06:43 AM 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 2015 SP2
Ernst Engineering
www.ernstengineering.com
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.