Typedefs | Functions
Constraint Models

Typedefs

typedef void(* ConsMod_ApplyCallback )(Cons *cons, CallbackArgP arg)
 Callback function used by mdlConsMod_apply. More...
 

Functions

nativeCode ConsmdlConsMod_add (ConsModel *pThis, Cons *pNode)
 mdlConsMod_add adds a constraint, construction, etc. More...
 
nativeCode void mdlConsMod_concat (ConsModel *pThis, ConsModel *pModel2)
 
The mdlConsMod_concat adds all of the objects in the second model to the first

model. More...

 
nativeCode ConsmdlConsMod_drop (ConsModel *pThis, Cons *pNode)
 mdlConsMod_drop removes an object from a constraint model. More...
 
nativeCode ConsModelmdlConsMod_create (ConsModel *pThis)
 mdlConsMod_create defines an empty constraint model. More...
 
nativeCode void mdlConsMod_destroy (ConsModel *pThis)
 
mdlConsMod_destroy frees the memory allocated by

mdlConsMod_create. More...

 
nativeCode void mdlConsMod_destroyNodes (ConsModel *pThis)
 
mdlConsMod_destroyNodes drops, destroys, and frees each constraint, construction

frame, constraint parameter, equation and attachment which has been added to the model. More...

 
nativeCode void mdlConsMod_chooseSolution (ConsModel *pThis, bool unused)
 
mdlConsMod_chooseSolution directs the constraint model pModel to identify and

track the solutions to the constraint problem closest to the model's current geometry. More...

 
nativeCode int mdlConsMod_solve (ConsModel *pThis)
 
mdlConsMod_solve solves a constraint problem by modifying the attribute variables

of construction frames and constraint parameters as necessary. More...

 
nativeCode int mdlConsMod_validate (ConsModel *pThis)
 
mdlConsMod_validate diagnoses under-determined variables and redundant

constraints in a constraint-solving problem. More...

 
nativeCode int mdlConsMod_dof (ConsModel *pThis)
 mdlConsMod_dof returns the degrees of freedom left in a constraint problem. More...
 
nativeCode void mdlConsMod_backupVars (ConsModel *pThis)
 
mdlConsMod_backupVars commands each object in the constraint model to save the

current values of its attribute variables. More...

 
nativeCode void mdlConsMod_restoreVars (ConsModel *pThis)
 
mdlConsMod_restoreVars commands each object in the constraint model to restore

the values of its attribute variables. More...

 
nativeCode void mdlConsMod_apply (ConsModel *pThis, ConsMod_ApplyCallback fp, CallbackArgP arg)
 
mdlConsMod_apply applies the supplied MDL function to each object in the

constraint model. More...

 
nativeCode bool mdlConsMod_isFound (ConsModel *pThis, void *pNode)
 
mdlConsMod_isFound looks for an object in the constraint model by its pointer

value. More...

 
nativeCode int mdlConsMod_transform (ConsModel *pThis, TransformP pTransform)
 
mdlConsMod_transform transforms the geometry of all objects in the specified

constraint model. More...

 
nativeCode int mdlConsMod_offset (ConsModel *pThis, Dpoint3d *pOff)
 
mdlConsMod_offset translates all objects in the specified constraint model by the

specified offsets in the x and y directions in the current plane (the z offset is ignored, since the model is planar). More...

 
nativeCode void mdlConsMod_mirror (ConsModel *pThis, Dpoint3d *pO, RotMatrixP pRot)
 
mdlConsMod_mirror modifies the geometry of the objects in the specified constraint

model by mirroring across the specified line of symmetry in the current plane. More...

 
nativeCode int mdlCons_isChanged (Cons *pThis)
 mdlCons_isChanged queries if an object's attribute variables or targets have been changed, compared to their saved values. More...
 
nativeCode Var * mdlCons_getVar (Cons *pThis, int i)
 mdlCons_getVar retrieves the ith attribute variable of the specified Cons object. More...
 

