Table of Contents

Class StlFile

Namespace
Hi.Geom
Assembly
HiGeom.dll

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 string

file path

StlFile(XElement, string)

Ctor.

public StlFile(XElement src, string baseDirectory)

Parameters

src XElement

XML

baseDirectory string

Base directory path

Properties

CacheStl

CacheStl is loaded by the xml construtor.

public Stl CacheStl { get; set; }

Property Value

Stl

SourceFile

Stl file path.

public string SourceFile { get; set; }

Property Value

string

XName

Name for XML IO.

public static string XName { get; }

Property Value

string

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 Box3d

Destination 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 string

The 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 string

The base directory for resolving relative paths

relFile string

The 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 string

The base directory where the file will be saved