0028345: Data Exchange - Reading STEP model using STEPCAF crashes
[occt.git] / dox / technical_overview / technical_overview.md
72b7576f 1Technical Overview {#technical_overview}
e5bd0d98 4@tableofcontents
2683e647 6Open CASCADE Technology (OCCT) is an object-oriented C++ class library designed for rapid production of sophisticated domain-specific CAD/CAM/CAE applications.
72b7576f 7
013a8549 8A typical application developed using OCCT deals with two or three-dimensional (2D or 3D) geometric modeling
72b7576f 9in general-purpose or specialized Computer Aided Design (CAD) systems, manufacturing
2683e647 10or analysis applications, simulation applications, or even illustration tools.
72b7576f 11
013a8549 12@figure{/technical_overview/images/technical_overview_over.png}
2683e647 14OCCT library is designed to be truly modular and extensible, providing C++ classes for:
15 * Basic data structures (geometric modeling, visualization, interactive selection and application specific services);
16 * Modeling algorithms;
17 * Working with mesh (faceted) data;
18 * Data interoperability with neutral formats (IGES, STEP);
72b7576f 19
2683e647 20The C++ classes and other types are grouped into packages. Packages are organized into toolkits (libraries), to which you can link your application. Finally, toolkits are grouped into seven modules.
72b7576f 21
2683e647 22This modular structure is illustrated in the diagram below.
72b7576f 23
2683e647 24@figure{/technical_overview/images/technical_overview_schema.png}
72b7576f 25
2683e647 26* @ref OCCT_TOVW_SECTION_2 "Foundation Classes" module underlies all other OCCT classes;
27* @ref OCCT_TOVW_SECTION_3 "Modeling Data" module supplies data structures to represent 2D and 3D geometric primitives and their compositions into CAD models;
28* @ref OCCT_TOVW_SECTION_4 "Modeling Algorithms" module contains a vast range of geometrical and topological algorithms;
8b742dc1 29 * @ref OCCT_TOVW_SECTION_4a "Mesh" toolkit from "Modeling Algorithms" module implements tessellated representations of objects;
2683e647 30* @ref OCCT_TOVW_SECTION_5 "Visualization" module provides complex mechanisms for graphical data representation;
31* @ref OCCT_TOVW_SECTION_6 "Data Exchange" module inter-operates with popular data formats and relies on @ref OCCT_TOVW_SECTION_6a "Shape Healing" to improve compatibility between CAD software of different vendors;
32* @ref OCCT_TOVW_SECTION_7 "Application Framework" module offers ready-to-use solutions for handling application-specific data (user attributes) and commonly used functionality (save/restore, undo/redo, copy/paste, tracking CAD modifications, etc).
72b7576f 33
2683e647 34In addition, @ref OCCT_TOVW_SECTION_8 "Open CASCADE Test Harness", also called Draw, provides an entry point to the library and can be used as a testing tool for its modules.
72b7576f 35
2683e647 36@section OCCT_TOVW_SECTION_2 Foundation Classes
72b7576f 37
2683e647 38**Foundation Classes** module contains data structures and services used by higher-level Open CASCADE Technology classes:
40 * Primitive types, such as Boolean, Character, Integer or Real;
8b742dc1 41 * String classes that handle Unicode strings;
2683e647 42 * Collection classes that handle statically or dynamically sized aggregates of data, such as arrays, lists, queues, sets and hash tables (data maps).
43 * Classes providing commonly used numerical algorithms and basic linear algebra calculations (addition, multiplication, transposition of vectors and matrices, solving linear systems etc).
8b742dc1 44 * Fundamental types like color, date and time information;
2683e647 45 * Primitive geometry types providing implementation of basic geometric and algebraic entities that define and manipulate elementary data structures.
46 * Exception classes that describe situations, when the normal execution of program is abandoned;
48This module also provides a variety of general-purpose services, such as:
49 * Safe handling of dynamically created objects, ensuring automatic deletion of unreferenced objects (smart pointers);
8b742dc1 50 * Standard and specialized memory allocators;
2683e647 51 * Extended run-time type information (RTTI) mechanism maintaining a full type hierarchy and providing means to iterate over it;
52 * Encapsulation of C++ streams;
2683e647 53 * Basic interpreter of expressions facilitating the creation of customized scripting tools, generic definition of expressions, etc.;
8b742dc1 54 * Tools for dealing with configuration resource files and customizable message files facilitating multi-language support in applications;
2683e647 55 * Progress indication and user break interfaces, giving a possibility even for low-level algorithms to communicate with the user in a universal and convenient way;
56 * and many others...
07f2b741 58See the details in @ref occt_user_guides__foundation_classes "Foundation Classes User's Guide"
72b7576f 59
7863dabb 60See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
72b7576f 61
2683e647 62@section OCCT_TOVW_SECTION_3 Modeling Data
72b7576f 63
8b742dc1 64**Modeling Data** supplies data structures to implement boundary representation (BRep) of objects in 3D.
65In BRep the shape is represented as an aggregation of geometry within topology.
66The geometry is understood as a mathematical description of a shape, e.g. as curves and surfaces (simple or canonical, Bezier, NURBS, etc).
67The topology is a data structure binding geometrical objects together.
2683e647 68
69Geometry types and utilities provide geometric data structures and services for:
70 * Description of points, vectors, curves and surfaces:
8b742dc1 71 * their positioning in 3D space using axis or coordinate systems, and
72 * their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof.
2683e647 73 * Creation of parametric curves and surfaces by interpolation and approximation;
74 * Algorithms of direct construction;
75 * Conversion of curves and surfaces to NURBS form;
76 * Computation of point coordinates on 2D and 3D curves;
77 * Calculation of extrema between geometric objects.
8b742dc1 79Topology defines relationships between simple geometric entities.
80A shape, which is a basic topological entity, can be divided into components (sub-shapes):
3f812249 81 * Vertex -- a zero-dimensional shape corresponding to a point;
82 * Edge -- a shape corresponding to a curve and bounded by a vertex at each extremity;
83 * Wire -- a sequence of edges connected by their vertices;
84 * Face -- a part of a plane (in 2D) or a surface (in 3D) bounded by wires;
85 * Shell -- a collection of faces connected by edges of their wire boundaries;
86 * Solid -- a finite closed part of 3D space bounded by shells;
8b742dc1 87 * Composite solid -- a collection of solids connected by faces of their shell boundaries;
88 * Compound -- a collection of shapes of arbitrary type.
72b7576f 89
8b742dc1 90Complex shapes can be defined as assemblies (compounds) of simpler entities.
72b7576f 91
07f2b741 92See the details in @ref occt_user_guides__modeling_data "Modeling Data User's Guide"
72b7576f 93
2683e647 943D geometric models can be stored in OCCT native BREP format.
95See @ref occt_user_guides__brep_wp "BREP Format Description White Paper" for details on the format.
72b7576f 96
7863dabb 97See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
72b7576f 98
2683e647 99@section OCCT_TOVW_SECTION_4 Modeling Algorithms
013a8549 100
8b742dc1 101**Modeling Algorithms** module groups a wide range of topological and geometric algorithms used in geometric modeling.
102Basically, there are two groups of algorithms in Open CASCADE Technology:
103 * High-level modeling routines used in the real design;
104 * Low-level mathematical support functions used as a groundwork for the modeling API.
013a8549 105
8b742dc1 106Low-level *geometric tools* provide the algorithms, which:
107 * Calculate the intersection of two curves, surfaces, or a curve and a surface;
108 * Project points onto 2D and 3D curves, points onto surfaces and 3D curves onto surfaces;
109 * Construct lines and circles from constraints;
110 * Construct free-form curves and surfaces from constraints (interpolation, approximation, skinning, gap filling, etc).
2683e647 111
8b742dc1 112Low-level *topological tools* provide the algorithms, which:
113 * Tessellate shapes;
114 * Check correct definition of shapes;
115 * Determine the local and global properties of shapes (derivatives, mass-inertia properties, etc);
116 * Perform affine transformations;
117 * Find planes in which edges are located;
118 * Convert shapes to NURBS geometry;
119 * Sew connected topologies (shells and wires) from separate topological elements (faces and edges).
2683e647 120
121Top-level API provides the following functionality:
8b742dc1 122 * Construction of Primitives:
123 * Boxes;
124 * Prisms;
125 * Cylinders;
126 * Cones;
127 * Spheres;
128 * Toruses.
129 * Kinematic Modeling:
130 * Prisms -- linear sweeps;
131 * Revolutions -- rotational sweeps;
132 * Pipes -- general-form sweeps;
133 * Lofting.
2683e647 134
7e3451c7 135@figure{/technical_overview/images/0001.png "Shapes containing pipes with variable radius produced by sweeping"}
2683e647 136
8b742dc1 137 * Boolean Operations, which allow creating new shapes from the combinations of source shapes. For two shapes *S1* and *S2*:
138 * *Common* contains all points that are in *S1* and *S2*;
139 * *Fuse* contains all points that are in *S1* or *S2*;
140 * *Cut* contains all points in that are in *S1* and not in *S2*.
2683e647 142See @ref occt_user_guides__boolean_operations "Boolean Operations" User's Guide for detailed documentation.
013a8549 143
8b742dc1 144 * Algorithms for local modifications such as:
145 * Hollowing;
146 * Shelling;
147 * Creation of tapered shapes using draft angles;
148 * Algorithms to make fillets and chamfers on shape edges, including those with variable radius (chord).
013a8549 149
8b742dc1 150 * Algorithms for creation of mechanical features, i.e. depressions, protrusions, ribs and grooves or slots along planar or revolution surfaces.
013a8549 151
7e3451c7 152@figure{/technical_overview/images/0004.png}
2683e647 153
07f2b741 154See the details in @ref occt_user_guides__modeling_algos "Modeling Algorithms User's Guide".
013a8549 155
7863dabb 156See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
013a8549 157
8b742dc1 158@subsection OCCT_TOVW_SECTION_4a Mesh
013a8549 159
8b742dc1 160**Mesh** toolkit provides the functionality to work with tessellated representations of objects in form of triangular facets. This toolkit contains:
2683e647 161- data structures to store surface mesh data associated to shapes and basic algorithms to handle them;
8b742dc1 162- data structures and algorithms to build triangular surface mesh from *BRep* objects (shapes);
2683e647 163- tools for displaying meshes with associated pre- and post-processor data (scalars or vectors).
013a8549 164
2683e647 165Open CASCADE SAS also offers Advanced Mesh Products:
7863dabb 166- <a href="https://www.opencascade.com/content/mesh-framework">Open CASCADE Mesh Framework (OMF)</a>
167- <a href="https://www.opencascade.com/content/express-mesh">Express Mesh</a>
72b7576f 168
2683e647 169@figure{/technical_overview/images/0003.png}
72b7576f 170
2683e647 171@section OCCT_TOVW_SECTION_5 Visualization
72b7576f 172
8b742dc1 173**Visualization** module provides ready-to-use algorithms to create graphic presentations from various objects: shapes, meshes, etc.
72b7576f 174
8b742dc1 175In Open CASCADE Technology visualization is based on the separation of CAD data and its graphical presentation.
2683e647 176The module also supports a fast and powerful interactive selection mechanism.
72b7576f 177
8b742dc1 178Visualization module relies on the following key toolkits:
179- *TKV3d* toolkit defines a high-level API called (Application Interactive Services* (AIS) for working with interactive objects.
180- *TKService* toolkit defines a low-level API for managing and creating presentations from primitive arrays.
181 This toolkit defines an abstraction layer for defining an arbitrary graphic driver responsible for actual rendering.
182- *TKOpenGl* toolkit implements the graphic driver using OpenGL and OpenGL ES libraries.
184While low-level API operates with primitive arrays (triangles, lines, points), the higher level includes services for building presentations for B-Rep shapes (shaded and wireframe).
185A comprehensive list of standard interactive objects includes topological shape, mesh presentation, various dimensions, manipulators and others.
186It provides a solid basis for rapid application development, while flexible and extensible API allows development of highly customized application-specific presentations.
188Here are a few examples of OCCT Visualization features:
189* Camera-driven view projection and orientation.
190 Perspective, orthographic and stereographic projections are supported.
191* Support of Common (diffuse/ambient/specular) and PBR metallic-roughness material models.
192* Possibility to flexibly adjust appearance of dimensions in a 3D view.
193 The 3D text object represents a given text string as a true 3D object in the model space.
194* Definition of clipping planes through the plane equation coefficients.
195 Ability to define visual attributes for cross-section at the level or individual clipping planes.
196 In the image below different parts of the rocket are clipped with different planes and hatched.
197@figure{/technical_overview/images/0008.png, "Display of shape cross-section and dimensions"}
72b7576f 198
8b742dc1 199* Support of built-in and application-specific GLSL shaders.
2683e647 200@figure{/technical_overview/images/0013.png, "Fragment shader implementing custom clipping surface"}
72b7576f 201
8b742dc1 202* Optimization of rendering performance through the algorithms of:
203 * View frustum culling, which skips the presentation outside camera at the rendering stage;
204 * Back face culling, which reduces the rendered number of triangles and eliminates artifacts at shape boundaries.
205* Real-time ray tracing technique using recursive Whitted's algorithm and Bounded Volume Hierarchy effective optimization structure.
206@figure{/technical_overview/images/0002.png, "Real time visualization by ray tracing method"}
2683e647 207@figure{/technical_overview/images/0012.png, "Simulation of a glass cover"}
72b7576f 208
07f2b741 209For more details, see @ref occt_user_guides__visualization "Visualization User's Guide".
013a8549 210
2683e647 211The visualization of OCCT topological shapes by means of VTK library provided by VIS component is described in a separate @ref occt_user_guides__vis "VTK Integration Services" User's Guide.
013a8549 212
7863dabb 213See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
013a8549 214
2683e647 215@section OCCT_TOVW_SECTION_6 Data Exchange
013a8549 216
8b742dc1 217**Data Exchange** allows developing OCCT-based applications that can interact with other CAD systems by writing and reading CAD models to and from external data.
013a8549 218
2683e647 219@figure{/technical_overview/images/0014.png,"Shape imported from STEP"}
013a8549 220
8b742dc1 221**Data Exchange** is organized in a modular way as a set of interfaces that comply with various CAD formats: IGES, STEP, STL, VRML, etc.
222The interfaces allow software based on OCCT to exchange data with various CAD/PDM software packages, maintaining a good level of interoperability.
223This module handles various problems of interoperability between CAD systems, caused by differences in model validity criteria and requirements to internal representation.
225* **Standardized Data Exchange** interfaces allow querying and examining the input file, converting its contents to a CAD model and running validity checks on a fully translated shape.
226 The following formats are currently supported:
227 * @ref occt_user_guides__step "STEP" (AP203: Mechanical Design, this covers General 3D CAD; AP214: Automotive Design; AP242).
228 * @ref occt_user_guides__iges "IGES" (up to 5.3).
229 * **glTF** 2.0 reader and writer.
230 * **OBJ** mesh file reader.
231 * **VRML** converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language).
232 * **STL** converter translates Open CASCADE shapes to STL files.
233 STL (STtereoLithography) format is widely used for rapid prototyping (3D printing).
2683e647 234* @ref occt_user_guides__xde "Extended data exchange" (XDE) allows translating additional attributes attached to geometric data (colors, layers, names, materials etc).
8b742dc1 235* <a href="https://www.opencascade.com/content/advanced-data-exchange-components">Advanced Data Exchange Components</a>
236 are available in addition to standard Data Exchange interfaces to support interoperability and data adaptation (also using @ref OCCT_TOVW_SECTION_6a "Shape Healing") with CAD software using the following proprietary formats:
7863dabb 237 * <a href="https://www.opencascade.com/content/acis-sat-import-export">ACIS SAT</a>
238 * <a href="https://www.opencascade.com/content/parasolid-import">Parasolid</a>
239 * <a href="https://www.opencascade.com/content/dxf-import-export">DXF</a>
240 * <a href="https://www.opencascade.com/content/ifc-import">IFC</a>
241 * <a href="https://www.opencascade.com/content/jt-import-export">JT</a>
013a8549 242
2683e647 243These components are based on the same architecture as interfaces with STEP and IGES.
013a8549 244
2683e647 245@section OCCT_TOVW_SECTION_6a Shape Healing
013a8549 246
2683e647 247**Shape Healing** library provides algorithms to correct and adapt the geometry and topology of shapes imported to OCCT from other CAD systems.
013a8549 248
2683e647 249Shape Healing algorithms include, but are not limited to, the following operations:
8b742dc1 250 * Analyze shape characteristics and, in particular, identify the shapes that do not comply with OCCT geometry and topology validity rules by analyzing geometrical objects and topology:
251 - check edge and wire consistency;
252 - check edge order in a wire;
253 - check the orientation of face boundaries;
254 - analyze shape tolerances;
255 - identify closed and open wires in a boundary.
256 * Fix incorrect or incomplete shapes:
257 - provide consistency between a 3D curve and its corresponding parametric curve;
258 - repair defective wires;
259 - fit the shapes to a user-defined tolerance value;
260 - fill gaps between patches and edges.
261 * Upgrade and change shape characteristics:
262 - reduce curve and surface degree;
263 - split shapes to obtain C1 continuity;
264 - convert any types of curves or surfaces to Bezier or B-Spline curves or surfaces and back;
265 - split closed surfaces and revolution surfaces.
013a8549 266
2683e647 267Each sub-domain of Shape Healing has its own scope of functionality:
013a8549 268
2683e647 269| Sub-domain | Description | Impact on the shape |
270| :--- | :---- | :---- |
271| Analysis | Explores shape properties, computes shape features, detects violation of OCCT requirements. | The shape itself is not modified. |
272| Fixing | Fixes the shape to meet the OCCT requirements. | The shape may change its original form: modification, removal or creation of sub-shapes, etc.) |
273| Upgrade | Improves the shape to fit some particular algorithms. | The shape is replaced with a new one, but geometrically they are the same. |
274| Customization | Modifies the shape representation to fit specific needs. | The shape is not modified, only the mathematical form of its internal representation is changed. |
275| Processing | Mechanism of shape modification via a user-editable resource file. | |
013a8549 276
07f2b741 277For more details, refer to @ref occt_user_guides__shape_healing "Shape Healing User's guide".
013a8549 278
7863dabb 279See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
72b7576f 280
72b7576f 281@section OCCT_TOVW_SECTION_7 Application Framework
8b742dc1 283**Open CASCADE Application Framework** (OCAF) handles Application Data basing on the Application/Document paradigm.
284It uses an associativity engine to simplify the development of a CAD application thanks to the following ready-to-use features and services:
013a8549 285
2683e647 286* Data attributes managing the application data, which can be organized according to the development needs;
287* Data storage and persistence (open/save);
8b742dc1 288* Possibility to modify and recompute attributes in documents.
289 With OCAF it is easy to represent the history of modification and parametric dependencies within your model;
013a8549 290* Possibility to manage multiple documents;
2683e647 291* Predefined attributes common to CAD/CAM/CAE applications (e.g. to store dimensions);
292* Undo-Redo and Copy-Paste functions.
013a8549 293
2683e647 294Since OCAF handles the application structure, the only development task is the creation of application-specific data and GUIs.
013a8549 295
8b742dc1 296OCAF differs from any other CAD framework in the organization of application data, as there the data structures are based on reference keys rather than on shapes.
297In a model, such attributes as shape data, color and material are attached to an invariant structure, which is deeper than the shapes.
298A shape object becomes the value of *Shape* attribute, in the same way as an integer number is the value of *Integer* attribute and a string is the value of *Name* attribute.
013a8549 299
2683e647 300OCAF organizes and embeds these attributes in a document. OCAF documents, in their turn, are managed by an OCAF application.
013a8549 301
07f2b741 302For more details, see @ref occt_user_guides__ocaf "OCAF User's Guide".
72b7576f 303
7863dabb 304See also: our <a href="https://www.opencascade.com/content/tutorial-learning">E-learning & Training</a> offerings.
72b7576f 305
2683e647 306@section OCCT_TOVW_SECTION_8 Draw Test Harness
72b7576f 307
8b742dc1 308**Test Harness** or **Draw** is a convenient testing tool for OCCT libraries.
309It can be used to test and prototype various algorithms before building an entire application.
310It includes:
013a8549 311- A command interpreter based on the TCL language;
2683e647 312- A number of 2D and 3D viewers;
013a8549 313- A set of predefined commands.
2683e647 315The viewers support operations such as zoom, pan, rotation and full-screen views.
317The basic commands provide general-purpose services such as:
013a8549 318- Getting help;
319- Evaluating a script from a file;
320- Capturing commands in a file;
321- Managing views;
322- Displaying objects.
2683e647 324In addition, **Test Harness** provides commands to create and manipulate curves and surfaces (geometry) and shapes, access visualization services, work with OCAF documents, perform data exchange, etc.
013a8549 325
2683e647 326You can add custom commands to test or demonstrate any new functionalities, which you develop.
013a8549 327
07f2b741 328For more details, see @ref occt_user_guides__test_harness "Draw Test Harness Manual".