From: ysn Date: Thu, 30 Apr 2015 12:58:34 +0000 (+0300) Subject: 0025390: Redesign of Technical Overview X-Git-Tag: V6_9_0~30 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=2683e647de08fd287b0c1aaaf97396901eb5b5de 0025390: Redesign of Technical Overview Technical overview refactored; text duplicating information contained in user guides removed. Some images are regenerated for better presentation. Problems with formatting and section tags corrected in user guides. --- diff --git a/dox/dev_guides/wok/wok.md b/dox/dev_guides/wok/wok.md index 14081cd03f..d680815602 100644 --- a/dox/dev_guides/wok/wok.md +++ b/dox/dev_guides/wok/wok.md @@ -480,8 +480,11 @@ This automatically takes you to the root directory of the workbench @subsubsection occt_wok_3_3_8 Using Existing Resources Before creating new data types, you should look for existing components that you can reuse. In particular, you should look through the existing resources of your Open CASCADE Technology platform to see if any of the required components already exist, or if any existing generic components can be suitably implemented. This search can be conducted using the online documentation. You should note the packages and classes, which you can reuse. + @subsection occt_wok_3_4 Creating Software Components + @subsubsection occt_wok_3_4_1 Creating a Package + To develop new software components, you usually need to create one or more packages. You do this, by using the following command: ~~~~~ > ucreate –p @@ -613,6 +616,7 @@ The umake steps for development units of package type are explained below. * *obj.lib*    Generates the shared library for the development unit. @subsubsection occt_wok_3_4_2 Creating a Nocdlpack + If your executable requires the use of a nocdlpack, create a development unit of nocdlpack type and move to its structure using the commands below: ~~~~~ > ucreate -n @@ -656,7 +660,8 @@ The *umake* steps for development units of *nocdlpack* type are explained below. + Implementation dependencies in terms of the unit suppliers. (Unit.ImplDep) * *obj.lib* Generates the shared library for the unit. -@subsubsection occt_wok_3_3_3 Creating a Schema +@subsubsection occt_wok_3_4_3 Creating a Schema + If the application, which you intend to build, stores data in a file, you need to define a schema for the persistent data types that are known. You create a schema and go to its root directory using the commands: @@ -735,7 +740,9 @@ The umake steps for development units of schema type are explained below. * *obj.idep*   Generates dependency information for the schema. @subsection occt_wok_3_5 Building an Executable + @subsubsection occt_wok_3_5_1 Creating an Executable + To make an executable from one or more of the packages, which you have created, write a .cdl file to specify the packages to use. #### Writing an Executable @@ -805,7 +812,9 @@ The umake steps for development units of executable type are explained below. * *exec.link* Links each part of the executable. @subsection occt_wok_3_6 Test Environments -@subsubsection occt_wok_3_3_1 Testing an Executable + +@subsubsection occt_wok_3_6_1 Testing an Executable + To test an executable, you create an executable development unit and move to its structure. When you write the .cdl file for your test executable, specify the packages to test, for example: diff --git a/dox/technical_overview/images/0001.png b/dox/technical_overview/images/0001.png new file mode 100644 index 0000000000..1c43b6e9a3 Binary files /dev/null and b/dox/technical_overview/images/0001.png differ diff --git a/dox/technical_overview/images/0002.png b/dox/technical_overview/images/0002.png new file mode 100644 index 0000000000..21b15b6dfa Binary files /dev/null and b/dox/technical_overview/images/0002.png differ diff --git a/dox/technical_overview/images/0003.png b/dox/technical_overview/images/0003.png new file mode 100644 index 0000000000..929d1c8ad5 Binary files /dev/null and b/dox/technical_overview/images/0003.png differ diff --git a/dox/technical_overview/images/0004.png b/dox/technical_overview/images/0004.png new file mode 100644 index 0000000000..fd478bac7f Binary files /dev/null and b/dox/technical_overview/images/0004.png differ diff --git a/dox/technical_overview/images/0008.png b/dox/technical_overview/images/0008.png new file mode 100644 index 0000000000..a47c1900bb Binary files /dev/null and b/dox/technical_overview/images/0008.png differ diff --git a/dox/technical_overview/images/0012.png b/dox/technical_overview/images/0012.png new file mode 100644 index 0000000000..8c735c4e99 Binary files /dev/null and b/dox/technical_overview/images/0012.png differ diff --git a/dox/technical_overview/images/0013.png b/dox/technical_overview/images/0013.png new file mode 100644 index 0000000000..f9df8b4091 Binary files /dev/null and b/dox/technical_overview/images/0013.png differ diff --git a/dox/technical_overview/images/0014.png b/dox/technical_overview/images/0014.png new file mode 100644 index 0000000000..7d5922439b Binary files /dev/null and b/dox/technical_overview/images/0014.png differ diff --git a/dox/technical_overview/images/239_xde_12_400.png b/dox/technical_overview/images/239_xde_12_400.png deleted file mode 100644 index a22caaddd4..0000000000 Binary files a/dox/technical_overview/images/239_xde_12_400.png and /dev/null differ diff --git a/dox/technical_overview/images/610_xde_01_400.png b/dox/technical_overview/images/610_xde_01_400.png deleted file mode 100644 index 0eb739f6a5..0000000000 Binary files a/dox/technical_overview/images/610_xde_01_400.png and /dev/null differ diff --git a/dox/technical_overview/images/614_xde_04_400.png b/dox/technical_overview/images/614_xde_04_400.png deleted file mode 100644 index ef47706367..0000000000 Binary files a/dox/technical_overview/images/614_xde_04_400.png and /dev/null differ diff --git a/dox/technical_overview/images/642_sh_08_400.png b/dox/technical_overview/images/642_sh_08_400.png deleted file mode 100644 index 137b884016..0000000000 Binary files a/dox/technical_overview/images/642_sh_08_400.png and /dev/null differ diff --git a/dox/technical_overview/images/644_sh_09_400.png b/dox/technical_overview/images/644_sh_09_400.png deleted file mode 100644 index eeaa8fadc2..0000000000 Binary files a/dox/technical_overview/images/644_sh_09_400.png and /dev/null differ diff --git a/dox/technical_overview/images/646_xde_11_400.png b/dox/technical_overview/images/646_xde_11_400.png deleted file mode 100644 index 8e702c8ce8..0000000000 Binary files a/dox/technical_overview/images/646_xde_11_400.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_buildingmodules.png b/dox/technical_overview/images/technical_overview_buildingmodules.png deleted file mode 100644 index 5660c9241d..0000000000 Binary files a/dox/technical_overview/images/technical_overview_buildingmodules.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_de.png b/dox/technical_overview/images/technical_overview_de.png deleted file mode 100644 index e401c37385..0000000000 Binary files a/dox/technical_overview/images/technical_overview_de.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_ma.png b/dox/technical_overview/images/technical_overview_ma.png deleted file mode 100644 index 96bd108361..0000000000 Binary files a/dox/technical_overview/images/technical_overview_ma.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_md.png b/dox/technical_overview/images/technical_overview_md.png deleted file mode 100644 index a04a860364..0000000000 Binary files a/dox/technical_overview/images/technical_overview_md.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_occ_0005.png b/dox/technical_overview/images/technical_overview_occ_0005.png deleted file mode 100644 index 6d96ab4d51..0000000000 Binary files a/dox/technical_overview/images/technical_overview_occ_0005.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_occ_0006.png b/dox/technical_overview/images/technical_overview_occ_0006.png deleted file mode 100644 index 3909f78583..0000000000 Binary files a/dox/technical_overview/images/technical_overview_occ_0006.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_occ_0007.png b/dox/technical_overview/images/technical_overview_occ_0007.png deleted file mode 100644 index cf2c20902a..0000000000 Binary files a/dox/technical_overview/images/technical_overview_occ_0007.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_occ_0008.png b/dox/technical_overview/images/technical_overview_occ_0008.png deleted file mode 100644 index 612028625b..0000000000 Binary files a/dox/technical_overview/images/technical_overview_occ_0008.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_occ_0068.png b/dox/technical_overview/images/technical_overview_occ_0068.png deleted file mode 100644 index 32268f45ae..0000000000 Binary files a/dox/technical_overview/images/technical_overview_occ_0068.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_schema.png b/dox/technical_overview/images/technical_overview_schema.png index d806a825ad..38c605ef3e 100644 Binary files a/dox/technical_overview/images/technical_overview_schema.png and b/dox/technical_overview/images/technical_overview_schema.png differ diff --git a/dox/technical_overview/images/technical_overview_shapeattrib.png b/dox/technical_overview/images/technical_overview_shapeattrib.png deleted file mode 100644 index 1ff53764eb..0000000000 Binary files a/dox/technical_overview/images/technical_overview_shapeattrib.png and /dev/null differ diff --git a/dox/technical_overview/images/technical_overview_viz.png b/dox/technical_overview/images/technical_overview_viz.png deleted file mode 100644 index 53566b4120..0000000000 Binary files a/dox/technical_overview/images/technical_overview_viz.png and /dev/null differ diff --git a/dox/technical_overview/technical_overview.md b/dox/technical_overview/technical_overview.md index f7c355f53b..5a767303c1 100644 --- a/dox/technical_overview/technical_overview.md +++ b/dox/technical_overview/technical_overview.md @@ -3,2993 +3,320 @@ Technical Overview {#technical_overview} @tableofcontents -Open CASCADE Technology is an object-oriented C++ class library designed for rapid production of sophisticated domain-specific design applications. +Open CASCADE Technology (OCCT) is an object-oriented C++ class library designed for rapid production of sophisticated domain-specific CAD/CAM/CAE applications. A typical application developed using OCCT deals with two or three-dimensional (2D or 3D) geometric modeling in general-purpose or specialized Computer Aided Design (CAD) systems, manufacturing -or analysis applications, simulation applications, or illustration tools. +or analysis applications, simulation applications, or even illustration tools. @figure{/technical_overview/images/technical_overview_over.png} -OCCT Library is designed to be truly modular and extensible. It provides C++ classes for: - * Defining data structures (geometric modeling, display and graphic selection) - * Implementing complex algorithms - * Providing Application Programming Interfaces (APIs) +OCCT library is designed to be truly modular and extensible, providing C++ classes for: + * Basic data structures (geometric modeling, visualization, interactive selection and application specific services); + * Modeling algorithms; + * Working with mesh (faceted) data; + * Data interoperability with neutral formats (IGES, STEP); -The classes are grouped into packages. -To prevent any class-name conflicts, C++ class-names are prefixed by a package name. -For example, all classes defining 3D geometric objects belong to the *Geom* package. -In Geom, the class implementing Bezier surfaces is called *BezierSurface*, thus its full name is Geom_BezierSurface. +The 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. -Packages are then archived into toolkits (libraries), to which you can link your application. Finally, toolkits are grouped into seven modules. - -This modular structure is illustrated in the diagram below. - -@figure{/technical_overview/images/technical_overview_schema.png} - -Refer to the Technical Overview and User's Guides for details about the services provided in each module. - -* @ref OCCT_TOVW_SECTION_2 "Foundation Classes"; -* @ref OCCT_TOVW_SECTION_3 "Modeling Data"; -* @ref OCCT_TOVW_SECTION_4 "Modeling Algorithms"; -* @ref OCCT_TOVW_SECTION_4a "Mesh"; -* @ref OCCT_TOVW_SECTION_5 "Visualization"; -* @ref OCCT_TOVW_SECTION_6 "Data Exchange"; -* @ref OCCT_TOVW_SECTION_7 "Application Framework". - -In addition, @ref OCCT_TOVW_SECTION_7a "Open CASCADE Test Harness", also called Draw, provides testing tools for other modules. - - -@section OCCT_TOVW_SECTION_2 Foundation Classes - -Foundation Classes provide a variety of general-purpose services such as: - - * Primitive types, strings and various types of quantities - * Automated management of heap memory - * Exception handling - * Classes for manipulating data collections - * Math tools such as vectors, matrices and primitive geometric types - * Basic services for saving data in ASCII files - -These services are organized into the following toolkits: - * @ref OCCT_TOVW_SECTION_2_1 "Kernel Classes" - * @ref OCCT_TOVW_SECTION_2_2 "Math Utilities" - * @ref occt_fcug_5 "Basic Data Storage" - -The technical overview provides only a basic description of the libraries. -For more details see @ref occt_user_guides__foundation_classes "Foundation Classes User's Guide" - -See also: our web site at E-learning and Training. - -@subsection OCCT_TOVW_SECTION_2_1 Kernel Classes - -### Root Classes - -Root Classes, primarily implemented in the Standard package, are the predefined classes on which -all other Open CASCADE Technology classes are built. They provide: - - * Primitive types such as Boolean, Character, Integer or Real - * Memory manager based on reference counting for optimizing the allocation and deallocation of large numbers of small C++ objects - * Standard_Transient class automating memory management through smart pointers - * OCCT Handle; most of OCCT classes inherit from this base class. - * Management of exceptions, - * Encapsulation of C++ streams. - -### Quantities - -Quantity classes provide the following services: - - * Definition of primitive types representing most of mathematical and physical quantities - * Unit conversion tools. - * Resources to manage time information such as dates and time periods - * Resources to manage color definition - -A mathematical quantity is characterized by the name and the value (real). -A physical quantity is characterized by the name, the value (real) and the unit. -The unit may be either an international unit complying with the International Unit System (SI) -or a user defined unit. The unit is managed by the physical quantity user. - -The fact that both physical and mathematical quantities are manipulated as real -values means that : - - * They are defined as aliases of real values, so all functions provided by the Standard_Real class are available on each quantity. - * It is possible to mix several physical quantities in a mathematical or physical formula involving real values. - -Quantity package includes all commonly used basic physical quantities. - -### Exceptions - -Exception classes list all the exceptions, which can be raised by any OCCT function. - -Each exception inherits from Standard_Failure either directly or by inheriting from -another exception. - -Exceptions describe anomalies which can occur during the execution of a method. With -the raising of an exception, the normal course of program execution is abandoned. -The execution of actions in response to this situation is called the treatment of -the exception. - - -The methods try & catch are redefined in OCCT to work properly on any platform. Nevertheless -they call native mechanisms each time it is possible. The only reason not to use -native exceptions is that they may not work properly on some compilers. In this case, -a specific OCCT code is used instead. - - -### Strings - -Strings are classes that handle dynamically sized sequences of characters based on -ASCII/Unicode UTF-8 (normal 8-bit character type) -and UTF-16/UCS-2 (16-bit character type). They provide editing operations with built-in -memory management which make the relative objects easier to use than ordinary character -arrays. - -String classes provide the following services to manipulate character strings: - * Editing operations on string objects, using a built-in string manager - * Handling of dynamically-sized sequences of characters - * Conversion from/to ASCII and UTF-8 strings. - -Strings may also be manipulated by handles and therefore, can be shared. - -These classes are implemented in TCollection and NCollection packages. - -### Collections - -Apart from strings, the TCollection package contains classes of dynamically sized -aggregates of data. They include a wide range of collections. - - * Arrays (unidimensional and bidimensional) are generally used for quick access to an item. Note that an array is a fixed-sized aggregate. - * Sequences are ordered collections of non-unique objects. A sequence item is longer to access than an array item: only an exploration in sequence is efficient (but sequences are not adapted for numerous explorations). Arrays and sequences are commonly used as data structures for more complex objects. - * Maps are dynamic structures, where the size is constantly adapted to the number of inserted items and access to an item is the fastest. Maps structures are commonly used in cases of numerous explorations: they are typically internal data structures for complex algorithms. - * Lists are similar to sequences but with different algorithms to explore them. - * Specific iterators for sequences and maps. - -Most collections follow value semantics: their instances are the actual collections, not handles to a collection. Only arrays and sequences may also be manipulated by handle, and therefore shared. - - -Collection classes are generic (C++ template-like), so they can contain -a variety of objects which do not necessarily inherit from -a unique root class. When you need to use a collection of a given object type, you -must instantiate the collection for this specific type. Once the code for this declaration -is compiled, all functions available on the generic collection are available on your -instantiated class. - -Each collection directly used as an argument in Open CASCADE Technology public syntax -is instantiated in an OCCT component using the corresponding generic class in package - TCollection, by means of compiling the CDL declaration of the instance. -Thus OCCT generic classes require compilation of definitions in the CDL language and therefore -can only be instantiated in WOK. - -If you are not using CDL in your project (CDL compilation under WOK is necessary -to instantiate any generic Collection from package TCollection), then you should -use the Collections defined in NCollection package. It contains definitions of the -same generic collection classes described above, but in a form of C++ templates. -Therefore, to instantiate any collection type no additional support is required beyond -the ANSI C++ compiler. - -@subsection OCCT_TOVW_SECTION_2_2 Math Utilities - -### Vectors and Matrices - -The Vector and Matrix classes provide commonly used mathematical algorithms which -include: - - * Basic calculations involving vectors and matrices; - * Computation of eigenvalues and eigenvectors of a square matrix; - * Solvers for a set of linear algebraic equations; - * Algorithms to find the roots of a set of non-linear equations; - * Algorithms to find the minimum function of one or more independent variables. - -These classes also provide a data structure to represent any expression, -relation, or function used in mathematics, including the assignment of variables. - -Vectors and matrices have arbitrary ranges which must be defined at declaration time -and cannot be changed after declaration. - -~~~ - math_Vector v(1, 3); - // a vector of dimension 3 with range (1..3) - - math_Matrix m(0, 2, 0, 2); - // a matrix of dimension 3x3 with range (0..2, 0..2) - - math_Vector v(N1, N2); - // a vector of dimension N2-N1+1 with range (N1..N2) -~~~ - -Vector and Matrix objects follow "value semantics", that is, they cannot be shared -and are copied though assignment. - -~~~ - math_Vector v1(1, 3), v2(0, 2); - - v2 = v1; // v1 is copied into v2 - // a modification of v1 does not affect v2 -~~~ - -Vector and Matrix elements can be retrieved using indexes, which must be in the range -defined upon Vector/Matrix creation. The elements can be initialized with some numerical -value upon creation as well. - -~~~ - math_Vector v(1, 3); - math_Matrix m(1, 3, 1, 3); - Standard_Real value; - - v(2) = 1.0; - value = v(1); - m(1, 3) = 1.0; - value = m(2, 2); -~~~ - -Some operations on Vector and Matrix objects may not be legal. In this case an exception -is raised. Two standard exceptions are used: - *Standard_DimensionError exception is raised when two matrices or vectors involved -in an operation are of incompatible dimensions. - *Standard_RangeErrorexception is raised if an attempt to access outside the range -defined upon creation of a vector or a matrix is made. - -~~~ - math_Vector v1(1, 3), v2(1, 2), v3(0, 2); - - v1 = v2; // error: Standard_DimensionError is raised - v1 = v3; // OK: ranges are not equal, but dimensions are compatible - v1(0) = 2.0; // error: Standard_RangeError is raised -~~~ - - -### Fundamental Geometry Types - -The Fundamental Geometry Types component groups the following packages: -* geometric processor package gp; -* GeomAbs package, which provides enumerations generally used in geometry; - -gp package is a STEP-compliant implementation of basic geometric and algebraic -entities, used to define and manipulate elementary data structures. - -In particular, gp provides: - - * descriptions of primitive geometric shapes, such as: - * Points; - * Vectors; - * Lines; - * Circles and conics; - * Planes and elementary surfaces; - * positioning of these shapes in space or in a plane by means of an axis or a coordinate system; - * definition and application of geometric transformations to these shapes: - * Translations; - * Rotations; - * Symmetries; - * Scaling transformations; - * Composed transformations; - * Tools (coordinates and matrices) for algebraic computation. - -These functions are defined in 3D space and in the plane. - - gp curves and surfaces are analytic: there is no parameterization and no orientation -on gp entities, i.e. these entities do not provide functions which work with these properties. -If you need, you may use more evolved data structures provided by Geom -(in 3D space) and Geom2d (in the plane). However, the definition of gp entities -is identical to the one of equivalent Geom and Geom2d entities, and they are located -in the plane or in space with the same kind of positioning systems. -They implicitly contain the orientation, which they express -on the Geom and Geom2d entities, and they induce the definition of their parameterization. - - -Therefore, it is easy to give an implicit parameterization to gp curves and surfaces, -which is the parametarization of the equivalent Geom or Geom2d entity. This property -is particularly useful when computing projections or intersections, or for operations -involving complex algorithms where it is particularly important to manipulate the -simplest data structures, i.e. those of gp. Thus, the ElCLib and ElSLib packages -provide functions to compute: - - * the point of parameter u on a 2D or 3D gp curve, - * the point of parameter (u,v) on a gp elementary surface, and - * any derivative vector at this point. - -Note: the gp entities cannot be shared when they are inside more complex data structures. - - -### Common Mathematical Algorithms - -Common mathematical algorithms provided in OCCT include: - - * Algorithms to solve a set of linear algebraic equations, - * Algorithms to find the minimum of a function of one or more independent variables, - * Algorithms to find roots of one or of a set of non-linear equations, - * An algorithm to find the eigenvalues and eigenvectors of a square matrix. - -@section OCCT_TOVW_SECTION_3 Modeling Data - -Modeling Data supplies data structures to represent 2D and 3D geometric models. - -@figure{/technical_overview/images/technical_overview_md.png} - -These services are organized into the following toolkits: - - * @ref OCCT_TOVW_SECTION_3_1 "2D Geometry Types" - * @ref OCCT_TOVW_SECTION_3_2 "3D Geometry Types" - * @ref OCCT_TOVW_SECTION_3_3 "Geometry Utilities" - * @ref OCCT_TOVW_SECTION_3_4 "Topology" - -There are also some packages that help to find local and global @ref OCCT_TOVW_SECTION_3_5 "Properties of Shapes". - -The technical overview provides only a basic description of the libraries. -For more details see @ref occt_user_guides__modeling_data "Modeling Data User's Guide" - -3D geometric models are stored in OCCT native BREP format. -See @ref occt_user_guides__brep_wp "BREP Format Description White Paper" for details on the format. - -See also: our web site at E-learning and Training. - -@subsection OCCT_TOVW_SECTION_3_1 2D Geometry Types - - Geom2d package provides an implementation of 2D geometric objects, defined in the way similar to STEP standard (ISO 10303, part 42). - -In particular, it provides classes for: -* description of points, vectors and curves, -* their positioning in the plane using coordinate systems, -* their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof. - -The key characteristic of Geom2d curves is that they are parameterized. -Each class provides functions to work with the parametric equation of the curve, -and, in particular, to compute the point of parameter u on a curve and the derivative vectors of order 1, 2.., N at this point. - -As a consequence of the parameterization, a Geom2d curve is naturally oriented. - -Parameterization and orientation differentiate elementary Geom2d curves from their -equivalent as provided by gp package. Geom2d package provides conversion -functions to transform a Geom2d object into a gp object, and vice-versa, when this is possible. - -Moreover, Geom2d package provides more complex curves, including Bezier curves, -BSpline curves, trimmed curves and offset curves. - - Geom2d objects are organized according to an inheritance structure over several levels. - -Thus, an ellipse (specific class Geom2d_Ellipse) is also a conical curve and inherits from the abstract class Geom2d_Conic, while a Bezier curve (concrete class Geom2d_BezierCurve) is also a bounded curve and inherits from the abstract class Geom2d_BoundedCurve; both these examples are also curves (abstract class Geom2d_Curve). Curves, points and vectors inherit from the abstract class Geom2d_Geometry, which describes the properties common to any geometric object from the Geom2d package. - -This inheritance structure is open and it is possible to describe new objects, which inherit from those provided in the Geom2d package, provided that they respect the behavior of the classes from which they are to inherit. - -Finally, Geom2d objects can be shared within more complex data structures. This is why they are used within topological data structures, for example. - -Geom2dpackage uses the services of the gp package to: - * implement elementary algebraic calculus and basic analytic geometry, - * describe geometric transformations which can be applied to Geom2d objects, - * describe the elementary data structures of Geom2d objects. - -However, the Geom2d package essentially provides data structures and not algorithms. -You can refer to the GCE2d package to find more evolved construction algorithms for Geom2d objects. - -@subsection OCCT_TOVW_SECTION_3_2 3D Geometry Types - -The Geom package provides an implementation of 3D geometric objects, defined in the way similar to STEP standard (ISO 10303, part 42). - -In particular, it provides classes for: - - * description of points, vectors, curves and surfaces, - * their positioning in 3D space using axis or coordinate systems, and - * their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof. - -The key characteristic of Geom curves and surfaces is that they are parameterized. -Each class provides functions to work with the parametric equation of the curve or -surface, and, in particular, to compute: - - * the point of parameter u on a curve, or - * the point of parameters (u, v) on a surface. - -together with the derivative vectors of order 1, 2, ... N at this point. - -As a consequence of this parameterization, a Geom curve or surface is naturally oriented. - -Parameterization and orientation differentiate elementary Geom curves and surfaces from the classes of the same (or similar) names found in the gp package. -The Geom package also provides conversion functions to transform a Geom object into a gp object, and vice-versa, when such transformation is possible. - -Moreover, the Geom package provides more complex curves and surfaces, including: - * Bezier and BSpline curves and surfaces, - * swept surfaces, for example surfaces of revolution and surfaces of linear extrusion, - * trimmed curves and surfaces, and - * offset curves and surfaces. - -Geom objects are organized according to an inheritance structure over several levels. -Thus, a sphere (concrete class Geom_SphericalSurface) is also an elementary surface and inherits from the abstract class Geom_ElementarySurface, while a Bezier surface (concrete class Geom_BezierSurface) is also a bounded surface and inherits from the abstract class Geom_BoundedSurface; both these examples are also surfaces (abstract class Geom_Surface). Curves, points and vectors inherit from the abstract class Geom_Geometry, which describes the properties common to any geometric object from the Geom package. - -This inheritance structure is open and it is possible to describe new objects, which inherit from those provided in the Geom package, on the condition that they respect the behavior of the classes from which they are to inherit. - -Finally, Geom objects can be shared within more complex data structures. This is why they are used within topological data structures, for example. - -The Geom package uses the services of the gp package to: - * implement elementary algebraic calculus and basic analytic geometry, - * describe geometric transformations which can be applied to Geom objects, - * describe the elementary data structures of Geom objects. - -However, the Geom package essentially provides data structures, not algorithms. - -You can refer to the GC package to find more evolved construction algorithms for -Geom objects. - -@subsubsection OCCT_TOVW_SECTION_3_2_1 Adaptors for Curves and Surfaces - -Some Open CASCADE Technology general algorithms may work theoretically on numerous types of curves or surfaces. -To do this, they simply get the services required of the analysed curve or surface through an interface so as to a single API, whatever the type of curve or surface. These interfaces are called adaptors. -For example, Adaptor3d_Curve is the abstract class which provides the required services by an algorithm which uses any 3d curve. - - GeomAdaptor package provides interfaces: - - * On a Geom curve; - * On a curve lying on a Geom surface; - * On a Geom surface; - - Geom2dAdaptor package provides interfaces : - - * On a Geom2d curve. - - BRepAdaptor package provides interfaces: - - * On a Face - * On an Edge - -When you write an algorithm which operates on geometric objects, use Adaptor3d (or Adaptor2d) objects. - -As a result, you can use the algorithm with any kind of object, if you provide for this object an interface derived from *Adaptor3d* or *Adaptor2d*. -These interfaces are easy to use: simply create an adapted curve or surface from a *Geom2d* curve, -and then use this adapted curve as an argument for the algorithm which requires it. - -@subsection OCCT_TOVW_SECTION_3_3 Geometry Utilities - -This library provides standard high-level functions in 2D and 3D geometry such as: - - * Direct construction of algorithms; - * Approximation of curves and surfaces from points; - * Conversion of more elementary geometry to BSpline curves and surfaces; - * Calculation of points on a 2D or 3D curve; - * Calculation of extrema between two geometries. - -@subsubsection OCCT_TOVW_SECTION_3_3_1 Direct Construction - -The gp, Geom2d and Geom packages describe elementary data structures of simple geometric -objects. The constructors of these objects are elementary: the construction arguments -are fields by which the objects are represented in their data structure. - - -On the other hand, the gce, GCE2d and GC packages provided -by the Direct Construction component construct the same types of objects -as gp, Geom2d and Geom respectively. -However, the former implement geometric construction algorithms that translate the -constructor's arguments into the data structure specific to each object. - - -Algorithms implemented by these packages are simple: there is no creation of objects -defined by advanced positional constraints (for more information on this subject, -see Geom2dGcc and GccAna which describe geometry by constraints). - - - gce, GCE2d and GC each offer a series of classes of construction algorithms. - - -For example, the class gce_MakeCirc provides a framework -for defining eight problems encountered in the geometric construction of circles, -and implementing the eight related construction algorithms. - -The object created (or implemented) is an algorithm which can be consulted to find out, in particular: - - * its result, which is a gp_Circ, and - * its status. Here, the status indicates whether or not the construction was successful. - -If it was unsuccessful, the status gives the reason for the failure. - -~~~~ - gp_Pnt P1 (0.,0.,0.); - gp_Pnt P2 (0.,10.,0.); - gp_Pnt P3 (10.,0.,0.); - gce_MakeCirc MC (P1,P2,P3); - if (MC.IsDone()) { - const gp_Circ& C = MC.Value(); - } -~~~~ - -In addition, gce, GCE2d and GC each have a Root class. This class is the root of -all the classes in the package which return a status. The returned status (successful -construction or construction error) is described by the enumeration gce_ErrorType. - -Note: classes which construct geometric transformations do not return a status, and -therefore do not inherit from Root. - -@subsubsection OCCT_TOVW_SECTION_3_3_2 Approximations - -Approximation of Curves and Surfaces groups together a variety of functions used in 2D and 3D geometry for: - - * the interpolation of a set of 2D points using a 2D BSpline or Bezier curve; - * the approximation of a set of 2D points using a 2D BSpline or Bezier curve; - * the interpolation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface; - * the approximation of a set of 3D points using a 3D BSpline or Bezier curve, or a BSpline surface. - -You can program approximations in two ways: - - * Using high-level functions, designed to provide a simple method for obtaining approximations with minimal programming, - * Using low-level functions, designed for users requiring more control over the approximations. - -The low-level functions provide a second API with functions to: - - * Define compulsory tangents for an approximation. These tangents have origins and extremities. - * Approximate a set of curves in parallel to respect identical parameterization. - * Smooth approximations. This is to produce a faired curve. - -The classes AppDef_MultiPointConstraints and AppDef_MultiLines allow organizing the data. -The classes AppDef_Compute, AppDef_BSplineCompute and AppDef_TheVariational -classes perform the approximation itself using Bezier curves, BSpline curves, and smooth BSpline curves, respectively. - -You can also find functions to compute: - * The minimal box which includes a set of points - * The mean plane, line or point of a set of coplanar, collinear or coincident points. - -#### Example: How to approximate a curve with respect to tangencies - -To approximate a curve with respect to tangencies, follow these steps: - - 1. Create an object of type AppDef_MultiPointConstraints from the set of points to approximate and use the method SetTang to set the tangency vectors. - 2. Create an object of type AppDef_MultiLine from the AppDef_MultiPointConstraint. - 3. Use AppDef_BSplineCompute, which instantiates Approx_BSplineComputeLine to perform the approximation. - -@subsubsection OCCT_TOVW_SECTION_3_3_3 Conversion to and from BSplines - -The Conversion to and from BSplines component has two distinct purposes: - * Firstly, it provides a homogeneous formulation which can be used to describe any curve or surface. - This is useful for writing algorithms for a single data structure model. - The BSpline formulation can be used to represent most basic geometric objects provided - by the components which describe geometric data structures ("Fundamental Geometry Types", "2D Geometry Types" and "3D Geometry Types" components). - * Secondly, it can be used to divide a BSpline curve or surface into a series of curves or surfaces, - thereby providing a higher degree of continuity. This is useful for writing algorithms - which require a specific degree of continuity in the objects to which they are applied. - Discontinuities are situated on the boundaries of objects only. - -The "Conversion to and from BSplines" component is composed of three packages. - -The Convert package provides algorithms to convert the following into a BSpline curve or surface: - - * a bounded curve based on an elementary 2D curve (line, circle or conic) from the gp package, - * a bounded surface based on an elementary surface (cylinder, cone, sphere or torus) from the gp package, - * a series of adjacent 2D or 3D Bezier curves defined by their poles. - -These algorithms compute the data needed to define the resulting BSpline curve or surface. -This elementary data (degrees, periodic characteristics, poles and weights, knots and multiplicities) -may then be used directly in an algorithm, or can be used to construct the curve or the surface -by calling the appropriate constructor provided by the classes Geom2d_BSplineCurve, Geom_BSplineCurve or Geom_BSplineSurface. - -The Geom2dConvert package provides the following: - - * a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package, - * a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity, - * global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve, - * an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves. - -The GeomConvert package also provides the following: - - * a global function used to construct a BSpline curve from a bounded curve based on a curve from the Geom package, - * a splitting algorithm, which computes the points at which a BSpline curve should be cut in order to obtain arcs with the same degree of continuity, - * global functions to construct BSpline curves created by this splitting algorithm, or by other types of BSpline curve segmentation, - * an algorithm, which converts a BSpline curve into a series of adjacent Bezier curves, - * a global function to construct a BSpline surface from a bounded surface based on a surface from the Geom package, - * a splitting algorithm, which determines the curves along which a BSpline surface should be cut in order to obtain patches with the same degree of continuity, - * global functions to construct BSpline surfaces created by this splitting algorithm, or by other types of BSpline surface segmentation, - * an algorithm, which converts a BSpline surface into a series of adjacent Bezier surfaces, - * an algorithm, which converts a grid of adjacent Bezier surfaces into a BSpline surface. - -@subsubsection OCCT_TOVW_SECTION_3_3_4 Calculation of Points on Curves - -The Making Points on Curves component comprises high level functions providing an Application Programming Interface for complex algorithms that compute points on a 2D or 3D curve. The functions use various methods. - -The algorithms result in the following: - - * a point on a curve, situated at a given curvilinear distance from another point on the curve - * a distribution of points situated at constant curvilinear intervals along a curve - * a distribution of points at a constant rise (i.e. respecting a criterion of maximum rise between the curve and the polygon that results from the computed points) along a curve - * the length of a curve. - -@subsection OCCT_TOVW_SECTION_3_4 Topology - -Topological library allows you to build pure topological data structures.. - -Topology defines relationships between simple geometric entities. In this way, -you can model complex shapes as assemblies of simpler entities. -Due to a built-in non-manifold (or mixed-dimensional) feature, you can build models mixing: - - * 0D entities such as points; - * 1D entities such as curves; - * 2D entities such as surfaces; - * 3D entities such as volumes. - -You can, for example, represent a single object made of several distinct bodies -containing embedded curves and surfaces connected or non-connected to an outer boundary. - -Abstract topological data structure describes a basic entity - a shape, -which can be divided into the following component topologies: - - * Vertex - a zero-dimensional shape corresponding to a point in geometry; - * Edge - a shape corresponding to a curve, and bound by a vertex at each extremity; - * Wire - a sequence of edges connected by their vertices; - * Face - part of a plane (in 2D geometry) or a surface (in 3D geometry) bounded by a closed wire; - * Shell - a collection of faces connected by some edges of their wire boundaries; - * Solid - a part of 3D space bound by a shell; - * Compound solid - a collection of solids. - -The wire and the solid can be either infinite or closed. - -A face with 3D underlying geometry may also refer to a collection of connected triangles -that approximate the underlying surface. The surfaces can be undefined -leaving the faces represented by triangles only. If so, the model is purely polyhedral. - -Topology defines the relationship between simple geometric entities, -which can thus be linked together to represent complex shapes. - -Abstract Topology is provided by six packages. -The first three packages describe the topological data structure used in Open CASCADE Technology: - - * TopAbs package provides general resources for topology-driven applications. It contains enumerations that are used to describe basic topological notions: topological shape, orientation and state. It also provides methods to manage these enumerations. - * TopLoc package provides resources to handle 3D local coordinate systems: Datum3Dand Location. Datum3D describes an elementary coordinate system, while Location comprises a series of elementary coordinate systems. - * TopoDS package describes classes to model and build data structures that are purely topological. - -Three additional packages provide tools to access and manipulate this abstract topology: - - * TopTools package provides basic tools to use on topological data structures. - * TopExp package provides classes to explore and manipulate the topological data structures described in the TopoDS package. - * BRepTools package provides classes to explore, manipulate, read and write BRep data structures. These more complex data structures combine topological descriptions with additional geometric information, and include rules for evaluating equivalence of different possible representations of the same object, for example, a point. - -@subsection OCCT_TOVW_SECTION_3_5 Properties of Shapes - -@subsubsection OCCT_TOVW_SECTION_3_5_1 Local Properties of Shapes - -BRepLProp package provides the Local Properties of Shapes component, -which contains algorithms computing various local properties on edges and faces in a BRep model. - -The local properties which may be queried are: - - * for a point of parameter u on a curve which supports an edge : - * the point, - * the derivative vectors, up to the third degree, - * the tangent vector, - * the normal, - * the curvature, and the center of curvature; - * for a point of parameter (u, v) on a surface which supports a face : - * the point, - * the derivative vectors, up to the second degree, - * the tangent vectors to the u and v isoparametric curves, - * the normal vector, - * the minimum or maximum curvature, and the corresponding directions of curvature; - * the degree of continuity of a curve which supports an edge, built by the concatenation of two other edges, at their junction point. - -Analyzed edges and faces are described as BRepAdaptor curves and surfaces, -which provide shapes with an interface for the description of their geometric support. -The base point for local properties is defined by its u parameter value on a curve, or its (u, v) parameter values on a surface. - -@subsubsection OCCT_TOVW_SECTION_3_5_2 Local Properties of Curves and Surfaces - -The "Local Properties of Curves and Surfaces" component provides algorithms for computing various local -properties on a Geom curve (in 2D or 3D space) or a surface. It is composed of: - - * Geom2dLProp package, which allows computing Derivative and Tangent vectors (normal and curvature) of a parametric point on a 2D curve; - * GeomLProp package, which provides local properties on 3D curves and surfaces - * LProp package, which provides an enumeration used to characterize a particular point on a 2D curve. - -Curves are either Geom_Curve curves (in 3D space) or Geom2d_Curve curves (in the plane). -Surfaces are Geom_Surface surfaces. The point on which local properties are calculated -is defined by its u parameter value on a curve, and its (u,v) parameter values on a surface. - -It is possible to query the same local properties for points as mentioned above, and additionally for 2D curves: - - * the points corresponding to a minimum or a maximum of curvature; - * the inflection points. - - -#### Example: How to check the surface concavity - -To check the concavity of a surface, proceed as follows: - - 1. Sample the surface and compute at each point the Gaussian curvature. - 2. If the value of the curvature changes of sign, the surface is concave or convex depending on the point of view. - 3. To compute a Gaussian curvature, use the class SLprops from GeomLProp, which instantiates the generic class SLProps from LProp and use the method GaussianCurvature. - -@subsubsection OCCT_TOVW_SECTION_3_5_3 Global Properties of Shapes - -The Global Properties of Shapes component provides algorithms for computing the global -properties of a composite geometric system in 3D space, and frameworks to query the computed results. - -The global properties computed for a system are : - - * mass, - * mass center, - * matrix of inertia, - * moment about an axis, - * radius of gyration about an axis, - * principal properties of inertia such as principal axis, principal moments, and principal radius of gyration. - -Geometric systems are generally defined as shapes. Depending on the way they are analyzed, these shapes will give properties of: - - * lines induced from the edges of the shape, - * surfaces induced from the faces of the shape, or - * volumes induced from the solid bounded by the shape. - -The global properties of several systems may be brought together to give the global properties of the system composed of the sum of all individual systems. - -The Global Properties of Shapes component is composed of: -* seven functions for computing global properties of a shape: one function for lines, two functions for surfaces and four functions for volumes. The choice of functions depends on input parameters and algorithms used for computation (BRepGProp global functions), -* a framework for computing global properties for a set of points (GProp_PGProps), -* and a general framework to bring together the global properties retained by several more elementary frameworks, and provide a general programming interface to consult computed global properties. - -@subsection OCCT_TOVW_SECTION_3_6 Examples - -### How to compute the curve length - -To compute curve length, use the method AbscissaPoint::Length from GCPnts. - -This function is used only for initializing a framework to compute the length of a curve (or a series of curves). - -The adapted curves are: - - * Adaptor_Curve2d for 2D curves - * Adaptor_Curve for 3D curves. - -The adapted curve is created in the following way: - -In 2D: - -~~~~~~~~~~~ - Handle(Geom2d_Curve) mycurve = ... ; - Geom2dAdaptor_Curve C (mycurve) ; -~~~~~~~~~~~ - -In 3D: - -~~~~~~~~~ - Handle(Geom_Curve) mycurve = ... ; - GeomAdaptor_Curve C (mycurve) ; -~~~~~~~~~ - - -The length of the curve is then computed using this curve object: - -~~~~~~~~ - GCPnts_AbscissaPoint myAlgo () ; - Standard_Real L = myAlgo.Length( C ) ; -~~~~~~~~ - - - - - -### How to extract the underlying geometry from shapes - - -To extract the underlying geometry from a Shape, use the following methods: - - * BRep_Tool::Surface to get the geometric surface from a face. - * BRep_Tool::Curve to get the 3d geometric curve from an edge. - * BRep_Tool::CurveOnSurface to get the 2d geometric curve of an edge, defined in the parametric space of a face. - * BRep_Tool::Pnt to get the 3D point from a vertex. - -Some of these methods have a location as argument. - -For example, when you use S1 = BRep_Tool::Surface(F,L), you then get the surface stored in TShape. - -To use this surface in the same position as the face, you have to apply -a transformation to it corresponding to the location of the face as follows: - -~~~~~~~~~~~~ - gp_Trsf T(L) ; - S2 = S1->Moved(T) ; -~~~~~~~~~~~~ - -The same method used without location as argument is S3 = BRep_Tool : : Surface(F) -returns a Surface in position, according to the location. S3 and S2 are geometrically equivalent surfaces. - -Warning: with the first method, you get a pointer on the surface stored in the shape. -Do not modify the surface because you will modify the shape and may produce an inconsistent model. -With the second method, you get a copy of the surface on which the location has been applied. -Note: you can use also a topological object directly just as if it -were a geometric one by using the services of BRepAdaptor classes. - -### How to get the coordinates of a vertex - - -To recover the UV coordinates of vertices, -use BRep_Tool::Parameters const TopoDS_Vertex& V,const TopoDS_Face& F), -which returns the U and V parameters of the vertex V on the face F as a gp_Pnt2d. - -### How to explore a Wire - - -To explore the edges of a wire in a contiguous order, use BrepTools_WireExplorer class. - -~~~~ - TopoDS_Wire myWire =&ldots;. - BRepTools_WireExplorer Ex; - for (Ex.Init(myWire); Ex.More(); Ex.Next()) { - TopoDS_Edge currentedge = Ex.Current(); - // Process current edge - } -~~~~ - -### How to merge bspline curves - - -To merge joined bspline curves use the following methods: - -~~~~ - void GeomConvert::ConcatG1 - TColGeom_Array1OfBSplineCurve& ArrayOfCurves, - const TColStd_Array1OfReal& ArrayOfToler, - Handle(TColGeom_HArray1OfBSplineCurve) & ArrayOfConcatenated, - const Standard_Boolean ClosedG1Flag, - const Standard_Real ClosedTolerance) -~~~~ - -This method concatenates according to G1 (tangency continuity along the curve) the -ArrayOfCurves as far as possible. The following arguments are used: - - * ArrayOfCurves must have dimension bounds [0, N-1], N * number of curves to be merged. - * ArrayOfToler contains the biggest tolerance of the two points shared by two consecutive curves. Its dimension is: [0, N-2]. - * ArrayOfConcatenated contains results of operation: one or more, when impossible to merge all curves from ArrayOfCurves into one, new bspline curves are created. - * ClosedG1Flag indicates if the ArrayOfCurves is closed or not. - * If ClosedG1Flag = Standard_True, ClosedTolerance contains the biggest tolerance of the two points which are at the closure, otherwise its value is 0.0. - -~~~~ - void GeomConvert::ConcatC1 - TColGeom_Array1OfBSplineCurve& ArrayOfCurves, - const TColStd_Array1OfReal& ArrayOfToler, - Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, - Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, - const Standard_Boolean ClosedG1Flag, - const Standard_Real ClosedTolerance, - const Standard_Real AngularTolerance) -~~~~ - -This method concatenates according to C1 (first derivative continuity along the curve) the -ArrayOfCurves as far possible. The following arguments are used (additionally to the mentioned above): - -* ArrayOfIndices contains indices that define curves from ArrayOfCurves which are beginning curves for each group of curves merged into a new curve. -* AngularTolerance is used to check the continuity of tangencies. - -~~~~ - void GeomConvert::ConcatC1 - TColGeom_Array1OfBSplineCurve& ArrayOfCurves, - const TColStd_Array1OfReal& ArrayOfToler, - Handle(TColStd_HArray1OfInteger)& ArrayOfIndices, - Handle(TColGeom_HArray1OfBSplineCurve)& ArrayOfConcatenated, - const Standard_Boolean ClosedG1Flag, - const Standard_Real ClosedTolerance) -~~~~ -This method is the same as the previous one, except for that AngularTolerance = Precision::Angular() - -It is also possible to use class GeomConvert_CompCurveToBSplineCurve. -This class provides methods to concatenate several restricted curves to a bspline curve. -Non-bspline curves are converted to bspline before concatenation. - -Constructor: -~~~~~~~~~~ - GeomConvert_CompCurveToBSplineCurve:: - GeomConvert_CompCurveToBSplineCurve(const Handle(Geom_BoundedCurve)& BasisCurve, const Convert_ParameterisationType Parameterization) - BasisCurve * beginning curve; -~~~~~~~~~~ - -Parameterization defines the ways of conversion in bspline (by default Convert_TgtThetaOver2). - -The method to add a new curve is: -~~~~ - Standard_Boolean GeomConvert_CompCurveToBSplineCurve:: - Add(const Handle(Geom_BoundedCurve)& NewCurve, - const Standard_Real Tolerance, - const Standard_Boolean After, - const Standard_Boolean WithRatio, - const Standard_Integer MinM) -~~~~ - -It returns False if the curve is not C0 with the BSplineCurve. - -Tolerance is used to check the continuity and decrease the Multiplicity -at the common Knot until MinM . If MinM = 0 , the common Knot can be removed. - -The parameter after defines the place for a new curve when it is possible to put -the new curve before or after the BasisCurve (in fact, it is case when concatenated curve can be closed). -It does not change the shape of the curve, but defines its first and last points. - -If WithRatio = Standard_True the algorithm tries to reach C1 continuity. - -The method to get a result is Handle(Geom_BSplineCurve) GeomConvert_CompCurveToBSplineCurve::BSplineCurve() const - -@section OCCT_TOVW_SECTION_4 Modeling Algorithms - -Modeling Algorithms module groups a wide range of -topological algorithms used in modeling and geometric algorithms, called by them. - -@figure{/technical_overview/images/technical_overview_ma.png} - -These services are organized into the following libraries: - - * @ref OCCT_TOVW_SECTION_4_1 "Geometric Tools" - * @ref OCCT_TOVW_SECTION_4_2 "Topological Tools" - * @ref OCCT_TOVW_SECTION_4_3 "Construction of Primitives" - * @ref OCCT_TOVW_SECTION_4_4 "Boolean Operations" - * @ref OCCT_TOVW_SECTION_4_5 "Fillets and Chamfers" - * @ref OCCT_TOVW_SECTION_4_6 "Offsets and Drafts" - * @ref OCCT_TOVW_SECTION_4_7 "Features" - * @ref OCCT_TOVW_SECTION_4_8 "Hidden Line Removal" - * @ref OCCT_TOVW_SECTION_4_9 "Sewing" - * @ref OCCT_TOVW_SECTION_4_10 "Shape Healing" - -The technical overview provides only a basic description of the libraries. -For more details see @ref occt_user_guides__modeling_algos "Modeling Algorithms User's Guide". - -See also: our web site at E-learning and Training. - -@subsection OCCT_TOVW_SECTION_4_1 Geometric Tools - -This library provides algorithms to: - - * Calculate the intersection of two 2D curves, surfaces, or a 3D curve and a surface; - * Project points onto 2D and 3D curves, points onto surfaces, and 3D curves onto surfaces; - * Construct lines and circles from constraints; - * Construct curves and surfaces from constraints; - * Construct curves and surfaces by interpolation. - -OPEN CASCADE company also provides a product known as Surfaces from Scattered Points, which allows constructing surfaces from scattered points. This algorithm accepts or constructs an initial B-Spline surface and looks for its deformation (finite elements method) which would satisfy the constraints. Using optimized computation methods, this algorithm is able to construct a surface from more than 500 000 points. - -SSP product is not supplied with Open CASCADE Technology, but can be purchased separately. - -@subsubsection OCCT_TOVW_SECTION_4_1_1 Intersections - -The Intersections component is used to compute intersections between 2D or 3D geometrical -objects: - - * the intersections between two 2D curves - * the self-intersections of a 2D curve - * the intersection between a 3D curve and a surface - * the intersection between two surfaces. - -@subsubsection OCCT_TOVW_SECTION_4_1_2 Projections - -The Projections component provides functionality for 2D and 3D geometry objects for computing the following: - - * the projections of a 2D point onto a 2D curve - * the projections of a 3D point onto a 3D curve or surface - * the projection of a 3D curve onto a surface. - * the planar curve transposition from the 3D to the 2D parametric space of an underlying plane and v. s. - * the positioning of a 2D gp object in the 3D geometric space. - -@subsubsection OCCT_TOVW_SECTION_4_1_3 Lines and Circles from Constraints - -The Lines and Circles from Constraints component provides numerous -construction algorithms for 2D circles or lines described with numeric or -geometric constraints in relation to other curves. These constraints enable the following to be imposed: - - * the radius of a circle, - * the angle that a straight line makes with another straight line, - * the tangency of a straight line or circle in relation to a curve, - * the passage of a straight line or circle through a point, - * the circle with center in a point or curve. - -For example, these algorithms enable to easily construct a circle of a given radius, -centered on a straight line and tangential to another circle. - -The implemented algorithms are more complex than those provided -by the Direct Constructions component for building 2D circles or lines. - -The expression of a tangency problem generally leads to several results, according -to the relative positions of the solution and the circles or straight lines in relation -to which the tangency constraints are expressed. For example, consider the following -case of a circle of a given radius (a small one) which is tangential to two secant -circles C1 and C2: - -@figure{/technical_overview/images/technical_overview_occ_0005.png,"Example of a Tangency Constraint"} - -This diagram clearly shows that there are 8 possible solutions. - -In order to limit the number of solutions, we can try to express the relative position -of the required solution in relation to the circles to which it is tangential. For -example, if we specify that the solution is inside the circle C1 and outside the -circle C2, only two solutions referenced 3 and 4 on the diagram respond to the problem -posed. - -This technique of qualification of a solution, in relation to the curves to which -it is tangential, can be used in all algorithms for constructing a circle or a straight -line by geometric constraints. Four qualifiers are used, which specify the following: - - * the solution(s) must enclose the argument, or - * the solution(s) must be enclosed by the argument, or - * the solution(s) and the argument must be external to one another, or - * the relative position is not qualified, i.e. all solutions apply. - -These definitions are very easy to interpret on a circle, where it is easy to identify -the interior and exterior sides. In fact, for any kind of curve the interior is defined -as the left-hand side of the curve in relation to its orientation. - -OCCT implements several categories of algorithms: - - * analytic algorithms, where solutions are obtained by the resolution of an equation, such algorithms are used when the geometries which are worked on (tangency arguments, position of the center, etc.) are points, lines or circles; - * geometric algorithms, where the solution is generally obtained by calculating the intersection of parallel or bisecting curves built from geometric arguments; - * iterative algorithms, where the solution is obtained by a process of iteration. - -For each kind of geometric construction of a constrained line or circle, OCCT provides -two types of access to the user: - - * algorithms from the package Geom2dGcc automatically select the algorithm best suited to the problem, both in the general case and in all types of specific cases; the used arguments are *Geom2d* objects, while the computed solutions are gp objects; - * algorithms from the package GccAna resolve the problem analytically, and can only be used when the geometries to be worked on are lines or circles; both the used arguments and the computed solutions are gp objects. - -The provided algorithms compute all solutions, which correspond to the stated geometric -problem, unless the solution is found by an iterative algorithm. - -Iterative algorithms compute only one solution, closest to an initial -position. They can be used in the following cases: - - * to build a circle, when an argument is more complex than a line or a circle, and where - the radius is not known or difficult to determine: this is the case for a circle tangential - to three geometric elements, or tangential to two geometric elements and centered on a curve; - * to build a line, when a tangency argument is more complex than a line or a circle. - -Qualified curves (for tangency arguments) are provided either by: - - * the GccEnt package, for direct use by GccAna algorithms, or - * the Geom2dGcc package, for general use by Geom2dGcc algorithms. - -The GccEnt and Geom2dGcc packages also provide simple functions for building qualified curves in a very efficient way. - -The GccAna package also provides algorithms for constructing bisecting loci between -circles, lines or points. Bisecting loci between two geometric objects are such that -each of their points is at the same distance from the two geometric objects. They -are typically curves, such as circles, lines or conics for GccAna algorithms. -Each elementary solution is given as an elementary bisecting locus object (line, circle, -ellipse, hyperbola, parabola), described by the GccInt package. - -Note: Curves used by GccAna algorithms to define the geometric problem to be solved, -are 2D lines or circles from the gp package: they are not explicitly parameterized. -However, these lines or circles retain an implicit parameterization, corresponding -to that which they induce on equivalent Geom2d objects. This induced parameterization -is the one used when returning parameter values on such curves, for instance with -the functions Tangency1, Tangency2, Tangency3, Intersection2 and CenterOn3 provided -by construction algorithms from the GccAna or Geom2dGcc packages. - -@subsubsection OCCT_TOVW_SECTION_4_1_4 Curves and Surfaces from Constraints - -The Curves and Surfaces from Constraints component groups together high level functions -used in 2D and 3D geometry for: - - * creation of faired and minimal variation 2D curves - * construction of ruled surfaces - * construction of pipe surfaces - * filling of surfaces - * construction of plate surfaces - * extension of a 3D curve or surface beyond its original bounds. - -#### 2D Curves from constraints - -Elastic beam curves have their origin in traditional methods of modeling applied -in boat-building, where a long thin piece of wood, a lathe, was forced to pass -between two sets of nails and in this way, take the form of a curve based on the -two points, the directions of the forces applied at those points, and the properties -of the wooden lathe itself. - -Maintaining these constraints requires both longitudinal and transversal forces to -be applied to the beam in order to compensate for its internal elasticity. The longitudinal -forces can be a push or a pull and the beam may or may not be allowed to slide over -these fixed points. - -The class Batten produces curves defined on the basis of one or more constraints -on each of the two reference points. These include point and angle of tangency settings. -The class MinimalVariation produces curves with minimal variation in curvature. -The exact degree of variation is provided by curvature settings. - -#### Ruled Surfaces - -A ruled surface is built by ruling a line along the length of two curves. - -#### Pipe Surfaces - - -A pipe is built by sweeping a curve (the section) along another curve (the path). - -The following types of construction are available: - * pipes with a circular section of constant radius, - * pipes with a constant section, - * pipes with a section evolving between two given curves. - - -#### Surface filling - -It is often convenient to create a surface from two or more curves which will form -the boundaries that define the new surface. - -A case in point is the intersection of two fillets at a corner. If the radius of -the fillet on one edge is different from that of the fillet on another, it becomes -impossible to sew together all the edges of the resulting surfaces. This leaves a -gap in the overall surface of the object which you are constructing. - -@figure{/technical_overview/images/technical_overview_occ_0006.png,"Intersecting filleted edges with differing radiuses"} - -These algorithms allow you to fill this gap from two, three or four curves. This -can be done with or without constraints, and the resulting surface will be either -a Bezier or a BSpline surface in one of a range of filling styles. - - -This package was designed with a view to handling gaps produced during fillet construction. -Satisfactory results cannot be guaranteed for other uses. - -#### Plate surfaces - -In CAD, it is often necessary to generate a surface which has no exact mathematical -definition, but which is defined by respective constraints. These can be of a mathematical, -a technical or an aesthetic order. - - -Essentially, a plate surface is constructed by deforming a surface so that it conforms -to a given number of curve or point constraints. In the figure below, you can see -four segments of the outline of the plane, and a point which have been used as the -curve constraints and the point constraint respectively. The resulting surface can -be converted into a BSpline surface by using the function MakeApprox . - - -The surface is built using a variational spline algorithm. It uses the principle -of deformation of a thin plate by localised mechanical forces. If not already given -in the input, an initial surface is calculated. This corresponds to the plate prior -to deformation. Then, the algorithm is called to calculate the final surface. It -looks for a solution satisfying constraints and minimizing energy input. - -@figure{/technical_overview/images/technical_overview_occ_0007.png,"Surface generated from four curves and a point"} - -@figure{/technical_overview/images/technical_overview_occ_0008.png,"Surface generated from two curves and a point"} - -#### Extension of a 3D curve or surface beyond its original bounds - -The extension is performed according to a geometric requirement and a continuity -constraint. It should be a small extension with respect to the size of the original -curve or surface. - -@subsubsection OCCT_TOVW_SECTION_4_1_5 Interpolation - -The Interpolation Laws component provides definitions of functions: y=f(x) . - -In particular, it provides definitions of: - - * a linear function, - * an S function, and - * an interpolation function for a range of values. - -Such functions can be used to define, for example, the evolution law of a fillet along the edge of a shape. - -The validity of the function built is never checked: the Law package does not know for what -application or to what end the function will be used. In particular, if the function is used -as the evolution law of a fillet, it is important that the function is always positive. The user must check this. - -@subsection OCCT_TOVW_SECTION_4_2 Topological Tools - -This library provides algorithms to: - * Tessellate shapes - * Validate shapes - * Determine the local properties of shapes - * Determine the global properties of shapes - * Perform geometric transformations - * Find planes in which edges are located - * Convert shapes to NURBS geometry. - -It also furnishes a complete brep data structure for topological data structures defined in the @ref OCCT_TOVW_SECTION_3_4 "Topology" library of the Modeling Data module. The following standard topological objects can be created: - * Vertices - * Edges - * Faces - * Wires - * Polygonal wires - * Shells - * Solids. - -The classes provided by the API have the following features: - * The constructors of classes provide different construction methods; - * The class retains different tools used to build objects as fields; - * The class provides a casting method to obtain the result automatically with a function-like call. - -For example, to build a vertex V on a point P, you can use: - -~~~ - V = BRepBuilderAPI_MakeVertex(P); -~~~ -or - -~~~ - BRepBuilderAPI_MakeVertex MV(P); - V = MV.Vertex(); -~~~ - -For error handling, the BRepBuilderAPI commands raise only the - 0StdFail_NotDone exception. When IsDone is false for a command, -the error description can be requested from the command. - -@subsection OCCT_TOVW_SECTION_4_3 Construction of Primitives - -This library contained in BRepPrimAPI package provides an API (Application Programming Interface) for: - - * Construction of primitives such as: - * Boxes; - * Cones; - * Cylinders; - * Prisms. - -It is possible to create partial solids, such as a sphere limited by longitude. In real models, primitives can be used for easy creation of specific sub-parts. - - * Construction by sweeping along a profile: - * Linear; - * Rotational (through an angle of rotation). - -Sweeps are objects obtained by sweeping a profile along a path. -The profile can be any topology and the path is usually a curve or a wire. -The profile generates objects according to the following rules: - - * Vertices generate Edges - * Edges generate Faces. - * Wires generate Shells. - * Faces generate Solids. - * Shells generate Composite Solids. - -It is not allowed to sweep Solids and Composite Solids. Swept constructions along complex profiles such as BSpline curves also available in the BRepOffsetAPI package. This API provides simple, high level calls for the most common operations. - -@subsection OCCT_TOVW_SECTION_4_4 Boolean Operations - -Boolean operations allow creating new shapes from old ones by using: - * Common - * Cut - * Fuse - * Section - -From the viewpoint of Topology these are topological operations followed by blending (putting fillets onto edges created after the topological operation). - -Topological operations are the most convenient way to create real industrial parts. As most industrial parts consist of several simple elements such as gear wheels, arms, holes, ribs, tubes and pipes. It is usually easy to create those elements separately and then to combine them by Boolean operations in the whole final part. - -There exist two libraries providing Boolean Operations: - * Old Boolean Operations (BOA) provided by BRepAlgo package designed and developed in Open CASCADE 6x in 2000; its architecture and content are out of date. - * New Boolean Operations (NBOA) provided by BRepAlgoAPI package designed and developed in 2001 and completely revised in 2013. - -New Boolean Operations provide the following major benefits: - - * The NBOA have an expandable architecture of inner sub-algorithms, which allows to create specific algorithms for the Customers using existing inner sub-algorithms as root algorithms and to reduce the time for the development. - * The architecture of inner sub-algorithms of NBOA provides their reusability with maximal independence from the environment of NBOA. The fact allows to create specific algorithms for the Customers using these sub-algorithms as they are or as root classes and thus to reduce the time for the development. - * The architecture of NBOA is history-based. The implementation of NBOA internally sets up a correspondence between any sub-shape of the argument and its image in the result. The history is not imposed and thus it is not error-prone as it was in BOA. The fact allows direct and safely usage of the algorithm in parametric modeling. - * NBOA provide a general algorithm. It correctly processes without using the workarounds even the cases that cannot be properly processed by BOA. - * The implementation of NBOA is based on NCollection classes. The usage of opportunities given by local memory allocators ( NCollection_IncAllocator) allows improving memory management and saving memory resources. - * NBOA use modern algorithms of OCC as auxiliary tools. For e.g. the algorithm of unbalanced binary tree of overlapped bounding boxes NCollection_UBTree. The usage of the algorithm allows to improve the performance of NBOA if there is a big number of sub-shapes in the arguments. - -Boolean Operations have the following types of the arguments and produce the following results: -* For arguments having the same shape type (e.g. SOLID / SOLID) the type of the resulting shape will be a COMPOUND, containing shapes of this type; -* For arguments having different shape types (e.g. SHELL / SOLID) the type of the resulting shape will be a COMPOUND, containing shapes of the type that is the same as that of the low type of the argument. Example: For SHELL/SOLID the result is a COMPOUND of SHELLs. -* For arguments with different shape types some of Boolean Operations can not be done using the default implementation, because of a non-manifold type of the result. Example: the FUSE operation for SHELL and SOLID can not be done, but the CUT operation can be done, where SHELL is the object and SOLID is the tool. -* It is possible to perform Boolean Operations on arguments of the COMPOUND shape type. In this case each compound must not be heterogeneous, i.e. it must contain equidimensional shapes (EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDs inside the COMPOUND must not contact (intersect or touch) each other. The same condition should be respected for SHELLs or FACEs, WIREs or EDGEs. -* Boolean Operations for COMPSOLID type of shape are not supported. - -@subsection OCCT_TOVW_SECTION_4_5 Fillets and Chamfers - -This library provides algorithms to make fillets and chamfers on shape edges. -The following cases are addressed: - - * Corners and apexes with different radii; - * Corners and apexes with different concavity. - -If there is a concavity, both surfaces that need to be extended and those, which do not, are processed. - -@subsection OCCT_TOVW_SECTION_4_6 Offsets, Drafts and Sweeps - -These classes provide the following services: - - * Creation of offset shapes and their variants such as: - * Hollowing; - * Shelling; - * Lofting; - * Creation of tapered shapes using draft angles; - * Creation of sweeps. - -@subsection OCCT_TOVW_SECTION_4_7 Features - -This library contained in *BRepFeat* package is necessary for creation and manipulation of both form and mechanical features in a Boundary Representation framework. - -### Form Features - -The form features are depressions or protrusions including the following types: - - * Cylinder; - * Draft Prism; - * Prism; - * Revolved feature; - * Pipe. - -Depending on whether you wish to make a depression or a protrusion, -you can choose either to remove matter (Boolean cut: Fuse equal to 0) or to add it (Boolean fusion: Fuse equal to 1). - -The semantics of form feature creation is based on the construction of shapes: - - * for a certain length in a certain direction; - * up to the limiting face; - * from the limiting face at a height; - * above and/or below a plane. - -The shape defining the construction of a feature can be -either a supporting edge or a concerned area of a face. - -In case of supporting edge, this contour can be attached to a face of the basis shape by binding. When the contour is bound to this face, the information that the contour will slide on the face becomes available -to the relevant class methods. In case of the concerned area of a face, you can, for example, cut it out and move it at a different height, which defines the limiting face of a protrusion or depression. - -Topological definition with local operations of this sort makes calculations simpler -and faster than a global operation. The latter would entail a second phase -of removing unwanted matter to get the same result. - -### Mechanical Features - -Mechanical features include ribs, protrusions and grooves (or slots), -depressions along planar (linear) surfaces or revolution surfaces. - -The semantics of mechanical features is based on giving thickness to a contour. -This thickness can either be - - * unilateral - * on one side of the contour - * or bilateral - * on both sides. - -As in the semantics of form features, the thickness is defined -by construction of shapes in specific contexts. - -However, in case of mechanical features, development contexts differ. -Here they include extrusion: - - * to a limiting face of the basis shape; - * to or from a limiting plane; - * to a height. - -### Splitting and Gluing - -It can be required to perform low-level splitting/gluing operations on shapes. Open CASCADE provides the following algorithms for that: - -- **Split shape** allows defining particular faces in a shape and new edges which should split that faces. Upon completion the algorithm gives the part of the shape which is situated on the left side of the line composed from new edges. In combination with the Section algorithm it is a powerful tool for partitioning shapes. -- **Glue shapes** allows to defining pairs of faces and pairs of edges of two neighboring shapes to glue. Upon completion the algorithm gives the glued shape with cut out parts of faces inside the shape. - - - -@subsection OCCT_TOVW_SECTION_4_8 Hidden Line Removal - -This library provides two algorithms: HLRBRep_Algo and HLRBRep_PolyAlgo to define the lines of a shape hidden in a given projection. These lines can be shown or hidden to have the precision required in industrial design. To do this, the Hidden Line Removal component provides - -These algorithms remove or indicate lines hidden by surfaces. - -For a given projection, they calculate a set of lines characteristic of the object being represented. They are also used in conjunction with extraction utilities, which reconstruct a new, simplified shape from a selection of calculation results. -This new shape is made up of edges, which represent the lines of the visualized shape in a plane. This plane is the projection plane. - -The algorithm HLRBRep_Algo allows working with the shape itself, while HLRBRep_PolyAlgo works with its polyhedral simplification. When you use HLRBRep_Algo, you obtain an exact result, whereas, when you use HLRBRep_PolyAlgo, you reduce computation time but obtain polygonal segments. - - -@subsection OCCT_TOVW_SECTION_4_9 Sewing - -Sewing allows creation of connected topology (shells and wires) from a set of separate topological elements (faces and edges). For example, Sewing can be used to create of shell from a compound of separate faces. - -It is important to distinguish between sewing and other procedures, which modify the geometry, such as filling holes or gaps, gluing, bending curves and surfaces, etc. - -Sewing does not change geometrical representation of the shapes. Sewing applies to topological elements (faces, edges) which are not connected but can be connected because they are geometrically coincident : it adds the information about topological connectivity. Already connected elements are left untouched in case of manifold sewing. - -Let us define several terms: -* **Floating edges** do not belong to any face; -* **Free boundaries** belong to one face only; -* **Shared edges** belong to several faces, (i.e. two faces in a manifold topology). -* **Sewn faces** should have edges shared with each other. -* **Sewn edges** should have vertices shared with each other. - -### Sewing Algorithm - -The sewing algorithm is one of the basic algorithms used for shape processing, therefore its quality is very important. - -There are two implementations of sewing algorithm: -* **Standard** provided by *BRepAlgo_Sewing*, and -* **Advanced** provided by *ShapeUpgrade_Sewing*, which is a sub-class of *BRepAlgo_Sewing*. - -The only difference between them is that Advanced sewing performs some additional fixes provided by Shape Healing (use of *ShapeFix_Shape*) and improves some particular cases, such as closed surfaces. The principle and architecture of the algorithm itself remain the same. - -Class *BRepAlgo_Sewing* provides methods implementing sewing algorithms: -* loading initial data for global or local sewing; -* setting customization parameters, such as special operation modes, tolerances and output results; -* applying analysis methods that can be used to obtain connectivity data required by external algorithms; -* sewing of the loaded shapes. - -Sewing supports working mode with big value tolerance. It is not necessary to repeat sewing step by step while smoothly increasing tolerance. - -It is also possible to sew edges to wire and to sew locally separate faces and edges from a shape. - -The Sewing algorithm can be subdivided into several independent stages, some of which can be turned on or off using Boolean or other flags. - -In brief, the algorithm should find a find a set of merge candidates for each free boundary, filter them according to certain criteria, and finally merge the found candidates and build the resulting sewn shape. - -Each stage of the algorithm or the whole algorithm can be adjusted with the following parameters: -* **Working tolerance** defines the maximal distance between topological elements which can be sewn. It is not ultimate that such elements will be actually sewn as many other criteria are applied to make the final decision. -* **Minimal tolerance** defines the size of the smallest element (edge) in the resulting shape. It is declared that no edges with size less than this value are created after sewing. If encountered, such topology becomes degenerated. -* **Non-manifold mode** enables sewing of non-manifold topology. - - -### Tolerance Management - -To produce a closed shell, Sewing allows specifying the value of working tolerance, exceeding the size of small faces belonging to the shape. - -However, if we produce an open shell, it is possible to get incorrect sewing results if the value of working tolerance is too large (i.e. it exceeds the size of faces lying on an open boundary). - -The following recommendations can be proposed for tuning-up the sewing process: -- Use as small working tolerance as possible. This will reduce the sewing time and, consequently, the number of incorrectly sewn edges for shells with free boundaries. -- Use as large minimal tolerance as possible. This will reduce the number of small geometry in the shape, both original and appearing after cutting. -- If it is expected to obtain a shell with holes (free boundaries) as a result of sewing, the working tolerance should be set to a value not greater than the size of the smallest element (edge) or smallest distance between elements of such free boundary. Otherwise the free boundary may be sewn only partially. -- It should be mentioned that the Sewing algorithm is unable to understand which small (less than working tolerance) free boundary should be kept and which should be sewn. - -### Manifold and Non-manifold Sewing - -To create one or several shells from a set of faces, sewing merges edges, which belong to different faces or one closed face. - -Face sewing supports manifold and non manifold modes. Manifold mode can produce only a manifold shell. Sewing should be used in the non manifold mode to create non manifold shells. - -Manifold sewing of faces merges only two nearest edges belonging to different faces or one closed face with each other. Non manifold sewing of faces merges all edges at a distance less than the specified tolerance. - -For a complex topology it is advisable to apply first the manifold sewing and then the non manifold sewing a minimum possible working tolerance. However, this is not necessary for a easy topology. - -Giving a large tolerance value to non manifold sewing will cause a lot of incorrectness since all nearby geometry will be sewn. - -### Local Sewing -If a shape still has some non-sewn faces or edges after sewing, it is possible to use local sewing with a greater tolerance. - -Local sewing is especially good for open shells. It allows sewing an unwanted hole in one part of the shape and keeping a required hole, which is smaller than the working tolerance specified for the local sewing in the other part of the shape. Local sewing is much faster than sewing on the whole shape. - -All preexisting connections of the whole shape are kept after local sewing. - -@subsection OCCT_TOVW_SECTION_4_10 Shape Healing - -Shape Healing library provides algorithms to modify the geometry and topology of OCCT shapes and to make them maximally appropriate for use by OCCT, including, but not limited to the following operations: -* 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: - - check edge and wire consistency; - - check edge order in a wire; - - check the orientation of face boundaries; - - analyze shape tolerances; - - return closed and open wires in a boundary. -* fix incorrect or problem shapes: - - provide consistency between a 3D curve and its corresponding parametric curve; - - repair defective wires; - - fit the shapes to a user-defined tolerance value; - - fill gaps between patches and edges. -* upgrade and change shape characteristics: - - reduce curve and surface degree; - - split shapes to obtain C1 continuity; - - convert any types of curves or surfaces to Bezier or Bspline curves or surfaces and back; - - split closed surfaces and revolution surfaces. - -Each sub-domain of Shape Healing has its own scope of functionality: - -| Sub-domain | Description | Impact on the shape | -| :--- | :---- | :---- | -| Analysis | Exploring shape properties, computing shape features, detecting violation of OCCT requirements. | The shape itself is not modified. | -| Fixing | Fixing shape to meet the OCCT requirements. | The shape may change its original form: modification, removal or creation of sub-shapes, etc.) | -| Upgrade | Shape improvement for better usability in OCCT or other algorithms. | The shape is replaced with a new one, but geometrically they are the same. | -| Customization | The shape representation is modified to fit specific needs. | The shape is not modified, only the form of its representation is modified. | -| Processing | Mechanism of shape modification via a user-editable resource file. | | - -The technical overview provides only a basic description of the libraries. -For more details refer to @ref occt_user_guides__shape_healing "Shape Healing User's guide". - -See also: our web site at E-learning and Training. - - -@subsection OCCT_TOVW_SECTION_4_11 Examples - -### How to compute the state of a point on a face: - - -Use BRepTools::Pnt to get the point from your vertex. -Your shape must be of the TopoDS_Shape type. -If it is, you can use BRepTopAdaptor_FClass2d class. For example: - -~~~~~ - BRepTopAdaptor_FClass2d::Load (to load the solid ) - BRepTopAdaptor_FClass2d::Perform (to compute the state of the point ) - BRepTopAdaptor_FClass2d::State (to get the TopAbs_State). -~~~~~ - - -### How to compute the state of a point in a solid: - - -Use BRepTools::Pnt to get the point from your vertex. -Your shape must be of the TopoDS_Solid type. - -If it is, you can use the BRepClass3d_SolidClassifier class, for example: - -~~~~~ - BRepClass3d_SolidClassifier::Load (to load the solid) - BRepClass3d_SolidClassifier::Perform (to compute the state of the point) - BRepClass3d_SolidClassifier::State (to get a TopAbs_State object) - BRepClass3d_SolidClassifier inherits BRepclass3d_SClassifier -~~~~~ - -### How to connect a set of contiguous but independent faces - - -A unique topological object can be obtained in this way using the class - Sewing from the BRepOffsetAPI package which produces a shell as a result. - -~~~~~ - BRepOffsetAPI_Sewing Sew; - Sew.Add(Face1); - Sew.Add(Face2); - ... - Sew.Add(Facen); - Sew.Perform(); - TopoDS_Shape result= Sew.SewedShape(); -~~~~~ - -@note The sewing algorithm uses a tolerance to assemble the faces by sewing them along common edges. You must therefore check the gap between faces before sewing or adjust the value of the tolerance according to the real gap of the geometry. - -If all faces have been sewed correctly, the result is a shell. Otherwise, it is a compound. After a successful sewing operation all faces have a coherent orientation. - -For more information, refer to the entry for this class in reference documentation. - -### How to check the orientation of a solid - -If you want to create a solid from a closed shell, you must first check the orientation to determine if you have to reverse the shell or not (for example after creating a closed shell from a sewing operation). To do this, use the PerformInfinitePoint method from the BrepClass3D_SolidClassifier class. - -~~~~~ - BRepClass3d_SolidClassifier clas3d(aShell); - clas3d.PerformInfinitePoint(Precision::Confusion()); - if (clas3d.State() == TopAbs_IN) - newShell.Reverse(); - BRepBuilderAPI_MakeSolid aSolid(aShell); -~~~~~ - - - -@section OCCT_TOVW_SECTION_4a Mesh - -In addition to support of exact geometrical representation of 3D objects Open CASCADE Technology provides functionality to work with tessellated representations of the objects, in the form of mesh. - -Open CASCADE Technology mesh functionality provides: -- data structures to store surface mesh data associated to shapes, and some basic algorithms to handle these data -- data structures and algorithms to build surface triangular mesh from *BRep* objects (shapes). -- tools to extend 3D visualization capabilities of Open CASCADE Technology with displaying meshes along with associated pre- and post-processor data. - -Additionally, Open CASCADE Technology includes two mesh converters: -- VRML converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language). Open CASCADE shapes may be translated in two representations: shaded or wireframe. A shaded representation present shapes as sets of triangles computed by a mesh algorithm while a wireframe representation present shapes as sets of curves. -- STL converter translates Open CASCADE shapes to STL files. STL (STtereoLithography) format is widely used for rapid prototyping. - -Open CASCADE SAS also offers Advanced Mesh Products: -- Open CASCADE Mesh Framework (OMF) -- Express Mesh - -Besides, we can efficiently help you in the fields of surface and volume meshing algorithms, mesh optimization algorithms etc. If you require a qualified advice about meshing algorithms, do not hesitate to benefit from the expertise of our team in that domain. - -The projects dealing with numerical simulation can benefit from using SALOME - an Open Source Framework for CAE with CAD data interfaces, generic Pre- and Post- F.E. processors and API for integrating F.E. solvers. - -Learn more about SALOME platform on http://www.salome-platform.org - -@subsection OCCT_TOVW_SECTION_4a_1 Shape Translation - -@subsubsection OCCT_TOVW_SECTION_4a_1_1 STL Format - -OCCT includes a module for translating OCCT shapes to STL (Stereolithography) format. -STL is a format designed for rapid prototyping. -It is intended to send geometric data (volumic) to stereolithography machines, -which can read and interpret such data. These machines can transform a volumic model -to a physical prototype made of plastic, by using laser to coagulate material, -which corresponds to the volume, and set free the material around. -STL defines these surfaces by triangles. -Thus, no machining is required to switch from a virtual model to a physical one. - -Since STL files can only include solids described by their mesh structures, -OCCT shapes, which are intended to be written, must be solids, -components of solids or closed shells with a correct orientation. - -When translating shapes to STL format, remember that all references -to shapes mean references to OCCT shapes unless otherwise explicitly defined. -In addition, sets of faces or unclosed shells may also be translated but visualization in foreign viewers may be incorrect. - -@subsection OCCT_TOVW_SECTION_4a_1_2 VRML Format - -The Virtual Reality Modeling Language (VRML) is a language for describing multi-participant interactive simulations, virtual worlds networked via the Internet and hyperlinked with the World Wide Web. VRML is a format designed for animated visualization of solids. -OCCT includes a module for translating OCCT shapes to VRML (Virtual Reality Modeling Language). -OCCT shapes may be translated in two representations (states): shaded or wireframe. -Since shaded VRML format files include only solids described by their mesh structures, the OCCT shapes intended to be written must be solids, components of solids or closed shells with a correct orientation. - -Please, note: - - * all references to shapes indicate OCCT shapes unless otherwise explicitly stated; - * sets of faces or unclosed shells may also be translated to shaded VRML format but visualization with foreign viewers may be incorrect. - -@section OCCT_TOVW_SECTION_5 Visualization - -Visualization in Open CASCADE Technology is based on the separation of modeling data you want to display and select, and on the graphical presentation of its structure. - -For visualizing data structures, OCCT provides ready-to-use algorithms, which create graphic presentations from geometric models. These data structures may be used with the viewers supplied, and can be customized to take the specificity of your application into account. - -Display is managed through presentation services, and selection in its turn is managed through selection services. With these services, data structures and algorithms are provided to display objects of an application and to support graphical selection of these objects. - -Application Interactive Services (AIS) are provided to manage displaying, detection and selection of graphical presentations. These services associate data structures and interactive objects. - -The technical overview provides only a basic description of the libraries. -For more details see @ref occt_user_guides__visualization "Visualization User's Guide". - -See also: our web site at E-learning and Training. - -@figure{/technical_overview/images/technical_overview_viz.png} - -@subsection OCCT_TOVW_SECTION_5_1 3D Graphics - -3D Graphics provided by Graphic3d package supports three-dimensional manipulation of 3d graphic objects called structures. Structures, are made up of groups that unite primitives, such as polylines, planar polygons with or without holes, text and markers, and attributes, such as color, transparency, reflection, line type, line width, and text font. -A group is the smallest editable element of a structure. - -A structure can be displayed, erased, highlighted and transformed. -Structures can be connected to form a hierarchy of structures, composed by transformations. -The viewer can perform global manipulation of structures. - - Visual3d package contains the group of classes required to implement commands for 3D viewer. The viewer manages views and light sources. - -Most types of primitives supported by Graphic3d can be dumped to a vector file format such as PDF and PostScript. Export to vector formats is implemented with help of GL2PS library. - -@subsection OCCT_TOVW_SECTION_5_2 3D Visualization - -This library provides services for: - - * Selection of 3D data structures - * Presentation of 3D data structures - -Access to 3D presentation and selection is provided through AIS (Application Interactive Services). -This package is a high-level interface that offers access to the lower-level presentation and selection services. -AIS expand this underlying functionality with standard 3D selection attributes, presentation management, and standard 3D presentation attributes, and manages it in the definition of GUI viewers. To implement these services, AIS package includes the following: - - * Interactive context - * Interactive objects - * A graphic attributes manager - * Selection filters - -### Interactive Context - -Interactive context pilots 3D visualizations and selections. -The interactive context allows you to manage, in a transparent way, graphic and "selectable" behavior of interactive objects which is not yet defined in the predefined types of these objects. - -AIS have two operating context types. The default neutral point type allows easily visualizing and selecting entire interactive objects, which have been loaded into the context. -Opening a local context allows preparing and using a temporary selection environment to select a part of an interactive object. - -### Interactive Objects - -Entities which are visualized and selected in the AIS viewer are objects. They connect the underlying reference geometry of a model to its graphic representation in AIS. You can use predefined OCCT classes of standard interactive objects for which all necessary functions have already been programmed, or, in case you are an advanced user, you can implement your own classes of interactive objects. - -### Graphic Attributes Manager - -Graphic attributes manager, or AIS Drawer, stores graphic attributes for specific interactive objects and for interactive objects controlled by interactive context. - -Initially, all drawer attributes are filled out with the predefined values which will define the default 3D object appearance. - -When an interactive object is visualized, the required graphic attributes are first taken from its own drawer if one exists, or from the context drawer if no specific drawer for that type of object exists. - -### Selection Filters - -An important aspect in selection is the filtering of entities you to select. -Selection filters allow you to refine the dynamic detection context, which you want to put into effect. Some of these filters can be used at the Neutral Point, others in an open local context only. You can also program your own filters and load them into the context. - - -@subsection OCCT_TOVW_SECTION_5_3 Application Interactive Services (AIS) - -Application Interactive Services provide the means to create links between an application GUI viewer and the packages which are used to manage selection and presentation. The tools AIS defined for this include different sorts of entities: the selectable viewable objects themselves and the context and attribute managers to define their selection and display. - -To orient the user as he works in a modeling environment, views and selections must be comprehensible. -There must be several different sorts of selectable and viewable object defined. -These must also be interactive, that is, connecting graphic representation and the underlying reference geometry. These entities are called Interactive Objects, and are divided into four types: - * the Datum - * the Relation - * the Object - * None. - -The Datum groups together the construction elements such as lines, circles, points, trihedrons, plane trihedrons, planes and axes. -The Relation is made up of constraints on one or more interactive shapes and the corresponding reference geometry. For example, you might want to constrain two edges in a parallel relation. This constraint is considered as an object in its own right, and is shown as a sensitive primitive. This takes the graphic form of a perpendicular arrow marked with the || symbol and lying between the two edges. - -The Object type includes topological shapes, and connections between shapes. - -None, in order not to eliminate the object, tells the application to look further until it finds an object definition in its generation which is accepted. - -Inside these categories, you have the possibility of an additional characterization by means of a signature. The signature provides an index to the further characterization. By default, the Interactive Object has a None type and a signature of 0 (equivalent to None.) -If you want to give a particular type and signature to your interactive object, you must redefine the two virtual methods: Type and Signature. - -In the C++ inheritance structure of the package, each class representing a specific Interactive Object inherits AIS_InteractiveObject. Among these inheriting classes, AIS_Relation functions as the abstract mother class for inheriting classes defining display of specific relational constraints and types of dimension. Some of these include: - - * display of constraints based on relations of symmetry, tangency, parallelism and concentricity - * display of dimensions for angles, offsets, diameters, radii and chamfers. - -No viewer can show everything at once with any coherence or clarity. -Views must be managed carefully both sequentially and at any given instant. -Another function of the view is that of a context to carry out design in. -The design changes are applied to the objects in the view and then extended -to the underlying reference geometry by a solver. -To make sense of this complicated visual data, several display and selection tools are required. -To facilitate management, each object and each construction element has a selection priority. -There are also means to modify the default priority. - -To define an environment of dynamic detection, you can use standard filter classes or create your own. -A filter questions the owner of the sensitive primitive in local context to determine -if it has the desired qualities. If it answers positively, it is kept. If not, it is rejected. - -The standard filters supplied in AIS include: - - * AIS_AttributeFilter - * AIS_SignatureFilter - * AIS_TypeFilter. - -Only the type filter can be used in the default operating mode, the neutral point. -The others can only be used in open local contexts. - -Neutral point and local context constitute the two operating modes of the -central entity which pilots visualizations and selections, the Interactive Context. -It is linked to a main viewer and if you like, a trash bin viewer as well. - -The neutral point, which is the default mode, allows you to easily visualize and select interactive objects which have been loaded into the context. Opening local contexts allows you to prepare and use a temporary selection environment without disturbing the neutral point. -A set of functions allows you to choose the interactive objects which you want to act on, the selection modes which you want to activate, and the temporary visualizations which you will execute. When the operation is finished, you close the current local context and return to the state in which you were before opening it (neutral point or previous local context). - -An interactive object can have a certain number of graphic attributes, which are specific to it, such as visualization mode, color, and material. By the same token, the interactive context has a set of graphic attributes, the Drawer which is valid by default for the objects it controls. -When an interactive object is visualized, the required graphic attributes are first taken from the object's own Drawer if one exists, or from the context drawer for the others. - - -@subsection OCCT_TOVW_SECTION_5_4 Presentation - -### Presentation Management - - PrsMgr package provides low level services and is only to be used when you do not want to use the services provided by AIS. It manages the display through the following services: - * supplying a graphic structure for the object to be presented - * recalculating presentations when required, e.g. by moving the object or changing its color - * defining the display mode of the object to be presented; in the case of AIS_Shape, for example, this determines whether the object is to be displayed in wireframe (0) or shading (1) mode. - -Note that each new Interactive Object must have all its display modes defined. - -### Presentations of Geometry - -The Presentations of Geometry component provides services for advanced programmers to extend the Application Interactive Services component, AIS. -This would prove necessary in situations where new Interactive Objects were required. - -The StdPrs package provides standard display tools for specific geometries and topologies whereas Prs3d provides those for generic objects. -Among these classes are definitions of the display of the specific geometry or topology in various display modes such as wireframe, shading or hidden line removal mode. - -### Presentation of Dimensions - - DsgPrs package provides tools for display of dimensions, relations and XYZ trihedrons. - -@subsection OCCT_TOVW_SECTION_5_5 Selection - -Selection of 3D data structures is provided using various algorithms. - -### Basic Selection - -The SelectBasics package provides the following services: - - * the root definition of the sensitive primitive, a selectable entity in a view - * the definition of the owner of a sensitive primitive; this entity relates the primitive to the application entity which is to be selected in the view. - -### Standard Selections - - The StdSelect package provides the following services: - - * definition of selection modes for topological shapes - * definition of several filter standard Selection2d.ap classes - * 3D viewer selectors. - -Note that each new Interactive Object must have all its selection modes defined. -The Select3D package provides the following services: - - * definition of standard 3D sensitive primitives such as points, curves and faces; - * recovery of the bounding boxes in the 2D graphic selection space, if required; - * a 3D-2D projector. - -### Selection Management - -The SelectMgr package provides low level services and classes - SelectMgr_SelectionManager and SelectMgr_ViewerSelector . -They can be used when you do not want to use the services provided by AIS. - - SelectMgr manages the process of dynamic selection through the following services: - - * activating and deactivating selection modes for Interactive Objects - * adding and removing viewer selectors - * definitions of abstract filter classes - -The principle of graphic selection consists in representing the objects which you want -to select by a bounding box in the selection view. -The object is selected when you use the mouse to designate the zone produced by the object. - -To realize this, the application creates a selection structure -which is independent of the point of view. This structure is made up -of sensitive primitives which have one owner object associated to each of them. -The role of the sensitive primitive is to reply to the requests of the selection algorithm -whereas the owner's purpose is to make the link between -the sensitive primitive and the object to be selected. -Each selection structure corresponds to a selection mode which defines the elements that can be selected. - -For example, to select a complete geometric model, -the application can create a sensitive primitive for each face -of the interactive object representing the geometric model. -In this case, all the primitives share the same owner. -On the other hand, to select an edge in a model, -the application must create one sensitive primitive per edge. - -~~~~ - -void InteractiveBox::ComputeSelection - (const Handle(SelectMgr_Selection)& Sel, - const Standard_Integer Mode){ - -switch(Mode){ -case 0: -// locating the whole box by making its faces sensitive ... - { - Handle(SelectMgr_EntityOwner) Ownr = new - SelectMgr_EntityOwner(this,5); - for(Standard_Integer I=1;I<=Nbfaces;I++){ - Sel->Add(new Select3D_SensitiveFace - (Ownr,[array of the vertices] face I); - break; - } - -case 1: // locates the edges - { - - for(Standard_Integer i=1;i<=12;i++){ - // 1 owner per edge... - Handle(mypk_EdgeOwner) Ownr = - new mypk_EdgeOwner(this,i,6); - // 6->priority - Sel->Add(new - Select3D_SensitiveSegment - (Ownr,firstpt(i),lastpt(i)); - } - } -} - -~~~~ - -The algorithms for creating selection structures store the sensitive primitives in a - SelectMgr_Selection object. To do this, a set of ready-made sensitive primitives is supplied -in the Select2D and Select3D packages. New sensitive primitives can be defined through inheritance -from SensitiveEntity. For the application to make its own objects selectable, - it must define owner classes inheriting SelectMgr_EntityOwner. - -For any object inheriting from AIS_InteractiveObject, you redefine -its ComputeSelection functions. In the example below there are different modes -of selection on the topological shape contained within the interactive object, -selection of the shape itself, the vertices, the edges, the wires, the faces. - -~~~~ - void MyPack_MyClass::ComputeSelection( - const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) - { - switch(aMode){ - case 0: - StdSelect_BRepSelectionTool::Load( - aSelection,this,myShape,TopAbs_SHAPE); - break; - } - case 1: - StdSelect_BRepSelectionTool::Load( - aSelection,this,myShape,TopAbs_VERTEX); - break; - } - case 2: - StdSelect_BRepSelectionTool::Load( - aSelection,this,myShape,TopAbs_EDGE); - break; - } - case 3: - StdSelect_BRepSelectionTool::Load( - aSelection,this,myShape,TopAbs_WIRE); - break; - } - case 4: - StdSelect_BRepSelectionTool::Load( - aSelection,this,myShape,TopAbs_FACE); - break; - } - } -~~~~ - -The StdSelect_BRepSelectionTool object provides a high level service -which will make the shape myShape selectable when the AIS_InteractiveContext is asked to display your object. - -Note: - -The traditional way of highlighting selected entity owners -adopted by Open CASCADE Technology assumes that each entity owner -highlights itself on its own. This approach has two drawbacks: - - * each entity owner has to maintain its own Prs3d_Presentation object, that results in large memory overhead for thousands of owners; - * drawing selected owners one by one is not efficient from the OpenGL usage viewpoint. - -That is why a different method has been introduced. -On the basis of SelectMgr_EntityOwner::IsAutoHilight() return value - AIS_LocalContext object either uses the traditional way of highlighting -( IsAutoHilight() returned true) or groups such owners according to their -Selectable Objects and finally calls SelectMgr_SelectableObject::HilightSelected() or - ClearSelected(), passing a group of owners as an argument. - -Hence, an application can derive its own interactive object and redefine HilightSelected(), - ClearSelected() and HilightOwnerWithColor() virtual methods - to take advantage of such OpenGL technique as arrays of primitives. - In any case, these methods should at least have empty implementation. - - The AIS_LocalContext::UpdateSelected(const Handle(AIS_InteratciveObject)&, Standard_Boolean) - method can be used for efficient redrawing a selection presentation for a given interactive object from an application code. - -Additionally, the SelectMgr_SelectableObject::ClearSelections() -method now accepts an optional Boolean argument. -This parameter defines whether all object selections should be flagged for further update or not. -This improved method can be used to re-compute an object selection (without redisplaying the object completely) -when some selection mode is activated not for the first time. - - -@subsection OCCT_TOVW_SECTION_5_6 Attribute Management - -The Attribute Management tool-kit provides services for advanced programmers to extend -the Application Interactive Services component, AIS. This would prove necessary -in situations where new Interactive Objects were required. - -The Prs3d package provides the following services: - - * a presentation object (the context for all modifications to the display, its presentation will be displayed in every view of an active viewer) - * an attribute manager governing how objects such as color, width, and type of line are displayed; these are generic objects, whereas those in StdPrs are specific geometries and topologies. - * generic algorithms providing default settings for objects such as points, curves, surfaces and shapes - * a root object which provides the abstract framework for the DsgPrs definitions at work in display of dimensions, relations and trihedrons. - - -@subsection OCCT_TOVW_SECTION_5_7 Mesh Visualization Services - - MeshVS (Mesh Visualization Service) component extends 3D visualization capabilities -of Open CASCADE Technology. It provides flexible means of displaying meshes along with associated pre- and post-processor data. - -From a developer's point of view, it is easy to integrate the *MeshVS* component into any mesh-related application with the following guidelines: - -* Derive a data source class from the *MeshVS_DataSource* class. -* Re-implement its virtual methods, so as to give the MeshVS component access to the application data model. This is the most important part of the job, since visualization performance is affected by performance of data retrieval methods of your data source class. -* Create an instance of MeshVS_Mesh class. -* Create an instance of your data source class and pass it to a MeshVS_Mesh object through the SetDataSource() method. -* Create one or several objects of MeshVS_PrsBuilder-derived classes (standard, included in the MeshVS package, or your custom ones). -* Each PrsBuilder is responsible for drawing a MeshVS_Mesh presentation in a certain display mode(s) specified as a PrsBuilder constructor's argument. Display mode is treated by MeshVS classes as a combination of bit flags (two least significant bits are used to encode standard display modes: wireframe, shading and shrink). -* Pass these objects to the MeshVS_Mesh::AddBuilder() method. MeshVS_Mesh takes advantage of improved selection highlighting mechanism: it highlights its selected entities itself, with the help of so called "highlighter" object. You can set one of PrsBuilder objects to act as a highlighter with the help of a corresponding argument of the AddBuilder() method. - -Visual attributes of the MeshVS_Mesh object (such as shading color, shrink coefficient and so on) are controlled through MeshVS_Drawer object. It maintains a map "Attribute ID --> attribute value" and can be easily extended with any number of custom attributes. - -In all other respects, MeshVS_Mesh is very similar to any other class derived from AIS_InteractiveObject and it should be used accordingly (refer to the description of AIS package in the documentation). - -@subsection OCCT_TOVW_SECTION_5_8 Images and Drivers - -### Images - -The *Image* package provides classes *PixMap*, defining low-level image bitmap in arbitrary formats (RGB, RGBA, Grayscale), and *AlienPixMap*, providing import / export from / to external image files in formats supported by FreeImage library. - -### Drivers - -The Xw package contains the common X graphic interface. It uses XWindow bitmap fonts that cannot be modified. - -The WNT package contains the common Windows NT graphic interface. - -The Cocoa package provides interaction with Cocoa API on Mac OS X. - -@subsection OCCT_TOVW_SECTION_5_9 New Interactive Services (NIS) - -New Interactive Services package provides the API similar to the traditional AIS but with some important differences/improvements: - - * Each type of InteractiveObject should have a corresponding Drawer class that defines the presentation of the Object type using direct OpenGl calls. This is a much faster way to display 3D objects, providing for more than 1 million separate selectable entities in one view. - * The abstract type NIS_InteractiveObject does not support any properties (color, material, other aspects). The relevant properties should be defined in the specializations of the Drawer class, and the API to set/modify should be implemented in the specializations of InteractiveObject class. - * Interactive selection is managed by InteractiveObject methods instead of special selector classes and data types. This is possible since in NIS the selection is based on 3D representation (by a ray or a box corresponding to the view direction) without intermediate 2D projection. - * Many InteractiveContext instances can be attached to a V3d_View, these instances being independent containers of interactive objects; removal (detaching) of InteractiveContext instance destroys the contained objects. - * All data types and algorithms are designed to provide the best performance for both OpenGl (server side) and application. On the other hand, the API is open to any feature supported by any version of OpenGl. This allows building custom presentations quickly and efficiently. - * Standard NIS_View subclasses V3d_View thus providing all its public API, such as scene definition (view orientation, lights, background, etc.) and the standard view transformations (pan/zoom/rotate,fitAll,...). The traditional AIS-based presentations (e.g., AIS_Shape) are also supported, they can be rendered together with NIS presentations in the same view window. - -The DRAW test plugin, TKViewerTest, has been modified -to manage AIS_InteractiveContext and NIS_InteractiveContext together in one view window. - -@subsection OCCT_TOVW_SECTION_5_10 Voxels - -A voxel is a sub-volume box with constant scalar/vector value. -The object in voxel representation is split into many small sub-volumes (voxels) and its properties are distributed through voxels. - -Voxels are used for analysis and visualization of 3D-dimensional distribution of data. -Medicine (mainly, tomography), computational physics (hydrodynamics, aerodynamics, nuclear physics) -and many other industries use voxels for 3D data visualization and analysis of physical processes. - -Open CASCADE Technology provides several basic data containers for voxels -with fast access to the data and optimal allocation of data in memory. -Also, a special visualization toolkit allows visualizing voxels -as colored or black/white points and cubes, displaying only the voxels visible from the user's point of view. - -See @ref occt_user_guides__voxels_wp "Voxels User's Guide" for more information. - -@subsection OCCT_TOVW_SECTION_5_11 Examples - -### How to change graphic attributes of an interactive object - -The set of graphic attributes of an interactive object is defined in AIS_Drawer. -Each interactive object can have its own visualization attributes. - -By default, the interactive object takes the graphic attributes of -the interactive context in which it is visualized -(visualization mode, deflection, values for the calculation of presentations, -number of isoparametric lines, color, type of line, material, etc.) - -In the AIS_InteractiveObject abstract class, several standard attributes -have been privileged. These include: color, thickness of line, material, and transparency. -Consequently, a certain number virtual functions which allow us to act on these attributes have been proposed. -Each new class of interactive object can use them as they are or -can redefine these functions to bring about the changes it should produce in the behavior of the class. - -Other attributes can be changed by acting directly on the drawer of the object. -An interactive object has a specific drawer as soon as you change an attribute on it. -If you do not modify any graphic attribute on it, the default drawer of the interactive context is referenced and used. - -To get the AIS_Drawer of an object, call method AIS_InteractiveObject::Attributes . - -To set the AIS_Drawer of an object, call method AIS_InteractiveObject::SetLocalAttributes . - -### How to dump a scene from the viewer - -You can dump the contents of a V3D_View in a file with the same scale or -with a different scale according to the required paper size (format) -and the aspect ratio of the view. This is provided by method V3d_View::Dump. For example: - -~~~~ -CString filename ("myView3D.bmp"); -myView->Dump (filename, Aspect_FOSP_A4); -~~~~ - - myView is a V3d_View, where OCCT objects are displayed using, for example, AIS services. - -Please, note: - - * The file name extension can be any among ".xwd", ".png", or ".bmp" formats both on UNIX or NT. - * Be careful about dump time requirements of the resulting file, especially for the A formats. - * The GIF format generates very small files, BMP and XWD generates much larger files (4 to 6 times the size of a GIF). - * The time to generate these files is very short with the XWD format but 2 to 4 times longer for the other formats. - * After getting an image file of your view, you can use any standard application for editing or sending the image file to a printer (i.e.: Microsoft Photo Editor on Windows or Image Viewer on SUN system) - -### How to add and remove objects from Selections - - -You can add or remove an object from a selection in one of two ways. You can use: - - * AIS_InteractiveContext::AddOrRemoveCurrentObject method at neutral points; - * AddOrRemoveCurrent method if a local context is opened. - - -### How to detect overlapped objects - - -When objects overlap each other and cause difficulties in selection, -you can use the mechanism provided with the AIS_InteractiveContext -to successively highlight all the objects found under the selection. -This allows you to choose and validate the required object. - -~~~~ - If ( myAISContext->HasNextDetected()) { - - // if up key is pressed - myAISContext ->HilightNextDetected(myView); - - // if down key is pressed - myAISContext ->HilightPreviousDetected(myView); - - } -~~~~ - - - -### Get mouse coordinates in 3D view - - -To switch from pixel mouse position on the screen to 3D coordinates -in V3d_View, use V3d_View::Convert method. - -~~~~ - Handle(V3d_View) aview - aView->Convert(Xp,Yp,X,Y,Z) -~~~~ - -Where Xp, Yp are the mouse coordinates in pixels and X,Y,Z the real coordinates in 3D space. - -### 3D Viewer Objects - -The V3d package contains the set of commands and services of the 3D Viewer. -It provides a set of high level commands to control views and viewing modes. -This package is complementary to the Visual3D graphic package. - - CSF_WALKTHROUGH variable enables you to manage the perspective of the view -in the viewer by defining setenv CSF_WALKTHROUGH "Yes". - -If you use the syntax unsetenv CSF_WALKTHROUGH , you make sure that the variable -is deactivated. In this case, the eye is located outside the 3D bounding box of the view. -This is the default behavior for managing the view perspective. - -@section OCCT_TOVW_SECTION_6 Data Exchange - -Data Exchange is a key factor in using Open CASCADE Technology (as well as applications based thereon) concurrently with other software such as CAD systems. It provides the openness of OCCT in a multi-software environment, by allowing it to process external data and providing a good level of integration. - -This means obtaining results of good quality, and covering the needs of exchanges from OCCT-based applications regardless of external data quality or requirements, in particular in respect of allowed data types and arrangements between them, accepted gaps between geometries. - -This matter is addressed by Data Exchange Module, which is organized in a modular way. - -@figure{/technical_overview/images/technical_overview_de.png} - -Data Exchange interfaces in OCCT allow software based on OCCT to exchange data with various CAD software, thus ensuring a good level of interoperability. - -@figure{/technical_overview/images/644_sh_09_400.png,"Image imported from STEP"} - -Data Exchange interfaces function either in accordance with the standards (IGES, STEP), -which can be used by various software packages for CAD, PDM etc., or as direct connectors to proprietary formats. - -* **Standardized Data Exchange** interfaces allow to querying and examining a file, results of conversion and its validity. They are designed to support extensions (new standards) in a common modular architecture. - * @ref OCCT_TOVW_SECTION_6_3 "STEP" (AP203 : Mechanical Design, this covers General 3D CAD; AP214: Automotive Design) - * @ref OCCT_TOVW_SECTION_6_2 "IGES" (up to 5.3) - * @ref OCCT_TOVW_SECTION_4a_1 "VRML and STL" meshes. -* @ref OCCT_TOVW_SECTION_6_4 "Extended data exchange" allows extending the scope of exchange by translating additional data attached to geometric *BREP* data. -* Advanced Data Exchange Components are available in addition to standard Data Exchange interfaces to provide direct mapping and data adaptation (also using @ref OCCT_TOVW_SECTION_6_3_3 "Shape Healing") with CAD software supporting the following formats: - * ACIS SAT - * Parasolid - * DXF - -These components are based on the same architecture as interfaces with STEP and IGES. - -@subsection OCCT_TOVW_SECTION_6_1 General Definitions - -OCCT general definitions for Data Exchange include several enumerations and classes used by IGES and STEP data exchange interfaces. +This modular structure is illustrated in the diagram below. -To define translation parameters and file headers, you can use: +@figure{/technical_overview/images/technical_overview_schema.png} - * Interface_InterfaceModel - * Interface_Static +* @ref OCCT_TOVW_SECTION_2 "Foundation Classes" module underlies all other OCCT classes; +* @ref OCCT_TOVW_SECTION_3 "Modeling Data" module supplies data structures to represent 2D and 3D geometric primitives and their compositions into CAD models; +* @ref OCCT_TOVW_SECTION_4 "Modeling Algorithms" module contains a vast range of geometrical and topological algorithms; +* @ref OCCT_TOVW_SECTION_4a "Mesh" module implements tessellated representations of objects; +* @ref OCCT_TOVW_SECTION_5 "Visualization" module provides complex mechanisms for graphical data representation; +* @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; +* @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). -To manage Message display, use class Mesage_Messenger. +In 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. -To define the type of analysis of the source file, and to ensure the success -of the loading operation, you use the following enumerations from the IFSelect package: +@section OCCT_TOVW_SECTION_2 Foundation Classes - * PrintCount - * ReturnStatus +**Foundation Classes** module contains data structures and services used by higher-level Open CASCADE Technology classes: + + * Primitive types, such as Boolean, Character, Integer or Real; + * String classes that handle ASCII and Unicode strings; + * Collection classes that handle statically or dynamically sized aggregates of data, such as arrays, lists, queues, sets and hash tables (data maps). + * Classes providing commonly used numerical algorithms and basic linear algebra calculations (addition, multiplication, transposition of vectors and matrices, solving linear systems etc). + * Fundamental types representing physical quantities and supporting date and time information; + * Primitive geometry types providing implementation of basic geometric and algebraic entities that define and manipulate elementary data structures. + * Exception classes that describe situations, when the normal execution of program is abandoned; + +This module also provides a variety of general-purpose services, such as: + * Safe handling of dynamically created objects, ensuring automatic deletion of unreferenced objects (smart pointers); + * Configurable optimized memory manager increasing the performance of applications that intensively use dynamically created objects; + * Extended run-time type information (RTTI) mechanism maintaining a full type hierarchy and providing means to iterate over it; + * Encapsulation of C++ streams; + * Automated management of heap memory by means of specific allocators; + * Basic interpreter of expressions facilitating the creation of customized scripting tools, generic definition of expressions, etc.; + * Tools for dealing with configuration resource files and customizable message files facilitating multi-language support in applications; + * 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; + * and many others... + +Please, see the details in @ref occt_user_guides__foundation_classes "Foundation Classes User's Guide" See also: our web site at E-learning and Training. +@section OCCT_TOVW_SECTION_3 Modeling Data -@subsection OCCT_TOVW_SECTION_6_2 IGES - -The IGES interface reads IGES files and translates them to Open CASCADE Technology models. -IGES files produced in accordance with IGES standard versions up to and including version 5.3 can be read. -The interface is able to translate one entity, a group of entities or a whole file. -Before beginning a translation, you can set a range of parameters to manage the translation process. -If you like, you can also check file consistency before translation. - -The IGES interface also translates OCCT models to IGES files. -IGES files produced by this component conform to IGES standard version 5.3. - -Other kinds of data such as colors and names can be read or written -with the help of XDE tools IGESCAFControl_Reader and IGESCAFControl_Writer. +**Modeling Data** supplies data structures to implement boundary representation (BRep) of objects in 3D. In BRep the shape is represented as an aggregation of geometry within topology. The geometry is understood as a mathematical description of a shape, e.g. as curves and surfaces (simple or canonical, Bezier, NURBS, etc). The topology is a data structure binding geometrical objects together. + +Geometry types and utilities provide geometric data structures and services for: + * Description of points, vectors, curves and surfaces: + * their positioning in 3D space using axis or coordinate systems, and + * their geometric transformation, by applying translations, rotations, symmetries, scaling transformations and combinations thereof. + * Creation of parametric curves and surfaces by interpolation and approximation; + * Algorithms of direct construction; + * Conversion of curves and surfaces to NURBS form; + * Computation of point coordinates on 2D and 3D curves; + * Calculation of extrema between geometric objects. + +Topology defines relationships between simple geometric entities. A shape, which is a basic topological entity, can be divided into components (sub-shapes): + * Vertex – a zero-dimensional shape corresponding to a point; + * Edge - a shape corresponding to a curve and bounded by a vertex at each extremity; + * Wire - a sequence of edges connected by their vertices; + * Face - a part of a plane (in 2D) or a surface (in 3D) bounded by wires; + * Shell - a collection of faces connected by edges of their wire boundaries; + * Solid - a finite closed part of 3D space bounded by shells; + * Compound solid - a collection of solids connected by faces of their shell boundaries. -Please, note: +Complex shapes can be defined as assemblies of simpler entities. - * an IGES model is an IGES file that has been loaded into memory. - * an IGES entity is an entity in the IGES normal sense. - * a root entity is the highest level entity of any given type, e.g. type 144 for surfaces and type 186 for solids. Roots are not referenced by other entities. +Please, see the details in @ref occt_user_guides__modeling_data "Modeling Data User's Guide" -For more details see @ref occt_user_guides__iges "IGES User's Guide". +3D geometric models can be stored in OCCT native BREP format. +See @ref occt_user_guides__brep_wp "BREP Format Description White Paper" for details on the format. See also: our web site at E-learning and Training. -@subsection OCCT_TOVW_SECTION_6_3 STEP - -STEP is more and more widely used to exchange data between various kinds of softwares, involved in CAD, PDM, Analysis, etc... STEP is far more than an "exchange standard" : it provides a technology and a set of methodologies to describe the data to exchange in a modular and upgradeable way. Regarding Open Cascade, this mostly applies to CAD data but it is not a limitation, other kinds of data for specific applications can be addressed too. - -@figure{/technical_overview/images/642_sh_08_400.png,"Image imported from STEP"} - -Open Cascade allows its users to employ STEP in the following domains: -* Exchange of data for technical applications, following the state-of-the-art definitions and rules; -* Extension of case coverage, according to specific needs or to the evolution of general business uses; -* Expertise on data architecture of an application, to get experience from STEP definitions and make easier the mapping to them, for a better interoperability with outer world. +@section OCCT_TOVW_SECTION_4 Modeling Algorithms -For more details see @ref occt_user_guides__step "STEP User's Guide". +**Modeling Algorithms** module groups a wide range of topological and geometric algorithms used in geometric modeling. Basically, there are two groups of algorithms in Open CASCADE Technology: +* High-level modeling routines used in the real design; +* Low-level mathematical support functions used as a groundwork for the modeling API; -See also: our web site at E-learning and Training. +* Low-level geometric tools provide the algorithms, which: + * Calculate the intersection of two curves, surfaces, or a curve and a surface; + * Project points onto 2D and 3D curves, points onto surfaces and 3D curves onto surfaces; + * Construct lines and circles from constraints; + * Construct free-form curves and surfaces from constraints (interpolation, approximation, skinning, gap filling, etc); + +* Low-level topological tools provide the algorithms, which: + * Tessellate shapes; + * Check correct definition of shapes; + * Determine the local and global properties of shapes (derivatives, mass-inertia properties, etc); + * Perform affine transformations; + * Find planes in which edges are located; + * Convert shapes to NURBS geometry; + * Sew connected topologies (shells and wires) from separate topological elements (faces and edges). + +Top-level API provides the following functionality: + +* Construction of Primitives: + * Boxes; + * Prisms; + * Cylinders; + * Cones; + * Spheres; + * Toruses. +* Kinematic Modeling: + * Prisms - linear sweeps; + * Revolutions - rotational sweeps; + * Pipes - general-form sweeps; + * Lofting. + +@figure{/technical_overview/images/0001.png "Shapes containing pipes with variable radius produced by sweeping"} + +* Boolean Operations, which allow creating new shapes from the combinations of source shapes. For two shapes *S1* and *S2*: + * *Common* contains all points that are in *S1* and *S2*; + * *Fuse* contains all points that are in *S1* or *S2*; + * *Cut* contains all points in that are in *S1* and not in *S2* + +See @ref occt_user_guides__boolean_operations "Boolean Operations" User's Guide for detailed documentation. -@subsubsection OCCT_TOVW_SECTION_6_3_1 STEP Exchanges in Open Cascade technology +* Algorithms for local modifications such as: + * Hollowing; + * Shelling; + * Creation of tapered shapes using draft angles; + * Algorithms to make fillets and chamfers on shape edges, including those with variable radius (chord). -Beyond the upper level API, which is fitted for an easy end-use, the STEP exchange functions enter in the general frame of Exchanges in Open Cascade, adapted for STEP: +* Algorithms for creation of mechanical features, i.e. depressions, protrusions, ribs and grooves or slots along planar or revolution surfaces. -* Specific packages for Data definition and checking; -* Physical Access supported by Drivers (Part 21 file access is embedded); -* Conversion to/from Open Cascade or applicative data supported by drivers (OCC-BREP and XDE ard basically provided); -* Tools for analysis, filtering, etc... including DRAW commands. +@figure{/technical_overview/images/0004.png} -These modules share common architecture and capabilities with other exchange modules of Open Cascade, like Shape Healing. Also, built-in Viewer and Converter (as Plugin for Netscape, Internet Explorer ..), are based on the same technology. -In addition, Open Cascade provides tools to process models described using STEP: to reflect EXPRESS descriptions, to read, write and check data, to analyze the whole models ... Their key features are: + +Please, see the details in @ref occt_user_guides__modeling_algos "Modeling Algorithms User's Guide". -* Modularity by sets of data types, which can be hierarchized to reflect the original modularity describing the resources and application protocols; -* Implementation as CDL/C++ classes, providing comprehensive access to their members; -* Early binding is basically used, providing good performance, easy installation and use as well as the capability to support non-compiled descriptions. +See also: our web site at E-learning and Training. -This provides a natural way to deal with non-supported protocols when they share common definitions, as for geometry, which can then be exploited. The common frame, as the already supported data types, give a good foundation to go towards new uses of STEP, either on data definition (protocols from ISO or from industrial consortia) or on mapping with applicative data. +@section OCCT_TOVW_SECTION_4a Mesh +**Mesh** module provides the functionality to work with tessellated representations of objects in form of triangular facets. This module contains: +- data structures to store surface mesh data associated to shapes and basic algorithms to handle them; +- data structures and algorithms to a build triangular surface mesh from *BRep* objects (shapes); +- tools for displaying meshes with associated pre- and post-processor data (scalars or vectors). -@subsubsection OCCT_TOVW_SECTION_6_3_2 STEP Interface +Open CASCADE Technology includes two mesh converters: +- VRML converter translates Open CASCADE shapes to VRML 1.0 files (Virtual Reality Modeling Language). Two representation modes are possible: shaded, which presents shapes as sets of triangles computed by the mesh algorithm, or wireframe, which presents shapes as sets of curves. +- STL converter translates Open CASCADE shapes to STL files. STL (STtereoLithography) format is widely used for rapid prototyping (3D printing). -The STEP interface reads STEP files produced in accordance with STEP Application Protocol 214 (Conformance Class 2 both CD and DIS versions of schema) and translates them to Open CASCADE Technology models. STEP Application Protocol 203 is also supported. +Open CASCADE SAS also offers Advanced Mesh Products: +- Open CASCADE Mesh Framework (OMF) +- Express Mesh -The STEP interface also translates OCCT models to STEP files. STEP files that are produced by this interface conform to STEP AP 203 or AP 214 (Conformance Class 2, either CD or DIS version of the schema) depending on the user's option. +@figure{/technical_overview/images/0003.png} -Basic interface reads and writes geometrical, topological STEP data and assembly structures. +@section OCCT_TOVW_SECTION_5 Visualization -The interface is able to translate one entity, a group of entities or a whole file. +**Visualization** module provides ready-to-use algorithms to create graphic presentations from various objects: shapes, meshes, etc. -Other kinds of data such as colors, validation properties, layers, names and the structure of assemblies can be read or written with the help of XDE tools - STEPCAFControl_Reader and STEPCAFControl_Writer. +In Open CASCADE Technology visualization is based on the separation of CAD data and its graphical presentation. The presentations can be customized to take the specificity of your application into account. -To choose a translation mode when exporting to a STEP format, use STEPControl_STEPModelType. +The module also supports a fast and powerful interactive selection mechanism. -There is a set of parameters that concern the translation and can be set before the beginning of the translation. +The view facilities provided by OCCT range from low-level tools working with basic geometry and topology (such as NURBS visualization with control points and nodes, rendering of isolines to estimate speed and quality of parameterization, or rendering of a parametric profile of edges) to high-level tools for real time quality rendering of models using ray tracing: shades, reflections, transparency, anti-aliasing, etc. -Please, note: -* a STEP model is a STEP file that has been loaded into memory; -* all references to shapes indicate OCCT shapes unless otherwise explicitly stated; -* a root entity is the highest level entity of any given type, i.e. an entity that is not referenced by any other one. +Here are just a few examples: -@subsubsection OCCT_TOVW_SECTION_6_3_3 Usage of Shape Healing after import from STEP and IGES +* Camera-driven view projection and orientation. It is possible to choose between perspective, orthographic and stereographic projection. -@ref OCCT_TOVW_SECTION_4_10 "Shape Healing" toolkit provides tools to heal various problems which may be encountered in shapes, and to make them valid in Open CASCADE. The Shape Healing is smoothly connected to IGES and STEP translators: the same API as for Open CASCADE IGES and STEP translators is used, only the names of API packages change. +* Real-time ray tracing technique using recursive Whitted's algorithm and Bounded Volume Hierarchy effective optimization structure. -Here are a few examples of typical problems that can be encountered in real IGES and STEP files, with illustrations of how Shape Healing deals with them: +@figure{/technical_overview/images/0002.png, "Real time visualization by ray tracing method"} -#### Face with missing seam edge +* Support of GLSL shaders. The shader management is fully automatic, like with any other OpenGL resource. -The problem: Face on a periodical surface is limited by wires which make a full trip around the surface. These wires are closed in 3d but not closed in parametric space of the surface. This is not valid in Open CASCADE. -The solution: Advanced Shape Healing fixes this face by inserting seam edge which combines two open wires and thus closes the parametric space. Note that internal wires are processed correctly. +@figure{/technical_overview/images/0013.png, "Fragment shader implementing custom clipping surface"} -#### Wrong orientation of wires -The problem: Wires on face have incorrect orientation, so that interior and outer parts of the face are mixed. -The solution: Advanced Shape Healing recovers correct orientation of wires. +* Support of standard and custom materials, defined by transparency, diffuse, ambient and specular reflection and refraction index. The latter allows implementing transparent materials, such as glass, diamond and water. -#### Self-intersecting wire -The problem: Face is invalid because its boundary wire has self-intersection (on two adjacent edges) -The solution: Advanced Shape Healing cuts intersecting edges at intersection points thus making boundary valid. +@figure{/technical_overview/images/0012.png, "Simulation of a glass cover"} -#### Lacking edge -The problem: There is a gap between two edges in the wire, so that wire is not closed -The solution: Advanced Shape Healing closes a gap by inserting lacking edge. +* Optimization of rendering performance through the algorithms of: + * View frustum culling, which skips the presentation outside camera at the rendering stage and + * Back face culling, which reduces the rendered number of triangles and eliminates artifacts at shape boundaries. + +* Definition of clipping planes through the plane equation coefficients. Ability to define visual attributes for cross-section at the level or individual clipping planes. In the image below different parts of the rocket are clipped with different planes and hatched. +* Possibility to flexibly adjust appearance of dimensions in a 3D view. The 3D text object represents a given text string as a true 3D object in the model space. -@subsection OCCT_TOVW_SECTION_6_4 Extended Data Exchange +@figure{/technical_overview/images/0008.png, "Display of shape cross-section and dimensions"} -The Extended Data Exchange (XDE) module allows extending the scope of exchange by translating additional data attached to geometric *BREP* data, thereby improving the interoperability with external software. Data types such as colors, layers, assembly descriptions and validation properties (i.e. center of gravity, etc.) are supported. These data are stored together with shapes in an XCAF document. +For more details see @ref occt_user_guides__visualization "Visualization User's Guide". -The basis of XDE, called XCAF, is a framework based on OCAF (Open CASCADE Application Framework) intended to work with assemblies and with various kinds of data (attributes) attached to shapes. The following types of data are currently supported : - - assemblies; - - validation properties; - - names; - - colors; - - layers. +The 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. -It is also possible to add a new types of data taking the existing tools as prototypes. +Open CASCADE Technology also supports voxel representation providing basic data containers and visualization of voxels as colored or grayscale bricks. -Finally, the XDE provides reader and writer tools for reading and writing the data supported by XCAF to and from IGES and STEP files. +See @ref occt_user_guides__voxels_wp "Voxels User's Guide" for more information. -@figure{/technical_overview/images/646_xde_11_400.png,"Shape imported using XDE"} +See also: our web site at E-learning and Training. -For more details see @ref occt_user_guides__xde "XDE User's Guide". -Here are some examples of IGES and STEP files with colors and other attributes read to XDE. +@section OCCT_TOVW_SECTION_6 Data Exchange -### Assembly Structure +**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. The exchanges run smoothly regardless of the quality of external data or requirements to its internal representation, for example, to the data types, accepted geometric inaccuracies, etc. -@figure{/technical_overview/images/610_xde_01_400.png,"Sample Assembly"} +@figure{/technical_overview/images/0014.png,"Shape imported from STEP"} -XDE supports assemblies by separation the shape definition and its location. The shape itself is stored in OCAF as a simple shape object without location, and then assemblies are defined by specifying what shapes they have as components, and with what locations. This gives a flexibility to define and easily work with complex multi-level assemblies. +**Data Exchange** is organized in a modular way as a set of interfaces that comply with various CAD formats: IGES, STEP, STL, VRML, etc. The interfaces allow software based on OCCT to exchange data with various CAD/PDM software packages, maintaining a good level of interoperability. -### Validation Properties -Validation properties are quite a new feature of STEP standard, currently being actively tested by CAX-IF organization and implemented in commercial STEP translators. +* **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. The following formats are currently supported. + * @ref occt_user_guides__step "STEP" (AP203 : Mechanical Design, this covers General 3D CAD; AP214: Automotive Design) + * @ref occt_user_guides__iges "IGES" (up to 5.3) + * VRML and STL meshes. +* @ref occt_user_guides__xde "Extended data exchange" (XDE) allows translating additional attributes attached to geometric data (colors, layers, names, materials etc). +* Advanced Data Exchange Components 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: + * ACIS SAT + * Parasolid + * DXF -Validation properties are geometric characteristics of shapes (volume, centroid, surface area) which can be put to the STEP file by the sending system. These data should be used by the receiving system in order to validate quality of translation (by comparing these values computed by original system with the same values computed by receiving system on resulting model). +These components are based on the same architecture as interfaces with STEP and IGES. -Extended Data Exchange supports both reading and writing validation properties, and provides some tool to check them. +@section OCCT_TOVW_SECTION_6a Shape Healing -### Names +**Shape Healing** library provides algorithms to correct and adapt the geometry and topology of shapes imported to OCCT from other CAD systems. -@figure{/technical_overview/images/614_xde_04_400.png,"Instance Names"} +Shape Healing algorithms include, but are not limited to, the following operations: +* 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: + - check edge and wire consistency; + - check edge order in a wire; + - check the orientation of face boundaries; + - analyze shape tolerances; + - identify closed and open wires in a boundary. +* fix incorrect or incomplete shapes: + - provide consistency between a 3D curve and its corresponding parametric curve; + - repair defective wires; + - fit the shapes to a user-defined tolerance value; + - fill gaps between patches and edges. +* upgrade and change shape characteristics: + - reduce curve and surface degree; + - split shapes to obtain C1 continuity; + - convert any types of curves or surfaces to Bezier or B-Spline curves or surfaces and back; + - split closed surfaces and revolution surfaces. -XDE supports reading and writing names of shapes to and from both IGES and STEP formats. This functionality can be switched off in case of need (if these data are not needed, thus avoiding unnecessary information in the document). +Each sub-domain of Shape Healing has its own scope of functionality: -### Colors and Layers +| Sub-domain | Description | Impact on the shape | +| :--- | :---- | :---- | +| Analysis | Explores shape properties, computes shape features, detects violation of OCCT requirements. | The shape itself is not modified. | +| Fixing | Fixes the shape to meet the OCCT requirements. | The shape may change its original form: modification, removal or creation of sub-shapes, etc.) | +| Upgrade | Improves the shape to fit some particular algorithms. | The shape is replaced with a new one, but geometrically they are the same. | +| Customization | Modifies the shape representation to fit specific needs. | The shape is not modified, only the mathematical form of its internal representation is changed. | +| Processing | Mechanism of shape modification via a user-editable resource file. | | -@figure{/technical_overview/images/239_xde_12_400.png,"Motor Head"} +For more details refer to @ref occt_user_guides__shape_healing "Shape Healing User's guide". -XDE can read and write colors and layers assigned to shapes or their subparts (down to level of faces and edges) to and from both IGES and STEP formats. +See also: our web site at E-learning and Training. @section OCCT_TOVW_SECTION_7 Application Framework -Open CASCADE Application Framework (OCAF) provides a solution for handling of Application Data, based on the Application/Document paradigm. It uses an associativity engine to simplify the development of a CAD application due to the following features: +**Open CASCADE Application Framework** (OCAF) handles Application Data basing on the Application/Document paradigm. It uses an associativity engine to simplify the development of a CAD application thanks to the following ready-to-use features and services: -* @ref OCCT_TOVW_SECTION_7_2 "Data Attributes" that provide management of application data. Attributes may be organized according to the development needs; -* @ref OCCT_TOVW_SECTION_7_3 "Data storage and Persistence" services; -* Possibility to modify and recompute documents +* Data attributes managing the application data, which can be organized according to the development needs; +* Data storage and persistence (open/save); +* Possibility to modify and recompute attributes in documents. With OCAF it is easy to represent the history of modification and parametric dependencies within your model; * Possibility to manage multiple documents; -* Ready-to-use modeling data attributes common to CAD/CAM applications; -* Ready-to-use Undo-Redo and Copy-Paste functions. +* Predefined attributes common to CAD/CAM/CAE applications (e.g. to store dimensions); +* Undo-Redo and Copy-Paste functions. -Since OCAF handles your application structure, your only major development task is the creation of application-specific data and GUIs. It is the organization of application data due to which OCAF differs from any other CAD framework. In OCAF, data structures are not shape-driven, but reference-key driven. +Since OCAF handles the application structure, the only development task is the creation of application-specific data and GUIs. -Thus, the attributes, such as shape data, color and material, are attached to a deeper invariant structure of a model than the shapes themselves. OCAF organizes and embeds these attributes in a document. +OCAF 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. In a model, such attributes as shape data, color and material are attached to an invariant structure, which is deeper than the shapes. A 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. -For example, a geometry becomes the value of *Shape* attribute, in the same way as a number is the value of *Integer* attribute and a string is the value of *Name* attribute. OCAF documents are in their turn managed by an OCAF application. +OCAF organizes and embeds these attributes in a document. OCAF documents, in their turn, are managed by an OCAF application. For more details see @ref occt_user_guides__ocaf "OCAF User's Guide" and the OCAF white papers: * @ref occt_user_guides__ocaf_wp "Application Framework" * @ref occt_user_guides__ocaf_tree_wp "Distribution of Data through OCAF Tree" * @ref occt_user_guides__ocaf_functionmechanism_wp "Application Framework Function Mechanism" -See also: our web site at E-learning and Training. - -@subsection OCCT_TOVW_SECTION_7_1 How to start working with OCAF - -To create a useful OCAF-based application, it is necessary to redefine two deferred methods: Formats and ResourcesName - -In the Formats method, add the format of the documents, which need to be read by the application and may have been built in other applications. - -For example: - -~~~~ - void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats) - { - Formats.Append(TCollection_ExtendedString ("OCAF-myApplication")); - } -~~~~ - -In the ResourcesName method, you only define the name of the resource file. This -file contains several definitions for the saving and opening mechanisms associated -with each format and calling of the plug-in file. - -~~~~ - Standard_CString myApplication::ResourcesName() - { - return Standard_CString ("Resources"); - } -~~~~ - -To obtain the saving and opening mechanisms, it is necessary to set two environment variables: CSF_PluginDefaults, which defines the path of the plug-in file, and CSF_ResourcesDefault, which defines the resource file: - -~~~~ - SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory); - SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory); -~~~~ - -The plugin and the resource files of the application will be located in myDirector. -The name of the plugin file must be Plugin. - -### Resource File - -The resource file describes the documents (type and extension) and -the type of data that the application can manipulate -by identifying the storage and retrieval drivers appropriate for this data. - -Each driver is unique and identified by a GUID generated, for example, with the uuidgen tool in Windows. - -Five drivers are required to use all standard attributes provided within OCAF: - - * the schema driver (ad696002-5b34-11d1-b5ba-00a0c9064368) - * the document storage driver (ad696000-5b34-11d1-b5ba-00a0c9064368) - * the document retrieval driver (ad696001-5b34-11d1-b5ba-00a0c9064368) - * the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368) - * the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368) - -These drivers are provided as plug-ins and are located in the PappStdPlugin library. - - -For example, this is a resource file, which declares a new model document OCAF-MyApplication: - -~~~~ -formatlist:OCAF-MyApplication -OCAF-MyApplication.Description: MyApplication Document Version 1.0 -OCAF-MyApplication.FileExtension: sta -OCAF-MyApplication.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368 -OCAF-MyApplication.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368 -OCAF-MyApplicationSchema: ad696002-5b34-11d1-b5ba-00a0c9064368 -OCAF-MyApplication.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368 -OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368 -~~~~ - - -### Plugin File - -The plugin file describes the list of required plug-ins to run the application and the -libraries in which plug-ins are located. - -You need at least the FWOSPlugin and the plug-in drivers to run an OCAF application. - -The syntax of each item is Identification.Location Library_Name, where: -* Identification is GUID. -* Location defines the location of the Identification (where its definition is found). -* Library_Name is the name (and path to) the library, where the plug-in is located. - -For example, this is a Plugin file: - -~~~~ -a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin -! base document drivers plugin -ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin -ad696001-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin -ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin -47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin -47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin -~~~~ - -@subsection OCCT_TOVW_SECTION_7_2 Data Attributes - -The following ready-to-use attributes are provided: - * Shape attributes, which contain shapes and their evolution - * Standard attributes, a collection of common CAD/CAM attributes including: - * Real - * Integer - * Name - * Constrain - * Visualization attributes implement the Application Interactive Services in the context of Open CASCADE Application Framework. - * Function attributes which regenerate any data affected by modifications made in a -document - -### Shape Attributes - -A topological attribute can be seen as a hook into the topological structure. To -this hook, data can be attached and references defined. - - -It is used for keeping and access to topological objects and their evolution. All -topological objects are stored in the one user-protected TNaming_UsedShapes attribute -at the root label of the data framework. This attribute contains map with all topological -shapes, used in this document. - -TNaming_NamedShape attribute can be added to any other attribute. This attribute contains -references (hooks) to shapes from the TNaming_UsedShapes attribute and evolution -of these shapes. TNaming_NamedShape attribute contains a set of pairs of hooks: old -shape and new shape (see the figure below). It allows not only get the topological -shapes by the labels, but also trace evolution of the shapes and correctly resolve -dependent shapes by the changed one. - -If a shape is newly created, the old shape for the corresponding named shape is an empty -shape. If a shape is deleted, then the new shape in this named shape is empty. - -@figure{/technical_overview/images/technical_overview_shapeattrib.png} - - -### Shape attributes in data framework. - -Algorithms can dispose sub-shapes of the result shape at the individual -label depending on necessity: - - * If a sub-shape must have some extra attributes (material of each face or color of each edge). In this case a specific sub-shape is placed to the separate label (usually, sub-label of the result shape label) with all attributes of this sub-shape. - * If topological naming is needed, a necessary and sufficient (for selected sub-shapes identification) set of sub-shapes is placed to the child labels of the result shape label. As usual, as far as basic solids and closed shells are concerned, all faces of the shape are disposed. Edges and vertices sub-shapes can be identified as intersection of contiguous faces. Modified/generated shapes may be placed to one named shape and identified as this named shape and source named shape that also can be identified with used algorithms. - - TNaming_NamedShape may contain a few pairs of hooks with the same evolution. In this -case topology shape, which belongs to the named shape, is a compound of new shapes. - -The data model contains both the topology and the hooks, and functions handle both topological entities and hooks. Consider the case of a box function, which creates a solid with six faces and six hooks. Each hook is attached to a face. If you want, you can also have this function create hooks for edges and vertices as well as for faces. +See also: E-learning and Training. -Not all functions can define explicit hooks for all topological entities they create, but all topological entities can be turned into hooks when necessary. This is where topological naming is necessary. -Consider the following example. A box defines six hooks for the six faces, but a protrusion created on a face of the box can only define two hooks, one for the top face, and one for all the lateral faces. As the basic wire defining the protrusion may change in the future the protrusion function cannot designate the lateral faces without ambiguity, their number may change. Figure 6 illustrates this example, faces F1 to F6 of the box each have a hook. Faces F7 to F10, the lateral faces of the protrusion, share a single hook, and face F11, the top face, has one hook. +@section OCCT_TOVW_SECTION_8 Draw Test Harness -@figure{/technical_overview/images/technical_overview_occ_0068.png} - -This structure raises two problems: - - * the value of the face F6 attribute-hook has changed; - * no data can be attached to F7. - -When a hook designates multiple faces like F7-F10 (or the hook on F6 if F6 was split) -it is impossible to attach data to an individual face like F7. - -In fact, the protrusion has a trimmed face F6. As a result, the value of this face -has changed and the current value of the hook attached to it needs to be found. Note -that this face could have been split in two faces (for example if the function had -been a slot) and both new faces would have been attached to the same hook. - - -### Standard Attributes - - -Standard attributes are already existing ready-to-use attributes, which allow you -to create and modify labels and attributes for many basic data types. - -To find an attribute attached to a specific label, you use the GUID of the type of -attribute you are looking for. For this, find this information using the method - GetID and the method Find for the label as follows: - -~~~~ - Standard_GUID anID = MyAttributeClass::GetID(); - Standard_Boolean HasAttribute = aLabel.Find(anID,anAttribute); -~~~~ - -### Function Attributes - -A model consists of data and algorithms manipulating with data. OCAF attributes store data. -A Function attribute stores data corresponding to a Function (see the white paper @ref occt_user_guides__ocaf_functionmechanism_wp "Application Framework Function Mechanism"). -This mechanism manipulates with algorithms computing the model in the optimal way following the modifications. - -@subsection OCCT_TOVW_SECTION_7_3 Persistent Data Storage - -There are three schemes of persistence, which you can use to store and retrieve OCAF data (documents): - - * Standard persistence schema, compatible with previous OCAF applications - * XmlOcaf persistence, allowing the storage of all OCAF data in XML form - * BinOcaf persistence, allowing the storage of all OCAF data in binary format form - - -All schemes are independent of each other, but they guarantee that the standard OCAF -attributes stored and retrieved by one schema will be storable and retrievable by -the other. Therefore in any OCAF application you can use any persistence schema or -even all three of them. The choice is made by the Format string of stored OCAF documents -or automatically by the file header data - * on retrieval. - -Persistent data storage in OCAF using the Standard package is presented in: - - * Basic Data Storage - * Persistent Collections - -Persistent storage of shapes is presented in the following chapters: - - * Persistent Geometry - * Persistent Topology - -Finally, information about opening and saving persistent data is presented in Standard -Documents. - -@subsubsection OCCT_TOVW_SECTION_7_3_1 Basic Data Storage - -Normally, all data structures provided by Open CASCADE Technology are run-time structures, -in other words, transient data. As transient data, they exist only while an application -is running and are not stored permanently. However, the Data Storage module provides -resources, which enable an application to store data on disk as persistent data. - -Data storage services also provide libraries of persistent classes and translation -functions needed to translate data from transient to persistent state and vice-versa. - -#### Libraries of persistent classes - -Libraries of persistent classes are extensible libraries of elementary classes you -use to define the database schema of your application. They include: -* Unicode (8-bit or 16-bit character type) strings -* Collections of any kind of persistent data such as arrays. - -All persistent classes are derived from the \b Persistent base class, which defines -a unique way of creating and handling persistent objects. You create new persistent -classes by inheriting from this base class. - -#### Translation Functions - -Translation functions allow you to convert persistent objects to transient ones and -vice-versa. These translation functions are used to build Storage and Retrieval drivers -of an application. - -For each class of 2D and 3D geometric types, and for the general shape class in the -topological data structure library, there are corresponding persistent class libraries, -which allow you to translate your data with ease. - -#### Creation of Persistent Classes - -If you use Unix platforms as well as WOK and CDL, you can create your own persistent -classes. In this case, data storage is achieved by implementing *Storage* and *Retrieval* -drivers. - -The Storage package is used to write and read persistent objects. -These objects are read and written by a retrieval or storage algorithm -( Storage_Schema object) in a container (disk, memory, network ...). -Drivers ( FSD_File objects) assign a physical container for data to be stored or retrieved. - -The standard procedure for an application in reading a container is as follows: - -* open the driver in reading mode, -* call the Read function from the schema, setting the driver as a parameter. This function returns an instance of the Storage_Data class which contains the data being read, -* close the driver. - -The standard procedure for an application in writing a container is as follows: - -* open the driver in writing mode, -* create an instance of the Storage_Data class, then add the persistent data to write with the function AddRoot, -* call the function Write from the schema, setting the driver and the Storage_Data instance as parameters, -* close the driver. - -@subsubsection OCCT_TOVW_SECTION_7_3_2 Persistent Collections - -Persistent collections are classes which handle dynamically sized collections of data that can be stored in the database. These collections provide three categories of service: - - * persistent strings, - * generic arrays of data, - * commonly used instantiations of arrays. - -Persistent strings are concrete classes that handle sequences of characters based -on both ASCII (normal 8-bit) and Unicode (16-bit) character sets. - -Arrays are generic classes, that is, they can hold a variety of objects not necessarily inheriting from a unique root class. These arrays can be instantiated with any kind of storable or persistent object, and then inserted into the persistent data model of a user application. - -The purpose of these data collections is simply to convert transient data into its persistent equivalent so that it can be stored in the database. To this end, the collections are used to create the persistent data model and assure the link with the database. They do not provide editing or query capabilities because it is more efficient, within the operative data model of the application, to work with transient data structures (from the TCollection package). - -For this reason: - - * the persistent strings only provide constructors and functions to convert between transient and persistent strings, and - * the persistent data collections are limited to arrays. In other words, PCollection does not include sequences, lists, and so on (unlike TCollection). - -Persistent string and array classes are found in the PCollection package. In addition, PColStd package provides standard, and frequently used, instantiations of persistent arrays, for very simple objects. - -@subsubsection OCCT_TOVW_SECTION_7_3_3 Persistent Geometry - -The Persistent Geometry component describes geometric data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world". - -Persistent Geometry consists of a set of atomic data models parallel to the geometric data structures described in the geometry packages. Geometric data models, independent of each other, can appear within the data model of any application. The system provides the means to convert each atomic transient data model into a persistent one, but it does not provide a way for these data models to share data. - -Consequently, you can create a data model using these components, store data in, and retrieve it from a file or a database, using the geometric components provided in the transient and persistent "worlds". In other words, you customize the system by declaring your own objects, and the conversion of the geometric components from persistent to transient and vice versa is automatically managed for you by the system. - -However, these simple objects cannot be shared within a more complex data model. To allow data to be shared, you must provide additional tools. - -Persistent Geometry is provided by several packages. - -The PGeom package describes geometric persistent objects in 3D space, such as points, -vectors, positioning systems, curves and surfaces. - -These objects are persistent versions of those provided by the Geom package: for -each type of transient object provided by Geom there is a corresponding type of persistent -object in the PGeom package. In particular the inheritance structure is parallel. - -However the PGeom package does not provide any functions to construct, edit or access -the persistent objects. Instead the objects are manipulated as follows: - - * Persistent objects are constructed by converting the equivalent transient Geom objects. To do this you use the MgtGeom::Translate function. - * Persistent objects created in this way are used to build persistent data structures that are then stored in a file or database. - * When these objects are retrieved from the file or database, they are converted back into the corresponding transient objects from the Geom package. To do this, you use MgtGeom::Translate function. - -In other words, you always edit or query transient data structures within the transient -data model supplied by the session. -Consequently, the documentation for the PGeom package consists simply of a list of available objects. - -The PGeom2d package describes persistent geometric objects in 2D space, such as points, -vectors, positioning systems and curves. This package provides the same type of services -as the PGeom package, but for the 2D geometric objects provided by the Geom2d package. -Conversions are provided by the MgtGeom::Translate function. - -~~~~ -//Create a coordinate system -Handle(Geom_Axis2Placement) aSys; - - -//Create a persistent coordinate PTopoDS_HShape.cdlsystem -Handle(PGeom_Axis2placement) - aPSys = MgtGeom::Translate(aSys); - -//Restore a transient coordinate system -Handle(PGeom_Axis2Placement) aPSys; - -Handle(Geom_Axis2Placement) - aSys = MgtGeom::Translate(aPSys); -~~~~ - - -@subsubsection OCCT_TOVW_SECTION_7_3_4 Persistent Topology - -The Persistent Topology component describes topological data structures which can be stored in the database. These packages provide a way to convert data from the transient "world" to the persistent "world". - -Persistent Topology is based on the BRep concrete data model provided by the topology packages. Unlike the components of the Persistent Geometry package, topological components can be fully shared within a single model, as well as between several models. - -Each topological component is considered to be a shape: a TopoDS_Shape object. The system's capacity to convert a transient shape into a persistent shape and vice-versa applies to all objects, irrespective of their complexity: vertex, edge, wire, face, shell, solid, and so on. - -When a user creates a data model using BRep shapes, he uses the conversion functions that the system provides to store the data in, and retrieve it from the database. The data can also be shared. - -Persistent Topology is provided by several packages. - -The PTopoDS package describes the persistent data model associated with any BRep shape; it is the persistent version of any shape of type TopoDS_Shape. As is the case for persistent geometric models, this data structure is never edited or queried, it is simply stored in or retrieved from the database. It is created or converted by the MgtBRep::Translate function. - -The MgtBRepAbs and PTColStd packages provide tools used by the conversion functions of topological objects. - -~~~~ -//Create a shape -TopoDS_Shape aShape; - -//Create a persistent shape -PtColStd_DoubleTransientPersistentMap aMap; - -Handle(PTopoDS_HShape) aPShape = - aMap.Bind2(MgtBRep::Translate - aShape,aMap,MgtBRepAbs_WithTriangle)); - -aPShape.Nullify(); - -//Restore a transient shape -Handle(PTopoDS_HShape) aPShape; - -Handle(TopoDS_HShape) aShape = - aMap.Bind1(MgtBRep::Translate - (aPShape,aMap,MgtBRepAbs_WithTriangle)); - -aShape.Nullify(); -~~~~ - -@subsubsection OCCT_TOVW_SECTION_7_3_5 Standard Documents - -Standard documents offer you a ready-to-use document containing a TDF-based data -structure. The documents themselves are contained in a class inheriting from TDocStd_Application -which manages creation, storage and retrieval of documents. - -You can implement undo and redo in your document, and refer from the data framework -of one document to that of another one. This is done by means of external link attributes, -which store the path and the entry of external links. To sum up, standard documents -alone provide access to the data framework. They also allow you to: -*Update external links; -*Manage the saving and opening of data; -*Manage undo/redo functionality. - -@section OCCT_TOVW_SECTION_7a Draw Test Harness - -The Open CASCADE Test Harness, also called Draw, is an easy-to-use testing tool for the geometric modeling libraries. It can be used to test and demonstrate modeling components before building an entire application. It includes: +**Test Harness** or **Draw** is a convenient testing tool for OCCT libraries. It can be used to test and prototype various algorithms before building an entire application. It includes: - A command interpreter based on the TCL language; -- A 2D and a 3D viewer based on X on Unix and Win32 API on Windows; +- A number of 2D and 3D viewers; - A set of predefined commands. -The Test Harness is a single program written in C++, which can be called from interpreted commands. Predefined commands provide general-purpose services such as: +The viewers support operations such as zoom, pan, rotation and full-screen views. + +The basic commands provide general-purpose services such as: - Getting help; - Evaluating a script from a file; - Capturing commands in a file; - Managing views; - Displaying objects. -The viewers support operations such as zoom, pan, rotation and full-screen views. - -The Test Harness also provides geometric commands to create and manipulate curves and surfaces, and topological commands to create and manipulate shapes. Geometric and topological commands implement geometry and topology resources, and provide examples of their use. +In 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. -You can add new test harness commands to Draw in order to test or demonstrate a new functionality which you develop. +You can add custom commands to test or demonstrate any new functionalities, which you develop. For more details see @ref occt_user_guides__test_harness "Draw Test Harness Manual". - -@section OCCT_TOVW_SECTION_8 FAQ - -@subsection OCCT_TOVW_SECTION_8_1 Memory Management - -In a work-session, geometry modeling applications create and delete a certain number -of C++ objects. In this context, memory allocation and de-allocation standard functions -are not suited to the system's requirements and for this reason a specialized Memory -Manager is implemented into Open CASCADE Technology. The Memory Manager is based -on the following principles: - - * small memory arrays are grouped into clusters and then recycled (clusters are never released to the system), - * large arrays are allocated and de-allocated through the standard functions of the system (the arrays are released to system when they are no longer used). - -### The Reference Counter - -To lighten usual programming difficulties linked to the management of object life duration, before deleting an object, the user must ensure the object is no longer referenced and the delete function is secured by a reference counter. -A smart-pointer called *Handle* automates reference counter management and automatically deletes an object when it is no longer referenced. The application never calls the delete operator explicitly. To benefit from the memory manager in OCCT, transient classes must inherit from TShared. The principle of allocation is as follows: - -~~~~ - Handle (TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger; - // H1 has one reference and corresponds to 48 bytes of memory - { - Handle (TColStd_HSequenceOfInteger) H2; - H2 = H1; // H1 has two references - if (argc == 3) - { - Handle (TColStd_HSequenceOfInteger) H3; - H3 = H1; - // Here, H1 has three references - } - // Here, H1 has two references - } - // Here, H1 has 1 reference - } - // Here, H1 has no reference but the 48 bytes of memory are kept. - Handle (TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger; - // Here, H1 has one reference and corresponds to the preceding 48 bytes of - // memory. In this case, there is no allocation of memory. -~~~~ - -### Cycles - -As cycles are objects which reference one another, memory management is impossible if the data structure contains any cycles, particularly if there are back references. - -For example, objects in a graph include primitives and each one of these primitives has to know the graphic object to which it belongs (i.e. a reference to this graphic object). With normal references, the classical handle is used. With back references, a pointer is used. - -### Memory Consumption - - -As a general rule, it is advisable to allocate memory through significant blocks. -In this way, the user can work with blocks of contiguous data and it facilitates memory page manager processing. - -@subsection OCCT_TOVW_SECTION_8_2 How to define a handled object without CDL - -You can create a class manipulated by handle even if you do not use CDL (Open CASCADE Definition Language). -To do that you have to use the Define_Standard_Handle macro which is defined in the include file Standard_DefineHandle.hxx. - -Here is an example which shows how to define a class SamplePoint manipulated by handle. - -Sample_Point.hxx: ---------------- - -~~~~ - - #ifndef _Sample_Point_HeaderFile - #define _Sample_Point_HeaderFile - #ifndef _Standard_Macro_HeaderFile - #include - #endif - #include - #include - // Handle definition - // - - DEFINE_STANDARD_HANDLE(Sample_Point,MMgt_TShared) - class Sample_Point: public MMgt_TShared { - public: - Sample_Point(); - Sample_Point(const Standard_Real, const - Standard_Real); - void SetX(const Standard_Real x) { - myX = x; - } - void SetY(const Standard_Real y) { - myY = y; - } - Standard_Real X() const { - return myX; - } - Standard_Real Y() const { - return myY; - } - // some methods like DynamicType() or - IsKind() - // - DEFINE_STANDARD_RTTI(Sample_Point) - private: - Standard_Real myX; - Standard_Real myY; - }; - #endif - -~~~~ - -Sample_Point.cxx: ----------------- - -~~~~ - - #include - - // Implementation of Handle and type mgt - - IMPLEMENT_STANDARD_HANDLE(Sample_Point,MMgt_TShared) - IMPLEMENT_STANDARD_RTTI(Sample_Point,MMgt_TShared) - - // For ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and - // a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. - // We must respect the order: from the direct ancestor class to the base class. - - IMPLEMENT_STANDARD_TYPE(Sample_Point) - IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) - IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) - IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() - IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) - IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) - IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() - IMPLEMENT_STANDARD_TYPE_END(Sample_Point) - - // Constructors implementation - - Sample_Point::Sample_Point(const - Standard_Real x, const Standard_Real y) - { - myX = x; - myY = y; - } - Sample_Point::Sample_Point() - { - myX = 0.0; - myY = 0.0; - } -~~~~ - -@subsection OCCT_TOVW_SECTION_8_3 When is it necessary to use a handle? - -When designing an object, the user is faced with the choice of manipulating that -object by value, or by handle. - - * If your object may have a long lifetime within the application and you want to make multiple references to it, it would be preferable to manipulate this object with a handle. The memory for the object will be allocated on the heap. The handle which points to that memory is a light object which can be rapidly passed in argument. This avoids the penalty of copying a large object. - * If your object will have a limited lifetime, for example, used within a single algorithm, it would be preferable to manipulate this object by value, non-regarding its size, because this object is allocated on the stack and the allocation and de-allocation of memory is extremely rapid, which avoids the implicit calls to 'new' and 'delete' occasioned by allocation on the heap. - * Finally, if an object will be created only once during, but will exist throughout the lifetime of the application, the best choice may be a class manipulated by handle or a value declared as a global variable. - - -@subsection OCCT_TOVW_SECTION_8_4 How to cast shape handle to void - -You can easily cast a reference to the handle object to void* by defining the following: - -~~~~ - void *pointer; - Handle(Some_class) aHandle; - // Here only a pointer will be copied - Pointer = &aHandle; - // Here the Handle object will be copied - aHandle = * (Handle(Some_Class) *)pointer; -~~~~ - -@subsection OCCT_TOVW_SECTION_8_5 How to test correct ending of OCCT algorithms - -Generally OCCT algorithms implement IsDone method, which returns true -if computation has been performed successfully from beginning to end or false if computation has failed. - -When IsDone returns true, the computation is successful regarding -to the input data, but it does not necessary mean that you get a result. For example, if -you perform a cut algorithm between two shapes without any common part, the IsDone -method will return true, but the result will be empty. - -So, in some cases, it can be necessary to analyse the structure of a result before -using it again in following computations. These tests are not done systematically -into algorithms to get faster computations. The application performs necessary tests -depending on the context. - -@subsection OCCT_TOVW_SECTION_8_6 How to cut, copy and paste inside a document - -To cut, copy and paste inside a document, you must use the CopyLabel class from the TDF package. -In fact, you must define a Label which contains the temporary value a cut or -copy operation (say, in Lab_Clipboard). You must also define two other labels: - -* One containing the data (e.g. Lab_source) -* One for the destination of the copy (e.g. Lab_ Target ) - -~~~~ - Copy = copy (Lab_Source => Lab_Clipboard) - Cut = copy + Lab_Source.ForgetAll() // command clear the contents of LabelSource. - Paste = copy (Lab_Clipboard => Lab_target) -~~~~ - -So we need a tool to copy all (or a part) of the content of a label and its sub-label, -to another place defined by a label. - -~~~~ - TDF_CopyLabel aCopy; - TDF_IDFilter aFilter (Standard_False); - - //Don't copy TDataStd_TreeNode attribute - - aFilter.Ignore(TDataStd_TreeNode::GetDefaultTreeID()); - aCopy.Load(aSource, aTarget); aCopy.UseFilter(aFilter); aCopy.Perform(); - - // copy the data structure to clipboard - - return aCopy.IsDone(); } -~~~~ - -The filter is used to forbid copying a specified type of attribute. -You can also have a look at *TDF_Closure**, -which can be useful to determine the dependencies of the part you want to cut from the document. - -@subsection OCCT_TOVW_SECTION_8_7 Platform-related problems - -### Dynamic library loading - -Open CASCADE Technology uses a dynamic library loading mode. Sometimes, the error message such as the following appears: - -~~~~ - "cannot map libname.so .. under any of the filenames .." -~~~~ - -When this happens, check your *PATH* under Windows, *LD_LIBRARY_PATH* under UNIX, or *DYLD_LIBRARY_PATH* under Mac OS X. -It should contain the path where the required dynamic library is located. - -### Running Draw under Windows - - -When running DRAWEXE and using axo in the Command window you may see the "Invalid command name "axo" " message : - -Make sure that the OCCT directory name does not contain any blank spaces. -It causes some problems when reading the OCCT description TCL Commands files. -If you have set DRAWHOME and DRAWDEFAULT, replace \\ by / in the variable. - -### Error on application start on Windows - -If Windows shows an error message with the text *Application failed to initialize properly* -upon launching the application, check access rights for all libraries used in the application, in particular, third-party libraries. - -Make sure that you have all rights necessary to access these libraries. -It is recommended to use option *Inherit access rights from parent*. - -### Problems with 3D viewer - -If the 3D viewer fails to display the scene properly, or works very slowly, or exhibits -another problem, make sure to have the latest version of the graphics card driver -installed. If this is not possible or does not help, try to decrease -hardware acceleration level (usually found in Troubleshooting section of the graphics card properties). diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index 4670c8666d..98afd46f33 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -4790,7 +4790,7 @@ circle c 50 0 0 20 revsurf s c 0 0 0 0 1 0 ~~~~~ -@subsubsection occt_draw_6_3*11 extsurf +@subsubsection occt_draw_6_3_11 extsurf Syntax: ~~~~~ diff --git a/dox/user_guides/modeling_algos/modeling_algos.md b/dox/user_guides/modeling_algos/modeling_algos.md index 7f7ed3ff53..b4ebb4eae2 100644 --- a/dox/user_guides/modeling_algos/modeling_algos.md +++ b/dox/user_guides/modeling_algos/modeling_algos.md @@ -195,7 +195,7 @@ AnInterpolator.Load (StartingTangent, EndingTangent); @subsection occt_modalg_2_4 Lines and Circles from Constraints -@subsibsection occt_modalg_2_4_1 Types of constraints +@subsubsection occt_modalg_2_4_1 Types of constraints The algorithms for construction of 2D circles or lines can be described with numeric or geometric constraints in relation to other curves. @@ -244,7 +244,7 @@ GccAna_Circ2d2TanRad This expression finds all circles of radius *Rad*, which are tangent to both circle *C1* and *C2*, while *C1* is outside and *C2* is inside. -@subsection occt_modalg_2_4_2 Available types of lines and circles +@subsubsection occt_modalg_2_4_2 Available types of lines and circles The following analytic algorithms using value-handled entities for creation of 2D lines or circles with geometric constraints are available: * circle tangent to three elements (lines, circles, curves, points), @@ -448,7 +448,7 @@ GccAna_Circ2d2TanRad Solver(GccEnt::Unqualified(C1), ~~~~~ -@subsection occt_modalg_2_4_2 Types of algorithms +@subsubsection occt_modalg_2_4_3 Types of algorithms OCCT implements several categories of algorithms: @@ -555,7 +555,7 @@ The class *GeomFill_BezierCurves* allows producing a Bezier surface from contigu The class *GeomFill_BSplineCurves* allows producing a BSpline surface from contiguous BSpline curves. Note that problems may occur with rational BSplines. -@subsubsection occt_modalg_2_5_2 Pipe Surfaces +@subsubsection occt_modalg_2_5_3 Pipe Surfaces The class *GeomFill_Pipe* allows producing a pipe by sweeping a curve (the section) along another curve (the path). The result is a BSpline surface. @@ -565,14 +565,14 @@ The following types of construction are available: * pipes with a section evolving between two given curves. -@subsubsection occt_modalg_2_5_3 Filling a contour +@subsubsection occt_modalg_2_5_4 Filling a contour It is often convenient to create a surface from two or more curves which will form the boundaries that define the new surface. This is done by the class *GeomFill_ConstrainedFilling*, which allows filling a contour defined by two, three or four curves as well as by tangency constraints. The resulting surface is a BSpline. A case in point is the intersection of two fillets at a corner. If the radius of the fillet on one edge is different from that of the fillet on another, it becomes impossible to sew together all the edges of the resulting surfaces. This leaves a gap in the overall surface of the object which you are constructing. -@figure{/technical_overview/images/modeling_algos_image059.png,"Intersecting filleted edges with differing radiuses"} +@figure{/user_guides/modeling_algos/images/modeling_algos_image059.png,"Intersecting filleted edges with differing radiuses"} These algorithms allow you to fill this gap from two, three or four curves. This can be done with or without constraints, and the resulting surface will be either a Bezier or a BSpline surface in one of a range of filling styles. @@ -595,7 +595,7 @@ The enumerations *FillingStyle* specify the styles used to build the surface. Th @image html /user_guides/modeling_algos/images/modeling_algos_image018.png "Intersecting filleted edges with different radii leave a gap, is filled by a surface" @image latex /user_guides/modeling_algos/images/modeling_algos_image018.png "Intersecting filleted edges with different radii leave a gap, is filled by a surface" -@subsubsection occt_modalg_2_5_4 Plate surfaces +@subsubsection occt_modalg_2_5_5 Plate surfaces In CAD, it is often necessary to generate a surface which has no exact mathematical definition, but which is defined by respective constraints. These can be of a mathematical, a technical or an aesthetic order. @@ -605,7 +605,7 @@ curve constraints and the point constraint respectively. The resulting surface c The surface is built using a variational spline algorithm. It uses the principle of deformation of a thin plate by localised mechanical forces. If not already given in the input, an initial surface is calculated. This corresponds to the plate prior to deformation. Then, the algorithm is called to calculate the final surface. It looks for a solution satisfying constraints and minimizing energy input. -@figure{/technical_overview/images/modeling_algos_image061.png,"Surface generated from two curves and a point"} +@figure{/user_guides/modeling_algos/images/modeling_algos_image061.png,"Surface generated from two curves and a point"} The package *GeomPlate* provides the following services for creating surfaces respecting curve and point constraints: @@ -631,7 +631,7 @@ The class *Surface* allows describing the characteristics of plate surface objec The class *MakeApprox* allows converting a *GeomPlate* surface into a *Geom_BSplineSurface*. -@figure{/technical_overview/images/modeling_algos_image060.png,"Surface generated from four curves and a point"} +@figure{/user_guides/modeling_algos/images/modeling_algos_image060.png,"Surface generated from four curves and a point"} Let us create a Plate surface and approximate it from a polyline as a curve constraint and a point constraint @@ -1200,7 +1200,7 @@ There are two root classes for their construction and modification: * The deferred class *BRepBuilderAPI_MakeShape* is the root of all *BRepBuilderAPI* classes, which build shapes. It inherits from the class *BRepBuilderAPI_Command* and provides a field to store the constructed shape. * The deferred class *BRepBuilderAPI_ModifyShape* is used as a root for the shape modifications. It inherits *BRepBuilderAPI_MakeShape* and implements the methods used to trace the history of all sub-shapes. -@subection occt_modalg_3_1 Vertex +@subsection occt_modalg_3_1 Vertex *BRepBuilderAPI_MakeVertex* creates a new vertex from a 3D point from gp. ~~~~~ diff --git a/dox/user_guides/visualization/visualization.md b/dox/user_guides/visualization/visualization.md index bbd15519c8..2ab7198612 100644 --- a/dox/user_guides/visualization/visualization.md +++ b/dox/user_guides/visualization/visualization.md @@ -4,7 +4,7 @@ Visualization {#occt_user_guides__visualization} @section occt_visu_1 Introduction -Visualization in Open CASCADE Technology is based on the separation of: +Visualization in Open CASCADE Technology is based on the separation of: * on the one hand - the data which stores the geometry and topology of the entities you want to display and select, and * on the other hand - its **presentation** (what you see when an object is displayed in a scene) and **selection** (possibility to choose the whole object or its sub-parts interactively to apply application-defined operations to the selected entities). @@ -16,7 +16,7 @@ Presentations are managed through the **Presentation** component, and selection If, however, you require types of interactive objects and filters other than those provided, you will need to know the mechanics of presentable and selectable objects, specifically how to implement their virtual functions. To do this requires familiarity with such fundamental concepts as the sensitive primitive and the presentable object. -The the following packages are used to display 3D objects : +The the following packages are used to display 3D objects: * *AIS*; * *StdPrs*; * *Prs3d*; @@ -31,12 +31,12 @@ The figure below presents a schematic overview of the relations between the key @image html visualization_image003.png "Key concepts and packages in visualization" @image latex visualization_image003.png "Key concepts and packages in visualization" -To answer different needs of CASCADE users, this User’s Guide offers the following three paths in reading it. -  +To answer different needs of CASCADE users, this User's Guide offers the following three paths in reading it. + * If the 3D services proposed in AIS meet your requirements, you need only read chapter 3 AIS: Application Interactive Services. * If you need more detail, for example, a selection filter on another type of entity - you should read chapter 2 Fundamental Concepts, chapter 3 AIS: Application Interactive Services, and 4 3D Presentations. You may want to begin with the chapter presenting AIS. -@section occt_visu_2  Fundamental Concepts +@section occt_visu_2 Fundamental Concepts @subsection occt_visu_2_1 Presentation @@ -44,7 +44,7 @@ In Open CASCADE Technology, presentation services are separated from the data, @subsubsection occt_visu_2_1_1 Structure of the Presentation -Displaying an object on the screen involves three kinds of entities: +Displaying an object on the screen involves three kinds of entities: * a presentable object, the *AIS_InteractiveObject* * a viewer * an interactive context, the *AIS_InteractiveContext*. @@ -71,16 +71,16 @@ Presentation involves at least the *AIS, PrsMgr, StdPrs* and *V3d* packages. Ad * *StdPrs* package provides ready-to-use standard presentation algorithms for specific geometries: points, curves and shapes of the geometry and topology toolkits. * *Prs3d* package provides generic presentation algorithms such as wireframe, shading and hidden line removal associated with a *Drawer* class, which controls the attributes of the presentation to be created in terms of color, line type, thickness, etc. * *V3d* package provides the services supported by the 3D viewer. -* *Graphic3d* package provides resources to create 3D graphic structures. +* *Graphic3d* package provides resources to create 3D graphic structures. * *Visual3d* package contains classes implementing commands for 3D viewer. * *DsgPrs* package provides tools for display of dimensions, relations and XYZ trihedrons. @subsubsection occt_visu_2_1_3 A Basic Example: How to display a 3D object ~~~~~ -Void Standard_Real dx  = ...; //Parameters -Void Standard_Real dy  = ...; //to build a wedge -Void Standard_Real dz  = ...; +Void Standard_Real dx = ...; //Parameters +Void Standard_Real dy = ...; //to build a wedge +Void Standard_Real dz = ...; Void Standard_Real ltx = ...; Handle(V3d_Viewer)aViewer = ...; @@ -104,29 +104,29 @@ The shape is created using the *BRepPrimAPI_MakeWedge* command. An *AIS_Shape* Objects that may be selected graphically, are displayed as sets of sensitive primitives, which provide sensitive zones in 2D graphic space. These zones are sorted according to their position on the screen when starting the selection process. -@image html visualization_image006.png "A model" -@image latex visualization_image006.png "A model" +@image html visualization_image006.png "A model" +@image latex visualization_image006.png "A model" The position of the mouse is also associated with a sensitive zone. When moving within the window where objects are displayed, the areas touched by the zone of the mouse are analyzed. The owners of these areas are then highlighted or signaled by other means such as the name of the object highlighted in a list. That way, you are informed of the identity of the detected element. @image html visualization_image007.png "Modeling faces with sensitive primitives" @image latex visualization_image007.png "Modeling faces with sensitive primitives" -@image html visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle"   +@image html visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle" @image latex visualization_image008.png "In a dynamic selection, each sensitive polygon is represented by its bounding rectangle" @image html visualization_image009.png "Reference to the sensitive primitive, then to the owner" @image latex visualization_image009.png "Reference to the sensitive primitive, then to the owner" -@subsubsection occt_visu_2_2_1 The Sensitive Primitive +@subsubsection occt_visu_2_2_1 The Sensitive Primitive The sensitive primitive along with the entity owner allows defining what can be made selectable, and providing the link between the applicative object and the sensitive zones defined by the 2D bounding boxes. To be dynamically selectable, an object has to be represented either as a sensitive primitive or a set of them, e.g. 2D boxes that will be included in a sorting algorithm. -The use of 2D boxes allows a pre-selection of the detected entities. After pre-selection, the algorithm checks which sensitive primitives are actually detected. When detected, the primitives provide their owners’ identity. +The use of 2D boxes allows a pre-selection of the detected entities. After pre-selection, the algorithm checks which sensitive primitives are actually detected. When detected, the primitives provide their owners' identity. @image html visualization_image010.png "Example of sensitive primitives" -@image latex visualization_image010.png "Example of sensitive primitives" +@image latex visualization_image010.png "Example of sensitive primitives" In the example, the sensitive line segment proposes a bounding box to the selector. During selection, positions 1 and 2 of the mouse detect the box but after sorting, only position 2 retains the line segment as selected by the algorithm. @@ -148,7 +148,7 @@ as the mouse cursor moves over them. This allows the user to be certain that th

