• Articles
  • Api Documentation
Show / Hide Table of Contents
  • SprutTechnology.GeWatchDNClient
    • STGeWatch
    • STGeWatchClient
  • SprutTechnology.SCPostprocessor
    • ArcBreakMode
    • ArcSettings
    • BrakeAxesEnumerator
    • CLDArray
    • CLDAxisBrake
    • CLDCmdType
    • CLDCmdTypeExtensions
    • CLDConst
    • CLDCycle
    • CLDEDMMotionMode
    • CLDFeedKind
    • CLDFeedUnits
    • CLDFileType
    • CLDInterpMode
    • CLDMultiMotionAxis
    • CLDOriginPositionMode
    • CLDOriginType
    • CLDPlaneType
    • CLDRotationDir
    • CLDSpindleAction
    • CLDSpindleSpeedMode
    • CLDThreadOrient
    • CLDThreadUnits
    • CodeParamType
    • CommonFuncs
    • CountingNCWord
    • EDMRollMode
    • EPostprocessorException
    • IArrayNamedPropertyIndexer
    • IBinaryNCStorage
    • IBooleanNamedPropertyIndexer
    • ICLDAxesBrakeCommand
    • ICLDBrakeAxesIndexer
    • ICLDCircleCommand
    • ICLDClampCommand
    • ICLDCommand
    • ICLDCommentCommand
    • ICLDCoolantCommand
    • ICLDCoolantTubeIndexer
    • ICLDCutComCommand
    • ICLDCycleCommand
    • ICLDDelayCommand
    • ICLDEDMMoveCommand
    • ICLDEDMMoveSpan
    • ICLDEffectorCommand
    • ICLDExtCycleCommand
    • ICLDFeedrateCommand
    • ICLDFile
    • ICLDFileCmdIndexer
    • ICLDFileList
    • ICLDFiniCommand
    • ICLDFromCommand
    • ICLDGoHomeCommand
    • ICLDGotoCommand
    • ICLDInsertCommand
    • ICLDInterpolationCommand
    • ICLDLoadToolCommand
    • ICLDMachineAxesIndexer
    • ICLDMachineAxisInfo
    • ICLDMachineInfo
    • ICLDMachiningTool
    • ICLDMotionCommand
    • ICLDMoveVelocityCommand
    • ICLDMultiArcCommand
    • ICLDMultiArcPoint
    • ICLDMultiAxisArray
    • ICLDMultiGotoCommand
    • ICLDMultiMotionAxesIndexer
    • ICLDMultiMotionCommand
    • ICLDOpStopCommand
    • ICLDOriginCommand
    • ICLDPartNoCommand
    • ICLDPhysicGotoCommand
    • ICLDPlaneCommand
    • ICLDPowerCommand
    • ICLDPPFunCommand
    • ICLDPrintCommand
    • ICLDProject
    • ICLDRapidCommand
    • ICLDSelWorkpieceCommand
    • ICLDSinglePassThreadCommand
    • ICLDSpindleCommand
    • ICLDStopCommand
    • ICLDStructureCommand
    • ICLDSub
    • ICLDSubList
    • ICLDSyncAxesCommand
    • ICLDSyncWaitCommand
    • ICLDTakeoverCommand
    • ICLDTechOperation
    • ICLDTechOperationList
    • ICLDTLContactCommand
    • ICLDTranslator
    • ICodeParametersOfCLDCommand
    • ICodeParametersOfCLDCommandBooleanIndexer
    • ICodeParametersOfCLDCommandFloatIndexer
    • ICodeParametersOfCLDCommandIntegerIndexer
    • ICodeParametersOfCLDCommandStringIndexer
    • IFloatNamedPropertyIndexer
    • IInputBox
    • IInputBoxEnumValuesList<T>
    • IInputBoxFactory
    • IInputBoxProperty
    • IIntegerNamedPropertyIndexer
    • INamedPropertiesCollection
    • INamedProperty
    • INamedPropertyIndexer
    • INCBlockOwner
    • INCFileOwner
    • INCLabel
    • INCStorage
    • INCStorageManager
    • InitNamesProc
    • InpArray<T>
    • InpNumber
    • InputBoxEnumValuesFormer<T>
    • InputBoxValueSetter<T>
    • IPostprocessingLogReceiver
    • IPPFunTechInfo
    • IPPFunTechInfoTool
    • IPPFunTechInfoWorkpiece
    • IStringNamedPropertyIndexer
    • ITextNCStorage
    • IToolGeometry
    • Log
    • LogMessageType
    • MsgBtnSet
    • MsgClickedBtn
    • MsgDefBtn
    • MsgType
    • MultiMotionAxesEnumerator
    • NamedParamType
    • NamedPropIterator
    • NCBlock
    • NCBlockWordsEnumerator
    • NCLabelSnapMode
    • NCWord
    • NCWordDecPoint
    • NCWordSign
    • NCWordState
    • NCWordTextCase
    • NumericNCWord
    • PostprocessorSettings
    • TBinaryNCFile
    • TExternalNCFile
    • TextNCWord
    • TInp2DPoint
    • TInp3DPoint
    • TInp5DPoint
    • TInpComplexRotationConvention
    • TInpLocation
    • TInpQuaternion
    • TInpRotation
    • TInpRotationConvention
    • TNCFile
    • TNCFilesManager
    • TNCStorageType
    • TPostprocessor
    • TrailingZeroesMode
    • TransliterationTable
    • Transliterator
    • TranslitPair
    • TSimpleTextNCFile
    • TTextNCFile
  • SprutTechnology.STDefLib
    • AngleUnits
    • STDef
  • SprutTechnology.STMachiningToolsImportHelper
    • FinalizeMachiningToolsImportLib
    • GetMachiningToolsImportLibPointer
    • IMTI_AxialToolItemsExtension
    • IMTI_CustomAxialShapeToolExtension
    • IMTI_MachiningToolsImportLibraryExtension
    • IMTI_MachiningToolsItemExtension
    • IMTI_TurnToolItemsExtension
    • MTIMachiningToolsImportHelper
    • NativeLibLoader
    • TPlanarCurveReader
    • TPlanarCurveSpan
  • SprutTechnology.VecMatrLib
    • EVecMatrLibError
    • GWConsts
    • ISTGeWatch
    • ISTGeWatchable
    • ISTGeWatchClient
    • T2DPoint
    • T3DArc
    • T3DCut
    • T3DMatrix
    • T3DPoint
    • T5DPoint
    • TComplexRotationConvention
    • TLocation
    • TQuaternion
    • TRotation
    • TRotationConvention
    • TRotationsConverter
    • VML

