Вы находитесь на странице: 1из 17

Math Class

Other Versions

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as
placeholders.]
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.
Inheritance Hierarchy
System..::..Object
System..::..Math
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
C#
C++
F#
JScript
VB
public static class Math

The Math type exposes the following members.


Methods

Name Description

Abs(Double) Returns the absolute value of a double-precision floating-point number.

Abs(Int32) Returns the absolute value of a 32-bit signed integer.

Acos Returns the angle whose cosine is the specified number.

Asin Returns the angle whose sine is the specified number.


Atan Returns the angle whose tangent is the specified number.

Atan2 Returns the angle whose tangent is the quotient of two specified numbers.

Ceiling Returns the smallest integral value that is greater than or equal to the specified double-precision floating

Cos Returns the cosine of the specified angle.

Cosh Returns the hyperbolic cosine of the specified angle.

Exp Returns e raised to the specified power.

Floor Returns the largest integer less than or equal to the specified double-precision floating-point number.

IEEERemainder Returns the remainder resulting from the division of a specified number by another specified number.

Log Returns the natural (base e) logarithm of a specified number.

Log10 Returns the base 10 logarithm of a specified number.

Max(Double, Double) Returns the larger of two double-precision floating-point numbers.


Max(Int32, Int32) Returns the larger of two 32-bit signed integers.

Min(Double, Double) Returns the smaller of two double-precision floating-point numbers.

Min(Int32, Int32) Returns the smaller of two 32-bit signed integers.

Pow Returns a specified number raised to the specified power.

Round Rounds a double-precision floating-point value to the nearest integral value.

Sign Returns a value indicating the sign of a double-precision floating-point number.

Sin Returns the sine of the specified angle.

Sinh Returns the hyperbolic sine of the specified angle.

Sqrt Returns the square root of a specified number.

Tan Returns the tangent of the specified angle.

Tanh Returns the hyperbolic tangent of the specified angle.


Truncate Calculates the integral part of a specified double-precision floating-point number.

Top
Fields

Name Description

E Represents the natural logarithmic base, specified by the constant, e.

PI Represents the ratio of the circumference of a circle to its diameter, specified by the constant, .

Top
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not
guaranteed to be thread safe.
P1 (AP1) Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

P1 to P1000 is reserved as Subassembly Points. AP1 to AP1000 are available to


represent auxiliary points.

Function Name Description Comments

X Get a point's Example:


horizontal
position, P1.X
relative to the
Origin Point of If Subassembly Side is Right and
Subassembly. P1 is on the right of Origin, then P1.X
is Positive.
If Subassembly Side is Left and P1
is on the left of Origin, then P1.X is
Positive.

Y Get a point's
vertical
position,
relative to the
Origin Point of
Subassembly.

Offset Get a point's If the subassembly is attached to an


offset position, offset baseline, then the offset value is
relative to the relative to the offset baseline.
baseline.

Elevation Get a point's


elevation
relative to 0.0.

DistanceTo("point") Get the Example:


distance to
Function Name Description Comments

another point. P1.DistanceTo("P2") or


P1.DistanceTo(L1.StartPoint)

SlopeTo("point") Get the slope to Example:


another point.
P1.SlopeTo("P2") or
P1.SlopeTo(L1.StartPoint)

IsValid Determine
whether a
target is
assigned and is
valid to use.

DistanceToSurface(su Get the vertical Example:


rface target) distance to a
surface target. P1.DistanceToSurface(ExistingSurface)>0.

If P1 is above the surface, a


positive value is returned.
If P1 is below the surface, a
negative value is returned.
L1 (AL1) Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

L1 to L1000 is reserved as Subassembly Links. AL1 to AL1000 are available to


represent auxiliary links.

Function Name Description Comments

Slope Get the slope of a link. The slope is positive if the link
is in upward direction.

Length Get an absolute length. A positive value is always


returned.

Xlength Get a link's horizontal A positive value is always


length. returned.

Ylength Get a link's vertical A positive value is always


length. returned.

StartPoint Get the start point of a Example:


link.
To get the start point's X:
L1.StartPoint.X

EndPoint Get the end point of a


link.

MaxY Get the maximum Y


elevation from a link's
points.

MinY Get the minimum Y


elevation from the
link's points.
Function Name Description Comments

MaxInterceptY(slope) Apply the highest The Y elevation is relative to


intercept of a given Origin point.
link's points to the
start of another link. This is used in rehab
subassemblies to find the critical
MinInterceptY(slope) Apply the lowest depth for mill/overlay.
intercept of a given
link's points to the
start of another link.

LinearRegressionSlope Do a linear regression This is used in rehab


on the points in a link subassemblies to find the slope
to find the best fit of the existing pavement.
slope between all of
them. Both of these linear regression
functions are based on standard
LinearRegressionInterc Find the Y value of the
eptY linear regression line
(at the start point of
the link).

IsValid Determine whether a


target is assigned and
is valid to use.

