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
namestringName shown in the property page
facesToCenterIEnumerable<Face>The faces which are moved to keep them centered
objectsToCenterOnIEnumerable<object>The objects between (or onto) which the faces are centered: two vertices, edges or faces, or a single axis
referenceForCenteringIEnumerable<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
affectedObjectsIEnumerable<object>Faces, edges and vertices of the shell which are modified by this property, see GetAffectedObjects()
ratiodoubleThe 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
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
clonedFacesDictionary<Face, Face>clonedEdgesDictionary<Edge, Edge>clonedVerticesDictionary<Vertex, Vertex>
Returns
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
parametricParametric
Returns
GetAffectedObjects()
Returns the faces, which will be modified by this parametric property
public override IEnumerable<object> GetAffectedObjects()
Returns
GetAnchor()
Returns the object on which serves as a anchorpoint for the operation
public override object GetAnchor()
Returns
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
projectionProjection
Returns
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
dataIJsonWriteDataReceives 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
mModOp
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
dataIJsonReadDataProvides the data