Class STLDocument
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
stringThe 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
Name
The name of the solid.
public string? Name { get; set; }
Property Value
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
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
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
STLDocumentThe 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
GetEnumerator()
Iterates through the Facets collection.
public IEnumerator<Facet> GetEnumerator()
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsBinary(Stream)
Determines if the STLDocument contained within the stream
is binary-based.
public static bool IsBinary(Stream stream)
Parameters
stream
StreamThe 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
StreamThe 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
stringA 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
BinaryReaderThe 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
StreamThe stream which contains the STL data.
tryBinaryIfTextFailed
boolSet 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
StreamReaderThe 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
stringA 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
stringThe 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
stringThe absolute path where the STLDocument will be written.
ToString()
Returns the header representation of this STLDocument.
public override string ToString()
Returns
WriteBinary(Stream)
Writes the STLDocument as binary to the provided stream
.
public void WriteBinary(Stream stream)
Parameters
stream
StreamThe 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
StreamThe stream to which the STLDocument will be written.