HasIntersection(Link2I Determine whether the Three parameters are available:


D as string, current link intersects
ExtendLink1 as with another link. Link2ID: string specifying
bool=false, the intersecting link. Enter
ExtendLink2 as intersection link name in
bool=false) quotation marks.
ExtendLink1: boolean
value specifying whether
Link 1 is extended. The
default value is False.
ExtendLink2: boolean
value specifying whether
Link 2 is extended. The
default value is False.
Examples:
L1.HasIntersection("L2")

L1.HasIntersection("L2",true,true)
SE Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

Function Name Description Comments

HasLeftLI Return true if left lane


inside superelevation
slope is present.

HasLeftLO Return true if left lane


outside superelevation
slope is present.

HasLeftSI Return true if left shouder


inside superelevation
slope is present.

HasLeftSO Return true if left shouder


outside superelevation
slope is present.

HasRightLI Return true if right lane


inside superelevation
slope is present.

HasRightLO Return true if right lane


outside superelevation
slope is present.

HasRightSI Return true if right


shouder inside
superelevation slope is
present.
Function Name Description Comments

HasRightSO Return true if right


shouder outside
superelevation slope is
present.

LeftLI Return left lane inside


superelevation slope.

LeftLO Return left lane outside


superelevation slope.

LeftSI Return left shouder inside


superelevation slope.

LeftSO Return left shouder


outside superelevation
slope.

RightLI Return right lane inside


superelevation slope.

RightLO Return right lane outside


superelevation slope.

RightSI Return right shouder


inside superelevation
slope.

RightSO Return right shouder


outside superelevation
slope.

Offset Target Class


Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share
Add to Collection

Function Name Description Comments

IsValid Determine whether a Example:


target is assigned and is
valid to use. OffsetTarget.IsValid

Note: For an example of


the use of the IsValid
function, see
the Example in the Target
Parameters Tab topic.

Offset Get the offset value of the Example:


target.
OffsetTarget.Offset

Elevation Target Class


Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

Function Name Description Comments

IsValid Determine whether a Example:


target is assigned and is
valid to use. ElevationTarget.IsValid

Elevation Get the elevation value of Example:


Function Name Description Comments

a target. ElevationTarget.Elevation

Surface Target Class


Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

Function Name Description Comments

IsValid Determine whether a Example:


target is assigned and is
valid to use. SurfaceTarget.isValid

Parent topic: API Functions

Baseline Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

Function Name Description Comments

Station Get the current station on


Function Name Description Comments

the baseline alignment.

Elevation Get the current elevation


on the baseline.

RegionStart Get the start station of


the current region.

RegionEnd Get the end station of the


current region.

Grade Get the grade of the


baseline profile at the
current station.

TurnDirection Get the turn direction at Depending on the result


the current station, based found at the current
on the curve group. station, the result is
returned in one of three
ways:
Left turn: -1
Not on curve: 0
Right turn: 1

Enumeration Type Class


Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

Function Name Description Comments

Value Return the string value of


the current enumeration
Function Name Description Comments

item.

Parent topic: API Functions

SA Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share

Add to Collection

This class checks the status of an overall subassembly.

Function Name Description Comments

IsLayout Return True if the current Example:


preview mode is Layout
Mode. SA.IsLayout

Parent topic: API Functions

Cant Class
Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share
Add to Collection

Function Name Description Comments

PivotType Returns the pivot method Depending on the result


assigned to the current found at the current
curve. station, the result is
returned in one of three
ways:
-1: Low Side Rail
(left rail)
0: Center Baseline
(centerline)
1: High Side Rail
(right rail)

LeftRailDeltaElevation Returns the differential


elevation for the left rail.

RightRailDeltaElevation Returns the differential


elevation for the right rail.

TrackWidth Returns the Track Width


that is assigned to the
alignment.

IsDefined Determines whether cant Example:


has been calculated on
the alignment. IF(Cant.IsDefined, True,
False)

Parent topic: API Functions

API Function Examples


Apr 13 2016In-Product View
Applies to AutoCAD Civil 3D 2017

Share
Add to Collection

Use the API functions to get parameter values from other geometry elements.

To see examples of API functions, open the following Sample PKT file:

API Function Examples.pkt

The following table explains each of the API functions that are used in this example.

Element API Function Description

Cut or Fill Decision AP10.Y < P1.Y Checks whether the Y


Element API Function Description

value of AP10 is less than


the Y value of P1:
If True, the Fill case
is used
If False, the Cut
case is used

Fill Decision P1.DistanceToSurface(Surf Checks whether the


ace) > 2 distance between P1 and
the Surface is greater
than 2:
If True, the High Fill
case (slope to the
surface at -200%) is
used
If False, the Low Fill
case (slope the
surface at -100%) is
used

Cut Decision P1.DistanceToSurface(Surf Checks whether the


ace) > -2 distance between P1 and
the Surface is greater
than -2:
If True, the Deep
Cut case (slope to the
surface at 100%) is
used
If False, the Shallow
Cut case (slope the
surface at 200%) is
used

P4 Slope L1.Slope Apply the slope that is


calculated for L1.

P4 Delta Y P2.Y - P3.Y Apply a Y value that is


relative to the vertical
distance from the
previous point (P3).

Вам также может понравиться