1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-01 10:26:12 +03:00

0024602: Documentation Code Snippets missing sign

Fix for bug 24602 about missing <, >, " and some other signs.
Also a major review of documetation to fix wrong formatting issues.
This commit is contained in:
ysn 2014-04-11 20:24:19 +04:00 committed by apn
parent 828fb3291f
commit 4ee1bdf4e9
16 changed files with 669 additions and 668 deletions

View File

@ -163,7 +163,7 @@ Standard_Integer myCounter; // This is preferred
### Names of global variables ### Names of global variables
It is strongly recommended to avoid defining any global variables. It is strongly recommended to avoid defining any global variables.
However, as soon as a global variable is necessary, its name should be prefixed by the name of a class or a package where it is defined followed with *_my*. However, as soon as a global variable is necessary, its name should be prefixed by the name of a class or a package where it is defined followed with <i>_my</i>.
See the following examples: See the following examples:

View File

@ -121,7 +121,7 @@ The official repository contains:
If you prefer to work with the English interface, remove or rename .msg localization file If you prefer to work with the English interface, remove or rename .msg localization file
in subdirectories *share/git-gui/lib/msgs* and *share/gitk/lib/msgs* of the Git installation directory. in subdirectories *share/git-gui/lib/msgs* and *share/gitk/lib/msgs* of the Git installation directory.
Before the first commit to the OCCT repository, make sure that your User Name in the Git configuration file (file *.gitconfig* in the $HOME directory) is equal to your username on the OCCT development portal. Before the first commit to the OCCT repository, make sure that your User Name in the Git configuration file (file <i>.gitconfig</i> in the <i>$HOME</i> directory) is equal to your username on the OCCT development portal.
@subsubsection occt_gitguide_2_1_2 Installation and configuration of TortoiseGit @subsubsection occt_gitguide_2_1_2 Installation and configuration of TortoiseGit
@ -150,14 +150,14 @@ The official repository contains:
* After the installation select Start -> Programs -> TortoiseGit Settings to configure TortoiseGit. * After the installation select Start -> Programs -> TortoiseGit Settings to configure TortoiseGit.
Select Git->Config to add your user name and Email address to the local .gitconfig file Select Git->Config to add your user name and Email address to the local <i>.gitconfig</i> file
@image html OCCT_GitGuide_V2_image006.png @image html OCCT_GitGuide_V2_image006.png
@image latex OCCT_GitGuide_V2_image006.png @image latex OCCT_GitGuide_V2_image006.png
@subsection occt_gitguide_2_2 Linux platform @subsection occt_gitguide_2_2 Linux platform
We assume that Linux users have Git already installed and available in the PATH. We assume that Linux users have Git already installed and available in the *PATH*.
Make sure to configure Git so that the user name is equal to your username Make sure to configure Git so that the user name is equal to your username
on the OCCT development portal, and set SafeCrLf option to true: on the OCCT development portal, and set SafeCrLf option to true:
@ -190,7 +190,7 @@ The official repository contains:
It is highly recommended to use the tools that come It is highly recommended to use the tools that come
with the chosen Git client for generation of SSH keys. with the chosen Git client for generation of SSH keys.
Using incompatible tools (e.g. ssh-keygen.exe from Cygwin for code generation, Using incompatible tools (e.g. *ssh-keygen.exe* from Cygwin for code generation,
and TortoiseGit GUI with a default Putty client for connection to server) and TortoiseGit GUI with a default Putty client for connection to server)
may lead to authentication problems. may lead to authentication problems.
@ -201,8 +201,8 @@ The official repository contains:
Use this option if you have installed TortoiseGit (or other GUI Git client on Windows) Use this option if you have installed TortoiseGit (or other GUI Git client on Windows)
and have chosen “TortoisePLink” (or other Putty client) as SSH client during installation. and have chosen “TortoisePLink” (or other Putty client) as SSH client during installation.
To generate the key with this client, run Puttygen (e.g. from Start menu -> TortoiseGit -> Puttygen), To generate the key with this client, run **Puttygen** (e.g. from Start menu -> TortoiseGit -> Puttygen),
then click Generate and move mouse cursor over the blank area until the key is generated. then click **Generate** and move mouse cursor over the blank area until the key is generated.
@image html OCCT_GitGuide_V2_image007.png "Putty key generator" @image html OCCT_GitGuide_V2_image007.png "Putty key generator"
@image latex OCCT_GitGuide_V2_image007.png "Putty key generator" @image latex OCCT_GitGuide_V2_image007.png "Putty key generator"
@ -221,7 +221,7 @@ The official repository contains:
during installation of TortoiseGit (or other Windows tool). during installation of TortoiseGit (or other Windows tool).
Make sure that you have *ssh* and *ssh-keygen* commands in the path. Make sure that you have *ssh* and *ssh-keygen* commands in the path.
On Windows, you might need to start 'Git Bash' command prompt window provided by Git for Windows. On Windows, you might need to start **Git Bash** command prompt window.
Use the following command to generate SSH keys: Use the following command to generate SSH keys:
~~~~~ ~~~~~
@ -230,14 +230,14 @@ The official repository contains:
The last argument is an optional comment, which can be included with the public key and used to distinguish between different keys (if you have many). The common practice is to put here your mail address or workstation name. The last argument is an optional comment, which can be included with the public key and used to distinguish between different keys (if you have many). The common practice is to put here your mail address or workstation name.
The command will ask you where to store the keys. It is recommended to accept the default path *$HOME/.ssh/id_rsa*. Just press Enter for that. You will be warned if a key is already present in the specified file; you can either overwrite it by the new one, or stop generation and use the old key. The command will ask you where to store the keys. It is recommended to accept the default path <i>$HOME/.ssh/id_rsa</i>. Just press **Enter** for that. You will be warned if a key is already present in the specified file; you can either overwrite it by the new one, or stop generation and use the old key.
If you want to be on the safe side, enter password to encrypt the private key. You will be asked to enter this password each time you use that key (e.g. access a remote Git repository), unless you use the tool that caches the key (like TortoiseGit). If you do not want to bother, enter an empty string. If you want to be on the safe side, enter password to encrypt the private key. You will be asked to enter this password each time you use that key (e.g. access a remote Git repository), unless you use the tool that caches the key (like TortoiseGit). If you do not want to bother, enter an empty string.
On Windows, make sure to note the complete path to the generated files (the location of your $HOME might be not obvious). Two key files will be created in the specified location (by default in $HOME/.ssh/): On Windows, make sure to note the complete path to the generated files (the location of your $HOME might be not obvious). Two key files will be created in the specified location (by default in $HOME/.ssh/):
* *id_rsa* - private key * *id_rsa* - private key
* id_rsa.pub - public key * *id_rsa.pub* - public key
The content of the public key file (one text line) is the key to be added to the user account on the site (see below). The content of the public key file (one text line) is the key to be added to the user account on the site (see below).
@ -265,7 +265,7 @@ Click on that tab, then click **Add a public key**, and paste the text of the pu
to update the configuration after the new key is added. to update the configuration after the new key is added.
After that time, you can try accessing Git. After that time, you can try accessing Git.
@section occt_gitguide_4 WORK WITH REPOSITORY: DEVELOPER OPERATIONS @section occt_gitguide_4 Work with repository: developer operations
@subsection occt_gitguide_4_1 General workflow @subsection occt_gitguide_4_1 General workflow
@ -504,7 +504,7 @@ Rebasing is a good occasion to clean-up the history of commits in the branch. Co
To rebase your branch into a single commit, you need to do the following: To rebase your branch into a single commit, you need to do the following:
* Switch to your branch (e.g. “CR12345”) * Switch to your branch (e.g. “CR12345”)
* In TortoiseGit history log, select a branch to rebase on *(remotes/origin/master)* and in the context menu choose **Rebase “CR12345” onto this**. * In TortoiseGit history log, select a branch to rebase on <i>(remotes/origin/master)</i> and in the context menu choose **Rebase “CR12345” onto this**.
* In the **Rebase** dialog, check **Squash All**. You can also change the order of commits and define for each commit whether it should be kept (**Pick**), edited, or just skipped. * In the **Rebase** dialog, check **Squash All**. You can also change the order of commits and define for each commit whether it should be kept (**Pick**), edited, or just skipped.
@image html OCCT_GitGuide_V2_image023.png @image html OCCT_GitGuide_V2_image023.png

View File

@ -270,9 +270,9 @@ Example:
if { [isdraw result] } { if { [isdraw result] } {
checkshape result checkshape result
} else { } else {
puts *Error: The result shape can not be built* puts "Error: The result shape can not be built"
} }
puts *TEST COMPLETED* puts "TEST COMPLETED"
~~~~~ ~~~~~
@subsubsection testmanual_2_2_5 File "parse.rules" @subsubsection testmanual_2_2_5 File "parse.rules"
@ -602,7 +602,7 @@ Note that on older versions of OCCT the tests are run in compatibility mode and
You can extend the test system by adding your own tests. For that it is necessary to add paths to the directory where these tests are located, and one or more additional data directories, to the environment variables *CSF_TestScriptsPath* and *CSF_TestDataPath*. The recommended way for doing this is using DRAW configuration file *DrawAppliInit* located in the directory which is current by the moment of DRAW start-up. You can extend the test system by adding your own tests. For that it is necessary to add paths to the directory where these tests are located, and one or more additional data directories, to the environment variables *CSF_TestScriptsPath* and *CSF_TestDataPath*. The recommended way for doing this is using DRAW configuration file *DrawAppliInit* located in the directory which is current by the moment of DRAW start-up.
Use Tcl command *_path_separator* to insert a platform-dependent separator to the path list. Use Tcl command <i>_path_separator</i> to insert a platform-dependent separator to the path list.
For example: For example:
~~~~~ ~~~~~
@ -825,7 +825,7 @@ DRAW module: XSDRAW
@subsubsection testmanual_5_1_11 mesh @subsubsection testmanual_5_1_11 mesh
This group allows testing shape tessellation (*BRepMesh)) and shading. This group allows testing shape tessellation (*BRepMesh*) and shading.
DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*) DRAW modules: MODELING (package *MeshTest*), VISUALIZATION (package *ViewerTest*)

View File

@ -468,7 +468,7 @@ The example record is interpreted as a B-spline curve with a rational flag *r*=
**Example** **Example**
@verbatim @verbatim
8 4 -5 8 -4 5
1 1 2 3 1 0 0 1 1 2 3 1 0 0
@endverbatim @endverbatim
@ -1023,7 +1023,7 @@ The example record is interpreted as an offset surface with a distance *d*=-2 
@verbatim @verbatim
1 3 0 0 -1 1 3 0 0 -1
@verbatim @endverbatim
**BNF-like Definition** **BNF-like Definition**
@ -1077,7 +1077,7 @@ The example record is interpreted as a circle which has a center *P*=(1,2). Th
@verbatim @verbatim
3 1 2 1 0 -0 1 4 3 3 1 2 1 0 -0 1 4 3
@verbatim @endverbatim
**BNF-like Definition** **BNF-like Definition**
@ -1567,7 +1567,7 @@ Geometric sense of curve *C* described above is determined by the direction of
@section occt_brep_format_5 Shapes @section occt_brep_format_5 Shapes
An example of section shapes and a whole *.brep file are given in chapter 7 "Appendix". An example of section shapes and a whole *.brep file are given in chapter 7 @ref occt_brep_format_6 "Appendix".
**BNF-like Definition** **BNF-like Definition**

View File

@ -320,12 +320,12 @@ dset x 10 y 15 z
# no $ required for Draw commands # no $ required for Draw commands
point p x y z point p x y z
# *puts* prints a string # "puts" prints a string
puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)]; puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)];
== x = 10, cos(x/pi) = -0.99913874099467914 == x = 10, cos(x/pi) = -0.99913874099467914
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Note,** that in TCL, parentheses are not considered to be special characters. Do not forget to quote an expression if it contains spaces in order to avoid parsing different words. <i>(a + b)</i> is parsed as three words: <i>"(a + b)"</i> or <i>(a+b)</i> are correct.* **Note,** that in TCL, parentheses are not considered to be special characters. Do not forget to quote an expression if it contains spaces in order to avoid parsing different words. <i>(a + b)</i> is parsed as three words: <i>"(a + b)"</i> or <i>(a+b)</i> are correct.
@subsection occt_draw_2_4 lists @subsection occt_draw_2_4 lists

View File

