# A New Approach to Modelling Lattices and Other Complex Geometry

Designers are increasingly being expected to produce extremely complex geometry. This is largely driven by the ability of additive manufacturing (AM) and 3D printing to produce virtually any level of detail. Lattices and organic shapes are now common in the latest generation of aerospace components. The development of optimization-based generative design is also a key aspect of this trend.

Although the increased design freedom can bring many performance advantages, it is also very problematic for established CAD systems such as SOLIDWORKS. This article explains why highly complex geometry is such a challenge for SOLIDWORKS, and how a new approach, implicit modelling, deals with complexity much more efficiently.

Every CAD designer will have models that fail to build, or start taking a long time to rebuild. For example, you might get a message in SOLIDWORKS that says, “Failed to create fillet.” Sometimes this happens when the feature count gets too high, but sometimes simply adding a few fillets can cause major issues.

The cause is the underlying way that the software represents geometry. This is not about how the designer defines the geometry, in terms of constraint-based sketches and other parametric modelling tools. It is about the way the software determines the solid geometry from these specifications.

### SOLIDWORKS Uses Boundary Representations

The fundamental issue with SOLIDWORKS, and almost every other commercial CAD software, is that when it comes to modelling complex geometry they use boundary representation (B-rep). In a B-rep model, solid geometry is defined by the topology that creates the boundary around the internal volume. The topology is features such as vertices, edges and faces. The topology is, in turn, defined by geometry which are features such as points, curves and surfaces. It may at first seem that topology and geometry are just different names for the same thing, but there is a simple difference.

Mathematical descriptions of geometry are often infinite while topology represents actual finite features. For example, the mathematical description for a curve often has no endpoints, so the curve extends indefinitely in each direction. An edge is a section of a curve that is bounded at each end by a vertex. Similarly, a surface may be represented as an infinite plane, but a face is a section of a surface that is bounded by edges.

Because B-rep uses topology to define the boundaries of edges, faces and volumes, they have to calculate all of this topology with every rebuild. As a person looking at a model, it may seem obvious that only some of the surfaces can intersect at edges, but a computer doesn’t know this. It must calculate whether each surface intersects with each other surface in a model to determine all of the edges.

This means that as the number of surfaces increases, the number of possible intersections increases by approximately the square of the number of surfaces. When the surfaces are planar, each individual calculation is at least relatively simple.

However, when curved surfaces intersect the calculations, it becomes considerably more complex with edges becoming spline curves. Fillets and blends can, therefore, significantly increase model size and rebuild time. There are rounding errors within the floating-point arithmetic used by computer processors. This means that faces close to being tangent become difficult to calculate. Many designers will have issues when faces just touch without intersecting in this way.

As well as determining edges, B-rep also has to determine the volume that is enclosed by the faces, which means checking whether points within the volume are inside or outside the boundary.

B-rep software has to use a brute force method to do this, checking each point by shooting a ray in a random direction and counting how many times it intersects with the boundary. If the point is inside, the ray will intersect with the boundary an odd number of times. If it is outside, it will intersect an even number of times or not at all. When the ray passes close to an edge or vertex, it causes issues for computers because of the floating-point arithmetic they use. If the ray is close to being tangent with a curve or close to a vertex, the number of boundary crossings can be miscounted.

Avoiding mistakes, therefore, requires processor hungry checks.

It should be clear at this point that B-rep is not a computationally efficient way to process geometry. When it is used for complex geometry, it leads to large file sizes, long rebuild times and unstable models.

A further problem with the conventional approach to CAD used by SOLIDWORKS is that each feature must be explicitly specified. Where large arrays of features, such as lattices merging with other features, fillets and blends must be individually defined for all the edges or faces that intersect.

### A More Efficient Approach – Implicit Modelling

Implicit equations use multiple variables within a single function. They can be used to define geometrical shapes by describing their 3D coordinates within a single equation. For example, an implicit equation for a sphere, with a radius r and its center located at the origin of a Cartesian coordinate system is:

x2 + y2 + z2 = r2

