Table of Contents

Class STLDocument

Namespace
LiveScope.STL
Assembly
LiveScope.Net.dll

The outer-most STL object which contains the Facets that make up the model.

public class STLDocument : IEquatable<STLDocument>, IEnumerable<Facet>, IEnumerable
Inheritance
STLDocument
Implements
Inherited Members
Extension Methods

Constructors

STLDocument()

Creates a new, empty STLDocument.

public STLDocument()

STLDocument(string, IEnumerable<Facet>)

Creates a new STLDocument with the given name and populated with the given facets.

public STLDocument(string name, IEnumerable<Facet> facets)

Parameters

name string

The name of the solid. This property is not used for binary STLs.

facets IEnumerable<Facet>

The facets with which to populate this solid.

Properties

Facets

The list of Facets within this solid.

public IList<Facet> Facets { get; set; }

Property Value

IList<Facet>

Name

The name of the solid.

public string? Name { get; set; }

Property Value

string

Remarks

This property is not used for binary STLs.

Methods

AppendFacets(IEnumerable<Facet>)

Appends the provided facets to this instance's Facets.

public void AppendFacets(IEnumerable<Facet> facets)

Parameters

facets IEnumerable<Facet>

The facets to append.

Remarks

An entire STLDocument can be passed to this method and all of the facets which it contains will be appended to this instance.

CopyAsBinary(Stream, Stream)

Reads the STLDocument within the inStream as binary into the outStream.

public static STLDocument CopyAsBinary(Stream inStream, Stream outStream)

Parameters

inStream Stream

The stream to read from.

outStream Stream

The stream to read into.

Returns

STLDocument

The STLDocument that was copied.

CopyAsText(Stream, Stream)

Reads the STLDocument within the inStream as text into the outStream.

public static STLDocument CopyAsText(Stream inStream, Stream outStream)

Parameters

inStream Stream

The stream to read from.

outStream Stream

The stream to read into.

Returns

STLDocument

The STLDocument that was copied.

Equals(STLDocument?)

Determines whether or not this instance is the same as the other instance.

public bool Equals(STLDocument? other)

Parameters

other STLDocument

The STLDocument to which to compare.

Returns

bool

True if this instance is equal to the other instance.

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetEnumerator()

Iterates through the Facets collection.

public IEnumerator<Facet> GetEnumerator()

Returns

IEnumerator<Facet>

GetHashCode()

public override int GetHashCode()

Returns

int

IsBinary(Stream)

Determines if the STLDocument contained within the stream is binary-based.

public static bool IsBinary(Stream stream)

Parameters

stream Stream

The stream which contains the STL data.

Returns

bool

True if the STLDocument is binary-based, otherwise false.

Remarks

The stream will be reset to position 0.

IsText(Stream)

Determines if the STLDocument contained within the stream is text-based.

public static bool IsText(Stream stream)

Parameters

stream Stream

The stream which contains the STL data.

Returns

bool

True if the STLDocument is text-based, otherwise false.

Remarks

The stream will be reset to position 0.

Open(string)

Reads the STL document located at the path into a new STLDocument.

public static STLDocument Open(string path)

Parameters

path string

A full path to a file which contains the STL data.

Returns

STLDocument

An STLDocument representing the data contained in the file located at the path specified or null if the parameter is empty.

Read(BinaryReader)

Reads the STL document contained within the reader into a new STLDocument.

public static STLDocument Read(BinaryReader reader)

Parameters

reader BinaryReader

The reader which contains the binary-based STL data.

Returns

STLDocument

An STLDocument representing the data contained in the stream or null if the stream is empty.

Remarks

This method will expects a binary-based STLDocument to be contained within the reader.

Read(Stream, bool)

Reads the STLDocument contained within the stream into a new STLDocument.

public static STLDocument Read(Stream stream, bool tryBinaryIfTextFailed = false)

Parameters

stream Stream

The stream which contains the STL data.

tryBinaryIfTextFailed bool

Set to true to try read as binary if reading as text results in zero facets

Returns

STLDocument

An STLDocument representing the data contained in the stream or null if the stream is empty.

Remarks

This method will determine how to read the STLDocument (whether to read it as text or binary data).

Read(StreamReader)

Reads the STL document contained within the reader into a new STLDocument.

public static STLDocument Read(StreamReader reader)

Parameters

reader StreamReader

The reader which contains the text-based STL data.

Returns

STLDocument

An STLDocument representing the data contained in the stream or null if the stream is empty.

Remarks

This method expects a text-based STL document to be contained within the reader.

Read(string)

Reads the STL document contained within the stl parameter into a new STLDocument.

public static STLDocument Read(string stl)

Parameters

stl string

A string which contains the STL data.

Returns

STLDocument

An STLDocument representing the data contained in the stl parameter or null if the parameter is empty.

SaveAsBinary(string)

Writes the STLDocument as binary to the provided path.

public void SaveAsBinary(string path)

Parameters

path string

The absolute path where the STLDocument will be written.

SaveAsText(string)

Writes the STLDocument as text to the provided path.

public void SaveAsText(string path)

Parameters

path string

The absolute path where the STLDocument will be written.

ToString()

Returns the header representation of this STLDocument.

public override string ToString()

Returns

string

WriteBinary(Stream)

Writes the STLDocument as binary to the provided stream.

public void WriteBinary(Stream stream)

Parameters

stream Stream

The stream to which the STLDocument will be written.

WriteText(Stream)

Writes the STLDocument as text to the provided stream.

public void WriteText(Stream stream)

Parameters

stream Stream

The stream to which the STLDocument will be written.