Detailed Description

Typedef Documentation

typedef void(* ConsMod_ApplyCallback)(Cons *cons, CallbackArgP arg)

Callback function used by mdlConsMod_apply.

Parameters
[in]consAn object in the constraint model.
[in]argArgument supplied to mdlConsMod_apply.

Function Documentation

nativeCode Var* mdlCons_getVar ( Cons pThis,
int  i 
)

mdlCons_getVar retrieves the ith attribute variable of the specified Cons object.

Parameters
[in]pThisis the object to be accessed.
[in]iis the index of the attribute to retrieve.
Returns
mdlCons_getVar returns a pointer to the ith attribute variable or NULL if i is out of range.
See also
mdlVar_getVal mdlVar_setVal mdlVar_isChanged mdlVar_isUnderDetermined mdlVar_isConstant mdlVar_setConstant
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlCons_isChanged ( Cons pThis)

mdlCons_isChanged queries if an object's attribute variables or targets have been changed, compared to their saved values.

Parameters
[out]pThisis the object to query.
Returns
mdlCons_isChanged returns true if the object's attributes or targets have changed; false otherwise.
Remarks
Attribute variable values are saved by mdlConsMod_backupVars.
See also
mdlConsMod_backupVars mdlConsMod_solve mdlCons_getVar mdlVar_isChanged
Remarks
Required Library: mdlbltin.lib
nativeCode Cons* mdlConsMod_add ( ConsModel pThis,
Cons pNode 
)

mdlConsMod_add adds a constraint, construction, etc.

to a constraint model.

Parameters
[in,out]pThisis the constraint model to update.
[in,out]pNodepoints to a constraint, construction frame, constraint parameter, equation constraint, or attachment.
Returns
mdlConsMod_add returns this.
Remarks
Duplicates are not checked, and adding the same object to a model more than once is not advisable. Duplicates would not cause problems in constraint solving, but would cause memory errors in mdlConsMod_destroyNodes.
See also
mdlConsMod_drop
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_apply ( ConsModel pThis,
ConsMod_ApplyCallback  fp,
CallbackArgP  arg 
)

mdlConsMod_apply applies the supplied MDL function to each object in the

constraint model.

All objects in the model are processed.

Parameters
[in]pThisis the constraint model.
[in]fpis a pointer to an MDL function
[in]argis passed to fp as its second argument.
Returns
mdlConsMod_apply is of type void.
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_backupVars ( ConsModel pThis)

mdlConsMod_backupVars commands each object in the constraint model to save the

current values of its attribute variables.

This then establishes the baseline for comparison and restoring for later calls to the solve function.

Parameters
[out]pThisis the constraint model containing the construction frames, etc., which are to be backed up.
Returns
mdlConsMod_backupVars is of type void.
Remarks
All attribute variable values are backed up, including the attributes of dimensions and constants.
See also
mdlConsMod_restoreVars mdlCons_isChanged
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_chooseSolution ( ConsModel pThis,
bool  unused 
)

mdlConsMod_chooseSolution directs the constraint model pModel to identify and

track the solutions to the constraint problem closest to the model's current geometry.

Parameters
[in,out]pThisthe storage to be filled out.
[in]unusedis this to be a post-check?
Returns
mdlConsMod_chooseSolution is of type void.
Remarks
This allows you to "teach" the model by example which solutions you want it to track. If, for example, there were an Intersection constraint applying to a particular point in the model and if there were two or more possible intersections to choose from, then the model would choose and favor the intersection closest to the current location of the point. Or, if there were an IOTangent constraint, the model would reset the inside/ outside sense of the tangency to match the current relative locations of the target circle and other curve.
mdlConsMod_chooseSolution may be called as often as needed. It has no effect on model validation.
You must call mdlConsMod_solve in order to obtain the new solutions.
See also
mdlConsMod_solve
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_concat ( ConsModel pThis,
ConsModel pModel2 
)

The mdlConsMod_concat adds all of the objects in the second model to the first

