AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Active Contributor
viktors.zilinskis
Posts: 43
Registered: ‎02-17-2010
Message 1 of 4 (543 Views)
Accepted Solution

Subassembly Composer Change Sign Of A Slope

543 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
viktors.zilinskis
Posts: 43
Registered: ‎02-17-2010
Message 2 of 4 (529 Views)

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.

Valued Mentor
fcernst
Posts: 1,158
Registered: ‎01-07-2011
Message 3 of 4 (522 Views)

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
viktors.zilinskis
Posts: 43
Registered: ‎02-17-2010
Message 4 of 4 (505 Views)

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
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.