Class ParametricProperty
- Namespace
- CADability
- Assembly
- CADability.dll
The ParametricProperty is the base class for all parametric properties of a shell. The different derived classes know which parts of the shell (Faces, Edges, Vertices) define the property and what to do, when the value of that property changes. For the Execute(Parametric) and GetResult(Parametric) we need a Parametric object, which can handle succesive parametric modifications on a clone of the shell. The derived classes (ParametricXxxProperty) are typically created by an Action (ParametricXxxAction), which allows to specify faces, Edges and Vertices of the shell and other data.
public abstract class ParametricProperty : IJsonSerialize
- Inheritance
-
ParametricProperty
- Implements
- Derived
- Inherited Members
Constructors
ParametricProperty(string)
Initializes the base part of a parametric property with its name.
public ParametricProperty(string name)
Parameters
Properties
Name
The name under which the parametric property appears in the property page of the Shell (or of the Solid containing it). Several parametric properties of a shell may share the same name; a value entered in the property page is then applied to all of them.
public string Name { get; set; }
Property Value
Preserve
true when the value of this parametric property is meant to be preserved while other parametric properties of the same shell are changed. The flag is set from the "preserve value" input of the parametric actions and can be toggled in the context menu of the property entry. It is saved with the shell, but it is not yet evaluated when parametrics are executed.
public bool Preserve { get; set; }
Property Value
PropertyEntry
The entry of the property page which currently displays this parametric property, or null when it is not displayed. It is set by the Shell when the entry is added to or removed from a property page and is used to refresh the displayed value after other parametric properties have changed the shell.
public IPropertyEntry PropertyEntry { 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 abstract double Value { get; set; }
Property Value
Methods
Clone(Parametric)
Clones this parametric property so that it refers to the faces, edges and vertices of the shell which is modified
by parametric (the shell returned by Result()). The mapping is taken from
GetDictionaries(out Dictionary<Face, Face>, out Dictionary<Edge, Edge>, out Dictionary<Vertex, Vertex>).
public ParametricProperty Clone(Parametric parametric)
Parameters
parametricParametricThe parametric modification whose cloned shell the result refers to
Returns
- ParametricProperty
The clone, referring to the objects of the cloned shell
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 abstract 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
CloneFacesWithDictionary(List<Face>, Dictionary<Face, Face>)
Maps a list of faces of the original shell to the corresponding faces of a cloned shell. Faces which are not found
in clonedFaces are omitted.
protected List<Face> CloneFacesWithDictionary(List<Face> list, Dictionary<Face, Face> clonedFaces)
Parameters
listList<Face>Faces of the original shell
clonedFacesDictionary<Face, Face>Maps the faces of the original shell to the faces of the clone
Returns
CloneWithDictionary(List<object>, Dictionary<Face, Face>, Dictionary<Edge, Edge>, Dictionary<Vertex, Vertex>)
Maps a list of objects of the original shell to the corresponding objects of a cloned shell. Faces, edges and vertices are looked up in the dictionaries; a Line which is the axis of a face of revolution (user data "CADability.AxisOf") is replaced by the axis of the cloned face. Objects which cannot be mapped are omitted.
protected List<object> CloneWithDictionary(List<object> list, Dictionary<Face, Face> clonedFaces, Dictionary<Edge, Edge> clonedEdges, Dictionary<Vertex, Vertex> clonedVertices)
Parameters
listList<object>Faces, edges, vertices or axis lines of the original shell
clonedFacesDictionary<Face, Face>Maps the faces of the original shell to the faces of the clone
clonedEdgesDictionary<Edge, Edge>Maps the edges of the original shell to the edges of the clone
clonedVerticesDictionary<Vertex, Vertex>Maps the vertices of the original shell to the vertices of the clone
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 abstract bool Execute(Parametric parametrics)
Parameters
parametricsParametric
Returns
GetAffectedObjects()
Returns the faces, which will be modified by this parametric property
public abstract IEnumerable<object> GetAffectedObjects()
Returns
GetAnchor()
Returns the object on which serves as a anchorpoint for the operation
public abstract object GetAnchor()
Returns
GetFeedback(Projection)
Returns a list of objects that can be used as a feedback for this property (usually an arrow)
public abstract 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 virtual void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDataReceives the data
GetResult(Parametric)
Returns the shell resulting from the parametric modifications executed on parametrics so far,
i.e. the result of Result().
public Shell GetResult(Parametric parametrics)
Parameters
parametricsParametricThe parametric modification on which Execute(Parametric) was called
Returns
- Shell
The modified shell, or null when the modifications did not yield a consistent shell
Modify(ModOp)
When the shell is beeing modified, we have the chance here to update the parametric property if necessary
public abstract void Modify(ModOp m)
Parameters
mModOp
ModifyAxis(List<object>, ModOp)
Updates the axis lines in objects after the shell has been modified: each Line
which is the axis of a face of revolution (user data "CADability.AxisOf") receives the geometry of the current axis
of that face. Faces, edges and vertices in the list are part of the shell and have already been modified, so they
are left alone.
protected void ModifyAxis(List<object> objects, ModOp m)
Parameters
objectsList<object>Faces, edges, vertices or axis lines referenced by the parametric property
mModOpThe modification that was applied to the shell
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 virtual void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDataProvides the data