Selectable Object

-A selectable object presents a given number of selection modes which can be redefined, and which will be activated or deactivated in the selection manager’s selectors. +A selectable object presents a given number of selection modes which can be redefined, and which will be activated or deactivated in the selection manager's selectors. Note that the selection mode of a selectable object, can refer to the selection mode of the object itself or to the selection mode of its part. @@ -167,7 +167,7 @@ See also AIS: Application Interactive Services. Let us consider, for example, a 3D selectable shape object, which corresponds to a topological shape. For this class, seven selection modes can be defined: -* mode 0 - selection of the shape itself +* mode 0 - selection of the shape itself * mode 1 - selection of vertices * mode 2 - selection of edges * mode 3 - selection of wires @@ -335,7 +335,7 @@ When all these steps have been carried out, follow the procedure below: 1. Create an interactive context. 2. Create the selectable objects and calculate their various possible selections. 3. Load these selectable objects in the interactive context. The objects may be common to all the selectors, i.e. they will be seen by all the selectors in the selection manager, or local to one selector or more. -4. Activate or deactivate the objects’ selection modes in the selector(s). When activating a selection mode in a selector for a given object, the manager sends the order to make the sensitive primitives in this selector selectable. If the primitives are to projected from 3D to 2D, the selector calls the specific method used to carry out this projection. +4. Activate or deactivate the objects' selection modes in the selector(s). When activating a selection mode in a selector for a given object, the manager sends the order to make the sensitive primitives in this selector selectable. If the primitives are to projected from 3D to 2D, the selector calls the specific method used to carry out this projection. At this stage, the selection of selectable entities in the selectors is available. The selection loop informs constantly the selectors with the position of the mouse and questions them about the detected entities. @@ -361,11 +361,11 @@ To build the selection, which corresponds to the mode "selection of the rooms" Void House::ComputeSelection (Const Handle(SelectMgr_Selection)& Sel, -  const Standard_Integer mode { -  switch(mode){   + const Standard_Integer mode { + switch(mode){ case 0: //Selection of the rooms - {   - for(Standard_Integer i = 1; i <= myNbRooms; i++)   + { + for(Standard_Integer i = 1; i <= myNbRooms; i++) { //for every room, create an instance of the owner, the given room and its name. Handle(RoomOwner) aRoomOwner = new RoomOwner (Room(i), NameRoom(i)); @@ -373,10 +373,10 @@ Void House::ComputeSelection Handle(Select3d_SensitiveBox) aSensitiveBox; aSensitiveBox = new Select3d_SensitiveBox (aRoomOwner, Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); -  Sel -> Add(aSensitiveBox);   - }   - break;   - Case 1: ... //Selection of the doors   + Sel -> Add(aSensitiveBox); + } + break; + Case 1: ... //Selection of the doors } //Switch ) // ComputeSelection ~~~~~ @@ -387,8 +387,8 @@ Void House::ComputeSelection @image html visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1" @image latex visualization_image013.png "Activated sensitive rectangles in the selector during dynamic selection in view 1" -@image html visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)" -@image latex visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)" +@image html visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)" +@image latex visualization_image014.png "Activated sensitive polygons corresponding to selection mode 1 (selection of doors)" @image html visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2" @image latex visualization_image015.png "Sensitive rectangles in the selector during dynamic selection in view 2" @@ -448,20 +448,20 @@ If you are creating your own type of interactive object, you must implement the ~~~~~ void PackageName_ClassName::Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, -  const Handle(Prs3d_Presentation)& aPresentation, -  const Standard_Integer aMode = 0); + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode = 0); ~~~~~ #### For hidden line removal (HLR) mode in 3D: ~~~~~ void PackageName_ClassName::Compute (const Handle(Prs3d_Projector)& aProjector, -  const Handle(Prs3d_Presentation)& aPresentation); + const Handle(Prs3d_Presentation)& aPresentation); ~~~~~ @subsubsection occt_visu_3_2_2 Hidden Line Removal -The view can have two states: the normal mode or the computed mode (Hidden Line Removal mode). When the latter is active, the view looks for all presentations displayed in the normal mode, which have been signalled as accepting HLR mode. An internal mechanism allows calling the interactive object’s own *Compute*, that is projector function. +The view can have two states: the normal mode or the computed mode (Hidden Line Removal mode). When the latter is active, the view looks for all presentations displayed in the normal mode, which have been signalled as accepting HLR mode. An internal mechanism allows calling the interactive object's own *Compute*, that is projector function. By convention, the Interactive Object accepts or rejects the representation of HLR mode. It is possible to make this declaration in one of two ways: @@ -472,8 +472,8 @@ By convention, the Interactive Object accepts or rejects the representation of * Later by using the function *PrsMgr_PresentableObject::SetTypeOfPresentation* *AIS_Shape* class is an example of an interactive object that supports HLR representation. It supports two types of the HLR algorithm: -* the polygonal algorithm based on the shape’s triangulation; -* the exact algorithm that works with the shape’s real geometry. +* the polygonal algorithm based on the shape's triangulation; +* the exact algorithm that works with the shape's real geometry. The type of the HLR algorithm is stored in *AIS_Drawer* of the shape. It is a value of the *Prs3d_TypeOfHLR* enumeration and can be set to: * *Prs3d_TOH_PolyAlgo* for a polygonal algorithm; @@ -521,17 +521,17 @@ Note that the same presentation (and consequently the same highlight mode) is u For example, you want to systematically highlight the wireframe presentation of a shape - non regarding if it is visualized in wireframe presentation or with shading. Thus, you set the highlight mode to *0* in the constructor of the interactive object. Do not forget to implement this representation mode in the *Compute* functions. #### Infinite Status -If you don’t want an object to be affected by a *FitAll* view, you must declare it infinite; you can cancel its "infinite" status using *AIS_InteractiveObject::SetInfiniteState* and *AIS_InteractiveObject::IsInfinite* functions. +If you do not want an object to be affected by a *FitAll* view, you must declare it infinite; you can cancel its "infinite" status using *AIS_InteractiveObject::SetInfiniteState* and *AIS_InteractiveObject::IsInfinite* functions. Let us take for example the class called *IShape* representing an interactive object : ~~~~~ myPk_IShape::myPK_IShape (const TopoDS_Shape& SH, PrsMgr_TypeOfPresentation aType): - AIS_InteractiveObject(aType), myShape(SH), myDrwr(new AIS_Drawer()) {SetHilightMode(0);}  + AIS_InteractiveObject(aType), myShape(SH), myDrwr(new AIS_Drawer()) {SetHilightMode(0);} void myPk_IShape::Compute (const Handle(PrsMgr_PresentationManager3d) & PM, - const Handle(Prs3d_Presentation)& P,   + const Handle(Prs3d_Presentation)& P, const Standard_Integer TheMode) { switch (TheMode){ @@ -577,7 +577,7 @@ These functions can be useful if you decide that the *0* mode used by default w * *AIS_InteractiveObject::SetSelectionPriority* sets a priority; * *AIS_InteractiveObject::UnsetSelectionPriority* unsets the priority. -     + @subsubsection occt_visu_3_2_5 Graphic attributes Graphic attributes manager, or *AIS Drawer*, stores graphic attributes for specific interactive objects and for interactive objects controlled by interactive context. @@ -603,7 +603,7 @@ The following virtual functions provide settings for color, width, material and * *AIS_InteractiveObject::SetWidth* * *AIS_InteractiveObject::UnsetWidth* * *AIS_InteractiveObject::SetMaterial (const Graphic3d_NameOfPhysicalMaterial & aName)* - * *AIS_InteractiveObject::SetMaterial  (const Graphic3d_MaterialAspect & aMat)* + * *AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect & aMat)* * *AIS_InteractiveObject::UnsetMaterial* * *AIS_InteractiveObject::SetTransparency* * *AIS_InteractiveObject::UnsetTransparency* @@ -645,7 +645,7 @@ Due to the fact that the accuracy of three-dimensional graphics coordinates has To the problem when the elements of two or more Interactive Objects are coincident you can apply the polygon offset. It is a sort of graphics computational offset, or depth buffer offset, that allows you to arrange elements (by modifying their depth value) without changing their coordinates. The graphical elements that accept this kind of offsets are solid polygons or displayed as boundary lines and points. The polygons could be displayed as lines or points by setting the appropriate interior style. -The method *AIS_InteractiveObject::SetPolygonOffsets (const Standard_Integer aMode, const Standard_Real aFactor, const Standard_Real aUnits)* allows setting up the polygon offsets. +The method *AIS_InteractiveObject::SetPolygonOffsets (const Standard_Integer aMode, const Standard_Real aFactor, const Standard_Real aUnits)* allows setting up the polygon offsets. The parameter *aMode* can contain various combinations of *Aspect_PolygonOffsetMode* enumeration elements: * *Aspect_POM_None* @@ -665,14 +665,14 @@ Negative offset values move polygons closer to the viewer while positive values **Warning** -This method has a side effect – it creates its own shading aspect if not yet created, so it is better to set up the object shading aspect first. +This method has a side effect - it creates its own shading aspect if not yet created, so it is better to set up the object shading aspect first. You can use the following functions to obtain the current settings for polygon offsets: ~~~~~ void AIS_InteractiveObject::PolygonOffsets (Standard_Integer &aMode, -  Standard_Real &aFactor, -  Standard_Real &aUnits) + Standard_Real &aFactor, + Standard_Real &aUnits) Standard_Boolean AIS_InteractiveObject::HasPolygonOffsets() ~~~~~ @@ -680,15 +680,15 @@ The same operation could be performed for the interactive object known by the * ~~~~~ void AIS_InteractiveContext::SetPolygonOffsets (const Handle(AIS_InteractiveObject) &anObj, -  const Standard_Integer aMode, -  const Standard_Real aFactor, -  const Standard_Real aUnits) + const Standard_Integer aMode, + const Standard_Real aFactor, + const Standard_Real aUnits) void AIS_InteractiveContext::PolygonOffsets (const Handle(AIS_InteractiveObject) &anObj, -  Standard_Integer &aMode, -  Standard_Real &aFactor, -  Standard_Real &aUnits) -Standard_Boolean     AIS_InteractiveContext::HasPolygonOffsets + Standard_Integer &aMode, + Standard_Real &aFactor, + Standard_Real &aUnits) +Standard_Boolean AIS_InteractiveContext::HasPolygonOffsets (const Handle(AIS_InteractiveObject) &anObj) ~~~~~ @@ -803,7 +803,7 @@ Closing Local Contexts is done by: ~~~~~ *Warning* -When the index isn’t specified in the first function, the current Context is closed. This option can be dangerous, as other Interactive Functions can open local contexts without necessarily warning the user. For greater security, you have to close the context with the index given on opening. +When the index is not specified in the first function, the current Context is closed. This option can be dangerous, as other Interactive Functions can open local contexts without necessarily warning the user. For greater security, you have to close the context with the index given on opening. To get the index of the current context, use function *AIS_InteractiveContext::IndexOfCurrentLocal*. It allows closing all open local contexts at one go. In this case, you find yourself directly at Neutral Point. @@ -819,14 +819,14 @@ Neutral Point should be used to visualize the interactive objects, which repres ~~~~~ AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& anIobj, -  const Standard_Boolean updateviewer=Standard_True); + const Standard_Boolean updateviewer=Standard_True); AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& anIobj, -  const Standard_Integer amode, -  const Standard_Integer aSelectionMode, -  const Standard_Boolean updateviewer = Standard_True, -  const Standard_Boolean allowdecomposition = Standard_True); + const Standard_Integer amode, + const Standard_Integer aSelectionMode, + const Standard_Boolean updateviewer = Standard_True, + const Standard_Boolean allowdecomposition = Standard_True); AIS_InteractiveContext::Erase AIS_InteractiveContext::EraseMode @@ -840,12 +840,12 @@ AIS_InteractiveContext::Display Bear in mind the following points: * It is recommended to display and erase interactive objects when no local context is opened, and open a local context for local selection only. - * The first *Display* function among the two ones available in *InteractiveContext* visualizes the object in its default mode (set with help of SetDisplayMode() method of InteractiveObject prior to Display() call), or in the default context mode, if applicable. If it has neither, the function displays it in 0 presentation mode. The object’s default selection mode is automatically activated (0 mode by convention). + * The first *Display* function among the two ones available in *InteractiveContext* visualizes the object in its default mode (set with help of SetDisplayMode() method of InteractiveObject prior to Display() call), or in the default context mode, if applicable. If it has neither, the function displays it in 0 presentation mode. The object's default selection mode is automatically activated (0 mode by convention). * Activating the displayed object by default can be turned off with help of *SetAutoActivateSelection()* method. This might be efficient if you are not interested in selection immediately after displaying an object. * The second *Display* function should only be used in Neutral Point to visualize a supplementary mode for the object, which you can erase by *EraseMode (...)*. You activate the selection mode. This is passed as an argument. By convention, if you do not want to activate a selection mode, you must set the *SelectionMode* argument to -1. This function is especially interesting in open local context, as we will see below. * In Neutral Point, it is not advisable to activate other selection modes than the default selection one. It is preferable to open a local context in order to activate particular selection modes. * When you call *Erase(Interactive object)* function, the *PutIncollector* argument, which is *FALSE* by default, allows you to visualize the object directly in the Collector and makes it selectable (by activation of 0 mode). You can nonetheless block its passage through the Collector by changing the value of this option. In this case, the object is present in the Interactive Context, but is not seen anywhere. - * *Erase()* with *putInCollector = Standard_True* might be slow as it recomputes the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the object’s presentation temporarily. + * *Erase()* with *putInCollector = Standard_True* might be slow as it recomputes the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the object's presentation temporarily. * Visualization attributes and graphic behavior can be modified through a set of functions similar to those for the interactive object (color, thickness of line, material, transparency, locations, etc.) The context then manages immediate and deferred updates. * Call *Remove()* method of *InteractiveContext* as soon as the interactive object is no longer needed and you want to destroy it.. Otherwise, references to *InteractiveObject* are kept by *InteractiveContext*, and the *Object* is not destroyed, which results in memory leaks. In general, if the presentation of an interactive object can be computed quickly, it is recommended to *Remove()* it instead of using *Erase()* method. @@ -855,7 +855,7 @@ In open local context, the *Display* functions presented above can be as well. **WARNING** -The function *AIS_InteractiveObject::Display* automatically activates the object’s default selection mode. When you only want to visualize an Interactive Object in open Context, you must call the function *AIS_InteractiveContext::Display*. +The function *AIS_InteractiveObject::Display* automatically activates the object's default selection mode. When you only want to visualize an Interactive Object in open Context, you must call the function *AIS_InteractiveContext::Display*. You can activate or deactivate specific selection modes in the local open context in several different ways: Use the Display functions with the appropriate modes. @@ -934,7 +934,7 @@ myContext->Display(myAIShape,1,-1,Standard_True,Standard_True); Handle(StdSelect_FaceFilter) Fil1= new StdSelect_FaceFilter(StdSelect_Revol); Handle(StdSelect_FaceFilter) Fil2= new -      StdSelect_FaceFilter(StdSelect_Plane); + StdSelect_FaceFilter(StdSelect_Plane); myContext->AddFilter(Fil1); myContext->AddFilter(Fil2); @@ -1004,7 +1004,7 @@ while (myAISCtx->MoreSelected()) { TopoDS_Shape ashape = myAISCtx->SelectedShape(); // to be able to use the picked shape -             } + } else { Handle_AIS_InteractiveObject anyobj = myAISCtx->Interactive(); @@ -1080,8 +1080,8 @@ For your applicative function, you need an axis to create a revolved object. Yo ~~~~~ myIHMEditor::myIHMEditor (const Handle(AIS_InteractiveContext)& Ctx, -  ....) : -  myCtx(Ctx), + ....) : + myCtx(Ctx), ... { } @@ -1092,7 +1092,7 @@ myIndex =myCtx->OpenLocalContext(); //the filters -Handle(AIS_SignatureFilter) F1 = new  AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Point); +Handle(AIS_SignatureFilter) F1 = new AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Point); //filter on the points Handle(AIS_SignatureFilter) F2 = new AIS_SignatureFilter(AIS_KOI_Datum,AIS_SD_Axis); @@ -1122,8 +1122,8 @@ Standard_Boolean myIHMEditor::Select() myCTX->Select(); myCTX->InitSelected(); if(myCTX->MoreSelected()) -  { -  if(myCTX->HasSelectedShape()) + { + if(myCTX->HasSelectedShape()) { const TopoDS_Shape& sh = myCTX->SelectedShape(); if( vertex){ if(myFirstV...) @@ -1136,19 +1136,19 @@ Standard_Boolean myIHMEditor::Select() // the filter on the AIS_Points myFirstV = Standard_False; return Standard_True; -  } + } else -  { + { mypoint2 =...; // construction of the axis return Standard_False; } -  } -  else -   { + } + else + { //it is a cylindrical face : you recover the axis; visualize it; and stock it. return Standard_False; } -   } + } // it is not a shape but is no doubt a point. else { @@ -1242,7 +1242,7 @@ And at maximum seven selection modes, depending on the shape complexity: * *AIS_Triangulation* is a simple interactive object for displaying triangular mesh contained in *Poly_Triangulation* container. * *AIS_ConnectedInteractive* is an Interactive Object connecting to another interactive object reference, and located elsewhere in the viewer makes it possible not to calculate presentation and selection, but to deduce them from your object reference. - * *AIS_ConnectedShape* is an object connected to interactive objects having a shape; this class has the same decompositions as *AIS_Shape*. What’s more, it allows a presentation of hidden parts, which are calculated automatically from the shape of its reference. + * *AIS_ConnectedShape* is an object connected to interactive objects having a shape; this class has the same decompositions as *AIS_Shape*. Furthermore, it allows a presentation of hidden parts, which are calculated automatically from the shape of its reference. * *AIS_MultipleConnectedInteractive* is an object connected to a list of interactive objects (which can also be Connected objects. It does not require memory hungry calculations of presentation) * *AIS_MultipleConnectedShape* is an interactive Object connected to a list of interactive objects having a Shape (AIS_Shape, AIS_ConnectedShape, AIS_MultipleConnectedShape). The presentation of hidden parts is calculated automatically. * *AIS_TexturedShape* is an Interactive Object that supports texture mapping. It is constructed as a usual AIS_Shape, but has additional methods that allow to map a texture on it. @@ -1319,7 +1319,7 @@ The list of relations is not exhaustive. *MeshVS_Mesh* is an Interactive Object that represents meshes. This object differs from the *AIS_Shape* as its geometrical data is supported by the data source *MeshVS_DataSource* that describes nodes and elements of the object. As a result, you can provide your own data source. -However, the *DataSource* does not provide any information on attributes, for example nodal colors, but you can apply them in a special way – by choosing the appropriate presentation builder. +However, the *DataSource* does not provide any information on attributes, for example nodal colors, but you can apply them in a special way - by choosing the appropriate presentation builder. The presentations of *MeshVS_Mesh* are built with the presentation builders *MeshVS_PrsBuilder*. You can choose between the builders to represent the object in a different way. Moreover, you can redefine the base builder class and provide your own presentation builder. @@ -1391,14 +1391,14 @@ aMesh->AddBuilder (aBuilder, Standard_True); *MeshVS_NodalColorPrsBuilder* allows representing a mesh with a color scaled texture mapped on it. To do this you should define a color map for the color scale, pass this map to the presentation builder, -and define an appropriate value in the range of 0.0 – 1.0 for every node. +and define an appropriate value in the range of 0.0 - 1.0 for every node. The following example demonstrates how you can do this (check if the view has been set up to display textures): ~~~~~ // assign nodal builder to the mesh Handle (MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder -    (aMesh,MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); + (aMesh,MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); aBuilder->UseTexture (Standard_True); // prepare color map @@ -1408,10 +1408,10 @@ aColorMap.Append ((Quantity_NameOfColor) Quantity_NOC_BLUE1); // assign color scale map values (0..1) to nodes TColStd_DataMapOfIntegerReal aScaleMap; -… +... // iterate through the nodes and add an node id and an appropriate value to the map aScaleMap.Bind (anId, aValue); -  + // pass color map and color scale values to the builder aBuilder->SetColorMap (aColorMap); aBuilder->SetInvalidColor (Quantity_NOC_BLACK); @@ -1474,7 +1474,7 @@ The *ComputeSelection* function for the interactive box can have the following ~~~~~ void InteractiveBox::ComputeSelection (const Handle(SelectMgr_Selection)& Sel, -  const Standard_Integer Mode) + const Standard_Integer Mode) { switch(Mode) { case 0: //locating the whole box by making its faces sensitive... @@ -1487,8 +1487,8 @@ void InteractiveBox::ComputeSelection Sel->Add(new Select3D_SensitiveFace(Ownr,Array,Sensitivity)); } break; -    } -   case 1: + } + case 1: // locates the edges { for(Standard_Integer i=1;i<=12;i++) { @@ -1527,7 +1527,7 @@ for(VS->Init();VS->More();VS->Next()) { VS->Picked(); // picking of all owners detected -   } + } SM->Deactivate(box1); // deactivate all active modes of box1 ~~~~~ @@ -1608,7 +1608,7 @@ The following example shows how to disable the VBO support: ~~~~~ // get the graphic driver Handle (Graphic3d_GraphicDriver) aDriver = -  myAISContext->CurrentViewer()->Driver(); + myAISContext->CurrentViewer()->Driver(); // disable VBO support aDriver->EnableVBO (Standard_False); @@ -1639,7 +1639,7 @@ You can also modify the values assigned to the vertex or query these values by * *void Graphic3d_ArrayOfPrimitives::SetVertexNormal* * *void Graphic3d_ArrayOfPrimitives::SetVertexTexel* * *gp_Pnt Graphic3d_ArrayOfPrimitives::Vertices* - * *gp_Dir  Graphic3d_ArrayOfPrimitives::VertexNormal* + * *gp_Dir Graphic3d_ArrayOfPrimitives::VertexNormal* * *gp_Pnt3d Graphic3d_ArrayOfPrimitives::VertexTexel* * *Quantity_Color Graphic3d_ArrayOfPrimitives::VertexColor* * *void Graphic3d_ArrayOfPrimitives::Vertices* @@ -1674,26 +1674,26 @@ The following example shows how to define an array of triangles: ~~~~~ // create an array -Standard_Boolean IsNormals     = Standard_False; -Standard_Boolean IsColors      = Standard_False; +Standard_Boolean IsNormals = Standard_False; +Standard_Boolean IsColors = Standard_False; Standard_Boolean IsTextureCrds = Standard_False; Handle (Graphic3d_ArrayOfTriangles) anArray = -          new Graphic3d_ArrayOfTriangles (aVerticesMaxCount, -                                          aEdgesMaxCount, -                                          IsNormals, -                                          IsColors, -                                          IsTextureCrds); + new Graphic3d_ArrayOfTriangles (aVerticesMaxCount, + aEdgesMaxCount, + IsNormals, + IsColors, + IsTextureCrds); // add vertices to the array -anArray->AddVertex (-1.0, 0.0, 0.0);   // vertex 1 -anArray->AddVertex ( 1.0, 0.0, 0.0);   // vertex 2 -anArray->AddVertex ( 0.0, 1.0, 0.0);   // vertex 3 -anArray->AddVertex ( 0.0,-1.0, 0.0);   // vertex 4 +anArray->AddVertex (-1.0, 0.0, 0.0); // vertex 1 +anArray->AddVertex ( 1.0, 0.0, 0.0); // vertex 2 +anArray->AddVertex ( 0.0, 1.0, 0.0); // vertex 3 +anArray->AddVertex ( 0.0,-1.0, 0.0); // vertex 4 // add edges to the array -anArray->AddEdge (1);  // first triangle +anArray->AddEdge (1); // first triangle anArray->AddEdge (2); anArray->AddEdge (3); -anArray->AddEdge (1);  // second triangle +anArray->AddEdge (1); // second triangle anArray->AddEdge (2); anArray->AddEdge (4); @@ -1717,31 +1717,31 @@ The following example shows how to define an array of polygons: ~~~~~ // create an array -Standard_Boolean IsNormals      = Standard_False; +Standard_Boolean IsNormals = Standard_False; Standard_Boolean IsVertexColors = Standard_False; -Standard_Boolean IsFaceColors   = Standard_False; -Standard_Boolean IsTextureCrds  = Standard_False; +Standard_Boolean IsFaceColors = Standard_False; +Standard_Boolean IsTextureCrds = Standard_False; Handle (Graphic3d_ArrayOfPolygons) anArray = -          new Graphic3d_ArrayOfPolygons (aVerticesMaxCount, -                                         aBoundsMaxCount, -                                         aEdgesMaxCount, -                                         IsNormals, -                                         IsVertexColors, -                                         IsFaceColors, -                                         IsTextureCrds); + new Graphic3d_ArrayOfPolygons (aVerticesMaxCount, + aBoundsMaxCount, + aEdgesMaxCount, + IsNormals, + IsVertexColors, + IsFaceColors, + IsTextureCrds); // add bounds to the array, first polygon anArray->AddBound (3); -anArray->AddVertex (-1.0, 0.0, 0.0);   -anArray->AddVertex ( 1.0, 0.0, 0.0);   -anArray->AddVertex ( 0.0, 1.0, 0.0);   +anArray->AddVertex (-1.0, 0.0, 0.0); +anArray->AddVertex ( 1.0, 0.0, 0.0); +anArray->AddVertex ( 0.0, 1.0, 0.0); // add bounds to the array, second polygon anArray->AddBound (4); -anArray->AddVertex (-1.0, 0.0, 0.0);   -anArray->AddVertex ( 1.0, 0.0, 0.0);   -anArray->AddVertex ( 1.0,-1.0, 0.0);   -anArray->AddVertex (-1.0,-1.0, 0.0);   +anArray->AddVertex (-1.0, 0.0, 0.0); +anArray->AddVertex ( 1.0, 0.0, 0.0); +anArray->AddVertex ( 1.0,-1.0, 0.0); +anArray->AddVertex (-1.0,-1.0, 0.0); // add the array to the structure Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); @@ -1784,41 +1784,41 @@ To add any text to the graphic structure you can use the following methods: ~~~~~ void Graphic3d_Group::Text (const Standard_CString AText, -  const Graphic3d_Vertex& APoint, -  const Standard_Real AHeight, -  const Quantity_PlaneAngle AAngle, -  const Graphic3d_TextPath ATp, -  const Graphic3d_HorizontalTextAlignment AHta, -  const Graphic3d_VerticalTextAlignment AVta, -  const Standard_Boolean EvalMinMax), + const Graphic3d_Vertex& APoint, + const Standard_Real AHeight, + const Quantity_PlaneAngle AAngle, + const Graphic3d_TextPath ATp, + const Graphic3d_HorizontalTextAlignment AHta, + const Graphic3d_VerticalTextAlignment AVta, + const Standard_Boolean EvalMinMax), ~~~~~ *AText* parameter is the text string, *APoint* is the three-dimensional position of the text, *AHeight* is the text height, *AAngle* is the orientation of the text (at the moment, this parameter has no effect, but you can specify the text orientation through the *Graphic3d_AspectText3d* attributes). *ATp* parameter defines the text path, *AHta* is the horizontal alignment of the text, *AVta* is the vertical alignment of the text. -You can pass *Standard_False* as *EvalMinMax* if you don’t want the graphic3d structure boundaries to be affected by the text position. +You can pass *Standard_False* as *EvalMinMax* if you do not want the graphic3d structure boundaries to be affected by the text position. **Note** that the text orientation angle can be defined by *Graphic3d_AspectText3d* attributes. ~~~~~ void Graphic3d_Group::Text (const Standard_CString AText, -  const Graphic3d_Vertex& APoint, -  const Standard_Real AHeight, -  const Standard_Boolean EvalMinMax) + const Graphic3d_Vertex& APoint, + const Standard_Real AHeight, + const Standard_Boolean EvalMinMax) void Graphic3d_Group::Text (const TCcollection_ExtendedString &AText, const Graphic3d_Vertex& APoint, -  const Standard_Real AHeight, -  const Quantity_PlaneAngle AAngle, -  const Graphic3d_TextPath ATp, -  const Graphic3d_HorizontalTextAlignment AHta, -  const Graphic3d_VerticalTextAlignment AVta, -  const Standard_Boolean EvalMinMax) + const Standard_Real AHeight, + const Quantity_PlaneAngle AAngle, + const Graphic3d_TextPath ATp, + const Graphic3d_HorizontalTextAlignment AHta, + const Graphic3d_VerticalTextAlignment AVta, + const Standard_Boolean EvalMinMax) void Graphic3d_Group::Text (const TCcollection_ExtendedString &AText, -  const Graphic3d_Vertex& APoint, -  const Standard_Real AHeight, -  const Standard_Boolean EvalMinMax) + const Graphic3d_Vertex& APoint, + const Standard_Real AHeight, + const Standard_Boolean EvalMinMax) ~~~~~ See the example: @@ -2036,7 +2036,7 @@ aView->Update(); @subsubsection occt_visu_4_4_5 Perspective Projection -**Field of view (FOVy)** - defines the field of camera view by y axis in degrees (45° is default). +**Field of view (FOVy)** - defines the field of camera view by y axis in degrees (45° is default). @image html camera_perspective.png "Perspective frustum" @@ -2058,7 +2058,7 @@ There are two types of IOD: * _IODType_Absolute_ : Intraocular distance is defined as an absolute value. * _IODType_Relative_ : Intraocular distance is defined relative to the camera focal length (as its coefficient). -**Field of view (FOV)** - defines the field of camera view by y axis in degrees (45° is default). +**Field of view (FOV)** - defines the field of camera view by y axis in degrees (45° is default). **ZFocus** - defines the distance to the point of stereographic focus. @@ -2132,21 +2132,21 @@ The following example demonstrates how to draw overlay graphics by the *V3d_Laye // redefined method of V3d_LayerMgr void MyLayerMgr::Redraw () { -  Quantity_Color aRed (Quantity_NOC_RED); -  myOverlayLayer->SetColor (aRed); -  myOverlayLayer->DrawRectangle (0, 0, 100, 100); + Quantity_Color aRed (Quantity_NOC_RED); + myOverlayLayer->SetColor (aRed); + myOverlayLayer->DrawRectangle (0, 0, 100, 100); } ~~~~~ -The layer contains layer items that will be displayed on view redraw. Such items are *Visual3d_LayerItem* entities. To manipulate *Visual3d_LayerItem* entities assigned to the layer’s internal list you can use the following methods: +The layer contains layer items that will be displayed on view redraw. Such items are *Visual3d_LayerItem* entities. To manipulate *Visual3d_LayerItem* entities assigned to the layer's internal list you can use the following methods: ~~~~~ void Visual3d_Layer::AddLayerItem (const Handle (Visual3d_LayerItem)& Item) - void Visual3d_Layer::RemoveLayerItem (const Handle (Visual3d_LayerItem)& Item)  + void Visual3d_Layer::RemoveLayerItem (const Handle (Visual3d_LayerItem)& Item) void Visual3d_Layer::RemoveAllLayerItems () - const Visual3d_NListOfLayerItem& Visual3d_Layer::GetLayerItemList ()   + const Visual3d_NListOfLayerItem& Visual3d_Layer::GetLayerItemList () ~~~~~ -The layer’s items are rendered when the method *void Visual3d_Layer::RenderLayerItems()* is called by the graphical driver. +The layer's items are rendered when the method *void Visual3d_Layer::RenderLayerItems()* is called by the graphical driver. The *Visual3d_LayerItem* has virtual methods that are used to render the item: ~~~~~ @@ -2160,8 +2160,8 @@ The item presentation can be computed before drawing by the *ComputeLayerPrs* me Standard_Boolean Visual3d_LayerItem::IsNeedToRecompute ~~~~~ -An example of *Visual3d_LayerItem* is *V3d_ColorScaleLayerItem* that represents the color scale entity as the layer’s item. -The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity represented by it. As this entity (*V3d_ColorScale*) is assigned to the *V3d_LayerMgr* it uses its overlay layer’s services for drawing: +An example of *Visual3d_LayerItem* is *V3d_ColorScaleLayerItem* that represents the color scale entity as the layer's item. +The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity represented by it. As this entity (*V3d_ColorScale*) is assigned to the *V3d_LayerMgr* it uses its overlay layer's services for drawing:

Example

@@ -2169,29 +2169,29 @@ The *V3d_ColorScaleLayerItem* sends render requests to the color scale entity r // tell V3d_ColorScale to draw itself void V3d_ColorScaleLayerItem::RedrawLayerPrs () { -  Visual3d_LayerItem::RedrawLayerPrs () -  if (!MyColorScale.IsNull ()) -    MyColorScale->DrawScale (); + Visual3d_LayerItem::RedrawLayerPrs () + if (!MyColorScale.IsNull ()) + MyColorScale->DrawScale (); } // V3d_ColorScale has a reference to a LayerMgr void V3d_ColorScale::DrawScale () { -    // calls V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc … + // calls V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc. } // PaintRect method uses overlay layer of LayerMgr to draw a rectangle void V3d_ColorScale::PaintRect -       (const Standard_Integer X, const Standard_Integer Y, -        const Standard_Integer W, const Standard_Integer H, -        const Quantity_Color aColor, -        const Standard_Boolean aFilled) + (const Standard_Integer X, const Standard_Integer Y, + const Standard_Integer W, const Standard_Integer H, + const Quantity_Color aColor, + const Standard_Boolean aFilled) { -  const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay (); -   ... -  theLayer->SetColor (aColor); -  theLayer->DrawRectangle (X, Y, W, H); -   ... + const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay (); + ... + theLayer->SetColor (aColor); + theLayer->DrawRectangle (X, Y, W, H); + ... } ~~~~~ @@ -2202,9 +2202,9 @@ To set solid color for the background you can use the following methods: ~~~~~ void V3d_View::SetBackgroundColor (const Quantity_TypeOfColor Type, -  const Quantity_Parameter V1, -  const Quantity_Parameter V2, -  const Quantity_Parameter V3) + const Quantity_Parameter V1, + const Quantity_Parameter V2, + const Quantity_Parameter V3) ~~~~~ This method allows you to specify the background color in RGB (red, green, blue) or HLS (hue, lightness, saturation) color spaces, so the appropriate values of the Type parameter are *Quantity_TOC_RGB* and *Quantity_TOC_HLS*. @@ -2220,15 +2220,15 @@ The gradient background style could be set up with the following methods: ~~~~~ void V3d_View::SetBgGradientColors (const Quantity_Color& Color1, -  const Quantity_Color& Color2, -  const Aspect_GradientFillMethod FillStyle, -  const Standard_Boolean update) + const Quantity_Color& Color2, + const Aspect_GradientFillMethod FillStyle, + const Standard_Boolean update) void V3d_View::SetBgGradientColors (const Quantity_NameOfColor Color1, -  const Quantity_NameOfColor Color2, -  const Aspect_GradientFillMethod FillStyle, -  const Standard_Boolean update) + const Quantity_NameOfColor Color2, + const Aspect_GradientFillMethod FillStyle, + const Standard_Boolean update) ~~~~~ The *Color1* and *Color2* parameters define the boundary colors of interpolation, the *FillStyle* parameter defines the direction of interpolation. You can pass *Standard_True* as the last parameter to update the view. @@ -2239,9 +2239,9 @@ To get the current background color you can use the following methods: ~~~~~ void V3d_View::BackgroundColor (const Quantity_TypeOfColor Type, -  Quantity_Parameter &V1, -  Quantity_Parameter &V2, -  Quantity_Parameter &V3) + Quantity_Parameter &V1, + Quantity_Parameter &V2, + Quantity_Parameter &V3) Quantity_Color V3d_View::BackgroundColor() void V3d_View::GradientBackgroundColors(Quantity_Color& Color1, Quantity_Color& Color2) Aspect_GradientBackground GradientBackground() @@ -2251,15 +2251,15 @@ To set the image as a background and change the background image style you can ~~~~~ void V3d_View::SetBackgroundImage (const Standard_CString FileName, -  const Aspect_FillMethod FillStyle, -  const Standard_Boolean update) + const Aspect_FillMethod FillStyle, + const Standard_Boolean update) void V3d_View::SetBgImageStyle (const Aspect_FillMethod FillStyle, -  const Standard_Boolean update) + const Standard_Boolean update) ~~~~~ The *FileName* parameter defines the image file name and the path to it, the *FillStyle* parameter defines the method of filling the background with the image. The methods are: - * *Aspect_FM_NONE* -  draws the image in the default position; + * *Aspect_FM_NONE* - draws the image in the default position; * *Aspect_FM_CENTERED* - draws the image at the center of the view; * *Aspect_FM_TILED* tiles the view with the image; * *Aspect_FM_STRETCH* stretches the image over the view. @@ -2326,21 +2326,21 @@ Handle(Aspect_DisplayConnection) aDisplayConnection; Handle (Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (aDisplayConnection); // create a window -Standard_Integer aDefWidth  = 800; +Standard_Integer aDefWidth = 800; Standard_Integer aDefHeight = 600; Handle (WNT_WClass) aWClass = new WNT_WClass ("Virtual Class",DefWindowProc, -                             CS_VREDRAW | CS_HREDRAW, 0, 0, -                             ::LoadCursor (NULL, IDC_ARROW)); -Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd",  aWClass, -                             WS_OVERLAPPEDWINDOW, 0, 0, -                             aDefWidth, aDefHeight); + CS_VREDRAW | CS_HREDRAW, 0, 0, + ::LoadCursor (NULL, IDC_ARROW)); +Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd", aWClass, + WS_OVERLAPPEDWINDOW, 0, 0, + aDefWidth, aDefHeight); // set up the window as virtual aWindow->SetVirtual (Standard_True); // create a view and an interactive context Handle (V3d_Viewer) aViewer = new V3d_Viewer (aDriver, -                             Standard_ExtString ("Virtual")); + Standard_ExtString ("Virtual")); Handle (AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer); Handle (V3d_View) aView = aViewer->CreateView (); @@ -2360,7 +2360,7 @@ aView->Dump ("3dscene.png"); The contents of a view can be printed out. Moreover, the OpenGl graphic driver used by the v3d view supports printing in high resolution. The print method uses the OpenGl frame buffer (Frame Buffer Object) for rendering the view contents and advanced print algorithms that allow printing in, theoretically, any resolution. -The method *void V3d_View::Print(const Aspect_Handle hPrnDC, const Standard_Boolean showDialog, const Standard_Boolean showBackground, const Standard_CString  filename, const Aspect_PrintAlgo printAlgorithm)* prints the view contents: +The method *void V3d_View::Print(const Aspect_Handle hPrnDC, const Standard_Boolean showDialog, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm)* prints the view contents: *hPrnDC* is the printer device handle. You can pass your own printer handle or *NULL* to select the printer by the default dialog. In that case you can use the default dialog or pass *Standard_False* as the *showDialog* argument to select the default printer automatically. @@ -2439,14 +2439,14 @@ Structure display priorities control the order, in which structures are drawn. W @subsubsection occt_visu_4_4_15 Z-layer support -OCCT features depth-arranging functionality called z-layer. A graphical presentation can be put into a z-layer. In general, this function can be used for implementing "bring to front" functionality in a graphical application. +OCCT features depth-arranging functionality called z-layer. A graphical presentation can be put into a z-layer. In general, this function can be used for implementing "bring to front" functionality in a graphical application. Example: ~~~~~ // set z-layer to an interactive object -Handle(AIS_InteractiveContext) aContext = … -Handle(AIS_InteractiveObject) anInterObj = … +Handle(AIS_InteractiveContext) aContext = ... +Handle(AIS_InteractiveObject) anInterObj = ... Standard_Integer anId = 3; aViewer->AddZLayer (anId); aContext->SetZLayer (anInterObj, anId); @@ -2458,7 +2458,7 @@ For each z-layer, it is allowed to: * Enable / disable depth buffer clearing. * Enable / disable polygon offset. -The corresponding method *SetZLayerOption (…)* is available in *Graphic3d_GraphicDriver* interface. You can get the options using getter from *Visual3d_ViewManager* and *V3d_Viewer*. It returns *Graphic3d_ZLayerSettings* cached in *Visual3d_ViewManager* for a given *LayerId*. +The corresponding method *SetZLayerOption (...)* is available in *Graphic3d_GraphicDriver* interface. You can get the options using getter from *Visual3d_ViewManager* and *V3d_Viewer*. It returns *Graphic3d_ZLayerSettings* cached in *Visual3d_ViewManager* for a given *LayerId*. Example: ~~~~~ @@ -2503,10 +2503,10 @@ Let us see for example how to create a new clipping plane with custom parameters // create a new clipping plane const Handle(Graphic3d_ClipPlane)& aClipPlane = new Graphic3d_ClipPlane(); // change equation of the clipping plane -Standard_Real aCoeffA = … -Standard_Real aCoeffB = … -Standard_Real aCoeffC = … -Standard_Real aCoeffD = … +Standard_Real aCoeffA = ... +Standard_Real aCoeffB = ... +Standard_Real aCoeffC = ... +Standard_Real aCoeffD = ... aClipPlane->SetEquation (gp_Pln (aCoeffA, aCoeffB, aCoeffC, aCoeffD)); // set capping aClipPlane->SetCapping (aCappingArg == "on"); @@ -2517,12 +2517,12 @@ aMat.SetAmbientColor (aColor); aMat.SetDiffuseColor (aColor); aClipPlane->SetCappingMaterial (aMat); // set the texture of clipping plane -Handle(Graphic3d_Texture2Dmanual) aTexture = … +Handle(Graphic3d_Texture2Dmanual) aTexture = ... aTexture->EnableModulate(); aTexture->EnableRepeat(); aClipPlane->SetCappingTexture (aTexture); // add the clipping plane to an interactive object -Handle(AIS_InteractiveObject) aIObj = … +Handle(AIS_InteractiveObject) aIObj = ... aIObj->AddClipPlane (aClipPlane); // or to the whole view aView->AddClipPlane (aClipPlane); @@ -2662,7 +2662,7 @@ Handle(AIS_Shape) anAISShape = new AIS_Shape(aShape); myAISContext->Display (anAISShape); ~~~~~ -@subsubsection occt_visu_4_5_4 Create your own interactive object +@subsubsection occt_visu_4_5_5 Create your own interactive object Follow the procedure below to compute the presentable object: