AutoCAD Civil 3D Customization

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

Subassembly Composer Change Sign Of A Slope

413 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

 

Active Contributor
viktors.zilinskis
Posts: 37
Registered: ‎02-17-2010
Message 2 of 4 (399 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,089
Registered: ‎01-07-2011
Message 3 of 4 (392 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: 37
Registered: ‎02-17-2010
Message 4 of 4 (375 Views)

Re: Subassembly Composer Change Sign Of A Slope

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

simplier and also works, thanks!

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs