# Technical Focus on Linear Pattern Constraints

This is the first in a sequence of posts that will dip into particular aspects of D-Cubed components. As you might expect from products that are quite mathematical, some of the concepts can be rather abstract. So, whenever possible I’ll try to give examples of where they can be used.

In this post I want to focus on **linear pattern constraints**, and to use an example that is likely to be, literally, right under your nose.

Our D-Cubed 2D DCM (Dimensional Constraint Manager) geometric constraint solver integrates into your software application so your end-users can create and modify 2D sketches more efficiently.

Within the D-Cubed 2D DCM, **patterns** are special types of constraints that can be applied between two or more groups of geometries. They ensure that each group is the same size and shape, but allow the separation and relative orientation between groups to vary.

There is probably a really good example of a linear pattern right in front of you – a computer keyboard. Here is a picture of mine:

Let’s imagine what an engineer wants to achieve when designing a keyboard like this. Almost certainly the alphanumeric keys need to be of the same size and be equally spaced in both directions. Different keys are used around the edges although most have the same size in the front-to-back direction. For example, the “tab” key might be 1.5 times as wide as a normal key in one direction, but the same size in the other.

Knowing the relative size and number of the keys, and the space available for the whole keyboard, it is straightforward to calculate the layout by hand. However, a constraint solver that supports patterns can make this much easier.

In the sketch below, a single row of the keyboard has been modelled in the 2D DCM testing application:

Most of the obvious constraints have been applied to the geometry. The width of the two “shift” keys has been defined using equations, and the gap around them is the same as between the other keys. Pattern constraints are used to make the 11 alphanumeric keys a uniform size and spacing.

It isn’t any more difficult to create a model in this way and there are significant benefits when the sketch needs to be changed. For example, suppose the speakers along the sides of the keyboard need to be wider, and the keys moved closer together to allow this. This isn’t a problem – the dimension of 288 can be changed and the 2D DCM adjusts the patterned geometries to fit the available space. In fact, the sketch could be extended to include the speakers, and the space available for the keyboard (288 in this case) automatically calculated. In a similar way, the size of the keys (given as “a” in the sketch) can be changed.

Being able to vary a model in this way is the essence of “variational modelling” – the key technology that the 2D DCM supports. Constraints and dimensions are applied to the geometry as it is created, and the sketch is quickly and easily changed by modifying the values of dimensions. So, a single sketch can represent a whole “family of parts”.

The keyboard layout is an example of using a “linear” 2D DCM pattern, where the elements that make up the pattern are transformed linearly with no rotation. The 2D DCM also supports a “circular” pattern, where the transformations between the corresponding geometries are rotations around a circle. The most recent release also introduced support for “instances”, which are very closely related to patterns. These might be a good subject for a future post, but for now take a look around you and see how many examples there are of patterns of geometry.

Leave me a comment on any you see and let me know what questions you have about geometric patterns.

Mike