model.

Each object added is assigned a new model ID number in the process.

Parameters
[in,out]pThisis the constraint model to which the objects are added.
[in]pModel2is the constraint model from which the objects are read.
Returns
mdlConsMod_concat is of type void.
Remarks
The objects to be concatenated are not copied and are not dropped from the second model. Therefore, after calling this function, both models will point to these objects. The second model should therefore be destroyed or emptied out, but you should not call mdlConsMod_destroyNodes on the second model or destroy its contents by any other means.
See also
mdlConsMod_add
Remarks
Required Library: mdlbltin.lib
nativeCode ConsModel* mdlConsMod_create ( ConsModel pThis)

mdlConsMod_create defines an empty constraint model.

Parameters
[out]pThisis the storage to be filled out.
Returns
mdlConsMod_create returns this.
Remarks
A constraint model contains dynamically allocated memory and must be destroyed when not longer needed in order to release this memory.
See also
mdlConsMod_destroy
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_destroy ( ConsModel pThis)

mdlConsMod_destroy frees the memory allocated by

mdlConsMod_create.

The constraint model is then invalid and should not be used.

Parameters
[out]pThisis the constraint model. It is not freed.
Returns
mdlConsMod_destroy is of type void.
Remarks
The input pointer is not freed.
See also
mdlConsMod_destroyNodes
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_destroyNodes ( ConsModel pThis)

mdlConsMod_destroyNodes drops, destroys, and frees each constraint, construction

frame, constraint parameter, equation and attachment which has been added to the model.

The model itself is not destroyed.

Parameters
[out]pThisis the constraint model
Returns
mdlConsMod_destroyNodes is of type void.
Remarks
Each item is freed. Do not call this function if the model contains items that were not created with dynamic memory.
See also
mdlConsMod_destroy
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlConsMod_dof ( ConsModel pThis)

mdlConsMod_dof returns the degrees of freedom left in a constraint problem.

If the degrees of freedom is zero and there are no redundant constraints in the model, then the problem is well constrained.

Parameters
[in]pThisis the constraint model to diagnose.
Remarks
You must solve the model before validating.
Returns
mdlConsMod_dof returns the number of degrees of freedom left in the model.
See also
mdlConsMod_validate
Remarks
Required Library: mdlbltin.lib
nativeCode Cons* mdlConsMod_drop ( ConsModel pThis,
Cons pNode 
)

mdlConsMod_drop removes an object from a constraint model.

The object is not destroyed. If the object is a constraint, its effects on the constraint-solving problem are removed.

Parameters
[in,out]pThisis the constraint model.
[in]pNodeis the Cons object to drop from the model.
Returns
mdlConsMod_drop is of type void.
Remarks
Dropping an object that is not in the model has no effect.
See also
mdlConsMod_add mdlConsMod_destroyNodes mdlConsMod_destroy
Remarks
Required Library: mdlbltin.lib
nativeCode bool mdlConsMod_isFound ( ConsModel pThis,
void *  pNode 
)

mdlConsMod_isFound looks for an object in the constraint model by its pointer

value.

Parameters
[in]pThisis the constraint model to be searched.
[in]pNodeis a pointer to the object to find.
Returns
mdlConsMod_isFound returns true if the object is found in the model; false otherwise.
See also
mdlConsMod_add mdlConsMod_drop
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_mirror ( ConsModel pThis,
Dpoint3d pO,
RotMatrixP  pRot 
)

mdlConsMod_mirror modifies the geometry of the objects in the specified constraint

model by mirroring across the specified line of symmetry in the current plane.