@ -19,23 +19,23 @@ Root classes are the basic data types and classes on which all the other classe
* extended run-time type information (RTTI) mechanism facilitating the creation of complex programs, * extended run-time type information (RTTI) mechanism facilitating the creation of complex programs,
* management of exceptions, * management of exceptions,
* encapsulation of C++ streams. * encapsulation of C++ streams.
Root classes are mainly implemented in the **Standard** and **MMgt** packages. Root classes are mainly implemented in the *Standard* and *MMgt* packages.
### Strings ### Strings
Strings are classes that handle dynamically sized sequences of characters based on both ASCII (normal 8-bit character type) and Unicode (16-bit character type). Strings are classes that handle dynamically sized sequences of characters based on both ASCII (normal 8-bit character type) and Unicode (16-bit character type).
Strings may also be manipulated by handles, and consequently be shared. Strings may also be manipulated by handles, and consequently be shared.
Strings are implemented in the **TCollection** package. Strings are implemented in the *TCollection* package.
### Collections ### Collections
Collections are the classes that handle dynamically sized aggregates of data. Collections are the classes that handle dynamically sized aggregates of data.
Collection classes are *generic*, that is, they define a structure and algorithms allowing to hold a variety of objects which do not necessarily inherit from a unique root class (similarly to C++ templates). When you need to use a collection of a given type of object, you must *instantiate* it for this specific type of element. Once this declaration is compiled, all functions available on the generic collection are available on your *instantiated class*. Collection classes are *generic*, that is, they define a structure and algorithms allowing to hold a variety of objects which do not necessarily inherit from a unique root class (similarly to C++ templates). When you need to use a collection of a given type of object, you must *instantiate* it for this specific type of element. Once this declaration is compiled, all functions available on the generic collection are available on your *instantiated class*.
Collections include a wide range of generic classes such as run-time sized arrays, lists, stacks, queues, sets and hash maps. Collections include a wide range of generic classes such as run-time sized arrays, lists, stacks, queues, sets and hash maps.
Collections are implemented in the **TCollection** and **NCollection** packages. Collections are implemented in the *TCollection* and *NCollection* packages.
### Collections of Standard Objects ### Collections of Standard Objects
The **TColStd** package provides frequently used instantiations of generic classes from the **TCollection** package with objects from the **Standard** package or strings from the **TCollection** package. The *TColStd* package provides frequently used instantiations of generic classes from the *TCollection* package with objects from the *Standard* package or strings from the *TCollection* package.
### Vectors and Matrices ### Vectors and Matrices
@ -240,32 +240,32 @@ The table below presents the equivalence existing between C++ fundamental types
**Reminder of the classes listed above:** **Reminder of the classes listed above:**
* Standard_Integer: fundamental type representing 32-bit integers yielding negative, positive or null values. **Integer** is implemented as a **typedef** of the C++ **int** fundamental type. As such, the algebraic operations +, -, *, / as well as the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on it. * **Standard_Integer** : fundamental type representing 32-bit integers yielding negative, positive or null values. *Integer* is implemented as a *typedef* of the C++ *int* fundamental type. As such, the algebraic operations +, -, *, / as well as the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on it.
* Standard_Real: fundamental type representing real numbers with finite precision and finite size. **Real** is implemented as a **typedef** of the C++ **double** (double precision) fundamental type. As such, the algebraic operations +, -, *, /, unary- and the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on reals. * **Standard_Real** : fundamental type representing real numbers with finite precision and finite size. **Real** is implemented as a *typedef* of the C++ *double* (double precision) fundamental type. As such, the algebraic operations +, -, *, /, unary- and the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on reals.
* Standard_ShortReal: fundamental type representing real numbers with finite precision and finite size. **ShortReal** is implemented as a **typedef** of the C++ **float** (simple precision) fundamental type. As such, the algebraic operations +, -, *, /, unary- and the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on reals. * **Standard_ShortReal** : fundamental type representing real numbers with finite precision and finite size. *ShortReal* is implemented as a *typedef* of the C++ *float* (simple precision) fundamental type. As such, the algebraic operations +, -, *, /, unary- and the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on reals.
* Standard_Boolean: **Boolean** is a fundamental type representing logical expressions. It has two values, false and true. **Boolean** is implemented as a **typedef** of the C++ **unsigned int** fundamental type. As such, the algebraic operations and, or, xor, not as well as equivalence relations ==, != are defined on Booleans. * **Standard_Boolean** : fundamental type representing logical expressions. It has two values: *false* and *true*. *Boolean* is implemented as a *typedef* of the C++ *unsigned int* fundamental type. As such, the algebraic operations *and, or, xor* and *not* as well as equivalence relations == and != are defined on Booleans.
* Standard_Character: **Character** is a fundamental type representing the normalized ASCII character set. It may be assigned the values of the 128 ASCII characters. **Character** is implemented as a **typedef** of the C++ **char** fundamental type. As such, the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on characters using the order of the ASCII chart (ex: A B). * **Standard_Character** : fundamental type representing the normalized ASCII character set. It may be assigned the values of the 128 ASCII characters. *Character* is implemented as a *typedef* of the C++ *char* fundamental type. As such, the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on characters using the order of the ASCII chart (ex: A B).
* Standard_ExtCharacter: **ExtCharacter** is a fundamental type representing the Unicode character set. It is a 16-bit character type. **ExtCharacter** is implemented as a **typedef** of the C++ **short** fundamental type. As such, the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on extended characters using the order of the UNICODE chart (ex: A B). * **Standard_ExtCharacter** : fundamental type representing the Unicode character set. It is a 16-bit character type. *ExtCharacter* is implemented as a *typedef* of the C++ *short* fundamental type. As such, the ordering and equivalence relations <, <=, ==, !=, >=, > are defined on extended characters using the order of the UNICODE chart (ex: A B).
* Standard_CString: **CString** is a fundamental type representing string literals. A string literal is a sequence of ASCII (8 bits) characters enclosed in double quotes. **CString** is implemented as a **typedef** of the C++ **char* ** fundamental type. * **Standard_CString** : fundamental type representing string literals. A string literal is a sequence of ASCII (8 bits) characters enclosed in double quotes. *CString* is implemented as a *typedef* of the C++ *char* fundamental type.
* Standard_Address : **Address** is a fundamental type representing a generic pointer. **Address** is implemented as a **typedef** of the C++ *void* fundamental type. * **Standard_Address** : fundamental type representing a generic pointer. *Address* is implemented as a *typedef* of the C++ *void* fundamental type.
* Standard_ExtString : **ExtString** is a fundamental type representing string literals as sequences of Unicode (16 bits) characters. **ExtString** is implemented as a **typedef** of the C++ *short* fundamental type. * **Standard_ExtString** is a fundamental type representing string literals as sequences of Unicode (16 bits) characters. *ExtString* is implemented as a *typedef* of the C++ *short* fundamental type.
@subsubsection occt_fcug_2_1_2 Types manipulated by value @subsubsection occt_fcug_2_1_2 Types manipulated by value
There are three categories of types which are manipulated by value: There are three categories of types which are manipulated by value:
* Primitive types * Primitive types
* Enumerated types * Enumerated types
* Types defined by classes not inheriting from Standard_Persistent or Standard_Transient, whether directly or not. * Types defined by classes not inheriting from *Standard_Persistent* or *Standard_Transient*, whether directly or not.
Types which are manipulated by value behave in a more direct fashion than those manipulated by handle and thus can be expected to perform operations faster, but they cannot be stored independently in a file. Types which are manipulated by value behave in a more direct fashion than those manipulated by handle and thus can be expected to perform operations faster, but they cannot be stored independently in a file.
@image html /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value" @image html /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value"
@image latex /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value" @image latex /user_guides/foundation_classes/images/foundation_classes_image005.png "Manipulation of a data type by value"
Types that are known to the schema (i.e. they are either **primitives** or they inherit from **Storable**) and are manipulated by value, can be stored inside a persistent object as part of the representation. Only in this way can a “manipulated by value” object be stored in a file. Types that are known to the schema (i.e. they are either **primitives** or they inherit from *Storable*) and are manipulated by value, can be stored inside a persistent object as part of the representation. Only in this way can a “manipulated by value” object be stored in a file.
@subsubsection occt_fcug_2_1_3 Types manipulated by reference (handle) @subsubsection occt_fcug_2_1_3 Types manipulated by reference (handle)
There are two categories of types which are manipulated by handle: There are two categories of types which are manipulated by handle:
* Types defined by classes inheriting from the **Persistent** class, which are therefore storable in a file. * Types defined by classes inheriting from the *Persistent* class, which are therefore storable in a file.
* Types defined by classes inheriting from the **Transient** class. * Types defined by classes inheriting from the *Transient* class.
@image html /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference" @image html /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@image latex /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference" @image latex /user_guides/foundation_classes/images/foundation_classes_image006.png "Manipulation of a data type by reference"
@ -286,8 +286,8 @@ A handle may be compared with a C++ pointer. Several handles can reference the
Transient and Persistent classes may be manipulated either with handles or with values. Handles which reference non-persistent objects are called non-storable handles; therefore, a persistent object cannot contain a non-storable handle. Transient and Persistent classes may be manipulated either with handles or with values. Handles which reference non-persistent objects are called non-storable handles; therefore, a persistent object cannot contain a non-storable handle.
Organization of Classes #### Organization of Classes
-----------------------
Classes used with handles are persistent or transient. Classes used with handles are persistent or transient.
Classes that inherit from *Standard_Transient* are transient while classes that inherit from *Standard_Persistent* are persistent. Classes that inherit from *Standard_Transient* are transient while classes that inherit from *Standard_Persistent* are persistent.
@ -296,10 +296,10 @@ In this chapter we will discuss only transient classes and relevant handles. Pe
Class *Standard_Transient* is a root of a big hierarchy of OCCT classes that are said to be operable by handles. It provides a reference counter field, inherited by all its descendant classes, that is used by associated *Handle()* classes to track a number of handles pointing to this instance of the object. Class *Standard_Transient* is a root of a big hierarchy of OCCT classes that are said to be operable by handles. It provides a reference counter field, inherited by all its descendant classes, that is used by associated *Handle()* classes to track a number of handles pointing to this instance of the object.
For every class derived (directly or indirectly) from *Transient*, CDL extractor creates associated class *Handle()* whose name is the same as the name of that class prefixed by *Handle_*. Open CASCADE Technology provides pre-processor macro *Handle()* that produces a name of a *Handle()* class for a given transient class name. For every class derived (directly or indirectly) from *Transient*, CDL extractor creates associated class *Handle()* whose name is the same as the name of that class prefixed by *Handle_*. Open CASCADE Technology provides preprocessor macro *Handle()* that produces a name of a *Handle()* class for a given transient class name.
#### Using a Handle
Using a Handle
--------------
A handle is characterized by the object it references. A handle is characterized by the object it references.
@ -315,16 +315,16 @@ To initialize a handle, either a new object should be created or the value of a
@subsubsection occt_fcug_2_2_2 Type Management @subsubsection occt_fcug_2_2_2 Type Management
General #### General
-------
Open CASCADE Technology provides a means to describe the hierarchy of data types in a generic way, with a possibility to check the exact type of the given object at run-time (similarly to C++ RTTI). For every class type derived from *Standard_Transient*, CDL extractor creates a code instantiating single instance of the class *Standard_Type* (type descriptor) that holds information on that type: its name and list of ancestor types. Open CASCADE Technology provides a means to describe the hierarchy of data types in a generic way, with a possibility to check the exact type of the given object at run-time (similarly to C++ RTTI). For every class type derived from *Standard_Transient*, CDL extractor creates a code instantiating single instance of the class *Standard_Type* (type descriptor) that holds information on that type: its name and list of ancestor types.
That instance (actually, a handle on it) is returned by the virtual method *DynamicType()* of the class derived from *Standard_Transient*. The other virtual method *IsKind()* provides a means to check whether a given object has specified type or inherits it. That instance (actually, a handle on it) is returned by the virtual method *DynamicType()* of the class derived from *Standard_Transient*. The other virtual method *IsKind()* provides a means to check whether a given object has specified type or inherits it.
In order to refer to the type descriptor object for a given class type, use macros *STANDARD_TYPE()* with argument being a name of the class. In order to refer to the type descriptor object for a given class type, use macros *STANDARD_TYPE()* with argument being a name of the class.
Type Conformity #### Type Conformity
---------------
The type used in the declaration of a handle is the static type of the object, the type seen by the compiler. A handle can reference an object instantiated from a subclass of its static type. Thus, the dynamic type of an object (also called the actual type of an object) can be a descendant of the type which appears in the handle declaration through which it is manipulated. The type used in the declaration of a handle is the static type of the object, the type seen by the compiler. A handle can reference an object instantiated from a subclass of its static type. Thus, the dynamic type of an object (also called the actual type of an object) can be a descendant of the type which appears in the handle declaration through which it is manipulated.
Consider the persistent class *CartesianPoint*, a sub-class of *Point*; the rule of type conformity can be illustrated as follows: Consider the persistent class *CartesianPoint*, a sub-class of *Point*; the rule of type conformity can be illustrated as follows:
@ -339,8 +339,8 @@ p1 = p2; // OK, the types are compatible
The compiler sees p1 as a handle to *Point* though the actual object referenced by *p1* is of the *CartesianPoint* type. The compiler sees p1 as a handle to *Point* though the actual object referenced by *p1* is of the *CartesianPoint* type.
Explicit Type Conversion #### Explicit Type Conversion
------------------------
According to the rule of type conformity, it is always possible to go up the class hierarchy through successive assignments of handles. On the other hand, assignment does not authorize you to go down the hierarchy. Consequently, an explicit type conversion of handles is required. According to the rule of type conformity, it is always possible to go up the class hierarchy through successive assignments of handles. On the other hand, assignment does not authorize you to go down the hierarchy. Consequently, an explicit type conversion of handles is required.
@ -432,8 +432,8 @@ else
*NullObject* exception will be raised if a field or a method of an object is accessed via a *Null* handle. *NullObject* exception will be raised if a field or a method of an object is accessed via a *Null* handle.
Invoking Class Methods #### Invoking Class Methods
----------------------
A class method is called like a static C++ function, i.e. it is called by the name of the class of which it is a member, followed by the “::” operator and the name of the method. A class method is called like a static C++ function, i.e. it is called by the name of the class of which it is a member, followed by the “::” operator and the name of the method.
For example, we can find the maximum degree of a Bezier curve: For example, we can find the maximum degree of a Bezier curve:
@ -443,7 +443,7 @@ Standard_Integer n;
n = Geom_BezierCurve::MaxDegree(); n = Geom_BezierCurve::MaxDegree();
~~~~~ ~~~~~
@subsubsection occt_fcug_2_2_5 Handle de-allocation @subsubsection occt_fcug_2_2_5 Handle deallocation
Before you delete an object, you must ensure it is no longer referenced. To reduce the programming load related to this management of object life, the delete function in Open CASCADE Technology is secured by a **reference counter** of classes manipulated by handle. A handle automatically deletes an object when it is no longer referenced. Normally you never call the delete operator explicitly on instances of subclasses of *Standard_Transient*. Before you delete an object, you must ensure it is no longer referenced. To reduce the programming load related to this management of object life, the delete function in Open CASCADE Technology is secured by a **reference counter** of classes manipulated by handle. A handle automatically deletes an object when it is no longer referenced. Normally you never call the delete operator explicitly on instances of subclasses of *Standard_Transient*.
When a new handle to the same object is created, the reference counter is incremented. When the handle is destroyed, nullified, or reassigned to another object, that counter is decremented. The object is automatically deleted by the handle when reference counter becomes 0. When a new handle to the same object is created, the reference counter is incremented. When the handle is destroyed, nullified, or reassigned to another object, that counter is decremented. The object is automatically deleted by the handle when reference counter becomes 0.
@ -471,8 +471,8 @@ Handle (TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger;
// Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted. // Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted.
~~~~~ ~~~~~
Cycles #### Cycles
------
Cycles appear if two or more objects reference each other by handles (stored as fields). In this condition automatic destruction will not work. Cycles appear if two or more objects reference each other by handles (stored as fields). In this condition automatic destruction will not work.
Consider for example a graph, whose objects (primitives) have to know the graph object to which they belong, i.e. a primitive must have a reference to complete graph object. If both primitives and the graph are manipulated by handle and they refer to each other by keeping a handle as a field, the cycle appears. Consider for example a graph, whose objects (primitives) have to know the graph object to which they belong, i.e. a primitive must have a reference to complete graph object. If both primitives and the graph are manipulated by handle and they refer to each other by keeping a handle as a field, the cycle appears.
@ -513,7 +513,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Appli_ExtSurface,Geom_Surface)
@subsection occt_fcug_2_3 Memory Management in Open CASCADE Technology @subsection occt_fcug_2_3 Memory Management in Open CASCADE Technology
In the course of a work session, geometric modeling applications create and delete a considerable number of C++ objects allocated in the dynamic memory (heap). In this context, performance of standard functions for allocating and de-allocating memory may be not sufficient. For this reason, Open CASCADE Technology employs a specialized memory manager implemented in the Standard package. In the course of a work session, geometric modeling applications create and delete a considerable number of C++ objects allocated in the dynamic memory (heap). In this context, performance of standard functions for allocating and deallocating memory may be not sufficient. For this reason, Open CASCADE Technology employs a specialized memory manager implemented in the Standard package.
@subsubsection occt_fcug_2_3_1. Usage @subsubsection occt_fcug_2_3_1. Usage
To use the Open CASCADE Technology memory manager to allocate memory in a C code, just use method *Standard::Allocate()* instead of *malloc()* and method *Standard::Free()* instead of *free()*. In addition, method *Standard::Reallocate()* is provided to replace C function *realloc()*. To use the Open CASCADE Technology memory manager to allocate memory in a C code, just use method *Standard::Allocate()* instead of *malloc()* and method *Standard::Free()* instead of *free()*. In addition, method *Standard::Reallocate()* is provided to replace C function *realloc()*.
@ -534,7 +534,7 @@ The configuration is defined by numeric values of the following environment var
* *MMGT_NBPAGES*: defines the size of memory chunks allocated for small blocks in pages (operating-system dependent). Default is 1000. * *MMGT_NBPAGES*: defines the size of memory chunks allocated for small blocks in pages (operating-system dependent). Default is 1000.
* *MMGT_THRESHOLD*: defines the maximal size of blocks that are recycled internally instead of being returned to the heap. Default is 40000. * *MMGT_THRESHOLD*: defines the maximal size of blocks that are recycled internally instead of being returned to the heap. Default is 40000.
* *MMGT_MMAP*: when set to 1 (default), large memory blocks are allocated using memory mapping functions of the operating system; if set to 0, they will be allocated in the C heap by *malloc()*. * *MMGT_MMAP*: when set to 1 (default), large memory blocks are allocated using memory mapping functions of the operating system; if set to 0, they will be allocated in the C heap by *malloc()*.
* MMGT_REENTRANT: when set to 1 (default), all calls to the optimized memory manager will be secured against possible simultaneous access from different execution threads. This variable should be set in any multithreaded application that uses an optimized memory manager (*MMGT_OPT=1*) and has more than one thread potentially calling OCCT functions. If set to 0, OCCT memory management and exception handling routines will skip the code protecting from possible concurrency in multi-threaded environment. This can yield some performance gain in some applications, but can lead to unpredictable results if used in a multithreaded application. * *MMGT_REENTRANT*: when set to 1 (default), all calls to the optimized memory manager will be secured against possible simultaneous access from different execution threads. This variable should be set in any multithreaded application that uses an optimized memory manager (*MMGT_OPT=1*) and has more than one thread potentially calling OCCT functions. If set to 0, OCCT memory management and exception handling routines will skip the code protecting from possible concurrency in multi-threaded environment. This can yield some performance gain in some applications, but can lead to unpredictable results if used in a multithreaded application.
**Note** it is recommended to use options *MMGT_OPT=2* and *MMGT_REENTRANT=1* for applications that use OCCT memory manager from more than one thread, on multiprocessor hardware. **Note** it is recommended to use options *MMGT_OPT=2* and *MMGT_REENTRANT=1* for applications that use OCCT memory manager from more than one thread, on multiprocessor hardware.
@ -564,7 +564,7 @@ Note that these overheads may be greater or less than overheads induced by the
As a general rule, it is advisable to allocate memory through significant blocks. In this way, you can work with blocks of contiguous data, and processing is facilitated for the memory page manager. As a general rule, it is advisable to allocate memory through significant blocks. In this way, you can work with blocks of contiguous data, and processing is facilitated for the memory page manager.
In multithreaded mode *(MMGT_REENTRANT=1)*, the OCCT memory manager uses mutex to lock access to free lists, therefore it may have less performance than non-optimized mode in situations when different threads often make simultaneous calls to the memory manager. The reason is that modern implementations of *malloc()* and *free()* employ several allocation arenas and thus avoid delays waiting mutex release, which are possible in such situations. In multithreaded mode <i>(MMGT_REENTRANT=1)</i>, the OCCT memory manager uses mutex to lock access to free lists, therefore it may have less performance than non-optimized mode in situations when different threads often make simultaneous calls to the memory manager. The reason is that modern implementations of *malloc()* and *free()* employ several allocation arenas and thus avoid delays waiting mutex release, which are possible in such situations.
@subsection occt_fcug_2_4 Exception Handling @subsection occt_fcug_2_4 Exception Handling
Exception handling provides a means of transferring control from a given point in a program being executed to an **exception handler** associated with another point previously executed. Exception handling provides a means of transferring control from a given point in a program being executed to an **exception handler** associated with another point previously executed.
@ -773,14 +773,14 @@ A plug-in is a component that can be loaded dynamically into a client applicati
A plug-in can be used to: A plug-in can be used to:
* implement the mechanism of a *driver*, i.e dynamically changing a driver implementation according to the current transactions (for example, retrieving a document stored in another version of an application), * implement the mechanism of a *driver*, i.e dynamically changing a driver implementation according to the current transactions (for example, retrieving a document stored in another version of an application),
* restrict processing resources to the minimum required (for example, it does not load any application services at run-time as long as the user does not need them), * restrict processing resources to the minimum required (for example, it does not load any application services at run-time as long as the user does not need them),
* facilitate development de-synchronization (an application can be delivered with base functions while some advanced capabilities will be added as plug-ins when they are available). * facilitate modular development (an application can be delivered with base functions while some advanced capabilities will be added as plug-ins when they are available).
The plug-in is identified with the help of the global universal identifier (GUID). The GUID includes lower case characters and cannot end with a blank space. The plug-in is identified with the help of the global universal identifier (GUID). The GUID includes lower case characters and cannot end with a blank space.
Once it has been loaded, the call to the services provided by the plug-in is direct (the client is implemented in the same language as the plug-in). Once it has been loaded, the call to the services provided by the plug-in is direct (the client is implemented in the same language as the plug-in).
C++ Plug-In Implementation #### C++ Plug-In Implementation
---------------------------
The C++ plug-in implements a service as an object with functions defined in an abstract class (this abstract class and its parent classes with the GUID are the only information about the plug-in implemented in the client application). The plug-in consists of a sharable library including a method named Factory which creates the C++ object (the client cannot instantiate this object because the plug-in implementation is not visible). The C++ plug-in implements a service as an object with functions defined in an abstract class (this abstract class and its parent classes with the GUID are the only information about the plug-in implemented in the client application). The plug-in consists of a sharable library including a method named Factory which creates the C++ object (the client cannot instantiate this object because the plug-in implementation is not visible).
Foundation classes provide in the package **Plugin** a method named Load(), which enables the client to access the required service through a library. Foundation classes provide in the package **Plugin** a method named Load(), which enables the client to access the required service through a library.
@ -840,8 +840,8 @@ FW-K4C/inc/BRep.ccl
Then the *Load* method loads the library according to the rules of the operating system of the host machine (for example, by using environment variables such as *LD_LIBRARY_PATH* with Unix and *PATH* with Windows). After that it invokes the *Factory* method to return the object which supports the required service. Then the *Load* method loads the library according to the rules of the operating system of the host machine (for example, by using environment variables such as *LD_LIBRARY_PATH* with Unix and *PATH* with Windows). After that it invokes the *Factory* method to return the object which supports the required service.
The client may then call the functions supported by this object. The client may then call the functions supported by this object.
C++ Client Plug-In Implementation #### C++ Client Plug-In Implementation
----------------------------------
To invoke one of the services provided by the plug-in, you may call the *Plugin::ServiceFactory* global function with the *Standard_GUID* of the requested service as follows: To invoke one of the services provided by the plug-in, you may call the *Plugin::ServiceFactory* global function with the *Standard_GUID* of the requested service as follows:
~~~~~ ~~~~~
@ -1107,9 +1107,9 @@ This is a map used to store keys with associated items. An entry of **DataMap**
The *DataMap* can be seen as an extended array where the keys are the indexes. The *DataMap* can be seen as an extended array where the keys are the indexes.
*DataMap* is a generic class which depends on three parameters: *DataMap* is a generic class which depends on three parameters:
* **Key** is the type of key for an entry in the map, * *Key* is the type of key for an entry in the map,
* **Item** is the type of element associated with a key in the map, * *Item* is the type of element associated with a key in the map,
* **Hasher*is the type of hasher on keys. * *Hasher* is the type of hasher on keys.
Use a *DataMapIterator* iterator to explore a *DataMap* map. Use a *DataMapIterator* iterator to explore a *DataMap* map.
@ -1237,7 +1237,7 @@ The *TColStd* and *TShort* packages provide frequently used instantiations of g
@subsubsection occt_fcug_3_2_2 Description @subsubsection occt_fcug_3_2_2 Description
These instantiations are the following: These instantiations are the following:
* Unidimensional arrays: instantiations of the **TCollection_Array1* generic class with *Standard* Objects and *TCollection*strings. * Unidimensional arrays: instantiations of the *TCollection_Array1* generic class with *Standard* Objects and *TCollection* strings.
* Bidimensional arrays: instantiations of the *TCollection_Array2* generic class with *Standard* Objects. * Bidimensional arrays: instantiations of the *TCollection_Array2* generic class with *Standard* Objects.
* Unidimensional arrays manipulated by handles: instantiations of the *TCollection_HArray1* generic class with *Standard* Objects and *TCollection* strings. * Unidimensional arrays manipulated by handles: instantiations of the *TCollection_HArray1* generic class with *Standard* Objects and *TCollection* strings.
* Bidimensional arrays manipulated by handles: instantiations of the *TCollection_HArray2* generic class with *Standard* Objects. * Bidimensional arrays manipulated by handles: instantiations of the *TCollection_HArray2* generic class with *Standard* Objects.
@ -1535,9 +1535,9 @@ The common point between them is that it is possible to create any number of bot
#### Heterogeneous Assign #### Heterogeneous Assign
The semantics of the method Assign() has been changed in comparison to TCollection. In NCollection classes the method Assign() is virtual and it receives the object of the abstract BaseCollection class (see the previous section). Therefore this method can be used to assign any collection type to any other if only these collections are instantiated on the same ItemType. The semantics of the method *Assign()* has been changed in comparison to *TCollection*. In *NCollection* classes the method *Assign()* is virtual and it receives the object of the abstract *BaseCollection* class (see the previous section). Therefore this method can be used to assign any collection type to any other if only these collections are instantiated on the same *ItemType*.
For example, conversion of Map into Array1 is performed like this: For example, conversion of *Map* into *Array1* is performed like this:
~~~~~ ~~~~~
#include <NCollection_Map.hxx> #include <NCollection_Map.hxx>
@ -1552,9 +1552,9 @@ anArr1Pnt.Assign (aMapPnt); // heterogeneous assignment
~~~~~ ~~~~~
There are some aspects to mention: There are some aspects to mention:
* Unlike in TCollection, in NCollection the methods Assign and operator= do not coincide. The former is a virtual method defined in the BaseCollection class. The latter is always defined in instance classes as a non-virtual inline method and it corresponds exactly to the method Assign in TCollection classes. Therefore it is always profitable to use operator= instead of Assign wherever the types on both sides of assignment are known. * Unlike in *TCollection*, in *NCollection* the methods *Assign* and operator= do not coincide. The former is a virtual method defined in the *BaseCollection* class. The latter is always defined in instance classes as a non-virtual inline method and it corresponds exactly to the method *Assign* in *TCollection* classes. Therefore it is always profitable to use operator= instead of *Assign* wherever the types on both sides of assignment are known.
* If the method Assign copies to Array1or Array2 structure, it first checks if the size of the array is equal to the number of items in the copied collection object. If the sizes differ, an exception is thrown, as in TCollection_Array1.gxx. * If the method *Assign* copies to *Array1* or *Array2* structure, it first checks if the size of the array is equal to the number of items in the copied collection object. If the sizes differ, an exception is thrown, as in *TCollection_Array1.gxx*.
* Copying to Map, IndexedMap, DataMap and IndexedDataMap can bring about a loss of data: when two or more copied data items have the same key value, only one item is copied and the others are discarded. It can lead to an error in the code like the following: * Copying to *Map, IndexedMap, DataMap* and *IndexedDataMap* can bring about a loss of data: when two or more copied data items have the same key value, only one item is copied and the others are discarded. It can lead to an error in the code like the following:
~~~~~ ~~~~~
MyPackage_Array1OfPnt anArr1Pnt (1, 100); MyPackage_Array1OfPnt anArr1Pnt (1, 100);
@ -1564,22 +1564,22 @@ aMapPnt.Assign(anArr1Pnt);
anArr1Pnt.Assign(aMapPnt); anArr1Pnt.Assign(aMapPnt);
~~~~~ ~~~~~
Objects of classes parameterised with two types (DoubleMap, DataMap and IndexedDataMap) cannot be assigned. Their method Assign throws the exception Standard_TypeMismatch (because it is impossible to check if the passed BaseCollection parameter belongs to the same collection type). Objects of classes parameterised with two types (*DoubleMap, DataMap* and *IndexedDataMap*) cannot be assigned. Their method *Assign* throws the exception *Standard_TypeMismatch* (because it is impossible to check if the passed *BaseCollection* parameter belongs to the same collection type).
#### Allocator #### Allocator
All constructors of NCollection classes receive the Allocator Object as the last parameter. This is an object of a type managed by Handle, inheriting NCollection_BaseAllocator, with the following (mandatory) methods redefined: All constructors of *NCollection* classes receive the *Allocator* Object as the last parameter. This is an object of a type managed by Handle, inheriting *NCollection_BaseAllocator*, with the following (mandatory) methods redefined:
~~~~~ ~~~~~
Standard_EXPORT virtual void* Allocate (const size_t size); Standard_EXPORT virtual void* Allocate (const size_t size);
Standard_EXPORT virtual void Free (void * anAddress); Standard_EXPORT virtual void Free (void * anAddress);
~~~~~ ~~~~~
It is used internally every time when the collection allocates memory for its item(s) and releases this memory. The default value of this parameter (empty Handle) designates the use of NCollection_BaseAllocator X where the functions Standard::Allocate and Standard::Free are called. Therefore if the user of NCollection does not specify any allocator as a parameter to the constructor of his collection, the memory management will be identical to the one in TCollection and other Open CASCADE Technology classes. It is used internally every time when the collection allocates memory for its item(s) and releases this memory. The default value of this parameter (empty *Handle*) designates the use of *NCollection_BaseAllocator* X where the functions *Standard::Allocate* and *Standard::Free* are called. Therefore if the user of *NCollection* does not specify any allocator as a parameter to the constructor of his collection, the memory management will be identical to the one in *TCollection* and other Open CASCADE Technology classes.
Nevertheless, the it is possible to define a custom Allocator type to manage the memory in the most optimal or convenient way for his algorithms. Nevertheless, the it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for his algorithms.
As one possible choice, the class NCollection_IncAllocator is included. Unlike BaseAllocator, it owns all memory it allocates from the system. Memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory. The method Allocate just increments the pointer to non-occupied memory and returns its previous value. Memory is only released in the destructor of IncAllocator, the method Free is empty. If used efficiently, this Allocator can greatly improve the performance of OCCT collections. As one possible choice, the class *NCollection_IncAllocator* is included. Unlike *BaseAllocator*, it owns all memory it allocates from the system. Memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory. The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value. Memory is only released in the destructor of *IncAllocator*, the method *Free* is empty. If used efficiently, this Allocator can greatly improve the performance of OCCT collections.
@ -1598,7 +1598,7 @@ A variable-length sequence of ASCII characters (normal 8-bit character type). I
#### TCollection_ExtendedString #### TCollection_ExtendedString
A variable-length sequence of ;extended; (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make *ExtendedString* objects easier to use than ordinary extended character arrays. A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make *ExtendedString* objects easier to use than ordinary extended character arrays.
*ExtendedString* objects follow value semantics;, that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use *HExtendedString* objects to get handles to strings. *ExtendedString* objects follow value semantics;, that is, they are the actual strings, not handles to strings, and are copied through assignment. You may use *HExtendedString* objects to get handles to strings.
@ -1619,10 +1619,8 @@ A variable-length sequence of extended; (UNICODE) characters (16-bit character
*HExtendedString* objects use an *ExtendedString* string as a field. *HExtendedString* objects use an *ExtendedString* string as a field.
@subsubsection occt_fcug_3_4_2 Conversion @subsubsection occt_fcug_3_4_2 Conversion
Resource_Unicode
---------------- *Resource_Unicode* provides functions to convert a non-ASCII *C string* given in ANSI, EUC, GB or SJIS format, to a Unicode string of extended characters, and vice versa.
Functions used to convert a non-ASCII *C string* given in ANSI, EUC, GB or SJIS
format, to a Unicode string of extended characters, and vice versa.
@subsection occt_fcug_3_5 Unit Conversion @subsection occt_fcug_3_5 Unit Conversion
@ -1632,10 +1630,10 @@ The *UnitsAPI* global functions are used to convert a value from any unit into
* the users **Current System**. * the users **Current System**.
The **SI System** is the standard international unit system. It is indicated by *SI* in the signatures of the *UnitsAPI* functions. The **SI System** is the standard international unit system. It is indicated by *SI* in the signatures of the *UnitsAPI* functions.
The OCCT (former MDTV) System corresponds to the SI international standard but the length unit and all its derivatives use the millimetre instead of the meter. The OCCT (former MDTV) System corresponds to the SI international standard but the length unit and all its derivatives use the millimeter instead of the meter.
Both systems are proposed by Open CASCADE Technology; the SI System is the standard option. By selecting one of these two systems, you define your **Local System** through the *SetLocalSystem* function. The **Local System** is indicated by *LS* in the signatures of the *UnitsAPI* functions. Both systems are proposed by Open CASCADE Technology; the SI System is the standard option. By selecting one of these two systems, you define your **Local System** through the *SetLocalSystem* function. The **Local System** is indicated by *LS* in the signatures of the *UnitsAPI* functions.
The Local System units can be modified in the working environment. You define your **Current System** by modifying its units through the **SetCurrentUnit** function. The Current System is indicated by *Current* in the signatures of the **UnitsAPI** functions. The Local System units can be modified in the working environment. You define your **Current System** by modifying its units through the *SetCurrentUnit* function. The Current System is indicated by *Current* in the signatures of the *UnitsAPI* functions.
A physical quantity is defined by a string (example: LENGTH). A physical quantity is defined by a string (example: LENGTH).
@ -1898,24 +1896,24 @@ It provides values to use in comparisons to test for real number equalities.
* Intersection precision is used by intersection algorithms. * Intersection precision is used by intersection algorithms.
* Approximation precision is used by approximation algorithms. * Approximation precision is used by approximation algorithms.
* Parametric precision gets a parametric space precision from a 3D precision. * Parametric precision gets a parametric space precision from a 3D precision.
* *Infinite* returns a high number that can be considered to be infinite. Use *-Infinite* for a high negative number. * *Infinite* returns a high number that can be considered to be infinite. Use <i>-Infinite</i> for a high negative number.
@subsubsection occt_occt_fcug_4_7_2 Standard Precision values @subsubsection occt_occt_fcug_4_7_2 Standard Precision values
This package provides a set of real space precision values for algorithms. The real space precisions are designed for precision to *0.1* nanometers. The only unit available is the millimeter. This package provides a set of real space precision values for algorithms. The real space precisions are designed for precision to *0.1* nanometers. The only unit available is the millimeter.
The parametric precisions are derived from the real precisions by the *Parametric* function. This applies a scaling factor which is the length of a tangent to the curve or the surface. You, the user, provide this length. There is a default value for a curve with *[0,1]* parameter space and a length less than 100 meters. The parametric precisions are derived from the real precisions by the *Parametric* function. This applies a scaling factor which is the length of a tangent to the curve or the surface. You, the user, provide this length. There is a default value for a curve with <i>[0,1]</i> parameter space and a length less than 100 meters.
The geometric packages provide Parametric precisions for the different types of curves. The geometric packages provide Parametric precisions for the different types of curves.
The *Precision* package provides methods to test whether a real number can be considered to be infinite. The *Precision* package provides methods to test whether a real number can be considered to be infinite.
#### Precision::Angular #### Precision::Angular
This method is used to compare two angles. Its current value is *Epsilon(2 * PI) *i.e. the smallest number *x *such that *2*PI + x *is different of *2* PI*. This method is used to compare two angles. Its current value is *Epsilon(2 * PI)* i.e. the smallest number *x* such that *2*PI + x* is different of *2\*PI*.
It can be used to check confusion of two angles as follows: It can be used to check confusion of two angles as follows:
_Abs(Angle1 - Angle2) < Precision::Angular()_ _Abs(Angle1 - Angle2) < Precision::Angular()_
It is also possible to check parallelism of two vectors (_Vec_ from _gp_) as follows _V1.IsParallel(V2,Precision::Angular())_ It is also possible to check parallelism of two vectors (_Vec_ from _gp_) as follows _V1.IsParallel(V2,Precision::Angular())_
Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent. So to test if two directions of type *gp\*_\*Dir* are perpendicular, it is legal to use the following code: Note that *Precision::Angular()* can be used on both dot and cross products because for small angles the *Sine* and the *Angle* are equivalent. So to test if two directions of type *gp_Dir* are perpendicular, it is legal to use the following code:
_Abs(D1 * D2) < Precision::Angular()_ _Abs(D1 * D2) < Precision::Angular()_
#### Precision::Confusion #### Precision::Confusion

View File

@ -317,8 +317,8 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”);
* *xst-model-roots* - selects all roots. * *xst-model-roots* - selects all roots.
* *xst-transferrable-all* - selects all translatable entities. * *xst-transferrable-all* - selects all translatable entities.
* *xst-transferrable-roots* - selects all translatable roots (default). * *xst-transferrable-roots* - selects all translatable roots (default).
* *xst-sharing + selection* - selects all entities sharing at least one entity selected by selection. * *xst-sharing + \<selection\>* - selects all entities sharing at least one entity selected by \<selection\>.
* *xst-shared + selection* - selects all entities shared by at least one entity selected by selection. * *xst-shared + \<selection\>* - selects all entities shared by at least one entity selected by \<selection\>.
* *iges-visible-roots* - selects all visible roots, whether translatable or not. * *iges-visible-roots* - selects all visible roots, whether translatable or not.
* *iges-visible-transf-roots* - selects all visible and translatable roots. * *iges-visible-transf-roots* - selects all visible and translatable roots.
* *iges-blanked-roots* - selects all blank roots, whether translatable or not. * *iges-blanked-roots* - selects all blank roots, whether translatable or not.
@ -352,7 +352,7 @@ where *nbtrans* returns the number of items in the list that produced a shape a
4. Translate a list of entities, entity by entity: 4. Translate a list of entities, entity by entity:
~~~~~ ~~~~~
Standard_Integer i,nb = list-Length(); Standard_Integer i,nb = list-Length();
for (i = 1; i = nb; i ++) { for (i = 1; i <= nb; i ++) {
Handle(Standard_Transient) ent = list-Value(i); Handle(Standard_Transient) ent = list-Value(i);
Standard_Boolean OK = reader.TransferEntity (ent); Standard_Boolean OK = reader.TransferEntity (ent);
} }
@ -373,7 +373,7 @@ returns the number of shapes recorded in the result.
~~~~~ ~~~~~
TopoDS_Shape shape = reader.Shape(num);, TopoDS_Shape shape = reader.Shape(num);,
~~~~~ ~~~~~
returns the result *num,* where *num* is an integer between 1 and *NbShapes*. returns the result *num*, where *num* is an integer between 1 and *NbShapes*.
~~~~~ ~~~~~
TopoDS_Shape shape = reader.Shape(); TopoDS_Shape shape = reader.Shape();
~~~~~ ~~~~~
@ -485,7 +485,7 @@ If a *TopoDS_Face* is output, its geometrical support is a *Geom_Surface* and i
Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.). Messages are displayed concerning the normal functioning of the processor (transfer, loading, etc.).
You must declare an include file: You must declare an include file:
~~~~~ ~~~~~
#includeInterface_DT.hxx #include \<Interface_DT.hxx\>
~~~~~ ~~~~~
You have the choice of the following options for messages: You have the choice of the following options for messages:
@ -516,7 +516,7 @@ During the transfer of IGES to Open CASCADE Technology several parameters are u
* Resolution in the IGES file is defined in the Global section of an IGES file. It is used as a fundamental value of precision during the transfer. * Resolution in the IGES file is defined in the Global section of an IGES file. It is used as a fundamental value of precision during the transfer.
* User-defined variable *read.precision.val* can be used instead of resolution from the file when parameter *read.precision.mode* is set to 1 ("User"). * User-defined variable *read.precision.val* can be used instead of resolution from the file when parameter *read.precision.mode* is set to 1 ("User").
* Field *EpsGeom* of the class *IGESToBRep_CurveAndSurface* is a basic precision for translating an IGES object. It is set for each object of class *IGESToBRep_CurveAndSurface* and its derived classes. It is initialized for the root of transfer either by value of resolution from the file or by value of *read.precision.val*, depending on the value of *read.precision.mode* parameter. It is returned by call to method *IGESToBRep_CurvAndSurface::GetEpsGeom*. As this value belongs to measurement units of the IGES file, it is usually multiplied by the coefficient *UnitFactor* (returned by method *IGESToBRep_CurvAndSurface::GetUnitFactor*) to convert it to Open CASCADE Technology units. * Field *EpsGeom* of the class *IGESToBRep_CurveAndSurface* is a basic precision for translating an IGES object. It is set for each object of class *IGESToBRep_CurveAndSurface* and its derived classes. It is initialized for the root of transfer either by value of resolution from the file or by value of *read.precision.val*, depending on the value of *read.precision.mode* parameter. It is returned by call to method *IGESToBRep_CurvAndSurface::GetEpsGeom*. As this value belongs to measurement units of the IGES file, it is usually multiplied by the coefficient *UnitFactor* (returned by method *IGESToBRep_CurvAndSurface::GetUnitFactor*) to convert it to Open CASCADE Technology units.
* Field *MaxTol* of the class *IGESToBRep_CurveAndSurface* is used as the maximum tolerance for some algorithms. Currently, it is computed as the maximum between 1 and <i>GetEpsGeom*GetUnitFactor</i>. This field is returned by method *IGESToBRep_CurvAndSurface::GetMaxTol*. * Field *MaxTol* of the class *IGESToBRep_CurveAndSurface* is used as the maximum tolerance for some algorithms. Currently, it is computed as the maximum between 1 and *GetEpsGeom* \* *GetUnitFactor*. This field is returned by method *IGESToBRep_CurvAndSurface::GetMaxTol*.
<h4>2D (parametric) tolerances</h4> <h4>2D (parametric) tolerances</h4>
@ -559,7 +559,7 @@ Use of precision parameters is reflected in the following classes:
IGES entities represented as topological shapes and geometrical objects are translated into OCCT shapes by use of the classes *IGESToBRep_TopoCurve, IGESToBRep_TopoSurface, IGESToBRep_BRepEntity* and *ShapeFix_Wire*. IGES entities represented as topological shapes and geometrical objects are translated into OCCT shapes by use of the classes *IGESToBRep_TopoCurve, IGESToBRep_TopoSurface, IGESToBRep_BRepEntity* and *ShapeFix_Wire*.
Class *IGESToBRep_BRepEntity* is intended for transferring BRep entities (IGES version 5.1) while the two former are used for translating geometry and topology defined in IGES 5.1. Methods from *IGESToBRep_BRepEntity* call methods from *IGESToBRep_TopoCurve* and *IGESToBRep_TopoSurface*, while those call methods from *IGESToBRep_BasicCurve* and *IGESToBRep_BasicSurface* to translate IGES geometry into OCCT geometry. Class *IGESToBRep_BRepEntity* is intended for transferring BRep entities (IGES version is 5.1 or greater) while the two former are used for translating geometry and topology defined in IGES versions prior to 5.1. Methods from *IGESToBRep_BRepEntity* call methods from *IGESToBRep_TopoCurve* and *IGESToBRep_TopoSurface*, while those call methods from *IGESToBRep_BasicCurve* and *IGESToBRep_BasicSurface* to translate IGES geometry into OCCT geometry.
Although the IGES file contains only one parameter for tolerance in the Global Section, OCCT shapes are produced with different tolerances. As a rule, updating the tolerance is fulfilled according to local distances between shapes (distance between vertices of adjacent edges, deviation of edges 3D curve and its parametric curve and so on) and may be less or greater than precision in the file. Although the IGES file contains only one parameter for tolerance in the Global Section, OCCT shapes are produced with different tolerances. As a rule, updating the tolerance is fulfilled according to local distances between shapes (distance between vertices of adjacent edges, deviation of edges 3D curve and its parametric curve and so on) and may be less or greater than precision in the file.
@ -567,7 +567,7 @@ The following classes show what default tolerances are used when creating shape
<h5>Class IGESToBRep_TopoCurve</h5> <h5>Class IGESToBRep_TopoCurve</h5>
All methods are in charge of transferring curves from IGES curve entities *(TransferCompositeCurve, Transfer2dCompositeCurve, TransferCurveOnFace, TransferBoundaryOnFace, TransferOffsetCurve, TransferTopoBasicCurve)* if an entity has transformation call to *IGESData_ToolLocation::ConvertLocation* with *Epsilon* value set to 10<sup>-4</sup>. All methods are in charge of transferring curves from IGES curve entities <i>(TransferCompositeCurve, Transfer2dCompositeCurve, TransferCurveOnFace, TransferBoundaryOnFace, TransferOffsetCurve, TransferTopoBasicCurve)</i> if an entity has transformation call to *IGESData_ToolLocation::ConvertLocation* with *Epsilon* value set to 10<sup>-4</sup>.
* *IGESToBRep_TopoCurve::TransferPoint* - vertex is constructed from a Point entity with tolerance *EpsGeom*UnitFactor*. * *IGESToBRep_TopoCurve::TransferPoint* - vertex is constructed from a Point entity with tolerance *EpsGeom*UnitFactor*.
* *IGESToBRep_TopoCurve::Transfer2dPoint* - vertex is constructed from a Point entity with tolerance *EpsCoeff*. * *IGESToBRep_TopoCurve::Transfer2dPoint* - vertex is constructed from a Point entity with tolerance *EpsCoeff*.
* *IGESToBRep_TopoCurve::TransferCompositeCurveGeneral* - obtains shapes (edges or wires) from other methods and adds them into the resulting wire. Two adjacent edges of the wire can be connected with tolerance up to *MaxTol*. * *IGESToBRep_TopoCurve::TransferCompositeCurveGeneral* - obtains shapes (edges or wires) from other methods and adds them into the resulting wire. Two adjacent edges of the wire can be connected with tolerance up to *MaxTol*.
@ -618,7 +618,7 @@ nIgesFaces = myList-Length();
nTransFaces = myIgesReader.TransferList(myList); nTransFaces = myIgesReader.TransferList(myList);
//translates MyList, //translates MyList,
cout“IGES Faces: “nIgesFaces“ Transferred:”nTransFacesendl; cout<<"IGES Faces: "<<nIgesFaces<<" Transferred:"<<nTransFaces<<endl;
TopoDS_Shape sh = myIgesReader.OneShape(); TopoDS_Shape sh = myIgesReader.OneShape();
//and obtains the results in an OCCT shape. //and obtains the results in an OCCT shape.
} }
@ -690,8 +690,8 @@ Default value is "Faces" (0).
* "Greatest" (1): resolution value is set to the maximum tolerance of all edges and all vertices in an OCCT shape. * "Greatest" (1): resolution value is set to the maximum tolerance of all edges and all vertices in an OCCT shape.
* "Session" (2): resolution value is that of the write.precision.val parameter. * "Session" (2): resolution value is that of the write.precision.val parameter.
* Read this parameter with *Standard_Integer ic = Interface_Static::IVal("write.precision.mode");* * Read this parameter with <i>Standard_Integer ic = Interface_Static::IVal("write.precision.mode");</i>
* Modify this parameter with *if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. * * Modify this parameter with <i>if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. </i>
* *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value. * *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value.
Read this parameter with: Read this parameter with:
@ -820,9 +820,9 @@ The highlighted classes are intended to translate geometry.
@subsection occt_iges_3_7 Example @subsection occt_iges_3_7 Example
~~~~~{c++} ~~~~~{c++}
#include IGESControl_Controller.hxx #include <IGESControl_Controller.hxx>
#include IGESControl_Writer.hxx #include <IGESControl_Writer.hxx>
#include TopoDS_Shape.hxx #include <TopoDS_Shape.hxx>
Standard_Integer main() Standard_Integer main()
{ {
IGESControl_Controller::Init(); IGESControl_Controller::Init();
@ -902,9 +902,9 @@ Command *igesbrep* will interactively ask the user to select a set of entities
After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes (e.g., one shape per root or one shape for all the entities). It is also possible to save loaded shapes in files, and to cancel loading. After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes (e.g., one shape per root or one shape for all the entities). It is also possible to save loaded shapes in files, and to cancel loading.
The second parameter of the *igesbrep* command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was s, they will be *s_1, ... s_N. The second parameter of the *igesbrep* command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter is s, they will be <i>s_1, ... s_N.</i>
*\<selection\>* specifies the scope of selected entities in the model, it is *xst-transferrable-roots* by default. An asterisk “*” can be specified instead of *iges-visible-transf-roots*. For possible values for selection refer to <a href="#occt_iges_2_3_4">Selecting entities</a> section. <i>\<selection\></i> specifies the scope of selected entities in the model, it is *xst-transferrable-roots* by default. An asterisk “*” can be specified instead of *iges-visible-transf-roots*. For possible values of *selection* refer to <a href="#occt_iges_2_3_4">Selecting entities</a> section.
Instead of *igesbrep* it is possible to use commands: Instead of *igesbrep* it is possible to use commands:
@ -917,7 +917,7 @@ Draw> trimpcomp <file_name> <result_shape_name> <selection>
~~~~~ ~~~~~
which outputs the result of translation of all selected entities into one shape (*TopoDS_Compound* for several entities). which outputs the result of translation of all selected entities into one shape (*TopoDS_Compound* for several entities).
An asterisk “*” can be specified instead of selection, it means *xst-transferrable-roots*. An asterisk “*” can be specified instead of *selection*, it means *xst-transferrable-roots*.
During the IGES translation, a map of correspondence between IGES entities and OCCT shapes is created. During the IGES translation, a map of correspondence between IGES entities and OCCT shapes is created.
The following commands are available: The following commands are available:
@ -1029,7 +1029,7 @@ Draw:> tpstat *l iges-faces
~~~~~ ~~~~~
The second version of the same command is TPSTAT (not capital spelling). The second version of the same command is TPSTAT (not capital spelling).
~~~~~ ~~~~~
Draw:> TPSTAT symbol Draw:> TPSTAT <symbol>
~~~~~ ~~~~~
Symbol can be of the following values: Symbol can be of the following values:
* g - General statistics (list of results and messages) * g - General statistics (list of results and messages)
@ -1074,7 +1074,7 @@ Draw> tolerance <shape_name> [<min> [<max>] [<symbol>]]
~~~~~ ~~~~~
It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances or it can output tolerances of all subshapes of the whole shape. It outputs maximum, average and minimum values of tolerances for each kind of subshapes having tolerances or it can output tolerances of all subshapes of the whole shape.
When specifying \<min\> and \<max\> arguments this command outputs shapes with names <i>\<shape_name\>...</i> and their total number with tolerances in the range [min, max]. When specifying *min* and *max* arguments this command outputs shapes with names <i>\<shape_name\>...</i> and their total number with tolerances in the range <i>[min, max]</i>.
<i>\<Symbol\></i> is used for specifying the kind of sub-shapes to analyze: <i>\<Symbol\></i> is used for specifying the kind of sub-shapes to analyze:
* v - for vertices, * v - for vertices,

View File

@ -845,7 +845,7 @@ Handle(Geom2d_BezierCurve) C =
Geom2dAPI_ProjectPointOnCurve Projector (P, C); Geom2dAPI_ProjectPointOnCurve Projector (P, C);
~~~~~ ~~~~~
To restrict the search for normals to a given domain *[U1,U2]*, use the following constructor: To restrict the search for normals to a given domain <i>[U1,U2]</i>, use the following constructor:
~~~~~ ~~~~~
Geom2dAPI_ProjectPointOnCurve Projector (P, C, U1, U2); Geom2dAPI_ProjectPointOnCurve Projector (P, C, U1, U2);
~~~~~ ~~~~~

View File

@ -292,7 +292,7 @@ The algorithm is then constructed with this object:
{ {
Standard_Integer nbr = myAlgo.NbPoints() ; Standard_Integer nbr = myAlgo.NbPoints() ;
Standard_Real param ; Standard_Real param ;
for ( Standard_Integer i = 1 ; i = nbr ; i++ ) for ( Standard_Integer i = 1 ; i <= nbr ; i++ )
{ {
param = myAlgo.Parameter (i) ; param = myAlgo.Parameter (i) ;
... ...
@ -607,9 +607,9 @@ The following example shows a routine receiving an argument of the *TopoDS_Shape
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include TopoDS_Vertex.hxx #include <TopoDS_Vertex.hxx>
#include TopoDS_Edge.hxx #include <TopoDS_Edge.hxx>
#include TopoDS_Shape.hxx #include <TopoDS_Shape.hxx>
void ProcessEdge(const TopoDS_Edge&); void ProcessEdge(const TopoDS_Edge&);
@ -618,7 +618,7 @@ The following example shows a routine receiving an argument of the *TopoDS_Shape
if (aShape.Shapetype() == TopAbs_VERTEX) { if (aShape.Shapetype() == TopAbs_VERTEX) {
TopoDS_Vertex V; TopoDS_Vertex V;
V = TopoDS::Vertex(aShape); // Also correct V = TopoDS::Vertex(aShape); // Also correct
TopoDS_Vertex V2 = aShape;// Rejected by compiler TopoDS_Vertex V2 = aShape; // Rejected by the compiler
TopoDS_Vertex V3 = TopoDS::Vertex(aShape); // Correct TopoDS_Vertex V3 = TopoDS::Vertex(aShape); // Correct
} }
else if (aShape.ShapeType() == TopAbs_EDGE){ else if (aShape.ShapeType() == TopAbs_EDGE){
@ -626,7 +626,7 @@ The following example shows a routine receiving an argument of the *TopoDS_Shape
ProcessEdge(TopoDS::Edge(aShape)) ; // Correct ProcessEdge(TopoDS::Edge(aShape)) ; // Correct
} }
else { else {
cout *Neither a vertex nor an edge ?* ; cout <<"Neither a vertex nor an edge ?";
ProcessEdge(TopoDS::Edge(aShape)) ; ProcessEdge(TopoDS::Edge(aShape)) ;
// OK for compiler but an exception will be raised at run-time // OK for compiler but an exception will be raised at run-time
} }
@ -751,7 +751,7 @@ The following steps are performed:
} }
//Draw the edges of theMap //Draw the edges of theMap
Standard_Integer i; Standard_Integer i;
for (i=1;i=edgemap.Extent();i++) { for (i=1;i<=edgemap.Extent();i++) {
switch (faceCount(i)) { switch (faceCount(i)) {
case 0 : case 0 :
DrawEdge(TopoDS::Edge(edgemap(i)),FreeEdgeColor); DrawEdge(TopoDS::Edge(edgemap(i)),FreeEdgeColor);
@ -782,7 +782,7 @@ The following example counts the size of a data structure as a number of *TShape
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include TopoDS_Iterator.hxx #include <TopoDS_Iterator.hxx>
Standard_Integer Size(const TopoDS_Shape& aShape) Standard_Integer Size(const TopoDS_Shape& aShape)
{ {
// This is a recursive method. // This is a recursive method.
@ -802,8 +802,8 @@ Thus for a contour of four edges it should count 1 wire + 4 edges +4 vertices wi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include TopoDS_Iterator.hxx #include <TopoDS_Iterator.hxx>
#includeTopTools_MapOfShape.hxx #include <TopTools_MapOfShape.hxx>
void MapShapes(const TopoDS_Shape& aShape, void MapShapes(const TopoDS_Shape& aShape,
TopTools_MapOfShape& aMap) TopTools_MapOfShape& aMap)
@ -835,11 +835,11 @@ The following example is more ambitious and writes a program which copies a data
- The structure is copied using the auxiliary recursive function,which copies from the map to the array. - The structure is copied using the auxiliary recursive function,which copies from the map to the array.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include TopoDS_Shape.hxx #include <TopoDS_Shape.hxx>
#include TopoDS_Iterator.hxx #include <TopoDS_Iterator.hxx>
#include TopTools_IndexedMapOfShape.hxx #include <TopTools_IndexedMapOfShape.hxx>
#include TopTools_Array1OfShape.hxx #include <TopTools_Array1OfShape.hxx>
#include TopoDS_Location.hxx #include <TopoDS_Location.hxx>
TopoDS_Shape Copy(const TopoDS_Shape& aShape, TopoDS_Shape Copy(const TopoDS_Shape& aShape,
const TopoDS_Builder& aBuilder) const TopoDS_Builder& aBuilder)
@ -855,7 +855,7 @@ The following example is more ambitious and writes a program which copies a data
S.Location(Identity); S.Location(Identity);
S.Orientation(TopAbs_FORWARD); S.Orientation(TopAbs_FORWARD);
theMap.Add(S); theMap.Add(S);
for (i=1; i= theMap.Extent(); i++) { for (i=1; i<= theMap.Extent(); i++) {
for(It.Initialize(theMap(i)); It.More(); It.Next()) { for(It.Initialize(theMap(i)); It.More(); It.Next()) {
S=It.Value(); S=It.Value();
S.Location(Identity); S.Location(Identity);

View File

@ -302,7 +302,7 @@ void DumpChildren(const TDF_Label& aLabel)
TCollection_AsciiString es; TCollection_AsciiString es;
for (it.Initialize(aLabel,Standard_True); it.More(); it.Next()){ for (it.Initialize(aLabel,Standard_True); it.More(); it.Next()){
TDF_Tool::Entry(it.Value(),es); TDF_Tool::Entry(it.Value(),es);
cout = as.ToCString() = endl; cout << as.ToCString() << endl;
} }
} }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -410,7 +410,7 @@ If you use a standard file format and you want your new attributes to be stored
1. If you place an attribute to a new package, it is desirable (although not mandatory) if your package name starts with letter "T" (transient), for example: attribute *TMyAttributePackage_MyAttribute* in the package *TMyAttributePackage*. 1. If you place an attribute to a new package, it is desirable (although not mandatory) if your package name starts with letter "T" (transient), for example: attribute *TMyAttributePackage_MyAttribute* in the package *TMyAttributePackage*.
2. Create a new package with name "P[package name]" (for example *PMyAttributePackage*) with class *PMyAttributePackage_MyAttribute* inside. The new class inherits the *PDF_Attribute* class and contains fields of attributes, which must be saved or retrieved ("P" - persistent). 2. Create a new package with name "P[package name]" (for example *PMyAttributePackage*) with class *PMyAttributePackage_MyAttribute* inside. The new class inherits the *PDF_Attribute* class and contains fields of attributes, which must be saved or retrieved ("P" - persistent).
3. Create a new package with name "M[package name]" (for example *MMyAttributePackage*) with classes *MMyAttributePackage_MyAttributeRetrievalDriver* and *MMyAttributePackage_MyAttributeStorageDriver* inside. The new classes inherit *MDF_ARDriver* and *MDF_ASDriver* classes respectively and contain the translation functionality: from T... attribute to P... and vice versa (M - middle) (see the realization of the standard attributes). 3. Create a new package with name "M[package name]" (for example *MMyAttributePackage*) with classes *MMyAttributePackage_MyAttributeRetrievalDriver* and *MMyAttributePackage_MyAttributeStorageDriver* inside. The new classes inherit *MDF_ARDriver* and *MDF_ASDriver* classes respectively and contain the translation functionality: from T... attribute to P... and vice versa (M - middle) (see the realization of the standard attributes).
4. M... package must contain *AddStorageDrivers(aDriverSeq : ASDriverHSequence* from MDF) and *AddRetrievalDrivers(aDriverSeq : ASDriverHSequence* from MDF) methods, which append to the given sequence *\<aDriverSeq\>* of drivers a sequence of all new attribute drivers (see the previous point), which will be used for the attributes storage/retrieval. 4. M... package must contain *AddStorageDrivers(aDriverSeq : ASDriverHSequence* from MDF) and *AddRetrievalDrivers(aDriverSeq : ASDriverHSequence* from MDF) methods, which append to the given sequence of drivers *aDriverSeq*, which is a sequence of all new attribute drivers (see the previous point) used for the storage/retrieval of attributes.
5 Use the standard schema (*StdSchema* unit) or create a new one to add your P-package and compile it. 5 Use the standard schema (*StdSchema* unit) or create a new one to add your P-package and compile it.
If you use the XML format, do the following: If you use the XML format, do the following:
@ -519,17 +519,17 @@ TDF_Label label = doc->Main();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_ocaf_4_3_2 Retrieving the document from a label in its framework @subsubsection occt_ocaf_4_3_2 Retrieving the document from a label in its framework
To retrieve the document from a label in its data framework, you use TDocStd_Document::Get as in the example below. The argument *label *passed to this method is an instantiation of TDF_Label. To retrieve the document from a label in its data framework, you use *TDocStd_Document::Get* as in the example below. The argument *label* passed to this method is an instantiation of *TDF_Label*.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
doc = TDocStd_Document::Get(label); doc = TDocStd_Document::Get(label);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@subsubsection occt_ocaf_4_3_3 Saving the document @subsubsection occt_ocaf_4_3_3 Saving the document
If in your document you use only standard attributes (from the packages TDF, TDataStd, TNaming, TFunction, TPrsStd and TDocStd), you just do the following steps: If in your document you use only standard attributes (from the packages *TDF, TDataStd, TNaming, TFunction, TPrsStd* and *TDocStd*), you just do the following steps:
* In your application class (which inherits class *TDocStd_Application*) implement two methods: * In your application class (which inherits class *TDocStd_Application*) implement two methods:
+ Formats (TColStd_SequenceOfExtendedString& theFormats), which append to a given sequence \<theFormats\> your document format string, for example, "NewDocumentFormat" this string is also set in the document creation command + Formats (TColStd_SequenceOfExtendedString& theFormats), which append to a given sequence <i>\<theFormats\></i> your document format string, for example, "NewDocumentFormat" this string is also set in the document creation command
+ ResourcesName(), which returns a string with a name of resources file (this file contains a description about the extension of the document, storage/retrieval drivers GUIDs...), for example, "NewFormat" + ResourcesName(), which returns a string with a name of resources file (this file contains a description about the extension of the document, storage/retrieval drivers GUIDs...), for example, "NewFormat"
* Create the resource file (with name, for example, "NewFormat") with the following strings: * Create the resource file (with name, for example, "NewFormat") with the following strings:
@ -990,23 +990,23 @@ The table of drivers is created by by methods *XmlDrivers_DocumentStorageDriver:
and *XmlDrivers_DocumentRetrievalDriver::AttributeDrivers()*. and *XmlDrivers_DocumentRetrievalDriver::AttributeDrivers()*.
Then the persistent document is written into a file (or read from a file). Then the persistent document is written into a file (or read from a file).
In standard persistence Storage and FSD packages contain classes for writing/reading the persistent document into a file. In XML persistence LDOMParser and LDOM_XmlWriter are used instead. In standard persistence Storage and FSD packages contain classes for writing/reading the persistent document into a file. In XML persistence *LDOMParser* and *LDOM_XmlWriter* are used instead.
Usually, the library containing document storage and retrieval drivers is loaded at run time by a plugin mechanism. To support this in XML Persistence, there is a plugin XmlPlugin and a Factory()method in the XmlDrivers package. This method compares passed GUIDs with known GUIDs and returns the corresponding driver or generates an exception if the GUID is unknown. Usually, the library containing document storage and retrieval drivers is loaded at run time by a plugin mechanism. To support this in XML Persistence, there is a plugin *XmlPlugin* and a *Factory()* method in the *XmlDrivers* package. This method compares passed GUIDs with known GUIDs and returns the corresponding driver or generates an exception if the GUID is unknown.
The application defines which GUID is needed for document storage or retrieval and in which library it should be found. This depends on document format and application resources. Resources for XML Persistence and also for standard persistence are found in the StdResource unit. They are written for the XmlOcaf document format. The application defines which GUID is needed for document storage or retrieval and in which library it should be found. This depends on document format and application resources. Resources for XML Persistence and also for standard persistence are found in the StdResource unit. They are written for the XmlOcaf document format.
@subsection occt_ocaf_9_2 Attribute Drivers @subsection occt_ocaf_9_2 Attribute Drivers
There is one attribute driver for XML persistence for each transient attribute from a set of standard OCAF attributes, with the exception of attribute types, which are never stored (pure transient). Standard OCAF attributes are collected in six packages, and their drivers also follow this distribution. Driver for attribute T*_* is called XmlM*_*. Conversion between transient and persistent form of attribute is performed by two methods Paste() of attribute driver. There is one attribute driver for XML persistence for each transient attribute from a set of standard OCAF attributes, with the exception of attribute types, which are never stored (pure transient). Standard OCAF attributes are collected in six packages, and their drivers also follow this distribution. Driver for attribute <i>T*_*</i> is called <i>XmlM*_*</i>. Conversion between transient and persistent form of attribute is performed by two methods *Paste()* of attribute driver.
*XmlMDF_ADriver* is the root class for all attribute drivers. *XmlMDF_ADriver* is the root class for all attribute drivers.
At the beginning of storage/retrieval process, one instance of each attribute driver is created and appended to driver table implemented as XmlMDF_ADriverTable. During OCAF Data storage, attribute drivers are retrieved from the driver table by the type of attribute. In the retrieval step, a data map is created linking names of DOM_Elements and attribute drivers, and then attribute drivers are sought in this map by DOM_Element qualified tag names. At the beginning of storage/retrieval process, one instance of each attribute driver is created and appended to driver table implemented as *XmlMDF_ADriverTable*. During OCAF Data storage, attribute drivers are retrieved from the driver table by the type of attribute. In the retrieval step, a data map is created linking names of *DOM_Elements* and attribute drivers, and then attribute drivers are sought in this map by *DOM_Element* qualified tag names.
Every transient attribute is saved as a DOM_Element (root element of OCAF attribute) with attributes and possibly sub-nodes. The name of the root element can be defined in the attribute driver as a string passed to the base class constructor. The default is the attribute type name. Similarly, namespace prefixes for each attribute can be set. There is no default value, but it is possible to pass NULL or an empty string to store attributes without namespace prefixes. Every transient attribute is saved as a *DOM_Element* (root element of OCAF attribute) with attributes and possibly sub-nodes. The name of the root element can be defined in the attribute driver as a string passed to the base class constructor. The default is the attribute type name. Similarly, namespace prefixes for each attribute can be set. There is no default value, but it is possible to pass NULL or an empty string to store attributes without namespace prefixes.
The basic class XmlMDF_ADriver supports errors reporting via the method *WriteMessage(const TCollection_ExtendedString&)*. It sends a message string to its message driver which is initialized in the constructor with a Handle(CDM_MessageDriver) passed from the application by Document Storage/Retrieval Driver. The basic class *XmlMDF_ADriver* supports errors reporting via the method *WriteMessage(const TCollection_ExtendedString&)*. It sends a message string to its message driver which is initialized in the constructor with a *Handle(CDM_MessageDriver)* passed from the application by Document Storage/Retrieval Driver.
@subsection occt_ocaf_9_3 XML Document Structure @subsection occt_ocaf_9_3 XML Document Structure
@ -1014,7 +1014,7 @@ Every XML Document has one root element, which may have attributes and contain o
* **Element info** - contains strings identifying the format version and other parameters of the OCAF XML document. Normally, data under the element is used by persistence algorithms to correctly retrieve and initialize an OCAF document. The data also includes a copyright string. * **Element info** - contains strings identifying the format version and other parameters of the OCAF XML document. Normally, data under the element is used by persistence algorithms to correctly retrieve and initialize an OCAF document. The data also includes a copyright string.
* **Element comments** - consists of an unlimited number of \<comment\> sub-elements containing necessary comment strings. * **Element comments** - consists of an unlimited number of \<comment\> sub-elements containing necessary comment strings.
* **Element label** is the root label of the document data structure, with the XML attribute "tag" equal to 0. It contains all the OCAF data (labels, attributes) as tree of XML elements. Every sub-label is identified by a tag (positive integer) defining a unique key for all sub-labels of a label. Every label can contain any number of elements representing OCAF attributes (see OCAF Attributes Representation below). * **Element label** is the root label of the document data structure, with the XML attribute "tag" equal to 0. It contains all the OCAF data (labels, attributes) as tree of XML elements. Every sub-label is identified by a tag (positive integer) defining a unique key for all sub-labels of a label. Every label can contain any number of elements representing OCAF attributes (see OCAF Attributes Representation below).
* **Element shapes** - contains geometrical and topological entities in BRep format. These entities being referenced by OCAF attributes written under the element \<label\>. This element is empty if there are no shapes in the document. It is only output if attribute driver XmlMNaming_NamedShapeDriver has been added to drivers table by the DocumentStorageDriver. * **Element shapes** - contains geometrical and topological entities in BRep format. These entities being referenced by OCAF attributes written under the element \<label\>. This element is empty if there are no shapes in the document. It is only output if attribute driver *XmlMNaming_NamedShapeDriver* has been added to drivers table by the *DocumentStorageDriver*.
### OCAF Attributes Representation ### OCAF Attributes Representation
@ -1024,9 +1024,9 @@ XML types for OCAF attributes are declared with XML W3C Schema in a few XSD file
### Example of resulting XML file ### Example of resulting XML file
The following example is a sample text from an XML file obtained by storing an OCAF document with two labels (0: and 0:2) and two attributes - TDataStd_Name (on label 0:) and TNaming_NamedShape (on label 0:2). The \<shapes\> section contents are replaced by an ellipsis. The following example is a sample text from an XML file obtained by storing an OCAF document with two labels (0: and 0:2) and two attributes - *TDataStd_Name* (on label 0:) and *TNaming_NamedShape* (on label 0:2). The \<shapes\> section contents are replaced by an ellipsis.
~~~~~ ~~~~
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document format="XmlOcaf" xmlns="http://www.opencascade.org/OCAF/XML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <document format="XmlOcaf" xmlns="http://www.opencascade.org/OCAF/XML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opencascade.org/OCAF/XML http://www.opencascade.org/OCAF/XML/XmlOcaf.xsd"> xsi:schemaLocation="http://www.opencascade.org/OCAF/XML http://www.opencascade.org/OCAF/XML/XmlOcaf.xsd">
@ -1054,7 +1054,7 @@ xsi:schemaLocation="http://www.opencascade.org/OCAF/XML http://www.opencascade.o
</shapes> </shapes>
</document> </document>
~~~~~ ~~~~
@subsection occt_ocaf_9_4 XML Schema @subsection occt_ocaf_9_4 XML Schema
@ -1072,9 +1072,9 @@ The Schema definitions are not used by OCAF XML Persistence algorithms when savi
### Management of Namespaces ### Management of Namespaces
Both the XML format and the XML OCAF persistence code are extensible in the sense that every new development can reuse everything that has been created in previous projects. For the XML format, this extensibility is supported by assigning names of XML objects (elements) to different XML Namespaces. Hence, XML elements defined in different projects (in different persistence libraries) can easily be combined into the same XML documents. An example is the XCAF XML persistence built as an extension to the Standard OCAF XML persistence [File XmlXcaf.xsd]. For the correct management of Namespaces it is necessary to: Both the XML format and the XML OCAF persistence code are extensible in the sense that every new development can reuse everything that has been created in previous projects. For the XML format, this extensibility is supported by assigning names of XML objects (elements) to different XML Namespaces. Hence, XML elements defined in different projects (in different persistence libraries) can easily be combined into the same XML documents. An example is the XCAF XML persistence built as an extension to the Standard OCAF XML persistence <i>[File XmlXcaf.xsd]</i>. For the correct management of Namespaces it is necessary to:
* Define *targetNamespace* in the new XSD file describing the format. * Define *targetNamespace* in the new XSD file describing the format.
* Declare (in XSD files) all elements and types in the targetNamespace to appear without a namespace prefix; all other elements and types use the appropriate prefix (such as "ocaf:"). * Declare (in *XSD* files) all elements and types in the targetNamespace to appear without a namespace prefix; all other elements and types use the appropriate prefix (such as "ocaf:").
* Add (in the new *DocumentStorageDriver*) the *targetNamespace* accompanied with its prefix, using method *XmlDrivers_DocumentStorageDriver::AddNamespace*. The same is done for all namespaces objects which are used by the new persistence, with the exception of the "ocaf" namespace. * Add (in the new *DocumentStorageDriver*) the *targetNamespace* accompanied with its prefix, using method *XmlDrivers_DocumentStorageDriver::AddNamespace*. The same is done for all namespaces objects which are used by the new persistence, with the exception of the "ocaf" namespace.
* Pass (in every OCAF attribute driver) the namespace prefix of the *targetNamespace* to the constructor of *XmlMDF_ADriver*. * Pass (in every OCAF attribute driver) the namespace prefix of the *targetNamespace* to the constructor of *XmlMDF_ADriver*.
@ -1107,7 +1107,6 @@ Both the XML format and the XML OCAF persistence code are extensible in the sens
To store these references properly, a label must also contain an external link attribute. To store these references properly, a label must also contain an external link attribute.
* **Father** - a label, from which other labels have been created. The other labels are, by definition, the children of this label. * **Father** - a label, from which other labels have been created. The other labels are, by definition, the children of this label.
* **Framework** - a group of co-operating classes which enable a design to be re-used for a given category of problem. The framework guides the architecture of the application by breaking it up into abstract classes, each of which has different responsibilities and collaborates in a predefined way. Application developer creates a specialized framework by: * **Framework** - a group of co-operating classes which enable a design to be re-used for a given category of problem. The framework guides the architecture of the application by breaking it up into abstract classes, each of which has different responsibilities and collaborates in a predefined way. Application developer creates a specialized framework by:
* defining new classes which inherit from these abstract classes * defining new classes which inherit from these abstract classes
* composing framework class instances * composing framework class instances
* implementing the services required by the framework. * implementing the services required by the framework.

View File

@ -126,7 +126,7 @@ OCAF uses other modules of Open CASCADE Technology — the Shape attribute is im
In order to maintain the attachment of application data, the geometry must be distinguished from other data. In order to maintain the attachment of application data, the geometry must be distinguished from other data.
In OCAF, the data are reference-key driven. It is a uniform model in which reference-keys In OCAF, the data are reference-key driven. It is a uniform model in which reference-keys
are the persistent identification of data. All *accessible* data, including the geometry, are the persistent identification of data. All **accessible** data, including the geometry,
are implemented as attributes attached to reference-keys. are implemented as attributes attached to reference-keys.
The geometry becomes the value of the Shape attribute, just as a number is the value The geometry becomes the value of the Shape attribute, just as a number is the value
of the Integer and Real attributes and a string that of the Name attribute. of the Integer and Real attributes and a string that of the Name attribute.

View File

@ -93,7 +93,7 @@ sfs->Perform();
~~~~~ ~~~~~
4. Get the result: 4. Get the result:
~~~~~ ~~~~~
TopoDS_Shape aResult = sfs-Shape(); TopoDS_Shape aResult = sfs->Shape();
~~~~~ ~~~~~
In some cases using only *ShapeFix_Shape* can be insufficient. It is possible to use tools for merging and removing small edges and fixing gaps between 2D and 3D curves. In some cases using only *ShapeFix_Shape* can be insufficient. It is possible to use tools for merging and removing small edges and fixing gaps between 2D and 3D curves.
5. Create *ShapeFix_Wireframe* tool and initialize it by shape: 5. Create *ShapeFix_Wireframe* tool and initialize it by shape:
@ -111,17 +111,17 @@ sfs->SetMaxTolerance ( maxTol );
See the description for *Prec* and *maxTol* above. See the description for *Prec* and *maxTol* above.
7. Merge and remove small edges: 7. Merge and remove small edges:
~~~~~ ~~~~~
SFWF-DropSmallEdgesMode() = Standard_True; SFWF->DropSmallEdgesMode() = Standard_True;
SFWF-FixSmallEdges(); SFWF->FixSmallEdges();
~~~~~ ~~~~~
**Note:** Small edges are not removed with the default mode, but in many cases removing small edges is very useful for fixing a shape. **Note:** Small edges are not removed with the default mode, but in many cases removing small edges is very useful for fixing a shape.
8. Fix gaps for 2D and 3D curves 8. Fix gaps for 2D and 3D curves
~~~~~ ~~~~~
SFWF-FixWireGaps(); SFWF->FixWireGaps();
~~~~~ ~~~~~
9. Get the result 9. Get the result
~~~~~ ~~~~~
TopoDS_Shape Result = SFWF-Shape(); TopoDS_Shape Result = SFWF->Shape();
~~~~~ ~~~~~
@ -147,19 +147,19 @@ Handle(ShapeFix_Face) SFF= new ShapeFix_Face;
// create tool for rebuilding a shape and initialize it by shape // create tool for rebuilding a shape and initialize it by shape
Handle(ShapeBuild_ReShape) Context = new ShapeBuild_ReShape; Handle(ShapeBuild_ReShape) Context = new ShapeBuild_ReShape;
Context-Apply(Shape1); Context->Apply(Shape1);
//set a tool for rebuilding a shape in the tool for fixing //set a tool for rebuilding a shape in the tool for fixing
SFF-SetContext(Context); SFF->SetContext(Context);
//initialize the fixing tool by one face //initialize the fixing tool by one face
SFF-Init(Face1); SFF->Init(Face1);
//fix the set face //fix the set face
SFF-Perform(); SFF->Perform();
//get the result //get the result
TopoDS_Shape NewShape = Context-Apply(Shape1); TopoDS_Shape NewShape = Context->Apply(Shape1);
//Resulting shape contains the fixed face. //Resulting shape contains the fixed face.
~~~~~ ~~~~~
@ -186,13 +186,12 @@ The following sequence of actions should be applied to perform fixes:
- with help of a special method *Shape(),Face(),Wire().Edge()*. - with help of a special method *Shape(),Face(),Wire().Edge()*.
- from the rebuilding tool by method *Apply* (for access to rebuilding tool use method *Context()*): - from the rebuilding tool by method *Apply* (for access to rebuilding tool use method *Context()*):
~~~~~ ~~~~~
TopoDS_Shape resultShape = fixtool-Context()-Apply(initialShape); TopoDS_Shape resultShape = fixtool->Context()->Apply(initialShape);
~~~~~ ~~~~~
Modification fistory for the shape and its sub-shapes can be obtained from the tool for shape re-building (*ShapeBuild_ReShape*). Modification fistory for the shape and its sub-shapes can be obtained from the tool for shape re-building (*ShapeBuild_ReShape*).
~~~~~ ~~~~~
TopoDS_Shape modifsubshape = fixtool-Context() TopoDS_Shape modifsubshape = fixtool->Context() -> Apply(initsubshape);
-Apply(initsubshape);
~~~~~ ~~~~~
@ -204,9 +203,9 @@ For example, it is possible to forbid performing fixes to remove small edges - *
~~~~~ ~~~~~
Handle(ShapeFix_Shape) Sfs = new ShapeFix_Shape(shape); Handle(ShapeFix_Shape) Sfs = new ShapeFix_Shape(shape);
Sfs- FixWireTool ()-FixSmallMode () =0; Sfs-> FixWireTool ()->FixSmallMode () =0;
if(Sfs-Perform()) if(Sfs->Perform())
TopoDS_Shape resShape = Sfs-Shape(); TopoDS_Shape resShape = Sfs->Shape();
~~~~~ ~~~~~
@ -224,19 +223,19 @@ Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape(face);
sfs->SetPrecision(prec); sfs->SetPrecision(prec);
sfs->SetMaxTolerance(maxTol); sfs->SetMaxTolerance(maxTol);
//set the value of flag for forcing the removal of 2D curves //set the value of flag for forcing the removal of 2D curves
sfs->FixWireTool()-FixRemovePCurveMode() =1; sfs->FixWireTool()->FixRemovePCurveMode() =1;
//reform fixes //reform fixes
sfs->Perform(); sfs->Perform();
//getting the result //getting the result
if(sfs->Status(ShapeExtend_DONE) ) { if(sfs->Status(ShapeExtend_DONE) ) {
cout << Shape was fixed << endl; cout << "Shape was fixed" << endl;
TopoDS_Shape resFace = sfs->Shape(); TopoDS_Shape resFace = sfs->Shape();
} }
else if(sfs->Status(ShapeExtend_FAIL)) { else if(sfs->Status(ShapeExtend_FAIL)) {
cout<< Shape could not be fixed << endl; cout<< "Shape could not be fixed" << endl;
} }
else if(sfs->Status(ShapeExtent_OK)) { else if(sfs->Status(ShapeExtent_OK)) {
cout<< Initial face is valid with specified precision =<< precendl; cout<< "Initial face is valid with specified precision ="<< precendl;
} }
~~~~~ ~~~~~
@ -387,24 +386,20 @@ Standard_Real precision = 1e-04;
ShapeFix_Wire sfw (wire, face, precision); ShapeFix_Wire sfw (wire, face, precision);
//Creates a tool and loads objects into it //Creates a tool and loads objects into it
sfw.FixReorder(); sfw.FixReorder();
//Orders edges in the wire so that each edge //Orders edges in the wire so that each edge starts at the end of the one before it.
//starts at the end of the one before it
sfw.FixConnected(); sfw.FixConnected();
//Forces all adjacent edges to share //Forces all adjacent edges to share
//the same vertex //the same vertex
Standard_Boolean LockVertex = Standard_True; Standard_Boolean LockVertex = Standard_True;
if (sfw.FixSmall (LockVertex, precision)) { if (sfw.FixSmall (LockVertex, precision)) {
//Removes all edges which are shorter than //Removes all edges which are shorter than the given precision and have the same vertex at both ends.
//the given precision and have the same vertex at both ends
} }
if (sfw.FixSelfIntersection()) { if (sfw.FixSelfIntersection()) {
//Fixes self-intersecting edges and intersecting //Fixes self-intersecting edges and intersecting adjacent edges.
//adjacent edges cout <<"Wire was slightly self-intersecting. Repaired"<<endl;
cout;Wire was slightly self-intersecting. Repaired;endl;
} }
if ( sfw.FixLacking ( Standard_False ) ) { if ( sfw.FixLacking ( Standard_False ) ) {
//Inserts edges to connect adjacent //Inserts edges to connect adjacent non-continuous edges.
//non-continuous edges
} }
TopoDS_Wire newwire = sfw.Wire(); TopoDS_Wire newwire = sfw.Wire();
//Returns the corrected wire //Returns the corrected wire
@ -438,8 +433,7 @@ if (saw.CheckOrder()) {
// their orientation is corrected // their orientation is corrected
if (saw.CheckSmall (precision)) { if (saw.CheckSmall (precision)) {
cout<<“Wire contains edge(s) shorter than “<<precision<<endl; cout<<“Wire contains edge(s) shorter than “<<precision<<endl;
// An edge that is shorter than the given // An edge that is shorter than the given tolerance is found.
// tolerance is found
Standard_Boolean LockVertex = Standard_True; Standard_Boolean LockVertex = Standard_True;
if (sfw.FixSmall (LockVertex, precision)) { if (sfw.FixSmall (LockVertex, precision)) {
cout<<“Edges shorter than “<<precision<< have been removed cout<<“Edges shorter than “<<precision<< have been removed
@ -450,11 +444,10 @@ if (saw.CheckSmall (precision)) {
if (saw.CheckSelfIntersection()) { if (saw.CheckSelfIntersection()) {
cout<<“Wire has self-intersecting or intersecting cout<<“Wire has self-intersecting or intersecting
adjacent edges”<<endl; adjacent edges”<<endl;
// Two intersecting adjacent edges are found // Two intersecting adjacent edges are found.
if (sfw.FixSelfIntersection()) { if (sfw.FixSelfIntersection()) {
cout<<“Wire was slightly self-intersecting. Repaired”<<endl; cout<<“Wire was slightly self-intersecting. Repaired”<<endl;
// The edges are cut at the intersection point so // The edges are cut at the intersection point so that they no longer intersect.
// that they no longer intersect
} }
} }
~~~~~ ~~~~~
@ -504,7 +497,7 @@ As the result, the edge tolerance has been increased.
@subsubsection occt_shg_2_3_9 Repairing tool for the wireframe of a shape @subsubsection occt_shg_2_3_9 Repairing tool for the wireframe of a shape
Class *ShapeFix_Wireframe provides methods for geometrical fixing of gaps and merging small edges in a shape. This class performs the following operations: Class *ShapeFix_Wireframe* provides methods for geometrical fixing of gaps and merging small edges in a shape. This class performs the following operations:
* fills gaps in the 2D and 3D wireframe of a shape. * fills gaps in the 2D and 3D wireframe of a shape.
* merges and removes small edges. * merges and removes small edges.
@ -519,8 +512,7 @@ To perform fixes it is necessary to:
~~~~~ ~~~~~
//creation of a tool //creation of a tool
Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(shape); Handle(ShapeFix_Wireframe) sfwf = new ShapeFix_Wireframe(shape);
//sets the working precision problems will be detected with and //sets the working precision problems will be detected with and the maximum allowed tolerance
//the maximum allowed tolerance
sfwf->SetPrecision(prec); sfwf->SetPrecision(prec);
sfwf->SetMaxTolerance(maxTol); sfwf->SetMaxTolerance(maxTol);
//fixing of gaps //fixing of gaps
@ -574,8 +566,7 @@ ShapeFix_ShapeTolerance Sft;
Sft.SetTolerance(shape,toler); Sft.SetTolerance(shape,toler);
//setting a specified tolerance for vertices only //setting a specified tolerance for vertices only
Sft.SetTolerance(shape,toler,TopAbs_VERTEX); Sft.SetTolerance(shape,toler,TopAbs_VERTEX);
//limiting the tolerance on the shape and its sub-shapes between minimum and //limiting the tolerance on the shape and its sub-shapes between minimum and maximum tolerances
//maximum tolerances
Sft.LimitTolerance(shape,tolermin,tolermax); Sft.LimitTolerance(shape,tolermin,tolermax);
~~~~~ ~~~~~
@ -600,7 +591,7 @@ ShapeAnalysis_Edge sae;
for(TopExp_Explorer Exp(face,TopAbs_EDGE);Exp.More();Exp.Next()) { for(TopExp_Explorer Exp(face,TopAbs_EDGE);Exp.More();Exp.Next()) {
TopoDS_Edge edge = TopoDS::Edge (Exp.Current()); TopoDS_Edge edge = TopoDS::Edge (Exp.Current());
if (!sae.HasCurve3d (edge)) { if (!sae.HasCurve3d (edge)) {
cout *Edge has no 3D curve* endl; } cout <<"Edge has no 3D curve"<< endl; }
} }
~~~~~ ~~~~~
@ -611,7 +602,7 @@ It is possible to check whether a face has an outer boundary with the help of me
~~~~~ ~~~~~
TopoDS_Face face … //analyzed face TopoDS_Face face … //analyzed face
if(!ShapeAnalysis::IsOuterBound(face)) { if(!ShapeAnalysis::IsOuterBound(face)) {
cout*Face has not outer boundary**endl; cout<<"Face has not outer boundary"<<endl;
} }
~~~~~ ~~~~~
@ -651,20 +642,18 @@ Standard_Real precision = 1e-04;
ShapeAnalysis_Wire saw (wire, face, precision); ShapeAnalysis_Wire saw (wire, face, precision);
//Creates a tool and loads objects into it //Creates a tool and loads objects into it
if (saw.CheckOrder()) { if (saw.CheckOrder()) {
cout*Some edges in the wire need to be reordered*endl; cout<<"Some edges in the wire need to be reordered"<<endl;
cout*Please ensure that all the edges are correctly cout<<"Please ensure that all the edges are correctly ordered before further analysis"<<endl;
ordered before further analysis*endl;
return; return;
} }
if (saw.CheckSmall (precision)) { if (saw.CheckSmall (precision)) {
cout*Wire contains edge(s) shorter than *precisionendl; cout<<"Wire contains edge(s) shorter than "<<precisionendl;
} }
if (saw.CheckConnected()) { if (saw.CheckConnected()) {
cout*Wire is disconnected*endl; cout<<"Wire is disconnected"<<endl;
} }
if (saw.CheckSelfIntersection()) { if (saw.CheckSelfIntersection()) {
cout*Wire has self-intersecting or intersecting cout<<"Wire has self-intersecting or intersecting adjacent edges"<< endl;
adjacent edges* endl;
} }
~~~~~ ~~~~~
@ -687,27 +676,26 @@ ShapeAnalysis_Edge sae;
for(TopExp_Explorer Exp(face,TopAbs_EDGE);Exp.More();Exp.Next()) { for(TopExp_Explorer Exp(face,TopAbs_EDGE);Exp.More();Exp.Next()) {
TopoDS_Edge edge = TopoDS::Edge (Exp.Current()); TopoDS_Edge edge = TopoDS::Edge (Exp.Current());
if (!sae.HasCurve3d (edge)) { if (!sae.HasCurve3d (edge)) {
cout *Edge has no 3D curve* endl; cout << "Edge has no 3D curve" << endl;
} }
Handle(Geom2d_Curve) pcurve; Handle(Geom2d_Curve) pcurve;
Standard_Real cf, cl; Standard_Real cf, cl;
if (sae.PCurve (edge, face, pcurve, cf, cl, Standard_False)) { if (sae.PCurve (edge, face, pcurve, cf, cl, Standard_False)) {
//Returns the pcurve and its range on the given face //Returns the pcurve and its range on the given face
cout*Pcurve range [*cf*, *cl*]* endl; cout<<"Pcurve range ["<<cf<<", "<<cl<<"]"<< endl;
} }
Standard_Real maxdev; Standard_Real maxdev;
if (sae.CheckSameParameter (edge, maxdev)) { if (sae.CheckSameParameter (edge, maxdev)) {
//Checks the consistency of all the curves //Checks the consistency of all the curves in the edge
//in the edge cout<<"Incorrect SameParameter flag"<<endl;
cout*Incorrect SameParameter flag*endl;
} }
cout*Maximum deviation *maxdev*, tolerance* cout<<"Maximum deviation "<<maxdev<<", tolerance"
BRep_Tool::Tolerance(edge)endl; <<BRep_Tool::Tolerance(edge)<<endl;
} }
//checks the overlapping of two edges //checks the overlapping of two edges
if(sae.CheckOverlapping(edge1,edge2,prec,dist)) { if(sae.CheckOverlapping(edge1,edge2,prec,dist)) {
cout*Edges are overlapped with tolerance = *precendl; cout<<"Edges are overlapped with tolerance = "<<prec<<endl;
cout*Domain of overlapping =*distendl; cout<<"Domain of overlapping ="<<dist<<endl;
} }
~~~~~ ~~~~~
@ -731,7 +719,7 @@ saf.CheckStripFace(face,E1,E2,prec))
NumSmallfaces++; NumSmallfaces++;
} }
if(numSmallfaces) if(numSmallfaces)
cout*Number of small faces in the shape =* numSmallfaces endl; cout<<"Number of small faces in the shape ="<< numSmallfaces <<endl;
~~~~~ ~~~~~
@subsubsection occt_shg_3_1_5 Analysis of shell validity and closure @subsubsection occt_shg_3_1_5 Analysis of shell validity and closure
@ -769,15 +757,14 @@ The analysis of tolerance functionality is the following:
TopoDS_Shape shape = ...; TopoDS_Shape shape = ...;
ShapeAnalysis_ShapeTolerance sast; ShapeAnalysis_ShapeTolerance sast;
Standard_Real AverageOnShape = sast.Tolerance (shape, 0); Standard_Real AverageOnShape = sast.Tolerance (shape, 0);
cout*Average tolerance of the shape is *AverageOnShapeendl; cout<<"Average tolerance of the shape is "<<AverageOnShape<<endl;
Standard_Real MinOnEdge = sast.Tolerance (shape,-1,TopAbs_EDGE); Standard_Real MinOnEdge = sast.Tolerance (shape,-1,TopAbs_EDGE);
cout*Minimum tolerance of the edges is *MinOnEdgeendl; cout<<"Minimum tolerance of the edges is "<<MinOnEdge<<endl;
Standard_Real MaxOnVertex = sast.Tolerance (shape,1,TopAbs_VERTEX); Standard_Real MaxOnVertex = sast.Tolerance (shape,1,TopAbs_VERTEX);
cout*Maximum tolerance of the vertices is *MaxOnVertexendl; cout<<"Maximum tolerance of the vertices is "<<MaxOnVertex<<endl;
Standard_Real MaxAllowed = 0.1; Standard_Real MaxAllowed = 0.1;
if (MaxOnVertex MaxAllowed) { if (MaxOnVertex > MaxAllowed) {
cout*Maximum tolerance of the vertices exceeds cout<<"Maximum tolerance of the vertices exceeds maximum allowed"<<endl;
maximum allowed*endl;
} }
~~~~~ ~~~~~
@ -923,8 +910,7 @@ if(ShapeDivideCont.Status(ShapeExtend_DONE)
TopoDS_Shape result = ShapeDivideCont.GetResult(); TopoDS_Shape result = ShapeDivideCont.GetResult();
//get the history of modifications made to faces //get the history of modifications made to faces
for(TopExp_Explorer aExp(initShape,TopAbs_FACE); aExp.More(0; aExp.Next()) { for(TopExp_Explorer aExp(initShape,TopAbs_FACE); aExp.More(0; aExp.Next()) {
TopoDS_Shape modifShape = ShapeDivideCont.GetContext()- TopoDS_Shape modifShape = ShapeDivideCont.GetContext()-> Apply(aExp.Current());
Apply(aExp.Current());
} }
~~~~~ ~~~~~
@ -938,30 +924,25 @@ To change the value of criterion of shape splitting it is necessary to create a
Let us split a shape according to a specified criterion. Let us split a shape according to a specified criterion.
~~~~~ ~~~~~
//creation of new tools for geometry splitting by a specified //criterion. //creation of new tools for geometry splitting by a specified criterion.
Handle(MyTools_SplitSurfaceTool) MySplitSurfaceTool = Handle(MyTools_SplitSurfaceTool) MySplitSurfaceTool = new MyTools_SplitSurfaceTool;
new MyTools_SplitSurfaceTool; Handle(MyTools_SplitCurve3DTool) MySplitCurve3Dtool = new MyTools_SplitCurve3DTool;
Handle(MyTools_SplitCurve3DTool) MySplitCurve3Dtool = Handle(MyTools_SplitCurve2DTool) MySplitCurve2Dtool = new MyTools_SplitCurve2DTool;
new MyTools_SplitCurve3DTool;
Handle(MyTools_SplitCurve2DTool) MySplitCurve2Dtool =
new MyTools_SplitCurve2DTool;
//creation of a tool for splitting the shape and initialization of //that tool by shape. //creation of a tool for splitting the shape and initialization of that tool by shape.
TopoDS_Shape initShape TopoDS_Shape initShape
MyTools_ShapeDivideTool ShapeDivide (initShape); MyTools_ShapeDivideTool ShapeDivide (initShape);
//setting of work precision for splitting and maximum allowed //tolerance. //setting of work precision for splitting and maximum allowed tolerance.
ShapeDivide.SetPrecision(prec); ShapeDivide.SetPrecision(prec);
ShapeDivide.SetMaxTolerance(MaxTol); ShapeDivide.SetMaxTolerance(MaxTol);
//setting of new splitting geometry tools in the shape splitting //tools //setting of new splitting geometry tools in the shape splitting tools
Handle(ShapeUpgrade_FaceDivide) FaceDivide = Handle(ShapeUpgrade_FaceDivide) FaceDivide = ShapeDivide->GetSplitFaceTool();
ShapeDivide-GetSplitFaceTool(); Handle(ShapeUpgrade_WireDivide) WireDivide = FaceDivide->GetWireDivideTool();
Handle(ShapeUpgrade_WireDivide) WireDivide = FaceDivide->SetSplitSurfaceTool(MySplitSurfaceTool);
FaceDivide-GetWireDivideTool(); WireDivide->SetSplitCurve3dTool(MySplitCurve3DTool);
FaceDivide-SetSplitSurfaceTool(MySplitSurfaceTool); WireDivide->SetSplitCurve2dTool(MySplitCurve2DTool);
WireDivide-SetSplitCurve3dTool(MySplitCurve3DTool);
WireDivide-SetSplitCurve2dTool(MySplitCurve2DTool);
//setting of the value criterion. //setting of the value criterion.
ShapeDivide.SetValCriterion(val); ShapeDivide.SetValCriterion(val);
@ -974,8 +955,7 @@ TopoDS_Shape splitShape = ShapeDivide.GetResult();
//getting the history of modifications of faces //getting the history of modifications of faces
for(TopExp_Explorer aExp(initShape,TopAbs_FACE); aExp.More(0; aExp.Next()) { for(TopExp_Explorer aExp(initShape,TopAbs_FACE); aExp.More(0; aExp.Next()) {
TopoDS_Shape modifShape = ShapeDivide.GetContext()- TopoDS_Shape modifShape = ShapeDivide.GetContext()-> Apply(aExp.Current());
Apply(aExp.Current());
} }
~~~~~ ~~~~~
@ -1027,6 +1007,7 @@ This tool provides access to the tool for dividing and splitting 3D and 2D curve
* *GetSplitCurve2dTool*. * *GetSplitCurve2dTool*.
@subsubsection occt_shg_4_2_5 General tools for geometry splitting @subsubsection occt_shg_4_2_5 General tools for geometry splitting
There are three general tools for geometry splitting. There are three general tools for geometry splitting.
* General tool for surface splitting.(*ShapeUpgrade_SplitSurface*) * General tool for surface splitting.(*ShapeUpgrade_SplitSurface*)
* General tool for splitting 3D curves.(*ShapeUpgrade_SplitCurve3d*) * General tool for splitting 3D curves.(*ShapeUpgrade_SplitCurve3d*)
@ -1052,11 +1033,11 @@ Header file for the tool for surface splitting by continuity:
class ShapeUpgrade_SplitSurfaceContinuity : public ShapeUpgrade_SplitSurface { class ShapeUpgrade_SplitSurfaceContinuity : public ShapeUpgrade_SplitSurface {
Standard_EXPORT ShapeUpgrade_SplitSurfaceContinuity(); Standard_EXPORT ShapeUpgrade_SplitSurfaceContinuity();
//methods to set the criterion and the tolerance into the splitting //tool //methods to set the criterion and the tolerance into the splitting tool
Standard_EXPORT void SetCriterion(const GeomAbs_Shape Criterion) ; Standard_EXPORT void SetCriterion(const GeomAbs_Shape Criterion) ;
Standard_EXPORT void SetTolerance(const Standard_Real Tol) ; Standard_EXPORT void SetTolerance(const Standard_Real Tol) ;
//re-definition of method Compute //redefinition of method Compute
Standard_EXPORT virtual void Compute(const Standard_Boolean Segment) ; Standard_EXPORT virtual void Compute(const Standard_Boolean Segment) ;
Standard_EXPORT ~ShapeUpgrade_SplitSurfaceContinuity(); Standard_EXPORT ~ShapeUpgrade_SplitSurfaceContinuity();
private: private:
@ -1080,12 +1061,12 @@ sdc.SetPCurveCriterion (GeomAbs_C2); // for Curves 2D
sdc.SetSurfaceCriterion (GeomAbs_C2); // for Surfaces sdc.SetSurfaceCriterion (GeomAbs_C2); // for Surfaces
sdc.Perform (); sdc.Perform ();
TopoDS_Shape bshape = sdc.Result(); TopoDS_Shape bshape = sdc.Result();
.. to also get the correspondances before/after //.. to also get the correspondances before/after
Handle(ShapeBuild_ReShape) ctx = sdc.Context(); Handle(ShapeBuild_ReShape) ctx = sdc.Context();
.. on a given shape //.. on a given shape
if (ctx.IsRecorded (sh)) { if (ctx.IsRecorded (sh)) {
TopoDS_Shape newsh = ctx->Value (sh); TopoDS_Shape newsh = ctx->Value (sh);
// if there are several results, they are re-recorded inside a Compound // if there are several results, they are recorded inside a Compound.
// .. process as needed // .. process as needed
} }
~~~~~ ~~~~~
@ -1126,7 +1107,7 @@ Let us attempt to produce a conversion of planes to Bezier surfaces.
//Creation and initialization of a tool. //Creation and initialization of a tool.
ShapeUpgrade_ShapeConvertToBezier SCB (Shape); ShapeUpgrade_ShapeConvertToBezier SCB (Shape);
//setting tolerances //setting tolerances
….. ...
//setting mode for conversion of planes //setting mode for conversion of planes
SCB.SetSurfaceConversion (Standard_True); SCB.SetSurfaceConversion (Standard_True);
SCB.SetPlaneMode(Standard_True); SCB.SetPlaneMode(Standard_True);
@ -1149,7 +1130,7 @@ tool.SetMaxTolerance(maxTol);
Standard_Integer NbSplitPoints = …; Standard_Integer NbSplitPoints = …;
tool.SetNbSplitPoints(num); tool.SetNbSplitPoints(num);
if ( ! tool.Perform() && tool.Status (ShapeExtend_FAIL) ) { if ( ! tool.Perform() && tool.Status (ShapeExtend_FAIL) ) {
cout;Splitting of closed faces failed;endl; cout<<"Splitting of closed faces failed"<<endl;
. . . . . .
} }
TopoDS_Shape aResult = tool.Result(); TopoDS_Shape aResult = tool.Result();
@ -1217,7 +1198,7 @@ ShapeCustom::DirectFaces
static TopoDS_Shape DirectFaces(const TopoDS_Shape& S); static TopoDS_Shape DirectFaces(const TopoDS_Shape& S);
~~~~~ ~~~~~
This method provides conversion of indirect elementary surfaces (elementary surfaces with left-handed coordinate systems) in the shape into direct ones. New 2d curves (recomputed for converted surfaces) are added to the same edges being shared by both the resulting shape and the original shape S. This method provides conversion of indirect elementary surfaces (elementary surfaces with left-handed coordinate systems) in the shape into direct ones. New 2d curves (recomputed for converted surfaces) are added to the same edges being shared by both the resulting shape and the original shape *S*.
@subsubsection occt_shg_4_4_2 Shape Scaling @subsubsection occt_shg_4_4_2 Shape Scaling
@ -1249,7 +1230,7 @@ ShapeCustom::BsplineRestriction
It returns a new shape with all surfaces, curves and 2D curves of BSpline/Bezier type or based on them, converted with a degree less than *MaxDegree* or with a number of spans less then *NbMaxSegment* depending on the priority parameter *Degree*. If this parameter is equal to True then *Degree* will be increased to the value *GmaxDegree*, otherwise *NbMaxSegments* will be increased to the value *GmaxSegments*. *GmaxDegree* and *GMaxSegments* are the maximum possible degree and the number of spans correspondingly. These values will be used in cases when an approximation with specified parameters is impossible and either *GmaxDegree* or *GMaxSegments* is selected depending on the priority. It returns a new shape with all surfaces, curves and 2D curves of BSpline/Bezier type or based on them, converted with a degree less than *MaxDegree* or with a number of spans less then *NbMaxSegment* depending on the priority parameter *Degree*. If this parameter is equal to True then *Degree* will be increased to the value *GmaxDegree*, otherwise *NbMaxSegments* will be increased to the value *GmaxSegments*. *GmaxDegree* and *GMaxSegments* are the maximum possible degree and the number of spans correspondingly. These values will be used in cases when an approximation with specified parameters is impossible and either *GmaxDegree* or *GMaxSegments* is selected depending on the priority.
Note that if approximation is impossible with *GMaxDegree*, even then the number of spans can exceed the specified *GMaxSegment*. Rational specifies whether Rational BSpline/Bezier should be converted into polynomial B-Spline. Note that if approximation is impossible with *GMaxDegree*, even then the number of spans can exceed the specified *GMaxSegment*. *Rational* specifies whether Rational BSpline/Bezier should be converted into polynomial B-Spline.
Also note that the continuity of surfaces in the resulting shape can be less than the given value. Also note that the continuity of surfaces in the resulting shape can be less than the given value.
@ -1259,8 +1240,8 @@ To convert other types of curves and surfaces to BSpline with required parameter
The following flags define whether a specified-type geometry has been converted to BSpline with the required parameters: The following flags define whether a specified-type geometry has been converted to BSpline with the required parameters:
* *ConvertPlane,* * *ConvertPlane,*
* *ConvertBezierSurf,* * *ConvertBezierSurf,*
* *ConvertRevolutionSurf* * *ConvertRevolutionSurf,*
* *ConvertExtrusionSurf,.* * *ConvertExtrusionSurf,*
* *ConvertOffsetSurf,* * *ConvertOffsetSurf,*
* *ConvertCurve3d,* - for conversion of all types of 3D curves. * *ConvertCurve3d,* - for conversion of all types of 3D curves.
* *ConvertOffsetCurv3d,* - for conversion of offset 3D curves. * *ConvertOffsetCurv3d,* - for conversion of offset 3D curves.
@ -1375,36 +1356,36 @@ After the processing six internal wires with contour area less than the specifie
The example of method application is also given below: The example of method application is also given below:
~~~~~ ~~~~~
//Initialisation of the class by shape. //Initialization of the class by shape.
Handle(ShapeUpgrade_RemoveInternalWires) aTool = new ShapeUpgrade_RemoveInternalWires(inputShape); Handle(ShapeUpgrade_RemoveInternalWires) aTool = new ShapeUpgrade_RemoveInternalWires(inputShape);
//setting parameters //setting parameters
aTool-MinArea() = aMinArea; aTool->MinArea() = aMinArea;
aTool-RemoveFaceMode() = aModeRemoveFaces; aTool->RemoveFaceMode() = aModeRemoveFaces;
//when method Perform is carried out on separate shapes. //when method Perform is carried out on separate shapes.
aTool-Perform(aSeqShapes); aTool->Perform(aSeqShapes);
//when method Perform is carried out on whole shape. //when method Perform is carried out on whole shape.
aTool-Perform(); aTool->Perform();
//check status set after method Perform //check status set after method Perform
if(aTool-Status(ShapeExtend_FAIL) { if(aTool->Status(ShapeExtend_FAIL) {
cout*Operation failed* ;;\n;; cout<<"Operation failed"<< <<"\n";
return; return;
} }
if(aTool-Status(ShapeExtend_DONE1)) { if(aTool->Status(ShapeExtend_DONE1)) {
const TopTools_SequenceOfShape& aRemovedWires =aTool-RemovedWires(); const TopTools_SequenceOfShape& aRemovedWires =aTool->RemovedWires();
coutaRemovedWires.Length(); internal wires were removed;;\n;; cout<<aRemovedWires.Length()<<" internal wires were removed"<<"\n";
} }
if(aTool-Status(ShapeExtend_DONE2)) { if(aTool->Status(ShapeExtend_DONE2)) {
const TopTools_SequenceOfShape& aRemovedFaces =aTool-RemovedFaces(); const TopTools_SequenceOfShape& aRemovedFaces =aTool->RemovedFaces();
coutaRemovedFaces.Length(); small faces were removed;;\n;; cout<<aRemovedFaces.Length()<<" small faces were removed"<<"\n";
} }
//getting result shape //getting result shape
TopoDS_Shape res = aTool-GetResult(); TopoDS_Shape res = aTool->GetResult();
~~~~~ ~~~~~
@subsubsection occt_shg_4_4_8 Conversion of surfaces @subsubsection occt_shg_4_4_8 Conversion of surfaces
@ -1457,36 +1438,35 @@ TopoDS_Shape initialShape…
//creation of a rebuilding tool //creation of a rebuilding tool
Handle(ShapeBuild_ReShape) Context = new ShapeBuild_ReShape. Handle(ShapeBuild_ReShape) Context = new ShapeBuild_ReShape.
//next step is optional. It can be used for keeping //next step is optional. It can be used for keeping the assembly structure.
//the assembly structure. Context-> ModeConsiderLocation = Standard_True;
Context- ModeConsiderLocation = Standard_True;
//initialization of this tool by the initial shape //initialization of this tool by the initial shape
Context-Apply(initialShape); Context->Apply(initialShape);
//getting the intermediate result for replacing subshape1 with //getting the intermediate result for replacing subshape1 with the modified subshape1.
//the modified subshape1. TopoDS_Shape tempshape1 = Context->Apply(subshape1);
TopoDS_Shape tempshape1 = Context-Apply(subshape1);
//replacing the intermediate shape obtained from subshape1 with the //newsubshape1. //replacing the intermediate shape obtained from subshape1 with the newsubshape1.
Context-Replace(tempsubshape1,newsubshape1); Context->Replace(tempsubshape1,newsubshape1);
//for removing the subshape //for removing the subshape
TopoDS_Shape tempshape2 = Context-Apply(subshape2); TopoDS_Shape tempshape2 = Context->Apply(subshape2);
Context-Remove(tempsubshape2); Context->Remove(tempsubshape2);
//getting the result and the history of modification //getting the result and the history of modification
TopoDS_Shape resultShape = Context-Apply(initialShape); TopoDS_Shape resultShape = Context->Apply(initialShape);
//getting the resulting subshape from the subshape1 of the initial //shape. //getting the resulting subshape from the subshape1 of the initial shape.
TopoDS_Shape result_subshape1 = Context-Apply(subshape1); TopoDS_Shape result_subshape1 = Context->Apply(subshape1);
~~~~~ ~~~~~
@subsection occt_shg_5_2 Status definition @subsection occt_shg_5_2 Status definition
*ShapExtend_Status* is used to report the status after executing some methods that can either fail, do something, or do nothing. The status is a set of flags DONEi, FAILi, any combination of them can be set at the same time. For exploring the status, enumeration is used. *ShapExtend_Status* is used to report the status after executing some methods that can either fail, do something, or do nothing. The status is a set of flags *DONEi* and *FAILi*. Any combination of them can be set at the same time. For exploring the status, enumeration is used.
The values have the following meaning: The values have the following meaning:
| Value | Meaning | | Value | Meaning |
| :----- | :----------------- | | :----- | :----------------- |
| *OK,* | Nothing is done, everything OK | | *OK,* | Nothing is done, everything OK |
@ -1538,12 +1518,11 @@ Handle(ShapeExtend_MsgRegistrator) MessageReg = new ShapeExtend_MsgRegistrator;
//attaches messages to an object (shape or entity) //attaches messages to an object (shape or entity)
Message_Msg msg.. Message_Msg msg..
TopoDS_Shape Shape1… TopoDS_Shape Shape1…
MessageReg-Send(Shape1,msg,Message_WARNING); MessageReg->Send(Shape1,msg,Message_WARNING);
Handle(Standard_Transient) ent .. Handle(Standard_Transient) ent ..
MessageReg-Send(ent,msg,Message_WARNING); MessageReg->Send(ent,msg,Message_WARNING);
//gets messages attached to shape //gets messages attached to shape
const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = MessageReg->MapShape();
MessageReg-MapShape();
if (msgmap.IsBound (Shape1)) { if (msgmap.IsBound (Shape1)) {
const Message_ListOfMsg &msglist = msgmap.Find (Shape1); const Message_ListOfMsg &msglist = msgmap.Find (Shape1);
for (Message_ListIteratorOfListOfMsg iter (msglist); for (Message_ListIteratorOfListOfMsg iter (msglist);
@ -1592,9 +1571,12 @@ IGESBRep_Reader.cxx
} }
~~~~~ ~~~~~
The result of *DumpTimer()* after translation of a file is as follows: The result of *DumpTimer()* after file translation is as follows:
* TIMER: *IGES_LoadFile* Elapsed: 1.0 sec CPU User: 0.9 sec CPU Sys: 0.0 sec hits: 1
* TIMER: *IGESToBRep_Transfer* Elapsed: 14.5 sec CPU User: 4.4 sec CPU Sys: 0.1 sec hits: 1311 | TIMER | Elapsed | CPU User | CPU Sys | Hits |
| :--- | :---- | :----- | :---- | :---- |
| *IGES_LoadFile* | 1.0 sec | 0.9 sec | 0.0 sec | 1 |
| *IGESToBRep_Transfer* | 14.5 sec | 4.4 sec | 0.1 sec | 1311 |
@section occt_shg_6 Shape Processing @section occt_shg_6 Shape Processing
@ -1613,8 +1595,7 @@ Standard_Real Prec = …,
Standard_Real MaxTol = …; Standard_Real MaxTol = …;
TopoDS_Shape aResult; TopoDS_Shape aResult;
Handle(Standard_Transient) info; Handle(Standard_Transient) info;
TopoDS_Shape aResult = XSAlgo::AlgoContainer()-ProcessShape(aShape, TopoDS_Shape aResult = XSAlgo::AlgoContainer()->ProcessShape(aShape, Prec, MaxTol., "Name of ResourceFile", "NameSequence", info );
Prec, MaxTol., *Name of ResourceFile*, *NameSequence*, info );
~~~~~ ~~~~~
Let us create a custom sequence of operations: Let us create a custom sequence of operations:
@ -1640,8 +1621,7 @@ where *myfunction* is a function which implements the operation.
static Standard_Boolean myfunction (const static Standard_Boolean myfunction (const
Handle(ShapeProcess_Context)& context) Handle(ShapeProcess_Context)& context)
{ {
Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast(context);
Handle(ShapeProcess_ShapeContext)::DownCast(context);
if(ctx.IsNull()) return Standard_False; if(ctx.IsNull()) return Standard_False;
TopoDS_Shape aShape = ctx->Result(); TopoDS_Shape aShape = ctx->Result();
//receive our parameter: //receive our parameter:
@ -1660,7 +1640,7 @@ For example: input of the following string:
~~~~~ ~~~~~
NameSequence.exec.op: MyOper1,MyOper3 NameSequence.exec.op: MyOper1,MyOper3
~~~~~ ~~~~~
means that the corresponding functions from *ShapeProcess_OperLibrary* will be performed with the original shape *(aShape)* using parameters defined for *MyOper1* and *MyOper3* in the resource file. means that the corresponding functions from *ShapeProcess_OperLibrary* will be performed with the original shape *aShape* using parameters defined for *MyOper1* and *MyOper3* in the resource file.
It is necessary to note that these operations will be performed step by step and the result obtained after performing the first operation will be used as the initial shape for the second operation. It is necessary to note that these operations will be performed step by step and the result obtained after performing the first operation will be used as the initial shape for the second operation.
@ -1864,8 +1844,9 @@ Class *Message_MsgFile* allows defining messages by loading a custom message fil
The message file is an ASCII file, which defines a set of messages. Each line of the file must have a length of less than 255 characters. The message file is an ASCII file, which defines a set of messages. Each line of the file must have a length of less than 255 characters.
All lines in the file starting with the exclamation sign (perhaps preceded by spaces and/or tabs) are considered as comments and are ignored. All lines in the file starting with the exclamation sign (perhaps preceded by spaces and/or tabs) are considered as comments and are ignored.
A message file may contain several messages. Each message is identified by its key (string). A message file may contain several messages. Each message is identified by its key (string).
Each line in the file starting with the *dot* character (perhaps preceded by spaces and/or tabs) defines the key. The key is a string starting with a symbol placed after the dot and ending with the symbol preceding the ending of the newline character *\n*. Each line in the file starting with the *dot* character (perhaps preceded by spaces and/or tabs) defines the key. The key is a string starting with a symbol placed after the dot and ending with the symbol preceding the ending of the newline character <i>\\n.</i>
All the lines in the file after the key and before the next keyword (and which are not comments) define the message for that key. If the message consists of several lines, the message string will contain newline symbols *\n* between each line (but not at the end). All lines in the file after the key and before the next keyword (and which are not comments) define the message for that key. If the message consists of several lines, the message string will contain newline symbols <i>\\n</i> between each line (but not at the end).
The following example illustrates the structure of a message file: The following example illustrates the structure of a message file:
~~~~~ ~~~~~
@ -1878,7 +1859,7 @@ Your message string goes here
! !
!... !...
! !
!End of message file !End of the message file
~~~~~ ~~~~~
### Loading the message file ### Loading the message file
@ -1894,9 +1875,9 @@ Message_MsgFile::LoadFile (MsgFilePath);
The class *Message_Msg* allows using the message file loaded as a template. This class provides a tool for preparing the message, filling it with parameters, storing and outputting to the default trace file. The class *Message_Msg* allows using the message file loaded as a template. This class provides a tool for preparing the message, filling it with parameters, storing and outputting to the default trace file.
A message is created from a key: this key identifies the message to be created in the message file. The text of the message is taken from the loaded message file (class *Message_MsgFile* is used). A message is created from a key: this key identifies the message to be created in the message file. The text of the message is taken from the loaded message file (class *Message_MsgFile* is used).
The text of the message can contain places for parameters, which are to be filled by the proper values when the message is prepared. These parameters can be of the following types: The text of the message can contain places for parameters, which are to be filled by the proper values when the message is prepared. These parameters can be of the following types:
* string - coded in the text as *%s*, * string - coded in the text as \%s,
* integer - coded in the text as *%d*, * integer - coded in the text as \%d,
* real - coded in the text as *%f*. * real - coded in the text as \%f.
The parameter fields are filled by the message text by calling the corresponding methods *AddInteger, AddReal* and *AddString*. Both the original text of the message and the input text with substituted parameters are stored in the object. The prepared and filled message can be output to the default trace file. The text of the message (either original or filled) can be also obtained. The parameter fields are filled by the message text by calling the corresponding methods *AddInteger, AddReal* and *AddString*. Both the original text of the message and the input text with substituted parameters are stored in the object. The prepared and filled message can be output to the default trace file. The text of the message (either original or filled) can be also obtained.
~~~~~ ~~~~~
Message_Msg msg01 (;SampleKeyword;); Message_Msg msg01 (;SampleKeyword;);
@ -1908,14 +1889,14 @@ msg1.AddString (;SampleFile;);
@subsection occt_shg_7_4 Tool for managing trace files @subsection occt_shg_7_4 Tool for managing trace files
Class *Message_TraceFile* is intended to manage the trace file (or stream) for outputting messages and the current trace level. Trace level is an integer number, which is used when messages are sent. Generally, 0 means minimum, 0 various levels. If the current trace level is lower than the level of the message it is not output to the trace file. The trace level is to be managed and used by the users. Class *Message_TraceFile* is intended to manage the trace file (or stream) for outputting messages and the current trace level. Trace level is an integer number, which is used when messages are sent. Generally, 0 means minimum, \> 0 various levels. If the current trace level is lower than the level of the message it is not output to the trace file. The trace level is to be managed and used by the users.
There are two ways of using trace files: There are two ways of using trace files:
* define an object of *Message_TraceFile*, with its own definition (file name or cout, trace level), and use it where it is defined, * define an object of *Message_TraceFile*, with its own definition (file name or cout, trace level), and use it where it is defined,
* use the default trace file (file name or cout, trace level), usable from anywhere. * use the default trace file (file name or cout, trace level), usable from anywhere.
Use the constructor method to define the target file and the level of the messages as in the example below: Use the constructor method to define the target file and the level of the messages as in the example below:
~~~~~ ~~~~~
Message_TraceFile myTF Message_TraceFile myTF
(tracelevel, *tracefile.log*, Standard_False); (tracelevel, "tracefile.log", Standard_False);
~~~~~ ~~~~~
The parameters are as follows: The parameters are as follows:
* *tracelevel* is a Standard_Integer and modifies the level of messages. It has the following values and semantics: * *tracelevel* is a Standard_Integer and modifies the level of messages. It has the following values and semantics:

View File

@ -505,7 +505,7 @@ Not all entities defining the assembly structure in the STEP file are translated
| shape_definition_representation | A TopoDS_Compound for assemblies, a CASCADE shape corresponding to the component type for components. | Each assembly or component has its own *shape_definition_representation*. The graph of dependencies is modified in such a way that *shape_definition_representations* of all components of the assembly are referred by the *shape_definition_representation* of the assembly. | | shape_definition_representation | A TopoDS_Compound for assemblies, a CASCADE shape corresponding to the component type for components. | Each assembly or component has its own *shape_definition_representation*. The graph of dependencies is modified in such a way that *shape_definition_representations* of all components of the assembly are referred by the *shape_definition_representation* of the assembly. |
| next_assembly_usage_occurence | | This entity defines a relationship between the assembly and its component. It is used to introduce (in the dependencies graph) the links between *shape_definition_representation* of the assembly and *shape_definition_representations* and *context_dependent_shape_representations* of all its components. | | next_assembly_usage_occurence | | This entity defines a relationship between the assembly and its component. It is used to introduce (in the dependencies graph) the links between *shape_definition_representation* of the assembly and *shape_definition_representations* and *context_dependent_shape_representations* of all its components. |
| mapped_item | TopoDS_Shape | This entity defines a mapping of the assembly component into the *shape_representation* of the assembly. The result of translation is a CASCADE shape translated from the component, to which transformation defined by the *mapped_item* is applied. | | mapped_item | TopoDS_Shape | This entity defines a mapping of the assembly component into the *shape_representation* of the assembly. The result of translation is a CASCADE shape translated from the component, to which transformation defined by the *mapped_item* is applied. |
| context_dependent_shape_representation | TopoDS_Shape | This entity is associated with the *next_assembly_usage_occurence* entity and defines a placement of the component in the assembly. The graph of dependencies is modified so that each context_dependent_shape_representation* is referred by shape_definition_representation of the corresponding assembly. | | context_dependent_shape_representation | TopoDS_Shape | This entity is associated with the *next_assembly_usage_occurence* entity and defines a placement of the component in the assembly. The graph of dependencies is modified so that each *context_dependent_shape_representation* is referred by shape_definition_representation of the corresponding assembly. |
| shape_representation_relationship_with_transformation | | This entity is associated with *context_dependent_shape_representation* and defines a transformation necessary to apply to the component in order to locate it in its place in the assembly. | | shape_representation_relationship_with_transformation | | This entity is associated with *context_dependent_shape_representation* and defines a transformation necessary to apply to the component in order to locate it in its place in the assembly. |
| item_defined_transformation | | This entity defines a transformation operator used by *shape_representation_relationship_with_transformation* or *mapped_item* entity | | item_defined_transformation | | This entity defines a transformation operator used by *shape_representation_relationship_with_transformation* or *mapped_item* entity |
| cartesian_transformation_operator | | This entity defines a transformation operator used by *shape_representation_relationship_with_transformation* or *mapped_item* entity | | cartesian_transformation_operator | | This entity defines a transformation operator used by *shape_representation_relationship_with_transformation* or *mapped_item* entity |
@ -597,7 +597,7 @@ Not all entities defining the assembly structure in the STEP file are translated
@subsection occt_step_2_5 Tolerance management @subsection occt_step_2_5 Tolerance management
@subsubsection occt_step_2_5_1 Values used for tolerances during reading STEP @subsubsection occt_step_2_5_1 Values used for tolerances during reading STEP
During the STEP = OCCT translation several parameters are used as tolerances and precisions for different algorithms. Some of them are computed from other tolerances using specific functions. During the STEP to OCCT translation several parameters are used as tolerances and precisions for different algorithms. Some of them are computed from other tolerances using specific functions.
<h4>3D (spatial) tolerance</h4> <h4>3D (spatial) tolerance</h4>
* Package method *Precision::Confusion()* Value is 10-7. It is used as the minimal distance between points, which are considered to be distinct. * Package method *Precision::Confusion()* Value is 10-7. It is used as the minimal distance between points, which are considered to be distinct.
@ -690,9 +690,9 @@ The following diagram illustrates the structure of calls in reading STEP. The hi
@subsection occt_step_2_7 Example @subsection occt_step_2_7 Example
~~~~~ ~~~~~
#include STEPControl_Reader.hxx #include <STEPControl_Reader.hxx>
#include TopoDS_Shape.hxx #include <TopoDS_Shape.hxx>
#include BRepTools.hxx #include <BRepTools.hxx>
Standard_Integer main() Standard_Integer main()
{ {
@ -740,8 +740,8 @@ There are two families of OCCT objects that can be translated:
@subsubsection occt_step_3_2_2 Writing assembly structures @subsubsection occt_step_3_2_2 Writing assembly structures
The shapes organized in a structure of nested compounds can be translated either as simple compound shapes, or into the assembly structure, depending on the parameter *write.step.assembly*, which is described below. The shapes organized in a structure of nested compounds can be translated either as simple compound shapes, or into the assembly structure, depending on the parameter *write.step.assembly*, which is described below.
The assembly structure placed in the produced STEP file corresponds to the structure described in the ProSTEP Agreement Log (item 21) as the second alternative (assembly structure through representation_relationship / item_defined_transformation). To represent an assembly it uses entities of the representation_relationship_with_transformation type. Transformation operators used for locating assembly components are represented by item_defined_transformation entities. The assembly structure placed in the produced STEP file corresponds to the structure described in the ProSTEP Agreement Log (item 21) as the second alternative (assembly structure through *representation_relationship* / *item_defined_transformation*). To represent an assembly it uses entities of the *representation_relationship_with_transformation* type. Transformation operators used for locating assembly components are represented by *item_defined_transformation* entities.
If mode ;write.step.assembly; is set to the values ON or Auto then an OCC shape consisting of nested compounds will be written as an assembly, otherwise it will be written as separate solids. If mode *write.step.assembly* is set to the values *ON* or *Auto* then an OCC shape consisting of nested compounds will be written as an assembly, otherwise it will be written as separate solids.
Please see also <a href="#occt_step_3_4">Mapping OCCT shapes to STEP entities</a> Please see also <a href="#occt_step_3_4">Mapping OCCT shapes to STEP entities</a>
@ -872,7 +872,7 @@ An OCCT shape can be translated to STEP using one of the following models (shape
* shell_based_surface_model (manifold_surface_shape_representation) * shell_based_surface_model (manifold_surface_shape_representation)
* geometric_curve_set (geometrically_bounded_wireframe_shape_representation) * geometric_curve_set (geometrically_bounded_wireframe_shape_representation)
The enumeration **TEPControl_StepModelType* is intended to define a particular transferring model. The enumeration *STEPControl_StepModelType* is intended to define a particular transferring model.
The following values of enumeration are allowed: The following values of enumeration are allowed:
* *STEPControl_AsIs* Translator selects the resulting representation automatically, according to the type of CASCADE shape to translate it in its highest possible model; * *STEPControl_AsIs* Translator selects the resulting representation automatically, according to the type of CASCADE shape to translate it in its highest possible model;
* *STEPControl_ManifoldSolidBrep* resulting entity is manifold_solid_brep or brep_with_voids * *STEPControl_ManifoldSolidBrep* resulting entity is manifold_solid_brep or brep_with_voids
@ -1013,11 +1013,11 @@ The highlighted classes are intended to translate geometry.
@subsection occt_step_3_7 Example @subsection occt_step_3_7 Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
#include STEPControl.hxx #include <STEPControl.hxx>
#include STEPControl_Writer.hxx #include <STEPControl_Writer.hxx>
#include TopoDS_Shape.hxx #include <TopoDS_Shape.hxx>
#include BRepTools.hxx #include <BRepTools.hxx>
#include BRep_Builder.hxx #include <BRep_Builder.hxx>
Standard_Integer main() Standard_Integer main()
{ {
@ -1125,7 +1125,7 @@ A set of parameters for importing and exporting STEP data is defined in the XSTE
~~~~~ ~~~~~
Draw:> param [<parameter_name> [<value>]] Draw:> param [<parameter_name> [<value>]]
~~~~~ ~~~~~
Command param with no arguments gives a list of all parameters with their values. When the argument *parameter_name* is specified, information about this parameter is printed (current value and short description). Command *param* with no arguments gives a list of all parameters with their values. When the argument *parameter_name* is specified, information about this parameter is printed (current value and short description).
The third argument is used to set a new value of the given parameter. The result of the setting is printed immediately. The third argument is used to set a new value of the given parameter. The result of the setting is printed immediately.
@ -1177,12 +1177,13 @@ Second parameter of the stepread command defines the name of the loaded shape.
During the STEP translation, a map of correspondence between STEP entities and OCCT shapes is created. During the STEP translation, a map of correspondence between STEP entities and OCCT shapes is created.
To get information on the result of translation of a given STEP entity use the command *Draw:> tpent \#*. To get information on the result of translation of a given STEP entity use the command @code Draw:> tpent #*.@endcode
To create an OCCT shape, corresponding to a STEP entity, use the command *Draw:> tpdraw \#*. To create an OCCT shape, corresponding to a STEP entity, use the command @code Draw:> tpdraw #*. @endcode
To get the number of a STEP entity, corresponding to an OCCT shape, use the command *Draw:> fromshape \<shape_name\>*.
To clear the map of correspondences between STEP entities and OCCT shapes use the command *Draw:> tpclear*. To get the number of a STEP entity, corresponding to an OCCT shape, use the command @code Draw:> fromshape <shape_name>. @endcode
To clear the map of correspondences between STEP entities and OCCT shapes use the command @code Draw:> tpclear. @endcode
@subsection occt_step_6_4 Analyzing the transferred data @subsection occt_step_6_4 Analyzing the transferred data
@ -1211,9 +1212,9 @@ There is a set of special objects, which can be used to operate with a loaded mo
* Selection Filters - allow selecting subsets of entities of the loaded model; * Selection Filters - allow selecting subsets of entities of the loaded model;
* Counter - calculates some statistics on the model data. * Counter - calculates some statistics on the model data.
A list of these objects defined in the current session can be printed in DRAW by command *Draw:> listitems*. A list of these objects defined in the current session can be printed in DRAW by command @code Draw:> listitems. @endcode
Command *Draw:> givelist \<selection_name\>* prints a list of a subset of loaded entities defined by the <i>\<selection\></i> argument: Command @code Draw:> givelist <selection_name> @endcode prints a list of a subset of loaded entities defined by the <i>\<selection\></i> argument:
* *xst-model-all* all entities of the model; * *xst-model-all* all entities of the model;
* *xst-model-roots* all roots; * *xst-model-roots* all roots;
@ -1266,7 +1267,7 @@ The sign \* before parameters *n, s, b, t, r* makes it work on all entities (not
The sign ? before *n, s, b, t* limits the scope of information to invalid entities. The sign ? before *n, s, b, t* limits the scope of information to invalid entities.
Optional argument \<selection\> can limit the action of the command to the selection, not to all entities. Optional argument <i>\<selection\></i> can limit the action of the command to the selection, not to all entities.
To get help, run this command without arguments. To get help, run this command without arguments.

View File

@ -38,9 +38,9 @@ a limited number of objects at each level of the data structure (typically less
A greater number of objects causes performance problems due to list-based organization of OCAF documents. Therefore, other methods of storage, such as arrays, are advisable for data models or their sub-parts containing a great number of uniform objects. However, these methods A greater number of objects causes performance problems due to list-based organization of OCAF documents. Therefore, other methods of storage, such as arrays, are advisable for data models or their sub-parts containing a great number of uniform objects. However, these methods
can be combined with the usage of *TObj* to represent the high-level structure of the model. can be combined with the usage of *TObj* to represent the high-level structure of the model.
@section occt_tobj_2 *TObj* Model @section occt_tobj_2 TObj Model
@subsection occt_tobj_2_1 *TObj* Model structure @subsection occt_tobj_2_1 TObj Model structure
In the *TObj* data model the data are separated from the interfaces that manage them. In the *TObj* data model the data are separated from the interfaces that manage them.
@ -384,7 +384,7 @@ of the indicated object after the retrieval of the model from file
To copy the model between OCAF documents use the following methods: To copy the model between OCAF documents use the following methods:
~~~~~{.cpp} ~~~~~{.cpp}
virtual Standard_Boolean Paste (Handle(*TObj_Model*) theModel, Handle(TDF_RelocationTable) theRelocTable = 0 ); virtual Standard_Boolean Paste (Handle(TObj_Model) theModel, Handle(TDF_RelocationTable) theRelocTable = 0 );
~~~~~ ~~~~~
Pastes the current model to the new model. The relocation table Pastes the current model to the new model. The relocation table
@ -392,13 +392,13 @@ ensures correct copying of the sub-data shared by several parts of the model.
It stores a map of processed original objects of relevant types in their copies. It stores a map of processed original objects of relevant types in their copies.
~~~~~{.cpp} ~~~~~{.cpp}
virtual Handle(*TObj_Model*) NewEmpty() = 0; virtual Handle(TObj_Model) NewEmpty() = 0;
~~~~~ ~~~~~
Redefines a pure virtual method to create a new empty instance of the model. Redefines a pure virtual method to create a new empty instance of the model.
~~~~~{.cpp} ~~~~~{.cpp}
void CopyReferences ( const Handle(*TObj_Model*)& theTarget, const Handle(TDF_RelocationTable)& theRelocTable); void CopyReferences ( const Handle(TObj_Model)& theTarget, const Handle(TDF_RelocationTable)& theRelocTable);
~~~~~ ~~~~~
Copies the references from the current model to the target model. Copies the references from the current model to the target model.
@ -452,8 +452,8 @@ The special type of attribute *TObj_TObject* is used for storing instances of ob
in the OCAF tree. *TObj_TObject* is a simple container for the object of type *TObj_Object*. in the OCAF tree. *TObj_TObject* is a simple container for the object of type *TObj_Object*.
All objects (interfaces) of the data model inherit this class. All objects (interfaces) of the data model inherit this class.
@image html /user_guides/tobj/images/tobj_image006.png "*TObj* object stored on OCAF label" @image html /user_guides/tobj/images/tobj_image006.png "TObj object stored on OCAF label"
@image latex /user_guides/tobj/images/tobj_image006.png "*TObj* object stored on OCAF label" @image latex /user_guides/tobj/images/tobj_image006.png "TObj object stored on OCAF label"
@subsection occt_tobj_3_2 Basic features @subsection occt_tobj_3_2 Basic features

View File

@ -18,13 +18,13 @@ To make management of these functionalities in 3D more intuitive and consequent
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. 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 packages used to display 3D objects are the following: The the following packages are used to display 3D objects :
* AIS * *AIS*;
* StdPrs * *StdPrs*;
* Prs3d * *Prs3d*;
* PrsMgr * *PrsMgr*;
* V3d * *V3d*;
* Graphic3d * *Graphic3d*.
If you are concerned with 2D visualization, you must familiarize yourself with the fundamental concepts of presentation as outlined in the section on this subject in chapter Fundamental Concepts. In brief, the packages used to display 3D objects are applicable for visualization of 2D objects too. If you are concerned with 2D visualization, you must familiarize yourself with the fundamental concepts of presentation as outlined in the section on this subject in chapter Fundamental Concepts. In brief, the packages used to display 3D objects are applicable for visualization of 2D objects too.
@ -36,7 +36,7 @@ The figure below presents a schematic overview of the relations between the key
To answer different needs of CASCADE users, this users guide offers the following three paths in reading it. To answer different needs of CASCADE users, this users 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 <a href="#occt_visu_3">AIS: Application Interactive Services</a>. * If the 3D services proposed in AIS meet your requirements, you need only read chapter 3 <a href="#occt_visu_3">AIS: Application Interactive Services</a>.
* If you need more detail, for example, a selection filter on another type of entity - you should read chapter 2 <a href="#occt_visu_2">Fundamental Concepts</a>, chapter 3 <a href="#occt_visu_3">AIS: Application Interactive Services</a>, and possibly chapters 4 and 5 <a href="#occt_visu_4">3D Presentations</a> and <a href="#occt_visu_5">3D Resources</a>. You may want to begin with the chapter presenting AIS. * If you need more detail, for example, a selection filter on another type of entity - you should read chapter 2 <a href="#occt_visu_2">Fundamental Concepts</a>, chapter 3 <a href="#occt_visu_3">AIS: Application Interactive Services</a>, and possibly chapters 4 <a href="#occt_visu_4">3D Presentations</a> and 5 <a href="#occt_visu_5">3D Resources</a>. You may want to begin with the chapter presenting AIS.
@section occt_visu_2  Fundamental Concepts @section occt_visu_2  Fundamental Concepts
@ -90,7 +90,7 @@ BRepPrimAPI_MakeWedge w(dx, dy, dz, ltx);
TopoDS_Solid & = w.Solid(); TopoDS_Solid & = w.Solid();
Handle(AIS_Shape) anAis = new AIS_Shape(S); Handle(AIS_Shape) anAis = new AIS_Shape(S);
//creation of the presentable object //creation of the presentable object
aContext - Display(anAis); aContext -> Display(anAis);
//Display the presentable object in the 3d viewer. //Display the presentable object in the 3d viewer.
~~~~~ ~~~~~
@ -194,7 +194,7 @@ The following selection packages exist : *SelectBasics*, *SelectMgr*, *Select3D
*EntityOwner* is used to establish a link from *SensitiveEntity* to application-level objects. For example, *SelectMgr_EntityOwner* (see below) class holds a pointer to corresponding *SelectableObject*. *EntityOwner* is used to establish a link from *SensitiveEntity* to application-level objects. For example, *SelectMgr_EntityOwner* (see below) class holds a pointer to corresponding *SelectableObject*.
*SelectMgr* package is used to manage the whole dynamic selection process. It contains the *SelectableObject*, Entity Owner containing a link to its SelectableObject,* *Selection*, *SelectionManager*, and *ViewSelector* classes. *SelectMgr* package is used to manage the whole dynamic selection process. It contains the *SelectableObject*, Entity Owner containing a link to its *SelectableObject*, *Selection*, *SelectionManager*, and *ViewSelector* classes.
There are also implementations of *ViewerSelector* interface for 3D selection in *StdSelect* package: *ViewerSelector3d*. There are also implementations of *ViewerSelector* interface for 3D selection in *StdSelect* package: *ViewerSelector3d*.
*Select3D* package contains all 3D standard sensitive primitives such as point, curve and face. All these classes inherit from 3D *SensitiveEntry* from *SelectBasics* with an additional method, which allows recovery of the bounding boxes in the 2D graphic selection space, if required. This package also includes the 3D-2D projector. *Select3D* package contains all 3D standard sensitive primitives such as point, curve and face. All these classes inherit from 3D *SensitiveEntry* from *SelectBasics* with an additional method, which allows recovery of the bounding boxes in the 2D graphic selection space, if required. This package also includes the 3D-2D projector.
@ -239,13 +239,22 @@ To build the selection, which corresponds to the mode "selection of the rooms"
Void House::ComputeSelection Void House::ComputeSelection
(Const Handle(SelectMgr_Selection)& Sel, (Const Handle(SelectMgr_Selection)& Sel,
 const Standard_Integer mode {  const Standard_Integer mode {
 switch(mode){  case 0: //Selection of the rooms  switch(mode){  
{  for(Standard_Integer i = 1; i = myNbRooms; i++)  { //for every room, create an instance of the owner, the given room and its name. case 0: //Selection of the rooms
Handle(RoomOwner) aRoomOwner = new RoomOwner (Room(i), NameRoom(i)); //Room() returns a room and NameRoom() returns its name. {  
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));
//Room() returns a room and NameRoom() returns its name.
Handle(Select3d_SensitiveBox) aSensitiveBox; Handle(Select3d_SensitiveBox) aSensitiveBox;
aSensitiveBox = new Select3d_SensitiveBox aSensitiveBox = new Select3d_SensitiveBox
(aRoomOwner, Xmin, Ymin, Zmin, Xmax, Ymax, Zmax); (aRoomOwner, Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
 Sel - Add(aSensitiveBox);  }  break;  Case 1: ... //Selection of the doors  } //Switch  Sel -> Add(aSensitiveBox);  
}  
break;  
Case 1: ... //Selection of the doors  
} //Switch
) // ComputeSelection ) // ComputeSelection
~~~~~ ~~~~~
@ -511,10 +520,10 @@ The method *AIS_InteractiveObject::SetPolygonOffsets (const Standard_Integer aMo
The parameter *aMode* can contain various combinations of *Aspect_PolygonOffsetMode* enumeration elements: The parameter *aMode* can contain various combinations of *Aspect_PolygonOffsetMode* enumeration elements:
* *Aspect_POM_None* * *Aspect_POM_None*
* *Aspect_POM_Off* * *Aspect_POM_Off*
* Aspect_POM_Fill * *Aspect_POM_Fill*
* Aspect_POM_Line * *Aspect_POM_Line*
* Aspect_POM_Point * *Aspect_POM_Point*
* Aspect_POM_All * *Aspect_POM_All*
The combination of these elements defines the polygon display modes that will use the given offsets. You can switch off the polygon offsets by passing *Aspect_POM_Off*. Passing *Aspect_POM_None* allows changing the *aFactor* and *aUnits* values without changing the mode. If *aMode* is different from *Aspect_POM_Off*, the *aFactor* and *aUnits* arguments are used by the graphics renderer to calculate the depth offset value: The combination of these elements defines the polygon display modes that will use the given offsets. You can switch off the polygon offsets by passing *Aspect_POM_Off*. Passing *Aspect_POM_None* allows changing the *aFactor* and *aUnits* values without changing the mode. If *aMode* is different from *Aspect_POM_Off*, the *aFactor* and *aUnits* arguments are used by the graphics renderer to calculate the depth offset value:
~~~~~ ~~~~~
@ -563,18 +572,18 @@ There is one essential rule to follow: the modification of an interactive objec
~~~~~ ~~~~~
Handle (AIS_Shape) TheAISShape = new AIS_Shape (ashape); Handle (AIS_Shape) TheAISShape = new AIS_Shape (ashape);
myIntContext-Display(TheAISShape); myIntContext->Display(TheAISShape);
myIntContext-SetDisplayMode(TheAISShape ,1); myIntContext->SetDisplayMode(TheAISShape ,1);
myIntContext-SetColor(TheAISShape,Quantity_NOC_RED); myIntContext->SetColor(TheAISShape,Quantity_NOC_RED);
~~~~~ ~~~~~
You can also write You can also write
~~~~~ ~~~~~
Handle (AIS_Shape) TheAISShape = new AIS_Shape (ashape); Handle (AIS_Shape) TheAISShape = new AIS_Shape (ashape);
TheAISShape-SetColor(Quantity_NOC_RED); TheAISShape->SetColor(Quantity_NOC_RED);
TheAISShape-SetDisplayMode(1); TheAISShape->SetDisplayMode(1);
myIntContext-Display(TheAISShape); myIntContext->Display(TheAISShape);
~~~~~ ~~~~~
@subsubsection occt_visu_3_3_2 Groups of functions @subsubsection occt_visu_3_3_2 Groups of functions
@ -609,10 +618,10 @@ When you change a graphic attribute pertaining to the Context (visualization mo
Let us examine the case of two interactive objects: *obj1* and *obj2*: Let us examine the case of two interactive objects: *obj1* and *obj2*:
~~~~~ ~~~~~
TheCtx-Display(obj1,Standard_False); // False = no viewer update TheCtx->Display(obj1,Standard_False); // False = no viewer update
TheCtx-Display(obj2,Standard_True); // True = viewer update TheCtx->Display(obj2,Standard_True); // True = viewer update
TheCtx-SetDisplayMode(obj1,3,Standard_False); TheCtx->SetDisplayMode(obj1,3,Standard_False);
TheCtx-SetDisplayMode(2); TheCtx->SetDisplayMode(2);
// obj2 is visualised in mode 2 (if it accepts this mode) // obj2 is visualised in mode 2 (if it accepts this mode)
// obj1 stays visualised in its mode 3. // obj1 stays visualised in its mode 3.
~~~~~ ~~~~~
@ -697,7 +706,7 @@ Bear in mind the following points:
* 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. * 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. * 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. * 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. * 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 computes again the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the objects presentation temporarily. * *Erase()* with *putInCollector = Standard_True* might be slow as it computes again the object presentation in the Collector. Set *putInCollector* to *Standard_False* if you simply want to hide the objects 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. * 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. * 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.
@ -725,7 +734,7 @@ This activates the corresponding selection mode for all objects in Local Contex
**WARNING** **WARNING**
If you have opened a local context by loading an object with the default options *(AllowShapeDecomposition = Standard_True)*, all objects of the "Shape" type are also activated with the same modes. You can change the state of these "Standard" objects by using *SetShapeDecomposition(Status)*. If you have opened a local context by loading an object with the default options <i>(AllowShapeDecomposition = Standard_True)</i>, all objects of the "Shape" type are also activated with the same modes. You can change the state of these "Standard" objects by using *SetShapeDecomposition(Status)*.
Load an interactive object by the function *AIS_InteractiveContext::Load*. Load an interactive object by the function *AIS_InteractiveContext::Load*.
@ -735,7 +744,7 @@ Use *AIS_InteractiveContext::Activate* and *AIS_InteractiveContext::Deactivate*
@subsubsection occt_visu_3_4_5 Filters @subsubsection occt_visu_3_4_5 Filters
When Interactive objects have been "prepared" in the local context, you can add rejection filters. The root class of objects is *SelectMgr_Filter*. The principle behind it is straightforward: a filter tests to see whether the owners *(SelectMgr_EntityOwner)* detected in mouse position by the Local context selector answer *OK*. If so, it is kept, otherwise it is rejected. When Interactive objects have been "prepared" in the local context, you can add rejection filters. The root class of objects is *SelectMgr_Filter*. The principle behind it is straightforward: a filter tests to see whether the owners <i>(SelectMgr_EntityOwner)</i> detected in mouse position by the Local context selector answer *OK*. If so, it is kept, otherwise it is rejected.
You can create a custom class of filter objects by implementing the deferred function *IsOk()*: You can create a custom class of filter objects by implementing the deferred function *IsOk()*:
@ -763,35 +772,35 @@ Only type filters are activated in Neutral Point to make it possible to identif
There are several functions to manipulate filters: There are several functions to manipulate filters:
* *AIS_InteractiveContext::AddFilter* adds a filter passed as an argument. * *AIS_InteractiveContext::AddFilter* adds a filter passed as an argument.
  * *AIS_InteractiveContext::RemoveFilter* removes a filter passed as an argument. * *AIS_InteractiveContext::RemoveFilter* removes a filter passed as an argument.
* *AIS_InteractiveContext::RemoveFilters* removes all present filters. * *AIS_InteractiveContext::RemoveFilters* removes all present filters.
* *AIS_InteractiveContext::Filters* gets the list of filters active in a local context. * *AIS_InteractiveContext::Filters* gets the list of filters active in a local context.
<h4>Example </h4> <h4>Example </h4>
~~~~~ ~~~~~
myContext-OpenLocalContext(Standard_False); myContext->OpenLocalContext(Standard_False);
// no object in neutral point is loaded // no object in neutral point is loaded
myContext-ActivateStandardMode(TopAbs_Face); myContext->ActivateStandardMode(TopAbs_Face);
//activates decomposition of shapes into faces. //activates decomposition of shapes into faces.
Handle (AIS_Shape) myAIShape = new AIS_Shape ( ATopoShape); Handle (AIS_Shape) myAIShape = new AIS_Shape ( ATopoShape);
myContext-Display(myAIShape,1,-1,Standard_True,Standard_True); myContext->Display(myAIShape,1,-1,Standard_True,Standard_True);
//shading visualization mode, no specific mode, authorization for //decomposition into sub-shapes. At this Stage, myAIShape is decomposed into faces... //shading visualization mode, no specific mode, authorization for decomposition into sub-shapes. At this Stage, myAIShape is decomposed into faces...
Handle(StdSelect_FaceFilter) Fil1= new Handle(StdSelect_FaceFilter) Fil1= new
StdSelect_FaceFilter(StdSelect_Revol); StdSelect_FaceFilter(StdSelect_Revol);
Handle(StdSelect_FaceFilter) Fil2= new Handle(StdSelect_FaceFilter) Fil2= new
      StdSelect_FaceFilter(StdSelect_Plane);       StdSelect_FaceFilter(StdSelect_Plane);
myContext-AddFilter(Fil1); myContext->AddFilter(Fil1);
myContext-AddFilter(Fil2); myContext->AddFilter(Fil2);
//only faces of revolution or planar faces will be selected //only faces of revolution or planar faces will be selected
myContext-MoveTo( xpix,ypix,Vue); myContext->MoveTo( xpix,ypix,Vue);
// detects the mouse position // detects the mouse position
~~~~~ ~~~~~
@ -847,20 +856,20 @@ In the Local Context, you can explore the list of selected objects available. T
<h4>Example </h4> <h4>Example </h4>
~~~~~ ~~~~~
myAISCtx-InitSelected(); myAISCtx->InitSelected();
while (myAISCtx-MoreSelected()) while (myAISCtx->MoreSelected())
{ {
if (myAISCtx-HasSelectedShape) if (myAISCtx->HasSelectedShape)
{ {
TopoDS_Shape ashape = myAISCtx-SelectedShape(); TopoDS_Shape ashape = myAISCtx->SelectedShape();
// to be able to use the picked shape // to be able to use the picked shape
            }             }
else else
{ {
Handle_AIS_InteractiveObject aniobj = myAISCtx-Interactive(); Handle_AIS_InteractiveObject anyobj = myAISCtx->Interactive();
// to be able to use the picked interactive object // to be able to use the picked interactive object
} }
myAISCtx-NextSelected(); myAISCtx->NextSelected();
} }
~~~~~ ~~~~~
@ -938,7 +947,7 @@ myIHMEditor::myIHMEditor
myIHMEditor::PrepareContext() myIHMEditor::PrepareContext()
{ {
myIndex =myCtx-OpenLocalContext(); myIndex =myCtx->OpenLocalContext();
//the filters //the filters
@ -952,37 +961,37 @@ Handle(StdSelect_FaceFilter) F3 = new StdSelect_FaceFilter(AIS_Cylinder);
//cylindrical face filters //cylindrical face filters
//... //...
// activation of standard modes on the shapes.. // activation of standard modes on the shapes..
myCtx-ActivateStandardMode(TopAbs_FACE); myCtx->ActivateStandardMode(TopAbs_FACE);
myCtx-ActivateStandardMode(TopAbs_VERTEX); myCtx->ActivateStandardMode(TopAbs_VERTEX);
myCTX-Add(F1); myCTX->Add(F1);
myCTX-Add(F2); myCTX->Add(F2);
myCTX-Add(F3); myCTX->Add(F3);
// at this point, you can call the selection/detection function // at this point, you can call the selection/detection function
} }
void myIHMEditor::MoveTo(xpix,ypix,Vue) void myIHMEditor::MoveTo(xpix,ypix,Vue)
{ myCTX-MoveTo(xpix,ypix,vue); { myCTX->MoveTo(xpix,ypix,vue);
// the highlight of what is detected is automatic. // the highlight of what is detected is automatic.
} }
Standard_Boolean myIHMEditor::Select() Standard_Boolean myIHMEditor::Select()
{ {
// returns true if you should continue the selection // returns true if you should continue the selection
myCTX-Select(); myCTX->Select();
myCTX-InitSelected(); myCTX->InitSelected();
if(myCTX-MoreSelected()) if(myCTX->MoreSelected())
 {  {
 if(myCTX-HasSelectedShape())  if(myCTX->HasSelectedShape())
{ const TopoDS_Shape& sh = myCTX-SelectedShape(); { const TopoDS_Shape& sh = myCTX->SelectedShape();
if( vertex){ if( vertex){
if(myFirstV...) if(myFirstV...)
{ {
//if its the first vertex, you stock it, then you deactivate the faces and only keep the filter on the points: //if it is the first vertex, you stock it, then you deactivate the faces and only keep the filter on the points:
mypoint1 = ....; mypoint1 = ....;
myCtx-RemoveFilters(); myCtx->RemoveFilters();
myCTX-DeactivateStandardMode(TopAbs_FACE); myCTX->DeactivateStandardMode(TopAbs_FACE);
myCtx-Add(F1); myCtx->Add(F1);
// the filter on the AIS_Points // the filter on the AIS_Points
myFirstV = Standard_False; myFirstV = Standard_False;
return Standard_True; return Standard_True;
@ -1003,10 +1012,10 @@ Standard_Boolean myIHMEditor::Select()
else else
{ {
Handle(AIS_InteractiveObject) Handle(AIS_InteractiveObject)
SelObj = myCTX-SelectedInteractive(); SelObj = myCTX->SelectedInteractive();
if(SelObj-Type()==AIS_KOI_Datum) if(SelObj->Type()==AIS_KOI_Datum)
{ {
if(SelObj-Signature()==1) if(SelObj->Signature()==1)
{ {
if (firstPoint) if (firstPoint)
{ {
@ -1171,11 +1180,11 @@ Handle (XSDRAWSTLVRML_DataSource) aDataSource = new XSDRAWSTLVRML_DataSource (a
// create mesh // create mesh
Handle (MeshVS_Mesh) aMesh = new MeshVS(); Handle (MeshVS_Mesh) aMesh = new MeshVS();
aMesh-SetDataSource (aDataSource); aMesh->SetDataSource (aDataSource);
// use default presentation builder // use default presentation builder
Handle (MeshVS_MeshPrsBuilder) aBuilder = new MeshVS_MeshPrsBuilder (aMesh); Handle (MeshVS_MeshPrsBuilder) aBuilder = new MeshVS_MeshPrsBuilder (aMesh);
aMesh-AddBuilder (aBuilder, Standard_True); aMesh->AddBuilder (aBuilder, Standard_True);
~~~~~ ~~~~~
*MeshVS_NodalColorPrsBuilder* allows representing a mesh with a color scaled texture mapped on it. *MeshVS_NodalColorPrsBuilder* allows representing a mesh with a color scaled texture mapped on it.
@ -1188,7 +1197,7 @@ The following example demonstrates how you can do this (check if the view has be
// assign nodal builder to the mesh // assign nodal builder to the mesh
Handle (MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder 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); aBuilder->UseTexture (Standard_True);
// prepare color map // prepare color map
Aspect_SequenceOfColor aColorMap; Aspect_SequenceOfColor aColorMap;
@ -1202,10 +1211,10 @@ TColStd_DataMapOfIntegerReal aScaleMap;
aScaleMap.Bind (anId, aValue); aScaleMap.Bind (anId, aValue);
   
// pass color map and color scale values to the builder // pass color map and color scale values to the builder
aBuilder-SetColorMap (aColorMap); aBuilder->SetColorMap (aColorMap);
aBuilder-SetInvalidColor (Quantity_NOC_BLACK); aBuilder->SetInvalidColor (Quantity_NOC_BLACK);
aBuilder-SetTextureCoords (aScaleMap); aBuilder->SetTextureCoords (aScaleMap);
aMesh-AddBuilder (aBuilder, Standard_True); aMesh->AddBuilder (aBuilder, Standard_True);
~~~~~ ~~~~~
@subsection occt_visu_3_6 Dynamic Selection @subsection occt_visu_3_6 Dynamic Selection
@ -1269,24 +1278,22 @@ void InteractiveBox::ComputeSelection
{ case 0: //locating the whole box by making its faces sensitive... { case 0: //locating the whole box by making its faces sensitive...
{ {
Handle(SelectMgr_EntityOwner) Ownr = new SelectMgr_EntityOwner(this,5); Handle(SelectMgr_EntityOwner) Ownr = new SelectMgr_EntityOwner(this,5);
for(Standard_Integer I=1;I=Nbfaces;I++) for(Standard_Integer I=1;I<=Nbfaces;I++)
{ {
//Array is a TColgp_Array1OfPnt: which represents the array of vertices. Sensitivity is //Array is a TColgp_Array1OfPnt: which represents the array of vertices. Sensitivity is
Select3D_TypeOfSensitivity value Select3D_TypeOfSensitivity value
Sel-Add(new Sel->Add(new Select3D_SensitiveFace(Ownr,Array,Sensitivity));
Select3D_SensitiveFace(Ownr,Array,Sensitivity));
} }
break; break;
   }    }
  case 1:   case 1:
// locates the edges { // locates the edges {
for(Standard_Integer i=1;i=12;i++) for(Standard_Integer i=1;i<=12;i++)
{ {
// 1 owner per edge... // 1 owner per edge...
Handle(mypk_EdgeOwner) Ownr = Handle(mypk_EdgeOwner) Ownr = new mypk_EdgeOwner(this,i,6);
new mypk_EdgeOwner(this,i,6); //6->priority
//6-priority Sel->Add(new Select3D_SensitiveSegment (Ownr,firstpt(i),lastpt(i)));
Sel-Add(new Select3D_SensitiveSegment (Ownr,firstpt(i),lastpt(i)));
} }
break; break;
} }
@ -1303,23 +1310,23 @@ NOTE: This procedure is completely hidden if you use the <a href="#occt_visu_3_3
//We have several " interactive boxes " box1, box2, box3; //We have several " interactive boxes " box1, box2, box3;
Handle(SelectMgr_SelectionManager) SM = new SelectMgr_SelectionManager(); Handle(SelectMgr_SelectionManager) SM = new SelectMgr_SelectionManager();
Handle(StdSelect_ViewerSelector3d) VS = new StdSelect_ViewerSelector3d(); Handle(StdSelect_ViewerSelector3d) VS = new StdSelect_ViewerSelector3d();
SM-Add(VS); SM->Add(VS);
SM-Load(box1);SM-Load(box2);SM-Load(box3); SM->Load(box1);SM->Load(box2);SM->Load(box3);
// box load. // box load.
SM-Activate(box1,0,VS); SM->Activate(box1,0,VS);
// activates mode 0 of box 1 in the selector VS // activates mode 0 of box 1 in the selector VS
SM-Activate(box1,1,VS); SM->Activate(box1,1,VS);
M-Activate(box3,1,VS); M->Activate(box3,1,VS);
VS-Pick(xpix,ypix,vue3d) VS->Pick(xpix,ypix,vue3d)
// detection of primitives by mouse position. // detection of primitives by mouse position.
Handle(EntityOwner) POwnr = VS-OnePicked(); Handle(EntityOwner) POwnr = VS->OnePicked();
// picking of the "best" owner detected // picking of the "best" owner detected
for(VS-Init();VS-More();VS-Next()) for(VS->Init();VS->More();VS->Next())
{ {
VS-Picked(); VS->Picked();
// picking of all owners detected // picking of all owners detected
  }   }
SM-Deactivate(box1); SM->Deactivate(box1);
// deactivate all active modes of box1 // deactivate all active modes of box1
~~~~~ ~~~~~
@ -1373,17 +1380,17 @@ Create line attributes.
Handle(Graphic3d_AspectLine3d) CTXLBROWN = new Graphic3d_AspectLine3d (); Handle(Graphic3d_AspectLine3d) CTXLBROWN = new Graphic3d_AspectLine3d ();
Handle(Graphic3d_AspectLine3d) CTXLBLUE = new Graphic3d_AspectLine3d (); Handle(Graphic3d_AspectLine3d) CTXLBLUE = new Graphic3d_AspectLine3d ();
Handle(Graphic3d_AspectLine3d) CTXLWHITE = new Graphic3d_AspectLine3d(); Handle(Graphic3d_AspectLine3d) CTXLWHITE = new Graphic3d_AspectLine3d();
CTXLBROWN-SetColor (Brown); CTXLBROWN->SetColor (Brown);
CTXLBLUE-SetColor (Blue); CTXLBLUE->SetColor (Blue);
CTXLWHITE-SetColor (White); CTXLWHITE->SetColor (White);
~~~~~ ~~~~~
Create marker attributes. Create marker attributes.
~~~~~ ~~~~~
Handle(Graphic3d_AspectMarker3d) CTXMFIREBRICK = new Graphic3d_AspectMarker3d(); Handle(Graphic3d_AspectMarker3d) CTXMFIREBRICK = new Graphic3d_AspectMarker3d();
CTXMFIREBRICK-SetColor (Firebrick); CTXMFIREBRICK->SetColor (Firebrick);
CTXMFIREBRICK-SetScale (1.0); CTXMFIREBRICK->SetScale (1.0);
CTXMFIREBRICK-SetType (Aspect_TOM_BALL); CTXMFIREBRICK->SetType (Aspect_TOM_BALL);
~~~~~ ~~~~~
Create facet attributes. Create facet attributes.
@ -1391,12 +1398,12 @@ Create facet attributes.
Handle(Graphic3d_AspectFillArea3d) CTXF = new Graphic3d_AspectFillArea3d (); Handle(Graphic3d_AspectFillArea3d) CTXF = new Graphic3d_AspectFillArea3d ();
Graphic3d_MaterialAspect BrassMaterial (Graphic3d_NOM_BRASS); Graphic3d_MaterialAspect BrassMaterial (Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect GoldMaterial (Graphic3d_NOM_GOLD); Graphic3d_MaterialAspect GoldMaterial (Graphic3d_NOM_GOLD);
CTXF-SetInteriorStyle (Aspect_IS_SOLID); CTXF->SetInteriorStyle (Aspect_IS_SOLID);
CTXF-SetInteriorColor (MyColor); CTXF->SetInteriorColor (MyColor);
CTXF-SetDistinguishOn (); CTXF->SetDistinguishOn ();
CTXF-SetFrontMaterial (GoldMaterial); CTXF->SetFrontMaterial (GoldMaterial);
CTXF-SetBackMaterial (BrassMaterial); CTXF->SetBackMaterial (BrassMaterial);
CTXF-SetEdgeOn (); CTXF->SetEdgeOn ();
~~~~~ ~~~~~
Create text attributes. Create text attributes.
@ -1411,8 +1418,8 @@ Handle(Aspect_DisplayConnection) aDisplayConnection;
Handle(Graphic3d_GraphicDriver) aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection); Handle(Graphic3d_GraphicDriver) aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection);
TCollection_ExtendedString aName("3DV"); TCollection_ExtendedString aName("3DV");
myViewer = new V3d_Viewer (aGraphicDriver,aName.ToExtString (), ""); myViewer = new V3d_Viewer (aGraphicDriver,aName.ToExtString (), "");
myViewer - SetDefaultLights (); myViewer -> SetDefaultLights ();
myViewer - SetLightOn (); myViewer -> SetLightOn ();
~~~~~ ~~~~~
@subsubsection occt_visu_4_2_3 Create a 3D view (a Windows example) @subsubsection occt_visu_4_2_3 Create a 3D view (a Windows example)
@ -1436,7 +1443,7 @@ You are now able to display interactive objects such as an *AIS_Shape*.
~~~~~ ~~~~~
TopoDS_Shape aShape = BRepAPI_MakeBox(10,20,30)_Solid(); TopoDS_Shape aShape = BRepAPI_MakeBox(10,20,30)_Solid();
Handle (AIS_Shape) aAISShape = new AIS_Shape(aShape); Handle (AIS_Shape) aAISShape = new AIS_Shape(aShape);
myAISContext - Display (aAISShape); myAISContext -> Display (aAISShape);
~~~~~ ~~~~~
@subsubsection occt_visu_4_2_5 Create your own interactive object @subsubsection occt_visu_4_2_5 Create your own interactive object
@ -1482,7 +1489,7 @@ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPrs);
Update the group attributes. Update the group attributes.
~~~~~ ~~~~~
TheGroup - SetPrimitivesAspect(CTXLBLUE); TheGroup -> SetPrimitivesAspect(CTXLBLUE);
~~~~~ ~~~~~
Create two triangles in *TheGroup*. Create two triangles in *TheGroup*.
@ -1491,15 +1498,15 @@ Create two triangles in *TheGroup*.
Standard_Integer aNbTria = 2; Standard_Integer aNbTria = 2;
Handle(Graphic3d_ArrayOfTriangles) aTriangles = new Graphic3d_ArrayOfTriangles(3 * aNbTria, 0, Standard_True); Handle(Graphic3d_ArrayOfTriangles) aTriangles = new Graphic3d_ArrayOfTriangles(3 * aNbTria, 0, Standard_True);
Standard_Integer anIndex; Standard_Integer anIndex;
for (anIndex = 1; anIndex = aNbTria; nt++) for (anIndex = 1; anIndex <= aNbTria; nt++)
{ {
  aTriangles-AddVertex(anIndex * 5., 0., 0., 1., 1., 1.);   aTriangles->AddVertex(anIndex * 5., 0., 0., 1., 1., 1.);
  aTriangles-AddVertex(anIndex * 5 + 5, 0., 0., 1., 1., 1.);   aTriangles->AddVertex(anIndex * 5 + 5, 0., 0., 1., 1., 1.);
  aTriangles-AddVertex(anIndex * 5 + 2.5, 5., 0., 1., 1., 1.);   aTriangles->AddVertex(anIndex * 5 + 2.5, 5., 0., 1., 1., 1.);
} }
TheGroup-BeginPrimitives (); TheGroup->BeginPrimitives ();
mygroup-AddPrimitiveArray(aTriangles); mygroup->AddPrimitiveArray(aTriangles);
TheGroup-EndPrimitives (); TheGroup->EndPrimitives ();
~~~~~ ~~~~~
The *BeginPrimitives()* and *EndPrimitives()* methods are used when creating a set of various primitives in the same group. The *BeginPrimitives()* and *EndPrimitives()* methods are used when creating a set of various primitives in the same group.
@ -1507,33 +1514,33 @@ Use the polyline function to create a boundary box for the *Struct* structure in
~~~~~ ~~~~~
Standard_Real Xm, Ym, Zm, XM, YM, ZM; Standard_Real Xm, Ym, Zm, XM, YM, ZM;
Struct-MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); Struct->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM);
Handle(Graphic3d_ArrayOfPolylines) aPolylines = new Graphic3d_ArrayOfPolylines(16, 4); Handle(Graphic3d_ArrayOfPolylines) aPolylines = new Graphic3d_ArrayOfPolylines(16, 4);
aPolylines-AddBound (4); aPolylines->AddBound (4);
aPolylines-AddVertex (Xm, Ym, Zm); aPolylines->AddVertex (Xm, Ym, Zm);
aPolylines-AddVertex (Xm, Ym, ZM); aPolylines->AddVertex (Xm, Ym, ZM);
aPolylines-AddVertex (Xm, YM, ZM); aPolylines->AddVertex (Xm, YM, ZM);
aPolylines-AddVertex (Xm, YM, Zm); aPolylines->AddVertex (Xm, YM, Zm);
aPolylines-AddBound (4); aPolylines->AddBound (4);
aPolylines-AddVertex (Xm, Ym, Zm); aPolylines->AddVertex (Xm, Ym, Zm);
aPolylines-AddVertex (XM, Ym, Zm); aPolylines->AddVertex (XM, Ym, Zm);
aPolylines-AddVertex (XM, Ym, ZM); aPolylines->AddVertex (XM, Ym, ZM);
aPolylines-AddVertex (XM, YM, ZM); aPolylines->AddVertex (XM, YM, ZM);
aPolylines-AddBound (4); aPolylines->AddBound (4);
aPolylines-AddVertex (XM, YM, Zm); aPolylines->AddVertex (XM, YM, Zm);
aPolylines-AddVertex (XM, Ym, Zm); aPolylines->AddVertex (XM, Ym, Zm);
aPolylines-AddVertex (XM, YM, Zm); aPolylines->AddVertex (XM, YM, Zm);
aPolylines-AddVertex (Xm, YM, Zm); aPolylines->AddVertex (Xm, YM, Zm);
aPolylines-AddBound (4); aPolylines->AddBound (4);
aPolylines-AddVertex (Xm, YM, ZM); aPolylines->AddVertex (Xm, YM, ZM);
aPolylines-AddVertex (XM, YM, ZM); aPolylines->AddVertex (XM, YM, ZM);
aPolylines-AddVertex (XM, Ym, ZM); aPolylines->AddVertex (XM, Ym, ZM);
aPolylines-AddVertex (Xm, Ym, ZM); aPolylines->AddVertex (Xm, Ym, ZM);
TheGroup-BeginPrimitives (); TheGroup->BeginPrimitives ();
TheGroup-AddPrimitiveArray(aPolylines); TheGroup->AddPrimitiveArray(aPolylines);
TheGroup-EndPrimitives (); TheGroup->EndPrimitives ();
~~~~~ ~~~~~
Create text and markers in group *TheGroup*. Create text and markers in group *TheGroup*.
@ -1545,14 +1552,14 @@ static char *texte[3] = {  "Application title",
Graphic3d_Array1OfVertex Tpts8 (0, 1); Graphic3d_Array1OfVertex Tpts8 (0, 1);
Tpts8(0).SetCoord (-40.0, -40.0, -40.0); Tpts8(0).SetCoord (-40.0, -40.0, -40.0);
Tpts8(1).SetCoord (40.0, 40.0, 40.0); Tpts8(1).SetCoord (40.0, 40.0, 40.0);
TheGroup-MarkerSet (Tpts8); TheGroup->MarkerSet (Tpts8);
Graphic3d_Vertex Marker (0.0, 0.0, 0.0); Graphic3d_Vertex Marker (0.0, 0.0, 0.0);
for (i=0; i=2; i++) { for (i=0; i<=2; i++) {
  Marker.SetCoord (-(Standard_Real)i*4 + 30,   Marker.SetCoord (-(Standard_Real)i*4 + 30,
                    (Standard_Real)i*4,                     (Standard_Real)i*4,
                   -(Standard_Real)i*4);                    -(Standard_Real)i*4);
  TheGroup-Text (texte[i], Marker, 20.);   TheGroup->Text (texte[i], Marker, 20.);
} }
~~~~~ ~~~~~
@ -1619,12 +1626,12 @@ The Vertex Buffer Objects can be disabled at the application level. You can use
The following example shows how to disable the VBO support: The following example shows how to disable the VBO support:
~~~~~ ~~~~~
*// get the graphic driver* // get the graphic driver
Handle (Graphic3d_GraphicDriver) aDriver = Handle (Graphic3d_GraphicDriver) aDriver =
  myAISContext-CurrentViewer()-Driver();   myAISContext->CurrentViewer()->Driver();
*// disable VBO support* // disable VBO support
aDriver-EnableVBO (Standard_False); aDriver->EnableVBO (Standard_False);
~~~~~ ~~~~~
**Note** that the use of Vertex Buffer Objects requires the application level primitive data provided by the *Graphic3d_ArrayOfPrimitives* to be transferred to the video memory. *TKOpenGl* transfers the data and releases the *Graphic3d_ArrayOfPrimitives* internal pointers to the primitive data. Thus it might be necessary to pay attention to such kind of behaviour, as the pointers could be modified (nullified) by the *TKOpenGl*. **Note** that the use of Vertex Buffer Objects requires the application level primitive data provided by the *Graphic3d_ArrayOfPrimitives* to be transferred to the video memory. *TKOpenGl* transfers the data and releases the *Graphic3d_ArrayOfPrimitives* internal pointers to the primitive data. Thus it might be necessary to pay attention to such kind of behaviour, as the pointers could be modified (nullified) by the *TKOpenGl*.
@ -1667,14 +1674,14 @@ The following example shows how to define an array of points:
Handle (Graphic3d_ArrayOfPoints) anArray = new Graphic3d_ArrayOfPoints (aVerticiesMaxCount); Handle (Graphic3d_ArrayOfPoints) anArray = new Graphic3d_ArrayOfPoints (aVerticiesMaxCount);
// add vertices to the array // add vertices to the array
anArray-AddVertex (10.0, 10.0, 10.0); anArray->AddVertex (10.0, 10.0, 10.0);
anArray-AddVertex (0.0, 10.0, 10.0); anArray->AddVertex (0.0, 10.0, 10.0);
// add the array to the structure // add the array to the structure
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
aGroup-BeginPrimitives (); aGroup->BeginPrimitives ();
aGroup-AddPrimitiveArray (anArray); aGroup->AddPrimitiveArray (anArray);
aGroup-EndPrimitives (); aGroup->EndPrimitives ();
~~~~~ ~~~~~
If the primitives share the same vertices (polygons, triangles, etc.) then you can define them as indices of the vertices array. If the primitives share the same vertices (polygons, triangles, etc.) then you can define them as indices of the vertices array.
@ -1697,24 +1704,24 @@ Handle (Graphic3d_ArrayOfTriangles) anArray =
                                          IsColors,                                           IsColors,
                                          IsTextureCrds);                                           IsTextureCrds);
// add vertices to the array // add vertices to the array
anArray-AddVertex (-1.0, 0.0, 0.0);   // vertex 1 anArray->AddVertex (-1.0, 0.0, 0.0);   // vertex 1
anArray-AddVertex ( 1.0, 0.0, 0.0);   // vertex 2 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 3
anArray-AddVertex ( 0.0,-1.0, 0.0);   // vertex 4 anArray->AddVertex ( 0.0,-1.0, 0.0);   // vertex 4
// add edges to the array // add edges to the array
anArray-AddEdge (1);  // first triangle anArray->AddEdge (1);  // first triangle
anArray-AddEdge (2); anArray->AddEdge (2);
anArray-AddEdge (3); anArray->AddEdge (3);
anArray-AddEdge (1);  // second triangle anArray->AddEdge (1);  // second triangle
anArray-AddEdge (2); anArray->AddEdge (2);
anArray-AddEdge (4); anArray->AddEdge (4);
// add the array to the structure // add the array to the structure
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
aGroup-BeginPrimitives (); aGroup->BeginPrimitives ();
aGroup-AddPrimitiveArray (anArray); aGroup->AddPrimitiveArray (anArray);
aGroup-EndPrimitives (); aGroup->EndPrimitives ();
~~~~~ ~~~~~
If the primitive array presents primitives built from sequential sets of vertices, for example polygons, then you can specify the bounds, or the number of vertices for each primitive. You can use the method *Graphic3d_ArrayOfPrimitives::AddBound* to define the bounds and the color for each bound. This method returns the actual number of bounds. If the primitive array presents primitives built from sequential sets of vertices, for example polygons, then you can specify the bounds, or the number of vertices for each primitive. You can use the method *Graphic3d_ArrayOfPrimitives::AddBound* to define the bounds and the color for each bound. This method returns the actual number of bounds.
@ -1744,23 +1751,23 @@ Handle (Graphic3d_ArrayOfPolygons) anArray =
                                         IsTextureCrds);                                          IsTextureCrds);
// add bounds to the array, first polygon // add bounds to the array, first polygon
anArray-AddBound (3); anArray->AddBound (3);
anArray-AddVertex (-1.0, 0.0, 0.0);   anArray->AddVertex (-1.0, 0.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);   anArray->AddVertex ( 0.0, 1.0, 0.0);  
// add bounds to the array, second polygon // add bounds to the array, second polygon
anArray-AddBound (4); anArray->AddBound (4);
anArray-AddVertex (-1.0, 0.0, 0.0);   anArray->AddVertex (-1.0, 0.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);  
anArray-AddVertex (-1.0,-1.0, 0.0);   anArray->AddVertex (-1.0,-1.0, 0.0);  
// add the array to the structure // add the array to the structure
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
aGroup-BeginPrimitives (); aGroup->BeginPrimitives ();
aGroup-AddPrimitiveArray (anArray); aGroup->AddPrimitiveArray (anArray);
aGroup-EndPrimitives (); aGroup->EndPrimitives ();
~~~~~ ~~~~~
There are also several helper methods. You can get the type of the primitive array: There are also several helper methods. You can get the type of the primitive array:
@ -1863,13 +1870,13 @@ Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
// change the text aspect // change the text aspect
Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d (); Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d ();
aTextAspect-SetTextZoomable (Standard_True); aTextAspect->SetTextZoomable (Standard_True);
aTextAspect-SetTextAngle (45.0); aTextAspect->SetTextAngle (45.0);
aGroup-SetPrimitivesAspect (aTextAspect); aGroup->SetPrimitivesAspect (aTextAspect);
// add a text primitive to the structure // add a text primitive to the structure
Graphic3d_Vertex aPoint (1, 1, 1); Graphic3d_Vertex aPoint (1, 1, 1);
aGroup-Text (Standard_CString ("Text"), aPoint, 16.0); aGroup->Text (Standard_CString ("Text"), aPoint, 16.0);
~~~~~ ~~~~~
@subsubsection occt_visu_5_1_8 Display priorities @subsubsection occt_visu_5_1_8 Display priorities
@ -1906,13 +1913,15 @@ This sample TEST program for the *V3d* Package uses primary packages *Xw* and *
//Create a default display connection //Create a default display connection
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection(); Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
//Create a Graphic Driver from the default *Aspect_DisplayConnection* //Create a Graphic Driver from the default Aspect_DisplayConnection
Handle(Graphic3d_GraphicDriver) GD = Graphic3d::InitGraphicDriver (aDisplayConnection); Handle(Graphic3d_GraphicDriver) GD = Graphic3d::InitGraphicDriver (aDisplayConnection);
//Create a Viewer to this Driver //Create a Viewer to this Driver
Handle(V3d_Viewer) VM = new V3d_Viewer(GD, 400., Handle(V3d_Viewer) VM = new V3d_Viewer(GD, 400.,
// Space size // Space size
V3d_Xpos,// Default projection Quantity_NOC_DARKVIOLET, V3d_Xpos,
// Default projection
Quantity_NOC_DARKVIOLET,
// Default background // Default background
V3d_ZBUFFER, V3d_ZBUFFER,
// Type of visualization // Type of visualization
@ -1920,55 +1929,53 @@ V3d_GOURAUD,
// Shading model // Shading model
V3d_WAIT); V3d_WAIT);
// Update mode // Update mode
*// Create a structure in this Viewer * // Create a structure in this Viewer
Handle(Graphic3d_Structure) S = Handle(Graphic3d_Structure) S = new Graphic3d_Structure(VM->Viewer()) ;
new Graphic3d_Structure(VM-Viewer()) ;
*// Type of structure * // Type of structure
S-SetVisual (Graphic3d_TOS_SHADING); S->SetVisual (Graphic3d_TOS_SHADING);
*// Create a group of primitives in this structure* // Create a group of primitives in this structure
Handle(Graphic3d_Group) G = new Graphic3d_Group(S) ; Handle(Graphic3d_Group) G = new Graphic3d_Group(S) ;
*// Fill this group with one polygon of size 100* // Fill this group with one polygon of size 100
Graphic3d_Array1OfVertex Points(0,3) ; Graphic3d_Array1OfVertex Points(0,3) ;
Points(0).SetCoord(-100./2.,-100./2.,-100./2.) ; Points(0).SetCoord(-100./2.,-100./2.,-100./2.) ;
Points(1).SetCoord(-100./2., 100./2.,-100./2.) ; Points(1).SetCoord(-100./2., 100./2.,-100./2.) ;
Points(2).SetCoord( 100./2., 100./2.,-100./2.) ; Points(2).SetCoord( 100./2., 100./2.,-100./2.) ;
Points(3).SetCoord( 100./2.,-100./2.,-100./2.) ; Normal.SetCoord(0.,0.,1.) ; Points(3).SetCoord( 100./2.,-100./2.,-100./2.) ;
G-Polygon(Points,Normal) ; Normal.SetCoord(0.,0.,1.) ;
G->Polygon(Points,Normal) ;
*// Create Ambient and Infinite Lights in this Viewer* // Create Ambient and Infinite Lights in this Viewer
Handle(V3d_AmbientLight) L1 = new V3d_AmbientLight Handle(V3d_AmbientLight) L1 = new V3d_AmbientLight
(VM,Quantity_NOC_GRAY50) ; (VM,Quantity_NOC_GRAY50) ;
Handle(V3d_DirectionalLight) L2 = new V3d_DirectionalLight Handle(V3d_DirectionalLight) L2 = new V3d_DirectionalLight
(VM,V3d_XnegYnegZneg,Quantity_NOC_WHITE) ; (VM,V3d_XnegYnegZneg,Quantity_NOC_WHITE) ;
*// Create a 3D quality Window with the same DisplayConnection* // Create a 3D quality Window with the same DisplayConnection
Handle(Xw_Window) W = Handle(Xw_Window) W = new Xw_Window(aDisplayConnection,"Test V3d",0.5,0.5,0.5,0.5) ;
new Xw_Window(aDisplayConnection,"Test V3d",0.5,0.5,0.5,0.5) ;
*// Map this Window to this screen* // Map this Window to this screen
 W-Map() ; W->Map() ;
*// Create a Perspective View in this Viewer* // Create a Perspective View in this Viewer
Handle(V3d_PerspectiveView) V = Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM);
new V3d_PerspectiveView(VM);
*// Set the Eye position* // Set the Eye position
V-SetEye(100.,100.,100.) ; V->SetEye(100.,100.,100.) ;
*// Associate this View with the Window * // Associate this View with the Window
V-SetWindow(W) ; V->SetWindow(W) ;
*// Activate ALL defined Lights in this View * // Activate ALL defined Lights in this View
V-SetLightOn() ; V->SetLightOn() ;
*// Display ALL structures in this View * // Display ALL structures in this View
(VM-Viewer())-Display() ; (VM-Viewer())->Display() ;
*// Finally update the Visualization in this View * // Finally update the Visualization in this View
V-Update() ; V->Update() ;
~~~~~ ~~~~~
@subsubsection occt_visu_5_2_4 Glossary of view transformations @subsubsection occt_visu_5_2_4 Glossary of view transformations
@ -2021,13 +2028,13 @@ Let us see the example:
Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM); Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM);
// Set the ZSize // Set the ZSize
V-SetZSize(2000.) ; V->SetZSize(2000.) ;
// Set the Depth value // Set the Depth value
V-SetDepth(20.) ; V->SetDepth(20.) ;
// Set the current mapping as default to be used by Reset() operation // Set the current mapping as default to be used by Reset() operation
V-SetViewMappingDefault() ; V->SetViewMappingDefault() ;
~~~~~ ~~~~~
As an alternative to manual setting of perspective parameters the *V3d_View::DepthFitAll* function can be used. As an alternative to manual setting of perspective parameters the *V3d_View::DepthFitAll* function can be used.
@ -2035,19 +2042,19 @@ As an alternative to manual setting of perspective parameters the *V3d_View::De
~~~~~ ~~~~~
// Display  shape in Viewer VM // Display  shape in Viewer VM
Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(VM); Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(VM);
aContext-Display(shape); aContext->Display(shape);
// Create a Perspective View in Viewer VM // Create a Perspective View in Viewer VM
Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM); Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM);
// Set automatically the perspective parameters // Set automatically the perspective parameters
V-DepthFitAll() ; V->DepthFitAll() ;
// Fit view to object size // Fit view to object size
V-FitAll(); V->FitAll();
// Set the current mapping as default to be used by Reset() operation // Set the current mapping as default to be used by Reset() operation
V-SetViewMappingDefault() ; V->SetViewMappingDefault() ;
~~~~~ ~~~~~
It is necessary to take into account that during rotation Z size of the view might be modified automatically to fit the model into the viewing volume. It is necessary to take into account that during rotation Z size of the view might be modified automatically to fit the model into the viewing volume.
@ -2089,8 +2096,8 @@ The following example demonstrates how to draw overlay graphics by the *V3d_Lay
void MyLayerMgr::Redraw () void MyLayerMgr::Redraw ()
{ {
  Quantity_Color aRed (Quantity_NOC_RED);   Quantity_Color aRed (Quantity_NOC_RED);
  myOverlayLayer-SetColor (aRed);   myOverlayLayer->SetColor (aRed);
  myOverlayLayer-DrawRectangle (0, 0, 100, 100);   myOverlayLayer->DrawRectangle (0, 0, 100, 100);
} }
~~~~~ ~~~~~
@ -2127,13 +2134,13 @@ void V3d_ColorScaleLayerItem::RedrawLayerPrs ()
{ {
  Visual3d_LayerItem::RedrawLayerPrs ()   Visual3d_LayerItem::RedrawLayerPrs ()
  if (!MyColorScale.IsNull ())   if (!MyColorScale.IsNull ())
    MyColorScale-DrawScale ();     MyColorScale->DrawScale ();
} }
// V3d_ColorScale has a reference to a LayerMgr // V3d_ColorScale has a reference to a LayerMgr
void V3d_ColorScale::DrawScale () 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 // PaintRect method uses overlay layer of LayerMgr to draw a rectangle
@ -2143,12 +2150,11 @@ void V3d_ColorScale::PaintRect
        const Quantity_Color aColor,         const Quantity_Color aColor,
        const Standard_Boolean aFilled)         const Standard_Boolean aFilled)
{ {
  const Handle (Visual3d_Layer)& theLayer =   const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay ();
                                 myLayerMgr-Overlay ();    ...
      theLayer->SetColor (aColor);
  theLayer-SetColor (aColor);   theLayer->DrawRectangle (X, Y, W, H);
  theLayer-DrawRectangle (X, Y, W, H);    ...
  
} }
~~~~~ ~~~~~
@ -2206,11 +2212,11 @@ To get the current background color you can use the following methods:
To set the image as a background and change the background image style you can use the following methods: To set the image as a background and change the background image style you can use the following methods:
~~~~~ ~~~~~
* void V3d_View::SetBackgroundImage void V3d_View::SetBackgroundImage
(const Standard_CString FileName, (const Standard_CString FileName,
 const Aspect_FillMethod FillStyle,  const Aspect_FillMethod FillStyle,
 const Standard_Boolean update)  const Standard_Boolean update)
* void V3d_View::SetBgImageStyle void V3d_View::SetBgImageStyle
(const Aspect_FillMethod FillStyle, (const Aspect_FillMethod FillStyle,
 const Standard_Boolean update)  const Standard_Boolean update)
~~~~~ ~~~~~
@ -2237,13 +2243,15 @@ The *V3d_Plane* class provides the services of clipping planes: it holds the pl
 Quantity_Parameter& C,  Quantity_Parameter& C,
 Quantity_Parameter& D)  Quantity_Parameter& D)
~~~~~ ~~~~~
 *V3d_Plane* also provides display services:
*V3d_Plane* also provides display services:
~~~~~ ~~~~~
* void V3d_Plane::Display void V3d_Plane::Display
(const Handle(V3d_View)& aView, (const Handle(V3d_View)& aView,
 const Quantity_Color& aColor)  const Quantity_Color& aColor)
* void V3d_Plane::Erase () void V3d_Plane::Erase ()
* Standard_Boolean V3d_Plane::IsDisplayed () Standard_Boolean V3d_Plane::IsDisplayed ()
~~~~~ ~~~~~
The *Display* method could be redefined to provide custom representation of the clipping plane. The *Display* method could be redefined to provide custom representation of the clipping plane.
@ -2270,9 +2278,9 @@ The number of clipping planes is limited. The method *Standard_Boolean V3d_View
~~~~~ ~~~~~
// try to use an existing clipping plane or create a new one // try to use an existing clipping plane or create a new one
Handle(V3d_Plane) aCustomPlane; Handle(V3d_Plane) aCustomPlane;
myView-InitActivePlanes (); myView->InitActivePlanes ();
if (myView-MoreActivePlanes ()) if (myView->MoreActivePlanes ())
  aCustomPlane = myView-ActivePlane ();   aCustomPlane = myView->ActivePlane ();
else else
  aCustomPlane = new V3d_Plane ();   aCustomPlane = new V3d_Plane ();
@ -2284,28 +2292,47 @@ gp_Pln aPln (gp_Pnt (x, y, z), gp_Dir (dx, dy, dz));
aPln.Coefficients (a, b, c, d); aPln.Coefficients (a, b, c, d);
// update plane // update plane
aCustomPlane-SetPlane (a, b, c, d); aCustomPlane->SetPlane (a, b, c, d);
myView-SetPlaneOn (aCustomPlane); myView->SetPlaneOn (aCustomPlane);
~~~~~ ~~~~~
@subsubsection occt_visu_5_2_9 Dumping a 3D scene into an image file @subsubsection occt_visu_5_2_9 Dumping a 3D scene into an image file
The 3D scene displayed in the view could be dumped in high resolution into an image file. The high resolution (8192x8192 on some implementations) is achieved using the Frame Buffer Objects (FBO) provided by the graphic driver. Frame Buffer Objects enable off-screen rendering into a virtual view to produce images in the background mode (without displaying any graphics on the screen). The 3D scene displayed in the view could be dumped in high resolution into an image file. The high resolution (8192x8192 on some implementations) is achieved using the Frame Buffer Objects (FBO) provided by the graphic driver. Frame Buffer Objects enable off-screen rendering into a virtual view to produce images in the background mode (without displaying any graphics on the screen).
The *V3d_View* has the following methods for dumping the 3D scene: The *V3d_View* has the following methods for dumping the 3D scene:
* *Standard_Boolean V3d_View::Dump (const Standard_CString theFile, const Image_TypeOfImage theBufferType)* - dumps the scene into an image file with the view dimensions. ~~~~
* *Standard_Boolean V3d_View::Dump (const Standard_CString theFile, const Aspect_FormatOfSheetPaper theFormat, const Image_TypeOfImage theBufferType)* - allows making the dimensions of the output image compatible to a certain format of printing paper passed by *theFormat* argument. Standard_Boolean V3d_View::Dump
(const Standard_CString theFile,
const Image_TypeOfImage theBufferType)
~~~~
Dumps the scene into an image file with the view dimensions.
~~~~
Standard_Boolean V3d_View::Dump
(const Standard_CString theFile,
const Aspect_FormatOfSheetPaper theFormat,
const Image_TypeOfImage theBufferType)
~~~~
Makes the dimensions of the output image compatible to a certain format of printing paper passed by *theFormat* argument.
These methods dump the 3D scene into an image file passed by its name and path as theFile. These methods dump the 3D scene into an image file passed by its name and path as theFile.
The raster image data handling algorithm is based on the Image_PixMap class. The supported extensions are ".png", ".bmp", ".png", ".png". The raster image data handling algorithm is based on the Image_PixMap class. The supported extensions are ".png", ".bmp", ".png", ".png".
The value passed as *theBufferType* argument defines the type of the buffer for an output image *(RGB, RGBA, floating-point, RGBF, RGBAF)*. Both methods return *Standard_True* if the scene has been successfully dumped. The value passed as *theBufferType* argument defines the type of the buffer for an output image <i>(RGB, RGBA, floating-point, RGBF, RGBAF)</i>. Both methods return *Standard_True* if the scene has been successfully dumped.
**Note** that dumping the image for a paper format with large dimensions is a memory consuming operation, it might be necessary to take care of preparing enough free memory to perform this operation. **Note** that dumping the image for a paper format with large dimensions is a memory consuming operation, it might be necessary to take care of preparing enough free memory to perform this operation.
* Handle_Image_PixMap V3d_View::ToPixMap (const Standard_Integer theWidth, const Standard_Integer theHeight, const Image_TypeOfImage theBufferType, const Standard_Boolean theForceCentered)* allows dumping the displayed 3d scene into a pixmap with a width and height passed as *theWidth* and theHeight arguments. ~~~~
Handle_Image_PixMap V3d_View::ToPixMap
(const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Image_TypeOfImage theBufferType,
const Standard_Boolean theForceCentered)
~~~~
Dumps the displayed 3d scene into a pixmap with a width and height passed as *theWidth* and theHeight arguments.
The value passed as *theBufferType* argument defines the type of the buffer for a pixmap *(RGB, RGBA, floating-point, RGBF, RGBAF)*. The last parameter allows centering the 3D scene on dumping. The value passed as *theBufferType* argument defines the type of the buffer for a pixmap <i>(RGB, RGBA, floating-point, RGBF, RGBAF)</i>. The last parameter allows centering the 3D scene on dumping.
All these methods assume that you have created a view and displayed a 3d scene in it. However, the window used for such a view could be virtual, so you can dump the 3d scene in the background mode without displaying it on the screen. To use such an opportunity you can perform the following steps: All these methods assume that you have created a view and displayed a 3d scene in it. However, the window used for such a view could be virtual, so you can dump the 3d scene in the background mode without displaying it on the screen. To use such an opportunity you can perform the following steps:
* Create display connection; * Create display connection;
@ -2329,37 +2356,32 @@ Handle (Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (aDispl
// create a window // create a window
Standard_Integer aDefWidth  = 800; Standard_Integer aDefWidth  = 800;
Standard_Integer aDefHeight = 600; Standard_Integer aDefHeight = 600;
Handle (WNT_WClass) aWClass = Handle (WNT_WClass) aWClass = new WNT_WClass ("Virtual Class",DefWindowProc,
             new WNT_WClass ("Virtual Class",DefWindowProc,
                             CS_VREDRAW | CS_HREDRAW, 0, 0,                              CS_VREDRAW | CS_HREDRAW, 0, 0,
                             ::LoadCursor (NULL, IDC_ARROW));                              ::LoadCursor (NULL, IDC_ARROW));
Handle (WNT_Window) aWindow = Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd",  aWClass,
             new WNT_Window ("VirtualWnd",  aWClass,
                             WS_OVERLAPPEDWINDOW, 0, 0,                              WS_OVERLAPPEDWINDOW, 0, 0,
                             aDefWidth, aDefHeight);                              aDefWidth, aDefHeight);
// set up the window as virtual // set up the window as virtual
aWindow-SetVirtual (Standard_True); aWindow->SetVirtual (Standard_True);
// create a view and an interactive context // create a view and an interactive context
Handle (V3d_Viewer) aViewer = Handle (V3d_Viewer) aViewer = new V3d_Viewer (aDriver,
             new V3d_Viewer (aDriver,
                             Standard_ExtString ("Virtual"));                              Standard_ExtString ("Virtual"));
Handle (AIS_InteractiveContext) aContext = Handle (AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer);
             new AIS_InteractiveContext (aViewer); Handle (V3d_View) aView = aViewer->CreateView ();
Handle (V3d_View) aView = aViewer-CreateView ();
// assign the virtual window to the view // assign the virtual window to the view
aView-SetWindow (aWindow); aView->SetWindow (aWindow);
// display a 3D scene // display a 3D scene
Handle (AIS_Shape) aBox = Handle (AIS_Shape) aBox = new AIS_Shape (BRepPrimAPI_MakeBox (5, 5, 5));
             new AIS_Shape (BRepPrimAPI_MakeBox (5, 5, 5)); aContext->Display (aBox);
aContext-Display (aBox); aView->FitAll();
aView-FitAll();
// dump the 3D scene into an image file // dump the 3D scene into an image file
aView-Dump ("3dscene.png"); aView->Dump ("3dscene.png");
~~~~~ ~~~~~
@subsubsection occt_visu_5_2_10 Printing a 3D scene @subsubsection occt_visu_5_2_10 Printing a 3D scene

View File

@ -16,8 +16,8 @@ The Extended Data Exchange (XDE) component requires Advanced Shape Healing for o
@subsubsection occt_xde_1_1_2 Environment variables @subsubsection occt_xde_1_1_2 Environment variables
To use XDE you have to set the environment variables properly. Make sure that two important environment variables are set as follows: To use XDE you have to set the environment variables properly. Make sure that two important environment variables are set as follows:
* *CSF_PluginDefaults* points to sources of *\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)*. * *CSF_PluginDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
* *CSF_XCAFDefaults* points to sources of *\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)*. * *CSF_XCAFDefaults* points to sources of <i>\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)</i>.
@subsubsection occt_xde_1_1_3 Basic terms @subsubsection occt_xde_1_1_3 Basic terms
For better understanding of XDE, certain key terms are defined: For better understanding of XDE, certain key terms are defined:
* **Shape** - a standalone shape, which does not belong to the assembly structure. * **Shape** - a standalone shape, which does not belong to the assembly structure.
@ -71,20 +71,21 @@ Advanced Data Exchange supports both reading and writing of validation propertie
Check logs contain deviations of computed values from the values stored in a STEP file. A typical example appears as follows: Check logs contain deviations of computed values from the values stored in a STEP file. A typical example appears as follows:
Label Area defect Volume defect dX dY DZ Name | Label | Area defect | Volume defect | dX | dY | DZ | Name |
0:1:1:1 312.6 (0%) -181.7 (0%) 0.00 0.00 0.00 "S1" | :---- | :----- | :----- | :----- | :---- | :---- | :---- |
0:1:1:2 -4.6 (0%) -191.2 (0%) -0.00 0.00 -0.00 "MAINBODY" | 0:1:1:1 | 312.6 (0%) | -181.7 (0%) | 0.00 | 0.00 | 0.00 | "S1" |
0:1:1:3 -2.3 (0%) -52.5 (0%) -0.00 0.00 0.00 "MAIN_BODY_BACK" | 0:1:1:2 | -4.6 (0%) | -191.2 (0%) | -0.00 | 0.00 | -0.00 | "MAINBODY" |
0:1:1:4 -2.3 (0%) -51.6 (0%) 0.00 0.00 -0.00 "MAIN_BODY_FRONT" | 0:1:1:3 | -2.3 (0%) | -52.5 (0%) | -0.00 | 0.00 | 0.00 | "MAIN_BODY_BACK" |
0:1:1:5 2.0 (0%) 10.0 (0%) -0.00 0.00 -0.00 "HEAD" | 0:1:1:4 | -2.3 (0%) | -51.6 (0%) | 0.00 | 0.00 | -0.00 | "MAIN_BODY_FRONT" |
0:1:1:6 0.4 (0%) 0.0 (0%) 0.00 -0.00 -0.00 "HEAD_FRONT" | 0:1:1:5 | 2.0 (0%) | 10.0 (0%) | -0.00 | 0.00 | -0.00 | "HEAD" |
0:1:1:7 0.4 (0%) 0.0 (0%) 0.00 -0.00 -0.00 "HEAD_BACK" | 0:1:1:6 | 0.4 (0%) | 0.0 (0%) | 0.00 | -0.00 | -0.00 | "HEAD_FRONT" |
0:1:1:8 -320.6 (0%) 10.9 (0%) -0.00 0.00 0.00 "TAIL" | 0:1:1:7 | 0.4 (0%) | 0.0 (0%) | 0.00 | -0.00 | -0.00 | "HEAD_BACK" |
0:1:1:9 0.0 (0%) 0.0 (0%) -0.00 -0.00 0.00 "TAIL_MIDDLE" | 0:1:1:8 | -320.6 (0%) | 10.9 (0%) | -0.00 | 0.00 | 0.00 | "TAIL" |
0:1:1:10 -186.2 (0%) 4.8 (0%) -0.00 0.00 -0.00 "TAIL_TURBINE" | 0:1:1:9 | 0.0 (0%) | 0.0 (0%) | -0.00 | -0.00 | 0.00 | "TAIL_MIDDLE" |
0:1:1:11 0.3 (0%) -0.0 (0%) -0.00 -0.00 0.00 "FOOT" | 0:1:1:10 | -186.2 (0%) | 4.8 (0%) | -0.00 | 0.00 | -0.00 | "TAIL_TURBINE" |
0:1:1:12 0.0 (0%) -0.0 (0%) 0.00 -0.00 -0.00 "FOOT_FRONT" | 0:1:1:11 | 0.3 (0%) | -0.0 (0%) | -0.00 | -0.00 | 0.00 | "FOOT" |
0:1:1:13 0.0 (0%) 0.0 (0%) -0.00 0.00 0.00 "FOOT_BACK" | 0:1:1:12 | 0.0 (0%) | -0.0 (0%) | 0.00 | -0.00 | -0.00 |"FOOT_FRONT" |
| 0:1:1:13 | 0.0 (0%) | 0.0 (0%) | -0.00 | 0.00 | 0.00 | "FOOT_BACK" |
In our example, it can be seen that no errors were detected for either area, volume or positioning data. In our example, it can be seen that no errors were detected for either area, volume or positioning data.
@ -93,9 +94,9 @@ In our example, it can be seen that no errors were detected for either area, vol
XDE supports reading and writing the names of shapes to and from IGES and STEP file formats. This functionality can be switched off if you do not need this type of data, thereby reducing the size of the document. XDE supports reading and writing the names of shapes to and from IGES and STEP file formats. This functionality can be switched off if you do not need this type of data, thereby reducing the size of the document.
@subsubsection occt_xde_1_1_9 Colors and Layers @subsubsection occt_xde_1_1_9 Colors and Layers
XDE can read and write colors and layers assigned to shapes or their subparts (down to the level of faces and edges) to and from both IGES and STEP formats. Three types of colors are defined in the enumeration *XCAFDoc_ColorType*: XDE can read and write colors and layers assigned to shapes or their subparts (down to the level of faces and edges) to and from both IGES and STEP formats. Three types of colors are defined in the enumeration *XCAFDoc_ColorType*:
* generic color *(XCAFDoc_ColorGen)* * generic color <i>(XCAFDoc_ColorGen)</i>
* surface color *(XCAFDoc_ColorSurf)* * surface color <i>(XCAFDoc_ColorSurf)</i>
* curve color *(XCAFDoc_ColorCurv)* * curve color <i>(XCAFDoc_ColorCurv)</i>
@image html /user_guides/xde/images/xde_image006.png "Colors and Layers" @image html /user_guides/xde/images/xde_image006.png "Colors and Layers"
@image latex /user_guides/xde/images/xde_image006.png "Colors and Layers" @image latex /user_guides/xde/images/xde_image006.png "Colors and Layers"
@ -112,6 +113,7 @@ As explained in the last chapter, XDE uses *TDocStd_Documents* as a starting poi
* Querying and managing shapes * Querying and managing shapes
* Attaching properties to shapes * Attaching properties to shapes
The Document used by XDE usually starts as a TDocStd_Document. The Document used by XDE usually starts as a TDocStd_Document.
@subsubsection occt_xde_2_1_1 General Check @subsubsection occt_xde_2_1_1 General Check
Before working with shapes, properties, and other types of information, the global organization of an XDE Document can be queried or completed to determine if an existing Document is actually structured for use with XDE. Before working with shapes, properties, and other types of information, the global organization of an XDE Document can be queried or completed to determine if an existing Document is actually structured for use with XDE.
@ -122,33 +124,32 @@ if ( XCAFDoc_DocumentTool::IsXCAFDocument (doc) ) { .. yes .. }
~~~~~ ~~~~~
If the Document is suitable for XDE, you can perform operations and queries explained in this guide. However, if a Document is not fully structured for XDE, it must be initialized. If the Document is suitable for XDE, you can perform operations and queries explained in this guide. However, if a Document is not fully structured for XDE, it must be initialized.
@subsubsection occt_xde_2_1_2 Getting an Application or an Initialized Document @subsubsection occt_xde_2_1_2 Get an Application or an Initialized Document
If you want to retrieve an existing application or an existing document (known to be correctly structured for XDE), use: If you want to retrieve an existing application or an existing document (known to be correctly structured for XDE), use:
~~~~~ ~~~~~
Handle(TDocStd_Document) aDoc; Handle(TDocStd_Document) aDoc;
Handle(XCAFApp_Application) anApp = Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
XCAFApp_Application::GetApplication();
anApp->NewDocument(;MDTV-XCAF;,aDoc); anApp->NewDocument(;MDTV-XCAF;,aDoc);
~~~~~ ~~~~~
@subsection occt_xde_2_2 Shapes and Assemblies @subsection occt_xde_2_2 Shapes and Assemblies
@subsubsection occt_xde_2_2_1 Initializing an XDE Document (Shapes)
@subsubsection occt_xde_2_2_1 Initialize an XDE Document (Shapes)
An XDE Document begins with a *TDocStd_Document*. Assuming you have a *TDocStd_Document* already created, you can ensure that it is correctly structured for XDE by initializing the XDE structure as follows: An XDE Document begins with a *TDocStd_Document*. Assuming you have a *TDocStd_Document* already created, you can ensure that it is correctly structured for XDE by initializing the XDE structure as follows:
~~~~~ ~~~~~
Handle(TDocStd_Document) doc... Handle(TDocStd_Document) doc...
Handle (XCAFDoc_ShapeTool) myAssembly = Handle (XCAFDoc_ShapeTool) myAssembly =
XCAFDoc_DocumentTool::ShapeTool (Doc-Main()); XCAFDoc_DocumentTool::ShapeTool (Doc->Main());
TDF_Label aLabel = myAssembly->NewShape() TDF_Label aLabel = myAssembly->NewShape()
~~~~~ ~~~~~
**Note** that the method *XCAFDoc_DocumentTool::ShapeTool* returns the *XCAFDoc_ShapeTool*. The first time this method is used, it creates the *XCAFDoc_ShapeTool*. In our example, a handle is used for the *TDocStd_Document*. **Note** that the method *XCAFDoc_DocumentTool::ShapeTool* returns the *XCAFDoc_ShapeTool*. The first time this method is used, it creates the *XCAFDoc_ShapeTool*. In our example, a handle is used for the *TDocStd_Document*.
@subsubsection occt_xde_2_2_2 Getting a Node considered as an Assembly @subsubsection occt_xde_2_2_2 Get a Node considered as an Assembly
To get a node considered as an Assembly from an XDE structure, you can use the Label of the node. Assuming that you have a properly initialized *TDocStd_Document*, use: To get a node considered as an Assembly from an XDE structure, you can use the Label of the node. Assuming that you have a properly initialized *TDocStd_Document*, use:
~~~~~ ~~~~~
Handle(TDocStd_Document) doc... Handle(TDocStd_Document) doc...
Handle(XCAFDoc_ShapeTool) myAssembly = Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool (aLabel);
XCAFDoc_DocumentTool::ShapeTool (aLabel);
~~~~~ ~~~~~
In the previous example, you can also get the Main Item of an XDE document, which records the root shape representation (as a Compound if it is an Assembly) by using *ShapeTool(Doc-Main())* instead of *ShapeTool(aLabel)*. In the previous example, you can also get the Main Item of an XDE document, which records the root shape representation (as a Compound if it is an Assembly) by using *ShapeTool(Doc->Main())* instead of *ShapeTool(aLabel)*.
You can then query or edit this Assembly node, the Main Item or another one (*myAssembly* in our examples). You can then query or edit this Assembly node, the Main Item or another one (*myAssembly* in our examples).
@ -159,7 +160,7 @@ Some actions in this chapter affect the content of the document, considered as a
To update the representations, use: To update the representations, use:
~~~~~ ~~~~~
myAssembly-UpdateAssembly(aLabel); myAssembly->UpdateAssembly(aLabel);
~~~~~ ~~~~~
Since this call is always used by the editing functions, you need not apply it for such functions. However, you will need this call if special edits, not using XCAF functions, are used on the document. Since this call is always used by the editing functions, you need not apply it for such functions. However, you will need this call if special edits, not using XCAF functions, are used on the document.
@ -180,7 +181,7 @@ To break down a Compound in the assembly structure, use:
Standard_Boolean makeAssembly; Standard_Boolean makeAssembly;
// True to interpret a Compound as an Assembly, // True to interpret a Compound as an Assembly,
// False to take it as a whole // False to take it as a whole
aLabel = myAssembly-AddShape(aShape, makeAssembly); aLabel = myAssembly->AddShape(aShape, makeAssembly);
~~~~~ ~~~~~
Each node of the assembly therefore refers to its sub-shapes. Each node of the assembly therefore refers to its sub-shapes.
@ -193,7 +194,7 @@ Standard_CString LabelString ...;
// identifies the Label (form ;0:i:j...;) // identifies the Label (form ;0:i:j...;)
TDF_Label aLabel...; TDF_Label aLabel...;
// A label must be present // A label must be present
myAssembly-SetShape(aLabel, aShape); myAssembly->SetShape(aLabel, aShape);
~~~~~ ~~~~~
@subsubsection occt_xde_2_2_6 Getting a Shape from a Label @subsubsection occt_xde_2_2_6 Getting a Shape from a Label
@ -231,7 +232,7 @@ Various other queries can be made from a Label within the Main Item of XDE:
To determine if a Shape is recorded (or not), use: To determine if a Shape is recorded (or not), use:
~~~~~ ~~~~~
if ( myAssembly-IsShape(aLabel) ) { .. yes .. } if ( myAssembly->IsShape(aLabel) ) { .. yes .. }
~~~~~ ~~~~~
To determine if the shape is top-level, i.e. was added by the *AddShape* method, use: To determine if the shape is top-level, i.e. was added by the *AddShape* method, use:
@ -242,12 +243,12 @@ if ( myAssembly->IsTopLevel(aLabel) ) { .. yes .. }
To get a list of top-level shapes added by the *AddShape* method, use: To get a list of top-level shapes added by the *AddShape* method, use:
~~~~~ ~~~~~
TDF_LabelSequence frshapes; TDF_LabelSequence frshapes;
myAssembly-GetShapes(frshapes); myAssembly->GetShapes(frshapes);
~~~~~ ~~~~~
To get all free shapes at once if the list above has only one item, use: To get all free shapes at once if the list above has only one item, use:
~~~~~ ~~~~~
TopoDS_Shape result = myAssembly-GetShape(frshapes.Value(1)); TopoDS_Shape result = myAssembly->GetShape(frshapes.Value(1));
~~~~~ ~~~~~
If there is more than one item, you must create and fill a compound, use: If there is more than one item, you must create and fill a compound, use:
@ -266,7 +267,7 @@ In our example, the result is the compound C.
To determine if a shape is a free shape (no reference or super-assembly), use: To determine if a shape is a free shape (no reference or super-assembly), use:
~~~~~ ~~~~~
if ( myAssembly-IsFree(aLabel) ) { .. yes .. } if ( myAssembly->IsFree(aLabel) ) { .. yes .. }
~~~~~ ~~~~~
To get a list of Free Shapes (roots), use: To get a list of Free Shapes (roots), use:
@ -279,25 +280,24 @@ myAssembly->GetFreeShapes(frshapes);
To get the shapes, which use a given shape as a component, use: To get the shapes, which use a given shape as a component, use:
~~~~~ ~~~~~
TDF_LabelSequence users; TDF_LabelSequence users;
Standard_Integer nbusers = myAssembly-GetUsers(aLabel,users); Standard_Integer nbusers = myAssembly->GetUsers(aLabel,users);
~~~~~ ~~~~~
The count of users is contained with *nbusers*. It contains 0 if there are no users. The count of users is contained with *nbusers*. It contains 0 if there are no users.
#### Assembly and Components #### Assembly and Components
To determine if a label is attached to the main part or to a sub-part (component), use: To determine if a label is attached to the main part or to a sub-part (component), use:
~~~~~ ~~~~~
if (myAssembly-IsComponent(aLabel)) { .. yes .. } if (myAssembly->IsComponent(aLabel)) { .. yes .. }
~~~~~ ~~~~~
To determine whether a label is a node of a (sub-) assembly or a simple shape, use: To determine whether a label is a node of a (sub-) assembly or a simple shape, use:
~~~~~ ~~~~~
if ( myAssembly-IsAssembly(aLabel) ) { .. yes .. } if ( myAssembly->IsAssembly(aLabel) ) { .. yes .. }
~~~~~ ~~~~~
If the label is a node of a (sub-) assembly, you can get the count of components, use: If the label is a node of a (sub-) assembly, you can get the count of components, use:
~~~~~ ~~~~~
Standard_Boolean subchilds = Standard_False; //default Standard_Boolean subchilds = Standard_False; //default
Standard_Integer nbc = myAssembly-NbComponents (aLabel Standard_Integer nbc = myAssembly->NbComponents (aLabel [,subchilds]);
[,subchilds]);
~~~~~ ~~~~~
If *subchilds* is True, commands also consider sub-levels. By default, only level one is checked. If *subchilds* is True, commands also consider sub-levels. By default, only level one is checked.
@ -306,7 +306,7 @@ To get component Labels themselves, use:
~~~~~ ~~~~~
Standard_Boolean subchilds = Standard_False; //default Standard_Boolean subchilds = Standard_False; //default
TDF_LabelSequence comps; TDF_LabelSequence comps;
Standard_Boolean isassembly = myAssembly-GetComponents Standard_Boolean isassembly = myAssembly->GetComponents
(aLabel,comps[,subchilds]); (aLabel,comps[,subchilds]);
~~~~~ ~~~~~
@subsubsection occt_xde_2_2_9 Instances and References for Components @subsubsection occt_xde_2_2_9 Instances and References for Components
@ -316,15 +316,15 @@ if ( myAssembly->IsSimpleShape(aLabel) ) { .. yes .. }
~~~~~ ~~~~~
To determine if a label is a located reference to another one, use: To determine if a label is a located reference to another one, use:
~~~~~ ~~~~~
if ( myAssembly-IsReference(aLabel) ) { .. yes .. } if ( myAssembly->IsReference(aLabel) ) { .. yes .. }
~~~~~ ~~~~~
If the label is a located reference, you can get the location, use: If the label is a located reference, you can get the location, use:
~~~~~ ~~~~~
TopLoc_Location loc = myAssembly-GetLocation (aLabel); TopLoc_Location loc = myAssembly->GetLocation (aLabel);
~~~~~ ~~~~~
To get the label of a referenced original shape (also tests if it is a reference), use: To get the label of a referenced original shape (also tests if it is a reference), use:
~~~~~ ~~~~~
Standard_Boolean isref = myAssembly-GetReferredShape Standard_Boolean isref = myAssembly->GetReferredShape
(aLabel, refLabel); (aLabel, refLabel);
~~~~~ ~~~~~
@ -335,7 +335,7 @@ In addition to the previously described *AddShape* and *SetShape*, several shape
To remove a Shape, and all its sub-labels, use: To remove a Shape, and all its sub-labels, use:
~~~~~ ~~~~~
Standard_Boolean remsh = myAssembly-RemoveShape(aLabel); Standard_Boolean remsh = myAssembly->RemoveShape(aLabel);
// remsh is returned True if done // remsh is returned True if done
~~~~~ ~~~~~
This operation will fail if the shape is neither free nor top level. This operation will fail if the shape is neither free nor top level.
@ -368,7 +368,7 @@ TDF_Label subLabel = myAssembly->AddSubShape (aLabel, subShape);
To find the Label attached to a given sub-shape, use: To find the Label attached to a given sub-shape, use:
~~~~~ ~~~~~
TDF_Label subLabel; // new label to be computed TDF_Label subLabel; // new label to be computed
if ( myAssembly- FindSubShape (aLabel, subShape, subLabel)) { .. yes .. } if ( myAssembly-> FindSubShape (aLabel, subShape, subLabel)) { .. yes .. }
~~~~~ ~~~~~
If the sub-shape is found (yes), *subLabel* is filled by the correct value. If the sub-shape is found (yes), *subLabel* is filled by the correct value.
@ -491,7 +491,7 @@ These definitions are common to various exchange formats, at least for STEP and
To query, edit, or initialize a Document to handle Colors of XCAF, use: To query, edit, or initialize a Document to handle Colors of XCAF, use:
~~~~~ ~~~~~
Handle(XCAFDoc_ColorTool) myColors = Handle(XCAFDoc_ColorTool) myColors =
XCAFDoc_DocumentTool::ColorTool(Doc-Main ()); XCAFDoc_DocumentTool::ColorTool(Doc->Main ());
~~~~~ ~~~~~
This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following color calls and will not be repeated for these. This call can be used at any time. The first time it is used, a relevant structure is added to the document. This definition is used for all the following color calls and will not be repeated for these.
@ -509,7 +509,7 @@ XCAFDoc_ColorType ctype ..;
// XCAFDoc_ColorGen : all types of geometries // XCAFDoc_ColorGen : all types of geometries
// XCAFDoc_ColorSurf : surfaces only // XCAFDoc_ColorSurf : surfaces only
// XCAFDoc_ColorCurv : curves only // XCAFDoc_ColorCurv : curves only
myColors-SetColor ( aLabel, Col, ctype ); myColors->SetColor ( aLabel, Col, ctype );
~~~~~ ~~~~~
Alternately, the Shape can be designated directly, without using its label, use: Alternately, the Shape can be designated directly, without using its label, use:
~~~~~ ~~~~~
@ -582,7 +582,7 @@ TDF_Label ColLabel = myColors-FindColor (Col);
if ( !ColLabel.IsNull() ) { .. found .. } if ( !ColLabel.IsNull() ) { .. found .. }
~~~~~ ~~~~~
@subsubsection occt_xde_2_64 Editing Colors @subsubsection occt_xde_2_6_4 Editing Colors
Besides adding colors, the following attribute edits can be made: Besides adding colors, the following attribute edits can be made:
To unset a Color on a Shape, use: To unset a Color on a Shape, use: