Table of Contents

Class ExportToWebGl

Namespace
CADability
Assembly
CADability.dll

Export a Model as a WebGl based html file.

public class ExportToWebGl
Inheritance
ExportToWebGl
Inherited Members

Constructors

ExportToWebGl(Model)

Create the ExportToWebGl class with the model to be exported

public ExportToWebGl(Model m)

Parameters

m Model

Fields

HtmlTemplatePath

Location of the template html file. If no value is provided the file "CADability.WebGl.html" in the CADability installation directory will be used

public string HtmlTemplatePath

Field Value

string

InitialProjectionDirection

A initial direction for the projection may be specified.

public GeoVector InitialProjectionDirection

Field Value

GeoVector

Properties

IgnoreUserData

A list of keys for UserData which will be ignored (for display in the HTML ControlCenter). IgnoreUserData and UseOnlyUserData are mutually exclusive.

public string[] IgnoreUserData { get; set; }

Property Value

string[]

Precision

Precision for triangulation of Faces and approximation of curves to polylines. If no value is provided the precision will be 1/1000 of the model extend

public double Precision { get; set; }

Property Value

double

UseOnlyUserData

A list of keys for UserData which will be used (for display in the HTML ControlCenter). IgnoreUserData and UseOnlyUserData are mutually exclusive.

public string[] UseOnlyUserData { get; set; }

Property Value

string[]

UserDataAsName

Use the value of this UserData as the name property of the object (as shown in the HTML ControlCenter)

public string UserDataAsName { get; set; }

Property Value

string

Methods

GetData(bool)

Converts the model and returns the JSON data the html template embeds (the value of the %%CADability-WebGL-Data%% placeholder), for callers that build the page themselves instead of using WriteToFile(string). InitialProjectionDirection is included.

public string GetData(bool escapeQuote)

Parameters

escapeQuote bool

true to remove backslashes and escape the double quotes, so that the result can be embedded as a string literal in a script; false for the plain JSON

Returns

string

the JSON text

WriteToFile(string)

Write the resulting html file to the provided location.

public bool WriteToFile(string outPath)

Parameters

outPath string

Returns

bool

true on success