Skip to main content

Motion Standalone Preprocessor C# library 2025 R1

Class Canvas

Last update: 16.07.2025

Namespace: VM.CAD.Kernel.Render
Assembly: VM.CAD.Kernel.dll

public sealed class Canvas : KernelObject, IDrawReference

Inheritance

objectKernelObjectCanvas

Implements

IDrawReference

Inherited Members

KernelObject.Dispose(), KernelObject.Key

Extension Methods

LinkPropertyItemCache.GetLinkProperties(object, LinkPropertyType), LinkPropertyItemCache.GetLinkPropertiesAndValues(object, LinkPropertyType), LinkPropertyItemCache.GetLinkedObjects(object, LinkPropertyType)

Properties

BackplaneCull

Sets the back plane cull.

public bool BackplaneCull { set; }

Property Value

bool

Color

Sets the color.

public Color Color { set; }

Property Value

Color

Document

Gets the Document

public IDocument3D Document { get; }

Property Value

IDocument3D

LightInterpolationOption

Sets the light interpolation option.

public LightInterpolationOptionType LightInterpolationOption { set; }

Property Value

LightInterpolationOptionType

LineShape

Sets the line shape.

public LineType LineShape { set; }

Property Value

LineType

LineWeight

Sets the line weight.

public double LineWeight { set; }

Property Value

double

TextSize

Set the text size.

public double TextSize { set; }

Property Value

double

Transparency

Sets the transparency.

public double Transparency { set; }

Property Value

double

WireframeMode

Sets the wire frame mode.

public bool WireframeMode { set; }

Property Value

bool

Methods

AppendModellingMatrix(TMatrix)

Append modelling matrix.

public void AppendModellingMatrix(TMatrix mat)

Parameters

mat TMatrix

The transformation matrix

Clear()

Clear canvas.

public void Clear()

Create(IDocument3D, bool)

Create a new instance of the class

public static Canvas Create(IDocument3D doc, bool ThreadSafeCanvas = true)

Parameters

doc IDocument3D

The document

ThreadSafeCanvas bool

true if to create thread-safe canvas, otherwise false.

Returns

Canvas

Create(UIntPtr, IDocument3D, bool)

Create a new instance of the class

public static Canvas Create(UIntPtr key, IDocument3D doc, bool ThreadSafeCanvas = true)

Parameters

key UIntPtr

The key of the canvas

doc IDocument3D

The document

ThreadSafeCanvas bool

true if to create thread-safe canvas, otherwise false.

Returns

Canvas

DisplayTheFront(double)

Display front above all.

public void DisplayTheFront(double dDepthRange = -1)

Parameters

dDepthRange double

The depth range. If it is negative value, default value will be used.

DrawArc(Vector, Vector, Vector)

Draw arc.

public UIntPtr DrawArc(Vector vecFirst, Vector vecSecond, Vector vecThird)

Parameters

vecFirst Vector

The first point

vecSecond Vector

The second point

vecThird Vector

The third point

Returns

UIntPtr

DrawArrow(Vector, Vector, double)

Draw arrow.

public UIntPtr DrawArrow(Vector vecStart, Vector vecEnd, double dArrowSize = -1)

Parameters

vecStart Vector

The start point

vecEnd Vector

The end point

dArrowSize double

The arrow size. If dArrowSize is negative or zero value, default value will be used.

Returns

UIntPtr

DrawCircle(Vector, double, Vector, bool)

Draw circle.

public UIntPtr DrawCircle(Vector vecCenter, double dRad, Vector vecNormal, bool bFill = false)

Parameters

vecCenter Vector

The center point

dRad double

The radius

vecNormal Vector

The normal vector

bFill bool

The fill flag

Returns

UIntPtr

DrawCylinder(Vector, Vector, double, bool, bool)

Draw cylinder.

public UIntPtr DrawCylinder(Vector vecStart, Vector vecEnd, double dRad, bool bFirstCap = true, bool bSecondCap = true)

Parameters

vecStart Vector

The start point

vecEnd Vector

The end point

dRad double

The radius

bFirstCap bool

