Class StlFile
Represents an STL file with loading and saving capabilities
public class StlFile : IStlSource, IGetStl, IMakeXmlSource, IExpandToBox3d, IDuplicate, ISourceFile
- Inheritance
-
StlFile
- Implements
- Inherited Members
- Extension Methods
Constructors
StlFile()
Ctor.
public StlFile()
StlFile(string)
Ctor.
public StlFile(string filePath)
Parameters
filePath
stringfile path
StlFile(XElement, string)
Ctor.
public StlFile(XElement src, string baseDirectory)
Parameters
Properties
CacheStl
CacheStl is loaded by the xml construtor.
public Stl CacheStl { get; set; }
Property Value
SourceFile
Stl file path.
public string SourceFile { get; set; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
Duplicate(params object[])
Creates a deep copy of the object, excluding any source file references.
public object Duplicate(params object[] res)
Parameters
res
object[]Optional parameters that may be needed during the duplication process
Returns
- object
A new instance that is a deep copy of the original object
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dst
Box3dDestination box
GetStl()
Gets the STL geometry data.
public Stl GetStl()
Returns
- Stl
The STL geometry object
LoadStlByFile(string)
Loads an STL file from the specified base directory into the cache
public Stl LoadStlByFile(string baseDirectory)
Parameters
baseDirectory
stringThe base directory where the file is located
Returns
- Stl
The loaded STL object, or null if the file path is empty or loading fails
MakeXmlSource(string, string)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
Returns
- XElement
An XML element representing the object's state
Remarks
if the file does not exist, the cached Stl will be saved; if the file existed, the file will not be overwrited. The mechanism is for multi-base-directory setting.
SaveStlToFile(string)
Saves the cached STL data to a file in the specified base directory
public void SaveStlToFile(string baseDirectory)
Parameters
baseDirectory
stringThe base directory where the file will be saved