Table of Contents

Class ExportStep

Namespace
CADability
Assembly
CADability.dll

Writes the active model of a project to a STEP file (ISO 10303-21, AP214). Solids are written as MANIFOLD_SOLID_BREP, open shells as SHELL_BASED_SURFACE_MODEL, curves as GEOMETRIC_CURVE_SET, blocks as assemblies of their contents; the colours of the objects become STYLED_ITEMs and the names of solids and blocks are kept. Objects that do not implement IExportStep (e.g. text and dimensions) are skipped. Export(string, string) with the format "step" uses this class.

public class ExportStep
Inheritance
ExportStep
Inherited Members

Constructors

ExportStep()

Creates an export with the default Precision. Each instance writes one file or byte array.

public ExportStep()

Fields

EdgeToDefInd

The numbers of the EDGE_CURVE entities already written, so that an edge shared by two faces is written only once. Filled while writing.

public Dictionary<Edge, int> EdgeToDefInd

Field Value

Dictionary<Edge, int>

StyledItems

The numbers of the STYLED_ITEM entities written for each colour. Filled while writing.

public Dictionary<ColorDef, int> StyledItems

Field Value

Dictionary<ColorDef, int>

VertexToDefInd

The numbers of the VERTEX_POINT entities already written, so that a vertex shared by several edges is written only once. Filled while writing.

public Dictionary<Vertex, int> VertexToDefInd

Field Value

Dictionary<Vertex, int>

Properties

Precision

The precision written to the file as the UNCERTAINTY_MEASURE_WITH_UNIT, 1e-6 by default: two points closer than this are the same point for a reader of the file.

public double Precision { get; }

Property Value

double

Methods

ToString(double)

Formats a number the way STEP requires it: invariant culture and always with a decimal point (1., 1.5E-5), because a number without a point is read as an integer.

public string ToString(double d)

Parameters

d double

the number

Returns

string

the text of the number for use in an entity

WriteAxis1Placement3d(GeoPoint, GeoVector)

Writes an AXIS1_PLACEMENT, an axis given by a point and a direction as used by SURFACE_OF_REVOLUTION, together with its point and direction. The direction is normalized before it is written.

public int WriteAxis1Placement3d(GeoPoint location, GeoVector normal)

Parameters

location GeoPoint

a point on the axis

normal GeoVector

the direction of the axis

Returns

int

the number of the placement entity

WriteAxis2Placement3d(GeoPoint, GeoVector, GeoVector)

Writes an AXIS2_PLACEMENT_3D, the coordinate system that elementary surfaces, circles and ellipses are defined in, together with its point and its two directions. The directions are normalized before they are written.

public int WriteAxis2Placement3d(GeoPoint location, GeoVector normal, GeoVector xdir)

Parameters

location GeoPoint

the origin of the placement

normal GeoVector

the axis (z direction) of the placement

xdir GeoVector

the reference direction (x direction) of the placement; should be perpendicular to normal

Returns

int

the number of the placement entity

WriteDefinition(string)

Writes one entity instance #n=s; to the file and returns its number n. The numbers are assigned in sequence; Export(ExportStep, bool) implementations write the entities they refer to first and use the returned numbers as #n references in their own definition.

public int WriteDefinition(string s)

Parameters

s string

the entity, e.g. CARTESIAN_POINT('',(0.,0.,0.)), without the leading #n= and the trailing semicolon

Returns

int

the number of the entity

WriteToByteArray(Project)

Writes the active model of the project as a STEP file into memory, see WriteToFile(string, Project).

public byte[] WriteToByteArray(Project pr)

Parameters

pr Project

the project to export

Returns

byte[]

the contents of the STEP file

WriteToFile(string, Project)

Writes the active model of the project to a STEP file. The file is created or overwritten; the name of the project's file and the current date go into the header.

public void WriteToFile(string fileName, Project pr)

Parameters

fileName string

Path of the STEP file to write

pr Project

the project to export