Table of Contents

Class TransformationGeom

Namespace
Hi.Geom
Assembly
HiMech.dll

Represents a geometric transformation that can be applied to a geometry object. This class combines a transformer with a target geometry to produce transformed geometric results.

public class TransformationGeom : IStlSource, IGetStl, IMakeXmlSource, IGeomProperty, IGenStl, IExpandToBox3d, IDuplicate
Inheritance
TransformationGeom
Implements
Inherited Members
Extension Methods

Remarks

The TransformationGeom class provides functionality to:

  • Apply geometric transformations to STL geometry
  • Support XML serialization and deserialization
  • Handle duplication of transformation configurations
  • Manage transformation matrices and their application to geometry

Constructors

TransformationGeom()

Initializes a new instance of the TransformationGeom class with default values.

public TransformationGeom()

TransformationGeom(IGetStl)

Initializes a new instance of the TransformationGeom class with a specified geometry.

public TransformationGeom(IGetStl geom)

Parameters

geom IGetStl

The geometry object to be transformed.

TransformationGeom(XElement, string)

Initializes a new instance of the TransformationGeom class from XML data.

public TransformationGeom(XElement src, string baseDirectory)

Parameters

src XElement

The XML element containing the transformation data.

baseDirectory string

The base directory for resolving relative paths.

Remarks

This constructor deserializes both the transformer and geometry data from the provided XML. If either element is missing or invalid, the corresponding property will be null.

Properties

Geom

Gets or sets the target geometry that will be transformed.

public IGetStl Geom { get; set; }

Property Value

IGetStl

Remarks

This property represents the base geometry object that will have the transformation applied to it. If null, operations involving this geometry will return null results.

Transformer

Gets or sets the transformer that defines the geometric transformation. The transformation is applied from left (first element) to right (last element), with the target geometry being on the left side.

public ITransformer Transformer { get; set; }

Property Value

ITransformer

Remarks

The transformer can be null, in which case no transformation is applied to the geometry.

XName

Gets the XML element name used for serialization.

public static string XName { get; }

Property Value

string

The string “TransformationGeom”.

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

Remarks

The duplication process creates new instances of both the transformer and geometry objects if they implement the appropriate cloning interfaces.

ExpandToBox3d(Box3d)

Expands the given box to include the bounds of the transformed geometry.

public void ExpandToBox3d(Box3d dst)

Parameters

dst Box3d

The box to expand.

Remarks

This method updates the provided box to encompass the transformed geometry. If the geometry or its STL representation is null, no expansion occurs.

GenStl(IPolarResolution2d)

Generate a new Stl.

public Stl GenStl(IPolarResolution2d resolution)

Parameters

resolution IPolarResolution2d

Returns

Stl

newly created Stl

GetStl()

Gets the transformed STL representation of the geometry.

public Stl GetStl()

Returns

Stl

The transformed STL if both geometry and transformer are valid; the original STL if transformer is null; null if geometry is null or produces null STL.

Remarks

If the transformer is null, the method returns the untransformed geometry. If the geometry is null or produces a null STL, the method returns null.

MakeXmlSource(string, string, bool)

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, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.