Parameters
[in]pThisis the model containing the construction frames, etc. which are to be modified.
[in]pOstart of a line of symmetry
[in]pRotorientation of line of symmetry
Returns
mdlConsMod_mirror is of type void.
Remarks
The line of symmetry is defined by a point, pO, and a rotation matrix, pRot. The rotation matrix should be a simple 2D rotation matrix, such as mdlRMatrix_fromAngle would create. The direction of the line of symmetry is implicitly the x-axis-column of the rotation matrix.
Mirroring model geometry will have no effect on whether or not a model is solved, since it represents only a change in coordinate system (flipping the imaginary z-axis over). It should not be necessary to re-solve or re- validate the model in this case. The attribute values of the objects in the model will change, nevertheless.
See also
mdlConsMod_transform
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlConsMod_offset ( ConsModel pThis,
Dpoint3d pOff 
)

mdlConsMod_offset translates all objects in the specified constraint model by the

specified offsets in the x and y directions in the current plane (the z offset is ignored, since the model is planar).

Parameters
[in,out]pThisis the model containing the construction frames, etc. which are to be modified.
[in]pOffcontains the x and y offsets to add to each object's location.
Returns
mdlConsMod_offset is of type void.
Remarks
Translating model geometry will have no effect on whether or not a model is solved, since it represents only a change in coordinate system. It should not be necessary to re-solve or re-validate the model in this case. The attribute values of the objects in the model will change, nevertheless.
See also
mdlConsMod_transform
Remarks
Required Library: mdlbltin.lib
nativeCode void mdlConsMod_restoreVars ( ConsModel pThis)

mdlConsMod_restoreVars commands each object in the constraint model to restore

the values of its attribute variables.

This includes the attribute variables of constraints and constants.

Parameters
[out]pThisis the constraint model containing the construction frames, etc., which are to be restored.
Returns
mdlConsMod_restoreVars is of type void.
Remarks
mdlConsMod_solve calls mdlConsMod_restoreVars automatically whenever it cannot solve a constraint problem.
See also
mdlConsMod_backupVars mdlConsMod_solve
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlConsMod_solve ( ConsModel pThis)

mdlConsMod_solve solves a constraint problem by modifying the attribute variables

of construction frames and constraint parameters as necessary.

If all constraints are already satisfied, nothing is done. Solve restores the values of all attribute variables to their saved values if the constraint problem cannot be solved.

Parameters
[in,out]pThisis the constraint model to solve.
Returns
mdlConsMod_solve returns SUCCESS if the constraint problem required solving and was solved, ERROR if the problem required solving and could not be solved, or NOP if the constraint problem did not require solving.
See also
mdlConsMod_backupVars mdlConsMod_restoreVars
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlConsMod_transform ( ConsModel pThis,
TransformP  pTransform 
)

mdlConsMod_transform transforms the geometry of all objects in the specified

constraint model.

Parameters
[in,out]pThisis the model containing the construction frames, etc. which are to be modified.
[in]pTransformis the transformation matrix to apply to each object's geometry.
Returns
mdlConsMod_transform is of type void.
Remarks
Transforming model geometry will have no effect on whether or not a model is solved if the transformation entails only translation and/or rotation, since it represents only a change in coordinate system. It should not be necessary to re-solve or re-validate the model in this case. The attribute values of the objects in the model will change, nevertheless.
Applying a non-uniform scaling or a non-orthogonal transformation will change relative geometry and will potentially change both the solution conditions and the possibility of solving. In this case, you must call mdlConsMod_solve in order to obtain a new solution and you may have to call mdlConsMod_validate to check the model's viability.
See also
mdlConsMod_offset mdlConsMod_mirror
Remarks
Required Library: mdlbltin.lib
nativeCode int mdlConsMod_validate ( ConsModel pThis)

mdlConsMod_validate diagnoses under-determined variables and redundant

constraints in a constraint-solving problem.

The under-determined status of the attribute variables of construction frames and constraint parameters is updated, and the rGroup value of constraints is reset.

Parameters
[in]pThisis the constraint model to diagnose.
Remarks
You must solve the model before validating.
Returns
mdlConsMod_validate returns ERROR if the constraint model contains redundant equations; otherwise, SUCCESS.
See also
mdlConsMod_dof mdlConstraint_rGroup
Remarks
Required Library: mdlbltin.lib

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.