Class STDef

Class offers the following built-in general purpose functions and constants:

  1. trigonometric functions;
  2. mathematical functions;
  3. string functions;
  4. other functions
Inheritance
System.Object
STDef
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SprutTechnology.STDefLib
Assembly: STDefLib.dll
Syntax
public static class STDef

Fields

DegToRad

Converts degrees to radians

Declaration
public const double DegToRad = 0.017453292519943295
Field Value
Type Description
System.Double

DoublePi

Returns 2*Pi

Declaration
public const double DoublePi = 6.2831853071795862
Field Value
Type Description
System.Double

HalfPi

Returns Pi/2

Declaration
public const double HalfPi = 1.5707963267948966
Field Value
Type Description
System.Double

RadToDeg

Converts radians to degrees

Declaration
public const double RadToDeg = 57.295779513082323
Field Value
Type Description
System.Double

TinyZero

Returns 1e-12.

Declaration
public const double TinyZero = 1E-12
Field Value
Type Description
System.Double

Zero

Returns 1e-6.

Declaration
public const double Zero = 1E-06
Field Value
Type Description
System.Double

Methods

Abs(Double)

Returns the absolute value of a specified number

Declaration
public static double Abs(double x)
Parameters
Type Name Description
System.Double x

Positive or negative number

Returns
Type Description
System.Double

Positive number

Abs(Int32)

Returns the absolute value of a specified number

Declaration
public static int Abs(int x)
Parameters
Type Name Description
System.Int32 x

Positive or negative number

Returns
Type Description
System.Int32

