AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

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

Subassembly Composer Change Sign Of A Slope

491 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: 40
Registered: ‎02-17-2010
Message 2 of 4 (477 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,114
Registered: ‎01-07-2011
Message 3 of 4 (470 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
Ernst Engineering
www.ernstengineering.com
Active Contributor
viktors.zilinskis
Posts: 40
Registered: ‎02-17-2010
Message 4 of 4 (453 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
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.