if first cap and second cap is true, "both"; if first cap is true and second cap is false, "first"; if first cap is false and second cap is true, "second"; if first cap and second cap is false, "none"

bSecondCap bool

if first cap and second cap is true, "both"; if first cap is true and second cap is false, "first"; if first cap is false and second cap is true, "second"; if first cap and second cap is false, "none"

Returns

UIntPtr

DrawCylinder(Vector, Vector, double, string)

Draw cylinder.

public UIntPtr DrawCylinder(Vector vecStart, Vector vecEnd, double dRad, string strCapOption)

Parameters

vecStart Vector

The start point

vecEnd Vector

The end point

dRad double

The radius

strCapOption string

String specifying which ends to cap, either "first", "second", "none", or "both"

Returns

UIntPtr

DrawDimension(Vector, string)

Draws the dimension.

public UIntPtr DrawDimension(Vector vecCenter, string strText)

Parameters

vecCenter Vector

The center position.

strText string

The string text.

Returns

UIntPtr

DrawIcon(IconInfo)

Draw icon.

public void DrawIcon(IconInfo iconInfo)

Parameters

iconInfo IconInfo

The icon information

DrawIcon(IconInfo, double)

Draw icon.

public void DrawIcon(IconInfo iconInfo, double dScale)

Parameters

iconInfo IconInfo

The icon information

dScale double

The scale

DrawLine(Vector, Vector)

Draw line.

public UIntPtr DrawLine(Vector vecStart, Vector vecEnd)

Parameters

vecStart Vector

The start point

vecEnd Vector

The end point

Returns

UIntPtr

DrawMarker(Vector)

Draw marker.

public UIntPtr DrawMarker(Vector vecCenter)

Parameters

vecCenter Vector

The center point

Returns

UIntPtr

DrawMesh(int, int, ICollection)

Draw mesh.

public UIntPtr DrawMesh(int nRows, int nColumns, ICollection<vector> points)

Parameters

nRows int

The rows numner

nColumns int

The columns number

points ICollection

The collection of points

Returns

UIntPtr

DrawMesh(int, int, Vector[])

Draw mesh.

public UIntPtr DrawMesh(int nRows, int nColumns, Vector[] points)

Parameters

nRows int

The rows numner

nColumns int

The columns number

points Vector[]

The array of points

Returns

UIntPtr

DrawNurbs(int, int, int, int, ICollection, ICollection, ICollection, ICollection)

Draw nurbs.

public UIntPtr DrawNurbs(int u_degree, int v_degree, int u_count, int v_count, ICollection<vector> ctrlPts, ICollection<float> weights, ICollection<float> u_knots, ICollection<float> v_knots)

Parameters

u_degree int

Degree of the surface in the u direction

v_degree int

Degree of the surface in the v direction

u_count int

Number of valid control points in the u direction

v_count int

Number of valid control points in the v direction

ctrlPts ICollection

Vector of x-y-z triplets for the coordinates of the control points

weights ICollectionfloat&gt;

Control point weights

u_knots ICollectionfloat&gt;

Knot sequence in the u direction

v_knots ICollectionfloat&gt;

Knot sequence in the v direction

Returns

UIntPtr

DrawNurbs(int, int, int, int, Vector[], float[], float[], float[])

Draw nurbs.

public UIntPtr DrawNurbs(int u_degree, int v_degree, int u_count, int v_count, Vector[] ctrlPts, float[] weights, float[] u_knots, float[] v_knots)

Parameters

u_degree int

Degree of the surface in the u direction

v_degree int

Degree of the surface in the v direction

u_count int

Number of valid control points in the u direction

v_count int

Number of valid control points in the v direction

ctrlPts Vector[]

Vector of x-y-z triplets for the coordinates of the control points

weights float[]

Control point weights

u_knots float[]

Knot sequence in the u direction

v_knots float[]

Knot sequence in the v direction

Returns

UIntPtr

DrawPolygon(ICollection)

Draw polygon.

public UIntPtr DrawPolygon(ICollection<vector> colPoint)

Parameters

colPoint ICollection

Returns

UIntPtr

