Utility

public sealed class Utility
Class with useful static methods.

Methods

DocumentAngleTolerance

#
public static double DocumentAngleTolerance()
Returns the Angle Tolerance in degrees for the model document

DocumentTolerance

#
public static double DocumentTolerance()
Returns the Absolute Tolerance of the model document

DocumentUnits

#
public static string DocumentUnits()
Returns the unit system for the model document

FixNewlines

#
public static string FixNewlines(string text, string newLinePattern)
Make sure all newlines in a string have a specific pattern.
text (string)Text to fix.
newLinePattern (string)Newline string to use.
Fixed string

FixNewlines

#
public static string FixNewlines(string text)
Make sure all newlines in a string adhere to the current platform standard.
text (string)Text to fix.

InvokeDownloader

#
public static void InvokeDownloader(string sourceUri, string targetUri, bool silent)
Start an asynchronous download operation. The download runs in a separate appdomain. After triggering that process this method returns immediately.
sourceUri (string)Uri of data to download.
targetUri (string)Uri of file on local disk where to store downloaded data.
silent (bool)If true the download will not display any user interface.

InvokeGetter

#
public static object InvokeGetter(object target, string property)
Call a getter property via its name.
target (object)Object to invoke on.
property (string)Name of property to invoke.
The return value of the method.

InvokeGetterSafe

#
public static object InvokeGetterSafe(object target, string property)
Call a getter property via its name. No exceptions are thrown.
target (object)Object to invoke on.
property (string)Name of property to invoke.
The return value of the method.

InvokeMethod

#
public static object InvokeMethod(object target, string method, params object[] params)
Call a method via its name.
target (object)Object to invoke on.
method (string)Name of method to invoke.
params (params object[])Arguments for method.
The return value of the method.

InvokeMethod

#
public static object InvokeMethod(object target, string method)
Call a method via its name.
target (object)Object to invoke on.
method (string)Name of method to invoke.
The return value of the method.

InvokeMethodSafe

#
public static object InvokeMethodSafe(object target, string method, params object[] params)
Call a method via its name. No exceptions are thrown.
target (object)Object to invoke on.
method (string)Name of method to invoke.
params (params object[])Arguments for method.
The return value of the method.

InvokeMethodSafe

#
public static object InvokeMethodSafe(object target, string method)
Call a method via its name. No exceptions are thrown.
target (object)Object to invoke on.
method (string)Name of method to invoke.
The return value of the method.

InvokeSetter

#
public static void InvokeSetter(object target, string property, object value)
Call a setter property via its name.
target (object)Object to invoke on.
property (string)Name of property to invoke.
value (object)

InvokeSetterSafe

#
public static void InvokeSetterSafe(object target, string property, object value)
Call a setter property via its name. No exceptions are thrown.
target (object)Object to invoke on.
property (string)Name of property to invoke.
value (object)

LikeOperator

#
public static bool LikeOperator(string text, string pattern)
Exposes the VB.NET Like operator as a static method.
text (string)
pattern (string)

SetDefaultTolerances

#
public static void SetDefaultTolerances(double absoluteTolerance, double angleToleranceDegrees)
Utility function to set absolute and angle tolerance fields.
absoluteTolerance (double)Value to set model absolute tolerance
angleToleranceDegrees (double)Value to set model angle tolerance in degrees

SetDefaultUnits

#
public static void SetDefaultUnits(string modelUnits)
Utility function to set model unit fields
modelUnits (string)Value to set default model units

TernaryIf<T>

#
public static T TernaryIf<T>(bool condition, T A, T B)
obsoleteTernary conditionals are now part of the standard C# and VB language spec. Consider using those instead.
Type safe implementation of the IIf conditional statement.
condition (bool)If True, A is returned.
A (T)Value to return when condition evaluates to true.
B (T)Value to return when condition evaluates to false.