# OpenCascade Overview

## Introduction

Today the market of engineering software proposes a big number of open source products possessing a proven high quality and widely recognized for showing good results. In this article we make a brief overview of Open CASCADE Technology (OpenCascade, OCCT) capacities not going deeply into details and focusing only on the basic platform components. This overview will give you an initial understanding of OpenCascade and its possible application domains. OpenCascade provides a wide range of functionalities for the development of engineering software. Moreover, this library is accessible under the LGPL license which means that there are practically no restrictions against its commercial use.

### What is OpenCascade?

First and foremost OpenCascade is a geometric modelling software development kit (SDK) or, more simply, it is a *geometric kernel*. OpenCascade uses a B-rep (Boundary Representation) approach to represent 3D models. This ranks the library together with such products as ACIS, Parasolid, CGM or C3D. The main difference is that the OpenCascade's source code is completely at the developer's disposal, which makes us (as software developers) considerably independent from CAD vendors.

Figure 1. The key ingredients of Open CASCADE Technology.

Structurally the library consists of several inter-connected modules responsible for various functions (Figure 1). The main library components are listed below:

- Foundation Classes: the fundamental OpenCascade ecosystem, including smart pointers, memory management, collections, operating-system dependent tools (OSD), and other facilities providing the library's infrastructure.
- Modelling: the modelling itself. Here you will find the B-rep data model of OpenCascade and all geometric operations, including surface and solid modelling features.
- Mesh: built-in tools for triangulation of CAD models. This functionality is used mostly for 3D visualization, i.e., to prepare precise CAD geometries for rendering.
- Data Exchange: components for data interoperability between different CAD software. This component is mainly interesting for us because it provides import and export of CAD data in the open and widely used STEP format.
- Visualization: an integrated visualization subsystem for CAD models, grids and arbitrary application data.
- Application Framework (OCAF): components for rapid application development using OpenCascade.

### Historical Background

Historically OpenCasacde inherits its mathematical kernel from the EUCLID CAD system, developed by Matra Datavision Company since the beginning of the 1980-s. A platform called CAS.CADE (Computer-Aided Software for Computer-Aided Design and Engineering) was released in 1993. It served as a basis for the development of a new generation of EUCLID called the EUCLID QUANTUM system, which was officially released in 1996. However a few years later (in 1998) Matra Datavision Company changed its business model and focused on providing software services.

In 1999 the management of Matra Datavision made a historical decision to open the source code of CAS.CADE library, which was then called Open CASCADE. At the end of the year 2000, Matra Datavision created an affiliated company called OPEN CASCADE S.A.S. to provide support and services based on the new geometrical kernel. In 2003 Matra Datavision was purchased by IBM Corporation, while OPEN CASCADE S.A.S. was acquired by another French company: Principia. Later on, the company changed its owners several times.

Today, the kernel is supported and developed by a company bearing the same name: OPEN CASCADE S.A.S. Its front office is located in France. In Russia, the company is represented with a big competence centre located in the city of Nizhny Novgorod.

## Modelling

As we have mentioned above, OpenCascade implements the boundary representation scheme (B-rep) of objects in 3D. The notions of *Geometry* and *Topology* are fundamental for such representation. Geometry is usually understood as a mathematical description of a shape, e.g. in terms of Bezier curves and surfaces, NURBS representation, etc. In its turn, the Topology is a data structure binding geometrical objects together by connecting them to each other via sharing, instancing and nesting. Speaking abstractly, we could draw an analogy between B-rep Topology and classic topology in the mathematical sense. As it is known, mathematical topology studies homeomorphisms, i.e. transformations without cutting and glueing. From this point of view, a torus (Figure 2 to the left) is identical to a coffee cup (the reader with a good imagination can recognize it in Figure 2 to the right). The same is true for the B-rep Topology: data structures that describe a torus and a cup can be totally identical. The whole difference lies in Geometry, i.e., in the mathematic equations of shape.

Figure 2. Torus modification without changing its topological structures. The same topological structure can fit equally well to visually different models.

From the programmer's viewpoint, B-rep Topology is a graph of objects representing adjacent vertices and edges for the neighbour faces.

Figure. 3. Possible topological structure of a "patchwork" torus from Figure 2.

The structure of the OpenCascade's geometric and topological primitives generally corresponds to ISO-10303 (STEP) standard. It is mostly useful to check part 42 — "Integrated generic resource: Geometric and topological representation." Anyways, grasping the idea that a CAD model is rather a "patchwork" than a simple object is absolutely necessary to understand B-rep. The B-rep principles are rather standard and are not peculiar exclusively to OpenCascade. Only the set of used topological primitives changes from one kernel to another, while such objects as faces, edges and vertices are always there to host the underlying geometry. It is exactly these objects that get connected with geometric primitives, while all others play a purely structural role.

It needs to be noted that, apart from B-rep, other representation techniques for CAD modelling are known and actually used: voxels, cellular structures, CSG (Constructive Solid Geometry), etc. However, all of them are application-specific and are used only within a limited range of tasks.