DrawPolygon(Vector[])

Draw polygon.

public UIntPtr DrawPolygon(Vector[] arPoint)

Parameters

arPoint Vector[]

The array of points

Returns

UIntPtr

DrawPolyline(ICollection)

Draw polyline.

public UIntPtr DrawPolyline(ICollection<vector> colPoint)

Parameters

colPoint ICollection

Returns

UIntPtr

DrawPolyline(Vector[])

Draw polyline.

public UIntPtr DrawPolyline(Vector[] arPoint)

Parameters

arPoint Vector[]

The array of points

Returns

UIntPtr

DrawShell(ICollection, ICollection, double)

Draw shell.

public UIntPtr DrawShell(ICollection<vector> points, ICollection<int> connectivities, double dScale = 1)

Parameters

points ICollection

The collection of points.

connectivities ICollectionint&gt;

The collection of connectivities.

dScale double

Returns

UIntPtr

DrawShell(Vector[], int[], double)

Draw shell.

public UIntPtr DrawShell(Vector[] points, int[] connectivities, double dScale = 1)

Parameters

points Vector[]

The array of points.

connectivities int[]

The array of connectivities.

dScale double

Returns

UIntPtr

DrawShellWithFaceNormal(ICollection, ICollection, ICollection)

Draw shell with face normal.

public UIntPtr DrawShellWithFaceNormal(ICollection<vector> points, ICollection<int> connectivities, ICollection<vector> faceNormals = null)

Parameters

points ICollection

The collection of points.

connectivities ICollectionint&gt;

The collection of connectivities.

faceNormals ICollection

The collection of face normal vectors.

Returns

UIntPtr

DrawShellWithFaceNormal(Vector[], int[], Vector[])

Draw shell with face normal.

public UIntPtr DrawShellWithFaceNormal(Vector[] points, int[] connectivities, Vector[] faceNormals = null)

Parameters

points Vector[]

The array of points.

connectivities int[]

The array of connectivities.

faceNormals Vector[]

The array of face normal vectors.

Returns

UIntPtr

DrawShellWithVertexNormal(ICollection, ICollection, ICollection)

Draw shell with vertex normal.

public UIntPtr DrawShellWithVertexNormal(ICollection<vector> points, ICollection<int> connectivities, ICollection<vector> vertexNormals = null)

Parameters

points ICollection

The collection of points.

connectivities ICollectionint&gt;

The collection of connectivities.

vertexNormals ICollection

The collection of vertex normal vectors.

Returns

UIntPtr

DrawShellWithVertexNormal(Vector[], int[], Vector[])

Draw shell with vertex normal.

public UIntPtr DrawShellWithVertexNormal(Vector[] points, int[] connectivities, Vector[] vertexNormals = null)

Parameters

points Vector[]

The array of points.

connectivities int[]

The array of connectivities.

vertexNormals Vector[]

The array of vertex normal vectors.

Returns

UIntPtr

DrawSphere(Vector, double)

public UIntPtr DrawSphere(Vector vecCenter, double dRad)

Parameters

vecCenter Vector

dRad double

Returns

UIntPtr

DrawSphere(Vector, double, Vector, Vector)

public UIntPtr DrawSphere(Vector vecCenter, double dRad, Vector vecAxis, Vector vecOrtho)

Parameters

vecCenter Vector

dRad double

vecAxis Vector

vecOrtho Vector

Returns

UIntPtr

DrawText(Vector, string)

public UIntPtr DrawText(Vector vecCenter, string strText)

Parameters

vecCenter Vector

strText string

Returns

UIntPtr

DrawWireCylinder(Vector, Vector, double)

Draw cylinder with face.

public UIntPtr DrawWireCylinder(Vector vecStart, Vector vecEnd, double dRad)

Parameters

vecStart Vector

The start point

vecEnd Vector

The end point

dRad double

The radius

Returns

UIntPtr

DrawWireSphere(Vector, double)

public UIntPtr DrawWireSphere(Vector vecCenter, double dRad)

Parameters

vecCenter Vector

dRad double

Returns

UIntPtr

