public class Crystal : PreviewShape
Immutable collection of faces and edges of a material thumbnail gem.

Constructors

Crystal

#
public Crystal(IReader reader)
Deserialize a shape from an archive.
reader (IReader)

Crystal

#
public Crystal(string name, string info, IEnumerable<CrystalEdge> edges, IEnumerable<CrystalFace> facets)
Create a new shape.
name (string)Crystal name.
info (string)Crystal description, may be null.
edges (IEnumerable<CrystalEdge>)Collection of shape edges.
facets (IEnumerable<CrystalFace>)Collection of shape faces.

Properties

Bounds

public BoundingBox Bounds { get; }
Gets the bounding box for this shape.
inherited fromPreviewShape

CrystalNames

#
public static IEnumerable<string> CrystalNames { get; }
Enumerate over all defined crystals. Note that the crystals are stored as files on the disk and may thus be deleted or renamed at any time.

EdgeCount

#
public int EdgeCount { get; }
Gets the number of edges in this crystal.

Edges

#
public IEnumerable<CrystalEdge> Edges { get; }
Enumerate over all edges in this crystal.

FaceCount

#
public int FaceCount { get; }
Gets the number of faces in this crystal.

Faces

#
public IEnumerable<CrystalFace> Faces { get; }
Enumerate over all faces in this crystal.

Info

#
public string Info { get; }
Gets some information about this crystal.

Name

#
public string Name { get; }
Gets the name of this crystal.

Methods

CreateAngleTransform

public Transform CreateAngleTransform(double angleXy, double angleYz, double perspective, CircleF target)
Set up a transformation from a set of angles and a target.
inherited fromPreviewShape
angleXy (double)
angleYz (double)
perspective (double)
target (CircleF)

CreateCameraTransform

public Transform CreateCameraTransform(Point3d camera, double radius)
Set up a transformation from a camera location and display radius.
inherited fromPreviewShape
camera (Point3d)
radius (double)

LoadFromBrep

#
public static Crystal LoadFromBrep(string name, string description, Brep brep)
Create a new shape from a brep.
name (string)Name of crystal.
description (string)Description of crystal.
brep (Brep)Brep to convert. Brep must be closed and contain only planar faces and straight edges. The brep as a whole must be convex.
Thumbnail shape.

LoadFromFile

#
public static Crystal LoadFromFile(string filePath)
Load a crystal from a 3dm file. This method will throw whenever something's not correct. The file must contain a single Brep object, and that brep must be closed and contain only planar faces and linear edges. Breps that are not fully convex will not show correctly, but they will load.
filePath (string)File to parse.
Loaded crystal.

Render

#
public void Render(Graphics graphics, DisplayMaterial material, GuiseCurve visibleEdges, GuiseCurve hiddenEdges)
Render this crystal to a graphics context.
graphics (Graphics)
material (DisplayMaterial)
visibleEdges (GuiseCurve)
hiddenEdges (GuiseCurve)

Store

#
public override void Store(IWriter writer)
Serialize this shape.
writer (IWriter)

ToBrep

#
public Brep ToBrep()
Create a Brep from this crystal.
Brep form.

Transform

#
public Crystal Transform(Transform transform)
Transform this crystal.
transform (Transform)Transform to apply.
Transformed crystal.

TryLoadCrystal

#
public static Crystal TryLoadCrystal(string name)
Try and load a crystal from the resource folder by name.
name (string)Name of crystal.
Loaded crystal or null.