A precise B-rep model is "better" than a discrete one because it can always be converted into less precise voxels and meshes with a prescribed quality level. The reverse task (recovering a precise model from a discrete one) is not a trivial process as it poses a bunch of substantial difficulties (it's actually one of the grand challenges of CAD). The precise 3D modelling process requires a somewhat "ideal" object representation corresponding to its nomial form, without accounting for any imperfections, including technological tolerances whatsoever.

OpenCascade geometry is defined in somewhat standard parametric form. It is commonly known that NURBS is the most common approach to the description of a geometric form. Alongside it, the OpenCascade SDK implements surfaces of revolution, ruled surfaces, curves, сonics and quadrics, etc. Currently, OpenCascade supports the entire usual set of geometries, except for such technologies as T-splines and subdivision surfaces.

Figure 4. B-spline surface in OCCT.

Geometry is trimmed and structured using topological limitations. It can be seen how the parametric domain of each face changes in the process. The "parametric domain" means a (U, V) space, where the face of interest, complemented with parametric 2D curves (p-curves) is defined. The configuration and orientation of these curves indicate how the edges are defined on the face and where the holes are located.

Figure 5. Parametric domain of a face with internal holes.

After this brief overview of the basic B-rep principles, we will examine the fundamental OpenCascade capacities related to 3D modelling. For more details on the set of available functions, we invite you to join our CAD programming workshop.

### Surface from points

OpenCascade supports a toolset to reconstruct the surface geometry from an ordered set of points. This procedure can involve the global interpolation methods (if the resulting precision should be equal to zero) or the approximation methods with a given precision.

Figure 6. NURBS-surface, reconstructed from a cloud of points.

### Shell (Solid) Skinning

Reconstructing a shape from a given set of sections is a standard geometric modelling task. OCCT provides means for both, surface skinning and for solid reconstruction with automatic recovery of end faces.

Figure 7. Model constructed by sections.

### Kinematic modeling

Sweeping a profile along a given trajectory (spine) allows building tubes of arbitrary shape and section. The profile orientation along the spine is defined by the user.

Figure 8. Tube constructed by sweeping of a round profile.

### Boolean operations

Cut, fuse, common, intersection of shapes and surfaces — all these fundamental algorithms are implemented in OCCT and have been successfully tested on many real industrial models.

Figure 9. Cutting a prism from a revolution.

Figure 10. Fusing.

Figure 11. Common.

Figure 12. Intersection of shells.

### Chamfers and Fillets

Chamfers and fillets are also available in OCCT. Fillets with a variable radius are supported as well.

Figure 13. Fillets on edges.

Figure 14. Fillets with a variable radius.

### Anything else?

Well, there are a lot of functions in the library that could not be easily embraced with a single article. Stay tuned to our blog to know more.

## Data Exchange

Open CASCADE Technology provides advanced tools for CAD data exchange. It supports such common CAD formats as STEP and IGES. The correctness of data transfer using STEP format is ensured not only by a profound experience of using that translator in industrial projects, but also by the fact that the development team took part in a ProSTEP "test-rally" (in 1998-1999, TR 8-10), and later in CAX-IF (in 2000-2002, TRJ 3-10).

The quality of translation is amplified by the Shape Healing component, which serves for post-processing of a converted CAD model and allows solving geometric and topological problems (for example, related with self-intersection of edges, absence of parametric curves, insufficiency of topological information, etc.)

Data translators allow working not only with geometric information but also with some associated attributes. For example, Open CASCADE Technology is able to read components' colours and names, their nesting in assemblies, layers and some other properties from STEP format.

Figure 15. A STEP file with colors read by Open CASCADE Technology.

## Visualization

Open CASCADE Technology platform is supplied with its custom visualization subsystem based on OpenGL. The subsystem not only allows working efficiently with geometric resources of the library, but it also supports the implementation of interactive 3D scenes in real CAD applications.

Figure 16. Dynamic section by means of OpenGL.

Figure 17. Visualization by ray tracing method (real-time FPS).

Figure 18. Visualization of a pump model by ray tracing combining shading and wireframe.

At our disposal, we have either low-level tools working with basic geometry and topology (NURBS visualization with control points and knots, rendering of isolines to estimate the speed and quality of parameterization, rendering of a parametric domain of faces) or high-level tools for the real-time quality rendering of models using ray tracing (including shades, reflections, transparency, antialiasing, etc.). It seems that currently, this part of the library develops most rapidly.

## Conclusion

Open CASCADE Technology is an absolutely open product that can greatly contribute to your capacities to develop high-tech software. It is remarkable that this library can be applied even in domains outside of CAD/CAM/CAE fields. A sophisticated mathematical kernel, a visualization subsystem and components for fast prototyping of applications (OCAF) can be useful not only for the developers of industrial-grade software but also for educational and research purposes as a mathematical "ecosystem" for scientific projects.

*Want to discuss this? Jump in to our forum.*