This is true for any value of x, y and z. Although the function is easy to understand in this format, when used for modelling geometry, it is useful to setup the equation so that it will be equal to zero on the surface. So, the function for the sphere, with the center at coordinates a, b, c would become:

In this format, the implicit equation is equal to zero on the surface.It is negative for any point inside the volume, and it is positive for any point outside the volume. This is a far more efficient and less error-prone way of determining the interior volume than the way the B-rep does by shooting rays. The magnitude of the function is also equal to the distance from the surface. The function may, therefore, be considered to be a signed distance function, which can be very useful.

What makes implicit modelling so useful for complex geometry is the ease with which different features can be combined. Imagine that we have a solid made up of the union of two spheres. Both spheres have a radius of one. Sphere A is center on the origin and sphere B is located at (1,0,0).

The signed distance functions for the two spheres are given by:

Finding an implicit function for the combined volume is as simple as taking the minimum of these two functions:

FC = MIN( FA, FB )

For example, a point at (2,1,1) has a distance of 1 from sphere A and is on the surface of sphere B, so the minimum value is, therefore, zero since it is on the surface of the combined volume. The implicit function for the combined value can be used to calculate distance fields as shown below. Try entering some values to convince yourself that this works.

This is just a simple example. However, it is possible to combine large numbers of complex features into single solid bodies using this approach. It does not require any explicit definition of points or edges, making it extremely easy to calculate. Also, because the function value is a distance from the surface, floating-point approximations will only confuse the inside and outside of the volume for points that are extremely close to the boundary.

Typically, within the region is where it becomes difficult to define the boundary of a physical object in the real world. The ability to modify these functions based on their proximity to each other also means it is possible to create blends between features without explicitly defining fillets or edges.

Implicit functions can also be defined for features such as lattices. Instead of creating a single feature and then tiling it, a single implicit function can define a repeating pattern that would continue to infinity. Other geometry can then be used to bound this pattern. An example of this type of lattice is shown below.

This was created using the nTopology implicit modelling software. The individual beams of the lattice are not individually defined by the designer, only the region to fill, beam diameter and spacing of the lattice. It is also important to note that individual fillets have not been specified. Rather, a global blending has been applied automatically. Something that would have taken days to model, if it could be achieved at all, can be created in less than a minute.

### Geometry Defined as Fields Can Be Modified by Fields

The ability to modify a distance field based on another field is an extremely powerful capability. It allows highly efficient blending, both from the point of view of the designer and from the software. For the designer, individual fillet positions do not have to be identified. For the computer, all of the intensive edge calculations of filleting in B-rep can be avoided. The advantages don’t stop there. It is also possible to use fields such as a stress or a temperature field to modify geometry.

Imagine if before removing the material from the center of the above part and filling it with a lattice, the designer had to first run a stress analysis. This would produce a stress field for the part:

This stress field can be used to modify the implicit function for the lattice. The spacing and diameters of the beams within the lattice become a function of the stress so that in areas of high stress, the beams are thicker and closer together. Where there is little stress, the beams can be thinner and more widely spaced. Implicit functions allow such a highly complex modification of geometry to be carried out quickly and intuitively. Once again, no explicit definitions of fillets are required. Simple blending parameters take care of ensuring smooth transitions globally.

Implicit modelling offers extremely powerful tools for complex geometry. However, it currently isn’t well integrated into the constraint-based workflow of conventional parametric CAD. It is yet to be seen whether it will become integrated, as Fusion 360 is currently attempting with its Volumetric Kernel, or whether it will remain a specialized tool for complex features within a pre-designed envelope.

For SOLIDWORKS users, probably the most accessible tool for lattice creation is 3DXpert. This enables lattices to be efficiently created and manipulated. For the really advanced methods using field-based manipulates to optimize structures, nTopology is generally considered to be the leader. There are also other applications for implicit modelling beyond lattice creation; for example, Gen3D uses implicit modelling to greatly improve the design of flow paths for applications such as manifolds and heat exchangers.