AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Active Contributor
43 Posts
1 Kudo
Registered: ‎02-17-2010
Post 1 of 4
Accepted Solution

Subassembly Composer Change Sign Of A Slope

567 Views, 3 Replies
01-07-2013 04:28 AM

Hello!

 

I have an Input parameter called "Construction Slope" of type "Slope" that I would always like to be negative. As i did not find the possibility to restrict end user to inputing only negative value I tried to change the sign of the slope to negative if it is positive  by using an "IF" expression (when used as a "Geometry Property" for a new link):

 

IF(ConstructionSlope<=0,ConstructionSlope,(-1)*ConstructionSlope)

 However this expression produces an error: "Compiler error(s) encountered processing expression <...> Cannot infer a common type because more than one type is possible". If i remove multiplication by -1 then the error is gone (and the whole expression becomes meaningless as well of course). See even attached image. Any ideas about how to fix this one would be apprecciated!

 

BR,

Viktors

 

I found a workaround actually:

 

IF(ConstructionSlope<=0,1*ConstructionSlope,(-1)*ConstructionSlope)

Seems like if a slope variable is multiplied by a number then i becomes something else (another type of variable). So if I multiply even the first argument by 1, the problem is gone (both arguments become of the same type as both of them are multiplied by a number). I am not sure my explanation is quite correct but it seems to work at least.

-math.abs(ConstructionSlope)

Active Contributor
43 Posts
1 Kudo
Registered: ‎02-17-2010
Post 2 of 4

Re: Subassembly Composer Change Sign Of A Slope

01-08-2013 01:47 AM in reply to: viktors.zilinskis

I found a workaround actually:

 

IF(ConstructionSlope<=0,1*ConstructionSlope,(-1)*ConstructionSlope)

Seems like if a slope variable is multiplied by a number then i becomes something else (another type of variable). So if I multiply even the first argument by 1, the problem is gone (both arguments become of the same type as both of them are multiplied by a number). I am not sure my explanation is quite correct but it seems to work at least.

*Pro
1,182 Posts
180 Kudos
Registered: ‎01-07-2011
Post 3 of 4

Re: Subassembly Composer Change Sign Of A Slope

01-08-2013 06:16 AM in reply to: viktors.zilinskis

-math.abs(ConstructionSlope)

Fred Ernst, PE
C3D 2015 SP2
Ernst Engineering
www.ernstengineering.com
Active Contributor
43 Posts
1 Kudo
Registered: ‎02-17-2010
Post 4 of 4

Re: Subassembly Composer Change Sign Of A Slope

01-09-2013 05:11 AM in reply to: fcernst

simplier and also works, thanks!

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!