Table of Contents

Class ParametricCenterProperty

Namespace
CADability
Assembly
CADability.dll

Parametric property of a shell which keeps a set of faces (e.g. a hole or a boss) centered between or onto other objects of the shell: two vertices, edges or faces, or a single axis of a face of revolution. The Value is the ratio of the division (0.5 for the center). When it changes, the faces are translated by the vector computed by GetTranslationForCentering(IEnumerable<Face>, object, IEnumerable<object>, double) and the shell is recalculated. Instances are created by ParametricsCenterAction.

public class ParametricCenterProperty : ParametricProperty, IJsonSerialize, IJsonSerializeDone
Inheritance
ParametricCenterProperty
Implements
Inherited Members

Constructors

ParametricCenterProperty()

Empty constructor for the JSON deserialization; the data is set by SetObjectData(IJsonReadData).

protected ParametricCenterProperty()

ParametricCenterProperty(string, IEnumerable<Face>, IEnumerable<object>, IEnumerable<object>, IEnumerable<object>, double)

Creates the centering property.

public ParametricCenterProperty(string name, IEnumerable<Face> facesToCenter, IEnumerable<object> objectsToCenterOn, IEnumerable<object> referenceForCentering, IEnumerable<object> affectedObjects, double ratio)

Parameters

name string

Name shown in the property page

facesToCenter IEnumerable<Face>

The faces which are moved to keep them centered

objectsToCenterOn IEnumerable<object>

The objects between (or onto) which the faces are centered: two vertices, edges or faces, or a single axis

referenceForCentering IEnumerable<object>

The object of the faces to center which is to be positioned (a vertex, edge, face or axis); currently the center of the extent of the faces is positioned instead

affectedObjects IEnumerable<object>

Faces, edges and vertices of the shell which are modified by this property, see GetAffectedObjects()

ratio double

The ratio of the division, 0.5 for the center

Properties

Value

The value of the parametric property: a length, a radius or diameter, an angle in radians or a ratio, depending on the derived class. Getting it measures the current value in the shell; setting it only stores the desired value, which is applied to the shell by the next call to Execute(Parametric).

public override double Value { get; set; }

Property Value

double

Methods

Clone(Dictionary<Face, Face>, Dictionary<Edge, Edge>, Dictionary<Vertex, Vertex>)

When the shell is cloned, we need to replace the faces, edges and vertices with their clones

public override ParametricProperty Clone(Dictionary<Face, Face> clonedFaces, Dictionary<Edge, Edge> clonedEdges, Dictionary<Vertex, Vertex> clonedVertices)

Parameters

clonedFaces Dictionary<Face, Face>
clonedEdges Dictionary<Edge, Edge>
clonedVertices Dictionary<Vertex, Vertex>

Returns

ParametricProperty

Execute(Parametric)

if != NullVector, this is the direction of the extrusion. This is used by the distance calculation.

public override bool Execute(Parametric parametric)

Parameters

parametric Parametric

Returns

bool

GetAffectedObjects()

Returns the faces, which will be modified by this parametric property

public override IEnumerable<object> GetAffectedObjects()

Returns

IEnumerable<object>

GetAnchor()

Returns the object on which serves as a anchorpoint for the operation

public override object GetAnchor()

Returns

object

GetFeedback(Projection)

Returns a list of objects that can be used as a feedback for this property (usually an arrow)

public override GeoObjectList GetFeedback(Projection projection)

Parameters

projection Projection

Returns

GeoObjectList

GetObjectData(IJsonWriteData)

Writes the name and the Preserve flag for the JSON serialization (IJsonSerialize). Derived classes override this method, call the base implementation and add their own data.

public override void GetObjectData(IJsonWriteData data)

Parameters

data IJsonWriteData

Receives the data

Modify(ModOp)

When the shell is beeing modified, we have the chance here to update the parametric property if necessary

public override void Modify(ModOp m)

Parameters

m ModOp

SetObjectData(IJsonReadData)

Reads the name and the Preserve flag from the JSON serialization (IJsonSerialize). Derived classes override this method, call the base implementation and read their own data.

public override void SetObjectData(IJsonReadData data)

Parameters

data IJsonReadData

Provides the data