DrawWireSphere(Vector, double, Vector, Vector)

public UIntPtr DrawWireSphere(Vector vecCenter, double dRad, Vector vecAxis, Vector vecOrtho)

Parameters

vecCenter Vector

dRad double

vecAxis Vector

vecOrtho Vector

Returns

UIntPtr

EndGeometryEdit()

End geometry for edit.

public void EndGeometryEdit()

FastDrawShell(UIntPtr, ulong, UIntPtr, ulong, double)

Draw shell (fast).

public void FastDrawShell(UIntPtr points, ulong nPoints, UIntPtr connectivities, ulong nConnectivities, double dScale)

Parameters

points UIntPtr

The points array

nPoints ulong

The number of points

connectivities UIntPtr

The connectivities array

nConnectivities ulong

The number of connectivities

dScale double

The scale

FastDrawShellWithFaceNormal(UIntPtr, ulong, UIntPtr, ulong)

Draw shell with face normal (fast).

public void FastDrawShellWithFaceNormal(UIntPtr points, ulong nPoints, UIntPtr connectivities, ulong nConnectivities)

Parameters

points UIntPtr

The points array

nPoints ulong

The number of points

connectivities UIntPtr

The connectivities array

nConnectivities ulong

The number of connectivities

GetExtension()

Get canvas extension

public T GetExtension<t>() where T : KernelExtension

Returns

T

The canvas extension

Type Parameters

T

The type of the canvas extension

GetExtension(string)

Get canvas extension

public T GetExtension<t>(string strExtensionName) where T : KernelExtension

Parameters

strExtensionName string

The name of the canvas extension.

Returns

T

The canvas extension

Type Parameters

T

The type of the canvas extension

GetSubCanvas(string)

Get sub canvas.

public Canvas GetSubCanvas(string strCanvasName)

Parameters

strCanvasName string

The canvas name

Returns

Canvas

IgnoreDepthTest()

Ignore depth test.

public void IgnoreDepthTest()

SetMarkerSymbol(MarkerType, double)

Set marker symbol.

public void SetMarkerSymbol(MarkerType type, double dSize = -1)

Parameters

type MarkerType

dSize double

The marker size. If it is negative value, default value will be used.

SetModellingMatrix(TMatrix)

Set modelling matrix.

public void SetModellingMatrix(TMatrix mat)

Parameters

mat TMatrix

The transformation matrix

SetScale(double, double, double)

Set scale.

public void SetScale(double dX, double dY, double dZ)

Parameters

dX double

The X coordinate of scale

dY double

The Y coordinate of scale

dZ double

The Z coordinate of scale

SetWireframeMode(bool, bool)

Set wireframe mode.

public void SetWireframeMode(bool bWireframe, bool bVisibleEdge)

Parameters

bWireframe bool

Whether use wire frame mode

bVisibleEdge bool

Whether visible edge

StartGeometryEdit(UIntPtr)

Start geometry for edit.

public void StartGeometryEdit(UIntPtr pKeyGeom)

Parameters

pKeyGeom UIntPtr

The geometry key

TrimNurbs(int, int, ICollection, ICollection, ICollection, double, double)

Trim nurbs.

public void TrimNurbs(int degree, int cpcount, ICollection<vector> ctrlPts, ICollection<float> weights, ICollection<float> knots, double start_u, double end_u)

Parameters

degree int

Degree of the curve

cpcount int

Number of valid points in control_points

ctrlPts ICollection

The points

weights ICollectionfloat&gt;

Control point weights

knots ICollectionfloat&gt;

Knot sequence

start_u double

Start parameter

end_u double

End parameter

TrimNurbs(int, int, Vector[], float[], float[], double, double)

Trim nurbs.

public void TrimNurbs(int degree, int cpcount, Vector[] ctrlPts, float[] weights, float[] knots, double start_u, double end_u)

Parameters

degree int

Degree of the curve

cpcount int

Number of valid points in control_points

ctrlPts Vector[]

The points

weights float[]

Control point weights

knots float[]

Knot sequence

start_u double

Start parameter

end_u double

End parameter

Connect with Ansys