Positive number

ArcCos(Double)

Returns the angle whose cosine is the specified number

Declaration
public static double ArcCos(double x)
Parameters
Type Name Description
System.Double x

A number representing a cosine, where "x" must be greater than or equal to -1, but less than or equal to 1

Returns
Type Description
System.Double

An angle measured in radians

ArcCos(Double, AngleUnits)

Returns the angle whose cosine is the specified number (in the specified angle type)

Declaration
public static double ArcCos(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

A number representing a cosine, where "x" must be greater than or equal to -1, but less than or equal to 1

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

An angle in the specified angle units

ArcSin(Double)

Returns the angle whose sine is the specified number

Declaration
public static double ArcSin(double x)
Parameters
Type Name Description
System.Double x

A number representing a sine, where "x" must be greater than or equal to -1, but less than or equal to 1

Returns
Type Description
System.Double

An angle measured in radians

ArcSin(Double, AngleUnits)

Returns the angle whose sine is the specified number (in the specified angle type)

Declaration
public static double ArcSin(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

A number representing a sine, where "x" must be greater than or equal to -1, but less than or equal to 1

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

An angle in the specified angle units

ArcTan(Double)

Returns the angle whose tangent is the specified number

Declaration
public static double ArcTan(double x)
Parameters
Type Name Description
System.Double x

A number representing a tangent

Returns
Type Description
System.Double

An angle measured in radians

ArcTan(Double, AngleUnits)

Returns the angle whose tangent is the specified number (in the specified angle type)

Declaration
public static double ArcTan(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

A number representing a tangent

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

An angle in the specified angle units

ArcTan2(Double, Double)

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

Declaration
public static double ArcTan2(double y, double x)
Parameters
Type Name Description
System.Double y

The y coordinate of a point

System.Double x

The x coordinate of a point

Returns
Type Description
System.Double

An angle measured in radians

ArcTan2(Double, Double, AngleUnits)

Returns the angle whose tangent is the quotient of two specified numbers (in the specified angle type)

Declaration
public static double ArcTan2(double y, double x, AngleUnits units)
Parameters
Type Name Description
System.Double y

The y coordinate of a point

System.Double x

The x coordinate of a point

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

An angle in the specified angle units

Chr(Int32)

Converts an integer to a character

Declaration
public static string Chr(int x)
Parameters
Type Name Description
System.Int32 x

A number to be converted

Returns
Type Description
System.String

The character

Copy(String, Int32, Int32)

Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length

Declaration
public static string Copy(string s, int start, int count)
Parameters
Type Name Description
System.String s

Current string

System.Int32 start

The zero-based starting character position of a substring in this instance

System.Int32 count

The number of characters in the substring

Returns
Type Description
System.String

A string that is equivalent to the substring of length length that begins at startIndex in this instance

Cos(Double)

Returns the cosine of the specified angle

Declaration
public static double Cos(double x)
Parameters
Type Name Description
System.Double x

An angle, measured in radians

Returns
Type Description
System.Double

The cosine of "x"

Cos(Double, AngleUnits)

Returns the cosine of the specified angle (in the specified angle type)

Declaration
public static double Cos(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

An angle value

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

The cosine of "x"

IsEqD(Double, Double, Double)

Returns true if d1==d2 with defined tolerance

Declaration
public static bool IsEqD(double d1, double d2, double tolerance)
Parameters
Type Name Description
System.Double d1
System.Double d2
System.Double tolerance
Returns
Type Description
System.Boolean

IsGeD(Double, Double, Double)

Returns true if a more or equal than b with defined tolerance

Declaration
public static bool IsGeD(double a, double b, double Tol = 0)
Parameters
Type Name Description
System.Double a
System.Double b
System.Double Tol
Returns
Type Description
System.Boolean

IsGtD(Double, Double, Double)

Returns true if a more than b with defined tolerance

Declaration
public static bool IsGtD(double a, double b, double Tol = 0)
Parameters
Type Name Description
System.Double a
System.Double b
System.Double Tol
Returns
Type Description
System.Boolean

IsLeD(Double, Double, Double)

Returns true if a less or equal than b with defined tolerance

Declaration
public static bool IsLeD(double a, double b, double Tol = 0)
Parameters
Type Name Description
System.Double a
System.Double b
System.Double Tol
Returns
Type Description
System.Boolean

IsLtD(Double, Double, Double)

Returns true if a less than b with defined tolerance

Declaration
public static bool IsLtD(double a, double b, double Tol = 0)
Parameters
Type Name Description
System.Double a
System.Double b
System.Double Tol
Returns
Type Description
System.Boolean

IsZeroD(Double, Double)

Returns true if d==0 with defined tolerance

Declaration
public static bool IsZeroD(double d, double tolerance)
Parameters
Type Name Description
System.Double d
System.Double tolerance
Returns
Type Description
System.Boolean

Length(String)

Gets the number of characters in the current string

Declaration
public static int Length(string s)
Parameters
Type Name Description
System.String s

Current string

Returns
Type Description
System.Int32

The number of characters in the current string

Ord(Char)

Converts a character to an integer

Declaration
public static int Ord(char c)
Parameters
Type Name Description
System.Char c

A character in char-type to be converted

Returns
Type Description
System.Int32

Integer value of the character

Ord(String)

Converts a character to an integer

Declaration
public static int Ord(string s)
Parameters
Type Name Description
System.String s

A character in string-type to be converted

Returns
Type Description
System.Int32

Integer value of the character. If length of "s" ≠ 1, return value = -1

Pos(String, String, Int32)

Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position

Declaration
public static int Pos(string substring, string s, int start = 0)
Parameters
Type Name Description
System.String substring

The string to seek

System.String s

Current string

System.Int32 start

The search starting position

Returns
Type Description
System.Int32

The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not

Refine(Double, Double)

Return zero if Abs(d) less that tolerance, otherwise returns d.

Declaration
public static double Refine(double d, double tolerance)
Parameters
Type Name Description
System.Double d

A double number to be refined

System.Double tolerance

tolerance value

Returns
Type Description
System.Double

Replace(String, String, String)

Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string

Declaration
public static string Replace(string S, string Sub, string newSub)
Parameters
Type Name Description
System.String S

The current string in which to replace

System.String Sub

Old substring to be replaced

System.String newSub

New substring to be replaced with

Returns
Type Description
System.String

A string that is equivalent to the current string except that all instances of "Sub" are replaced with "newSub"

Round(Double)

Rounds a double value to the nearest integral value, and rounds midpoint values to the nearest even number

Declaration
public static int Round(double x)
Parameters
Type Name Description
System.Double x

A double number to be rounded

Returns
Type Description
System.Int32

The integer nearest "x".

Round(Double, Int32)

Rounds a double value to a specified number of fractional digits, and rounds midpoint values to the nearest even number

Declaration
public static double Round(double x, int digits)
Parameters
Type Name Description
System.Double x

A double number to be rounded

System.Int32 digits

The number of fractional digits in the return value

Returns
Type Description
System.Double

The number nearest to value that contains a number of fractional digits equal to "digits"

SameText(String, String)

Compares two strings by ordinal value without case sensitivity

Declaration
public static bool SameText(string s1, string s2)
Parameters
Type Name Description
System.String s1

First string to compare

System.String s2

Second string to compare

Returns
Type Description
System.Boolean

"True" if they are equal; otherwise, "False"

Sgn(Double)

Returns an integer that indicates the sign of a number

Declaration
public static int Sgn(double x)
Parameters
Type Name Description
System.Double x

Positive or negative number

Returns
Type Description
System.Int32

A number that indicates the sign of value (-1, 0, 1)

Sin(Double)

Returns the sine of the specified angle

Declaration
public static double Sin(double x)
Parameters
Type Name Description
System.Double x

An angle, measured in radians

Returns
Type Description
System.Double

The sine of "x"

Sin(Double, AngleUnits)

Returns the sine of the specified angle (in the specified angle type)

Declaration
public static double Sin(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

An angle value

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

The sine of "x"

Sqr(Double)

Returns the specified number to the second power

Declaration
public static double Sqr(double x)
Parameters
Type Name Description
System.Double x

The number to be raised to a power

Returns
Type Description
System.Double

The number raised to the second power

Sqrt(Double)

Returns the square root of a specified number

Declaration
public static double Sqrt(double x)
Parameters
Type Name Description
System.Double x

The number whose square root is to be found

Returns
Type Description
System.Double

Value of square root

STFloatToStr(Double)

Converts the numeric value of this instance to its equivalent string representation

Declaration
public static string STFloatToStr(double d)
Parameters
Type Name Description
System.Double d

Value to be converted

Returns
Type Description
System.String

The string representation of the value

Str(Double)

Converts the numeric value of this instance to its equivalent string representation

Declaration
public static string Str(double d)
Parameters
Type Name Description
System.Double d

Double value to be converted

Returns
Type Description
System.String

The string representation of the value

Str(Double, Int32, Int32)

Converts the double value of this instance to its equivalent string representation with the additional option of setting a fixed string width

Declaration
public static string Str(double d, int IndRound, int width)
Parameters
Type Name Description
System.Double d

Double value to be converted

System.Int32 IndRound

The number of fractional digits

System.Int32 width

Width ensures that the output line is no less than this width, padded with spaces on the left if necessary

Returns
Type Description
System.String

The string representation of the value with the additional option of fixed width and round value

Str(Int32)

Converts the integer value of this instance to its equivalent string representation

Declaration
public static string Str(int n)
Parameters
Type Name Description
System.Int32 n

Integer value to be converted

Returns
Type Description
System.String

The string representation of the value

Str(Int32, Int32)

Converts the integer value of this instance to its equivalent string representation with the additional option of setting a fixed string width

Declaration
public static string Str(int n, int width)
Parameters
Type Name Description
System.Int32 n

Integer value to be converted

System.Int32 width

Width ensures that the output line is no less than this width, padded with spaces on the left if necessary

Returns
Type Description
System.String

The string representation of the value with the additional option of fixed width

StringOfChar(Char, Int32)

Generates a sequence of strings containing one duplicate value

Declaration
public static string StringOfChar(char c, int repeatCount)
Parameters
Type Name Description
System.Char c

The value to duplicate the specified number of times

System.Int32 repeatCount

Number of duplicates

Returns
Type Description
System.String

A string containing all duplicates in the specified quantity. Empty string if repeatCount less than 1.

STTryStrToFloat(String, out Double)

Converts the string representation of a number to its float equivalent. A return value indicates whether the conversion succeeded

Declaration
public static bool STTryStrToFloat(string s, out double d)
Parameters
Type Name Description
System.String s

A string containing a number to convert

System.Double d

When this method returns, contains the float value equivalent of the number contained in "s"

Returns
Type Description
System.Boolean

"True" if "s" was converted successfully; otherwise, "false".

Tan(Double)

Returns the tangent of the specified angle

Declaration
public static double Tan(double x)
Parameters
Type Name Description
System.Double x

An angle, measured in radians

Returns
Type Description
System.Double

The tangent of "x"

Tan(Double, AngleUnits)

Returns the tangent of the specified angle (in the specified angle type)

Declaration
public static double Tan(double x, AngleUnits units)
Parameters
Type Name Description
System.Double x

An angle value

AngleUnits units

Angle units (radians or degrees)

Returns
Type Description
System.Double

The tangent of "x"

Trunc(Double)

Truncates a double-type value to an integer-type value

Declaration
public static int Trunc(double x)
Parameters
Type Name Description
System.Double x

A double number to be truncated

Returns
Type Description
System.Int32

Integer value that is the value of "x" rounded toward zero

TryStrToInt(String, out Int32)

Converts the string representation of a number to its integer equivalent. A return value indicates whether the conversion succeeded

Declaration
public static bool TryStrToInt(string s, out int i)
Parameters
Type Name Description
System.String s

A string containing a number to convert

System.Int32 i

When this method returns, contains the integer value equivalent of the number contained in "s"

Returns
Type Description
System.Boolean

"True" if "s" was converted successfully; otherwise, "false".

In This Article
Back to top Generated by DocFX