Driving and Variational Dimensions

Dimensions differ from logical constraints (parallelism, perpendicularity, etc.) in that they are linked with a numeric value called dimension value. A dimension value can be set by two methods:

  • Driving dimension. Dimension value is set by an independent user-defined numeric parameter that can be changed only from outside via solver API (by calling the GCE_ChangeDrivingDimension method). In this case the dimension does not depend on the geometry: on the contrary, the geometry depends on the dimension, as well as on the geometric constraint. The dimensions defined this way are required to control the geometry using dimensional parameters and they are called driving dimensions.

  • Variational dimension. Dimension value is defined by a numeric variable that is calculated by the solver as well as the geometry. In fact, the current value will be associated with a variable specially created by calling the GCE_AddVariable method, and it can be reused in other dimensions or equations. The value of dimension variable can be changed by the geometry. This representation is used when it is required to measure the dimension rather than to set it. Dimensions linked with variables are called variational dimensions.

Sometimes it is required to create a variational dimension that behaves as a driving dimension, especially when you need to control two or more dimensions linked with one numeric parameter simultaneously. In this case, you can create one or more variational dimensions that use one variable that can be made a driving parameter by calling:

constraint_item GCE_FixVariable(GCE_system gSys, var_item var), 

where var is the dimension variable descriptor.

The function returns the “driving parameter” constraint that fixes the current value of the var variable. After calling GCE_FixVariable, the variable virtually becomes an independent parameter of the constraint system and it can be changed only from the outside by calling the GCE_ChangeDrivingDimension method applied to the descriptor of the received constraint.

Driving dimensions and parameters can be varied using the

GCE_result GCE_ChangeDrivingDimension(GCE_system gSys, constraint_item dItem
                                     , double dVal).

The method input parameters are:

  • gSys is a parametric sketch constraint system;

  • dItem is a descriptor of driving dimension or driving parameter;

  • dVal is the required value of the driving dimension or the driving parameter;

If the operation is executed successfully, then the function would return the GCE_RESULT_OK code. If the function would return an error code (not GCE_RESULT_OK), then it can be caused by one of the following reasons:

  • Invalid system descriptors or gSys and dItem constraints.

  • The received constraint is not a driving dimension or driving parameter, for example, if the constraint is a variational dimension.

You should take into account that this function does not calculate anything, but just prepares the change of the driving dimension or parameter. In order to apply the change, please call the GCE_Evaluate calculation function. If it is required to change two and more driving dimensions simultaneously, then first make a series of preparatory GCE_ChangeDrivingDimension calls for each driving parameter or dimension, and then calculate the new positions of geometric elements determined by the new state of driving dimensions or parameters by calling GCE_Evaluate once.