Class ParametricDistanceProperty
- Namespace
- CADability
- Assembly
- CADability.dll
Parametric property of a shell which keeps the distance between two sets of faces editable, e.g. the thickness of
a plate or the depth of a pocket. The distance is measured between two reference objects (points, vertices, edges
or faces, one on each side). When the value changes, the faces to move are translated along the measured direction
by the difference (both sets by half of it in symmetric mode) and the shell is recalculated by a
Parametric. Instances are created by ParametricsDistanceAction (and by
ParametricsExtrudeAction, which is not part of the build yet) and added to the shell with
AddParametricProperty(ParametricProperty).
public class ParametricDistanceProperty : ParametricProperty, IJsonSerialize, IJsonSerializeDone
- Inheritance
-
ParametricDistanceProperty
- Implements
- Inherited Members
Constructors
ParametricDistanceProperty()
Empty constructor for the JSON deserialization; the data is set by SetObjectData(IJsonReadData).
protected ParametricDistanceProperty()
ParametricDistanceProperty(string, IEnumerable<Face>, IEnumerable<Face>, IEnumerable<object>, Mode, object, object)
Creates the distance property. The initial Value is the distance measured between
fromHere and toHere.
public ParametricDistanceProperty(string name, IEnumerable<Face> facesToKeep, IEnumerable<Face> facesToMove, IEnumerable<object> affectedObjects, ParametricDistanceProperty.Mode mode, object fromHere, object toHere)
Parameters
namestringName shown in the property page
facesToKeepIEnumerable<Face>The faces which stay in place (in symmetric mode they are moved against the measured direction)
facesToMoveIEnumerable<Face>The faces which are moved when the value changes
affectedObjectsIEnumerable<object>Faces, edges and vertices of the shell which are modified by this property, see GetAffectedObjects()
modeParametricDistanceProperty.ModeFlags controlling the measurement and the movement
fromHereobjectStart of the measured distance: a GeoPoint, Vertex, Edge or Face on the side of the faces to keep
toHereobjectEnd of the measured distance: a GeoPoint, Vertex, Edge or Face on the side of the faces to move
Properties
ExtrusionDirection
if != NullVector, this is the direction of the extrusion. This is used by the distance calculation.
public GeoVector ExtrusionDirection { get; set; }
Property Value
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)
Execute the parametrics. This will change the shell and the resulting shell may be inconsistent. But maybe further applications of other parametrics to the shell make it consistent again
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