From 4ee1bdf4e95d0a319a0498a8af60129dc61f9873 Mon Sep 17 00:00:00 2001 From: ysn Date: Fri, 11 Apr 2014 20:24:19 +0400 Subject: [PATCH] 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. --- dox/dev_guides/contribution/coding_rules.md | 2 +- dox/dev_guides/git_guide/git_guide.md | 22 +- dox/dev_guides/tests/tests.md | 10 +- dox/user_guides/brep_wp/brep_wp.md | 8 +- dox/user_guides/draw_test_harness.md | 6 +- .../foundation_classes/foundation_classes.md | 138 +++-- dox/user_guides/iges/iges.md | 42 +- .../modeling_algos/modeling_algos.md | 4 +- .../modeling_data/modeling_data.md | 40 +- dox/user_guides/ocaf/ocaf.md | 35 +- dox/user_guides/ocaf_wp/ocaf_wp.md | 2 +- .../shape_healing/shape_healing.md | 295 +++++---- dox/user_guides/step/step.md | 47 +- dox/user_guides/tobj/tobj.md | 16 +- .../visualization/visualization.md | 574 +++++++++--------- dox/user_guides/xde/xde.md | 102 ++-- 16 files changed, 672 insertions(+), 671 deletions(-) diff --git a/dox/dev_guides/contribution/coding_rules.md b/dox/dev_guides/contribution/coding_rules.md index 3f85bec2d8..d757d1a0db 100644 --- a/dox/dev_guides/contribution/coding_rules.md +++ b/dox/dev_guides/contribution/coding_rules.md @@ -163,7 +163,7 @@ Standard_Integer myCounter; // This is preferred ### Names of 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 _my. See the following examples: diff --git a/dox/dev_guides/git_guide/git_guide.md b/dox/dev_guides/git_guide/git_guide.md index 7a77d3285f..f5fac65d1c 100644 --- a/dox/dev_guides/git_guide/git_guide.md +++ b/dox/dev_guides/git_guide/git_guide.md @@ -121,7 +121,7 @@ The official repository contains: 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. - 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 .gitconfig in the $HOME directory) is equal to your username on the OCCT development portal. @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. - 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 .gitconfig file @image html OCCT_GitGuide_V2_image006.png @image latex OCCT_GitGuide_V2_image006.png @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 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 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) 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) 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), - then click Generate and move mouse cursor over the blank area until the key is generated. + 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. @image html 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). 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: ~~~~~ @@ -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 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 $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. 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/): * *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). @@ -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. 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 @@ -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: * 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 (remotes/origin/master) 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. @image html OCCT_GitGuide_V2_image023.png diff --git a/dox/dev_guides/tests/tests.md b/dox/dev_guides/tests/tests.md index 3406118639..f77dbeee2c 100644 --- a/dox/dev_guides/tests/tests.md +++ b/dox/dev_guides/tests/tests.md @@ -58,7 +58,7 @@ return ;# this is to avoid an echo of the last command above in cout Note that variable *CSF_TestDataPath* is set to default value at DRAW start, pointing at the folder $CASROOT/data. In this example, subdirectory d:/occt/test-data is added to this path. Similar code could be used on Linux and Mac OS X except that on non-Windows platforms colon ‘:’ should be used as path separator instead of semicolon ‘;’. -All tests are run from DRAW command prompt (run *draw.tcl* or *draw.sh *to start it). +All tests are run from DRAW command prompt (run *draw.tcl* or *draw.sh* to start it). @subsubsection testmanual_1_3_2 Running Tests @@ -270,9 +270,9 @@ Example: if { [isdraw result] } { checkshape result } 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" @@ -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. -Use Tcl command *_path_separator* to insert a platform-dependent separator to the path list. +Use Tcl command _path_separator to insert a platform-dependent separator to the path list. For example: ~~~~~ @@ -825,7 +825,7 @@ DRAW module: XSDRAW @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*) diff --git a/dox/user_guides/brep_wp/brep_wp.md b/dox/user_guides/brep_wp/brep_wp.md index e675959f52..5e5a892329 100644 --- a/dox/user_guides/brep_wp/brep_wp.md +++ b/dox/user_guides/brep_wp/brep_wp.md @@ -468,7 +468,7 @@ The example record is interpreted as a B-spline curve with a rational flag *r*= **Example** @verbatim - 8 4 -5 + 8 -4 5 1 1 2 3 1 0 0 @endverbatim @@ -1023,7 +1023,7 @@ The example record is interpreted as an offset surface with a distance *d*=-2  @verbatim 1 3 0 0 -1 -@verbatim +@endverbatim **BNF-like Definition** @@ -1077,7 +1077,7 @@ The example record is interpreted as a circle which has a center *P*=(1,2). Th @verbatim 3 1 2 1 0 -0 1 4 3 -@verbatim +@endverbatim **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 -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** diff --git a/dox/user_guides/draw_test_harness.md b/dox/user_guides/draw_test_harness.md index 8abfa22f8f..3e07634170 100644 --- a/dox/user_guides/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness.md @@ -66,7 +66,7 @@ exit @subsection occt_draw_1_3 Getting started -Install Draw and launch Emacs. Get a command line in Emacs using *Esc x *and key in *woksh*. +Install Draw and launch Emacs. Get a command line in Emacs using *Esc x* and key in *woksh*. All DRAW Test Harness can be activated in the common executable called **DRAWEXE**. They are grouped in toolkits and can be loaded at run-time thereby implementing dynamically loaded plug-ins. Thus, it is possible to work only with the required commands adding them dynamically without leaving the Test Harness session. @@ -320,12 +320,12 @@ dset x 10 y 15 z # no $ required for Draw commands point p x y z -# *puts* prints a string +# "puts" prints a string puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)]; == 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. (a + b) is parsed as three words: "(a + b)" or (a+b) 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. (a + b) is parsed as three words: "(a + b)" or (a+b) are correct. @subsection occt_draw_2_4 lists diff --git a/dox/user_guides/foundation_classes/foundation_classes.md b/dox/user_guides/foundation_classes/foundation_classes.md index 306ccb3b2c..0e9ab55a4e 100644 --- a/dox/user_guides/foundation_classes/foundation_classes.md +++ b/dox/user_guides/foundation_classes/foundation_classes.md @@ -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, * management of exceptions, * 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 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 are implemented in the **TCollection** package. +Strings are implemented in the *TCollection* package. ### Collections 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*. 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 -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 @@ -240,32 +240,32 @@ The table below presents the equivalence existing between C++ fundamental types **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_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_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_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_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_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_Address : **Address** is a 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_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_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** : 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** : 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** : 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** : 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** : fundamental type representing a generic pointer. *Address* is implemented as a *typedef* of the C++ *void* 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 There are three categories of types which are manipulated by value: * Primitive 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. @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" -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) 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 **Transient** class. + * 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. @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" @@ -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. -Organization of Classes ------------------------ +#### Organization of Classes + 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. @@ -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. -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. @@ -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 -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. 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. -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. 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. -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. @@ -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. -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. For example, we can find the maximum degree of a Bezier curve: @@ -443,7 +443,7 @@ Standard_Integer n; 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*. 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. ~~~~~ -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. 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 -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 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_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_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. @@ -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. -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 (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. @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. @@ -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: * 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), - * 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. 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). 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. 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: ~~~~~ @@ -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. *DataMap* is a generic class which depends on three parameters: - * **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, - * **Hasher*is the type of hasher on keys. + * *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, + * *Hasher* is the type of hasher on keys. Use a *DataMapIterator* iterator to explore a *DataMap* map. @@ -1148,9 +1148,9 @@ An entry of an *IndexedDataMap* is composed of both the key, the item and the i * and of a map because data may also be accessed with a key. *IndexedDataMap* is a generic class which depends on three parameters: - * *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, - * *Hasher* is the type of hasher on keys. + * *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, + * *Hasher* is the type of hasher on keys. ##### TCollection_IndexedMap @@ -1226,7 +1226,7 @@ An iterator class is automatically instantiated from this generic class at the #### TCollection_StackIterator -These are functions used for iterating the contents of a **Stack **data structure. +These are functions used for iterating the contents of a **Stack** data structure. An iterator class is automatically instantiated from this generic class at the time of instantiation of a *Stack* structure. @@ -1237,7 +1237,7 @@ The *TColStd* and *TShort* packages provide frequently used instantiations of g @subsubsection occt_fcug_3_2_2 Description 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. * 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. @@ -1535,9 +1535,9 @@ The common point between them is that it is possible to create any number of bot #### 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 @@ -1552,9 +1552,9 @@ anArr1Pnt.Assign (aMapPnt); // heterogeneous assignment ~~~~~ 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. -* 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. -* 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: +* 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 *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: ~~~~~ MyPackage_Array1OfPnt anArr1Pnt (1, 100); @@ -1564,22 +1564,22 @@ aMapPnt.Assign(anArr1Pnt); 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 -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 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 -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. @@ -1619,10 +1619,8 @@ A variable-length sequence of extended; (UNICODE) characters (16-bit character *HExtendedString* objects use an *ExtendedString* string as a field. @subsubsection occt_fcug_3_4_2 Conversion -Resource_Unicode ----------------- -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. + +*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. @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 user’s **Current System**. 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. -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). @@ -1898,24 +1896,24 @@ It provides values to use in comparisons to test for real number equalities. * Intersection precision is used by intersection algorithms. * Approximation precision is used by approximation algorithms. * 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 -Infinite for a high negative number. @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. -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 [0,1] parameter space and a length less than 100 meters. 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. #### 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: _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())_ -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()_ #### Precision::Confusion diff --git a/dox/user_guides/iges/iges.md b/dox/user_guides/iges/iges.md index 34a9806c85..b9e7d2f1e7 100644 --- a/dox/user_guides/iges/iges.md +++ b/dox/user_guides/iges/iges.md @@ -317,8 +317,8 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”); * *xst-model-roots* - selects all roots. * *xst-transferrable-all* - selects all translatable entities. * *xst-transferrable-roots* - selects all translatable roots (default). - * *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-sharing + \* - selects all entities sharing at least one entity selected by \. + * *xst-shared + \* - selects all entities shared by at least one entity selected by \. * *iges-visible-roots* - selects all visible roots, whether translatable or not. * *iges-visible-transf-roots* - selects all visible and translatable roots. * *iges-blanked-roots* - selects all blank roots, whether translatable or not. @@ -326,7 +326,7 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”); * *iges-status-independant* - selects entities whose IGES Subordinate Status = 0. * *iges-bypass-group* Selects all root entities. If a root entity is a group (402/7 or 402/9), the entities in the group are selected. * *iges-bypass-subfigure* Selects all root entities. If a root entity is a subfigure definition (308), the entities in the subfigure definition are selected. - * * iges-bypass-group-subfigure* Selects all root entities. If a root entity is a group (402/7 or 402/9) or a subfigure definition (308), the entities in the group and in the subfigure definition are selected. + * *iges-bypass-group-subfigure* Selects all root entities. If a root entity is a group (402/7 or 402/9) or a subfigure definition (308), the entities in the group and in the subfigure definition are selected. * *iges-curves-3d* - selects 3D curves, whether they are roots or not (e.g. a 3D curve on a surface). * *iges-basic-geom* - selects 3D curves and untrimmed surfaces. * *iges-faces* - selects face-supporting surfaces (trimmed 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: ~~~~~ 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); 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);, ~~~~~ -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(); ~~~~~ @@ -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.). You must declare an include file: ~~~~~ -#includeInterface_DT.hxx +#include \ ~~~~~ 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. * 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 *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*. +* 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*.

2D (parametric) tolerances

@@ -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*. -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 edge’s 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
Class IGESToBRep_TopoCurve
-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-4. +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-4. * *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::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); //translates MyList, -cout“IGES Faces: “nIgesFaces“ Transferred:”nTransFacesendl; +cout<<"IGES Faces: "<Standard_Integer ic = Interface_Static::IVal("write.precision.mode"); + * Modify this parameter with if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. * *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: @@ -820,9 +820,9 @@ The highlighted classes are intended to translate geometry. @subsection occt_iges_3_7 Example ~~~~~{c++} -#include IGESControl_Controller.hxx -#include IGESControl_Writer.hxx -#include TopoDS_Shape.hxx +#include +#include +#include Standard_Integer main() { 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. -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 s_1, ... s_N. -*\* 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 Selecting entities section. +\ 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 Selecting entities section. Instead of *igesbrep* it is possible to use commands: @@ -917,12 +917,12 @@ Draw> trimpcomp ~~~~~ 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. The following commands are available: -* *Draw> tpent \# * - provides information on the result of translation of the given IGES entity; +* *Draw> tpent \#* - provides information on the result of translation of the given IGES entity; * *Draw> tpdraw \#* - creates an OCCT shape corresponding to an IGES entity; * *Draw> fromshape \* provides the number of an IGES entity corresponding to an OCCT shape; * *Draw> tpclear* clears the map of correspondences between IGES entities and OCCT shapes. @@ -1029,7 +1029,7 @@ Draw:> tpstat *l iges-faces ~~~~~ The second version of the same command is TPSTAT (not capital spelling). ~~~~~ -Draw:> TPSTAT symbol +Draw:> TPSTAT ~~~~~ Symbol can be of the following values: * g - General statistics (list of results and messages) @@ -1074,7 +1074,7 @@ Draw> tolerance [ [] []] ~~~~~ 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 \ and \ arguments this command outputs shapes with names \... and their total number with tolerances in the range [min, max]. +When specifying *min* and *max* arguments this command outputs shapes with names \... and their total number with tolerances in the range [min, max]. \ is used for specifying the kind of sub-shapes to analyze: * v - for vertices, diff --git a/dox/user_guides/modeling_algos/modeling_algos.md b/dox/user_guides/modeling_algos/modeling_algos.md index 2d030ac82a..66e99b3845 100644 --- a/dox/user_guides/modeling_algos/modeling_algos.md +++ b/dox/user_guides/modeling_algos/modeling_algos.md @@ -617,7 +617,7 @@ For each algorithm, the tolerance (and angular tolerance if appropriate) is give @subsubsection occt_modalg_2_10_4 Geometric Algorithms -*Geom2dGcc *package offers algorithms, which produce 2d lines or circles with geometric constraints. For arguments, it takes curves for which an approximate solution is not requested. A tolerance value on the result is given as a starting parameter. The following services are provided: +*Geom2dGcc* package offers algorithms, which produce 2d lines or circles with geometric constraints. For arguments, it takes curves for which an approximate solution is not requested. A tolerance value on the result is given as a starting parameter. The following services are provided: #### Creation of a Circle @@ -845,7 +845,7 @@ Handle(Geom2d_BezierCurve) 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 [U1,U2], use the following constructor: ~~~~~ Geom2dAPI_ProjectPointOnCurve Projector (P, C, U1, U2); ~~~~~ diff --git a/dox/user_guides/modeling_data/modeling_data.md b/dox/user_guides/modeling_data/modeling_data.md index ad80aff079..3f17701a00 100644 --- a/dox/user_guides/modeling_data/modeling_data.md +++ b/dox/user_guides/modeling_data/modeling_data.md @@ -141,7 +141,7 @@ The class *MultiPoint* allows defining groups of 2D or 3D points making up a mul @subsection occt_modat_1_2 Direct Construction -Direct Construction methods from *gce*, *GC* and *GCE2d* packages provide simplified algorithms to build elementary geometric entities such as lines, circles and curves. They complement the reference definitions provided by the *gp*, *Geom* and *Geom2d *packages. +Direct Construction methods from *gce*, *GC* and *GCE2d* packages provide simplified algorithms to build elementary geometric entities such as lines, circles and curves. They complement the reference definitions provided by the *gp*, *Geom* and *Geom2d* packages. For example, to construct a circle from a point and a radius using the *gp* package, it is necessary to construct axis *Ax2d* before creating the circle. If *gce* package is used, and *Ox* is taken for the axis, it is possible to create a circle directly from a point and a radius. @@ -292,7 +292,7 @@ The algorithm is then constructed with this object: { Standard_Integer nbr = myAlgo.NbPoints() ; Standard_Real param ; - for ( Standard_Integer i = 1 ; i = nbr ; i++ ) + for ( Standard_Integer i = 1 ; i <= nbr ; i++ ) { param = myAlgo.Parameter (i) ; ... @@ -607,9 +607,9 @@ The following example shows a routine receiving an argument of the *TopoDS_Shape ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} - #include TopoDS_Vertex.hxx - #include TopoDS_Edge.hxx - #include TopoDS_Shape.hxx + #include + #include + #include void ProcessEdge(const TopoDS_Edge&); @@ -618,17 +618,17 @@ The following example shows a routine receiving an argument of the *TopoDS_Shape if (aShape.Shapetype() == TopAbs_VERTEX) { TopoDS_Vertex V; 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 } else if (aShape.ShapeType() == TopAbs_EDGE){ - ProcessEdge(aShape) ;// This is rejected + ProcessEdge(aShape) ; // This is rejected ProcessEdge(TopoDS::Edge(aShape)) ; // Correct } else { - cout *Neither a vertex nor an edge ?* ; + cout <<"Neither a vertex nor an edge ?"; ProcessEdge(TopoDS::Edge(aShape)) ; - // OK for compiler but anexception will be raised at run-time + // OK for compiler but an exception will be raised at run-time } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -693,7 +693,7 @@ The Explorer presumes that objects contain only objects of an equal or inferior The *MapShapes* method from *TopExp* package allows filling a Map. An exploration using the Explorer class can visit an object more than once if it is referenced more than once. For example, an edge of a solid is generally referenced by two faces. To process objects only once, they have to be placed in a Map. -**Example ** +**Example** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} void TopExp::MapShapes (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, @@ -751,7 +751,7 @@ The following steps are performed: } //Draw the edges of theMap Standard_Integer i; - for (i=1;i=edgemap.Extent();i++) { + for (i=1;i<=edgemap.Extent();i++) { switch (faceCount(i)) { case 0 : 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} - #include TopoDS_Iterator.hxx + #include Standard_Integer Size(const TopoDS_Shape& aShape) { // 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} - #include TopoDS_Iterator.hxx - #includeTopTools_MapOfShape.hxx + #include + #include void MapShapes(const TopoDS_Shape& aShape, 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. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} - #include TopoDS_Shape.hxx - #include TopoDS_Iterator.hxx - #include TopTools_IndexedMapOfShape.hxx - #include TopTools_Array1OfShape.hxx - #include TopoDS_Location.hxx + #include + #include + #include + #include + #include TopoDS_Shape Copy(const TopoDS_Shape& aShape, 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.Orientation(TopAbs_FORWARD); 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()) { S=It.Value(); S.Location(Identity); diff --git a/dox/user_guides/ocaf/ocaf.md b/dox/user_guides/ocaf/ocaf.md index c75ae59e88..66e1e99092 100644 --- a/dox/user_guides/ocaf/ocaf.md +++ b/dox/user_guides/ocaf/ocaf.md @@ -302,7 +302,7 @@ void DumpChildren(const TDF_Label& aLabel) TCollection_AsciiString es; for (it.Initialize(aLabel,Standard_True); it.More(); it.Next()){ 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*. 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). - 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 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. 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 -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} doc = TDocStd_Document::Get(label); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @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: - + Formats (TColStd_SequenceOfExtendedString& theFormats), which append to a given sequence \ 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 \ 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" * 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()*. 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. @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 T*_* is called XmlM*_*. 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. -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 @@ -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 comments** - consists of an unlimited number of \ 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 shapes** - contains geometrical and topological entities in BRep format. These entities being referenced by OCAF attributes written under the element \. 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 \. 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 @@ -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 -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 \ 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 \ section contents are replaced by an ellipsis. -~~~~~ +~~~~ @@ -1054,7 +1054,7 @@ xsi:schemaLocation="http://www.opencascade.org/OCAF/XML http://www.opencascade.o -~~~~~ +~~~~ @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 -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 [File XmlXcaf.xsd]. For the correct management of Namespaces it is necessary to: * 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. * 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. * **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: - * defining new classes which inherit from these abstract classes * composing framework class instances * implementing the services required by the framework. diff --git a/dox/user_guides/ocaf_wp/ocaf_wp.md b/dox/user_guides/ocaf_wp/ocaf_wp.md index 3e13080230..7f7140b449 100644 --- a/dox/user_guides/ocaf_wp/ocaf_wp.md +++ b/dox/user_guides/ocaf_wp/ocaf_wp.md @@ -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 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. 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. diff --git a/dox/user_guides/shape_healing/shape_healing.md b/dox/user_guides/shape_healing/shape_healing.md index 1dae4838a3..6135d2ccc5 100644 --- a/dox/user_guides/shape_healing/shape_healing.md +++ b/dox/user_guides/shape_healing/shape_healing.md @@ -93,7 +93,7 @@ sfs->Perform(); ~~~~~ 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. 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. 7. Merge and remove small edges: ~~~~~ -SFWF-DropSmallEdgesMode() = Standard_True; -SFWF-FixSmallEdges(); +SFWF->DropSmallEdgesMode() = Standard_True; +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. 8. Fix gaps for 2D and 3D curves ~~~~~ -SFWF-FixWireGaps(); +SFWF->FixWireGaps(); ~~~~~ 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 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 -SFF-SetContext(Context); +SFF->SetContext(Context); //initialize the fixing tool by one face -SFF-Init(Face1); +SFF->Init(Face1); //fix the set face -SFF-Perform(); +SFF->Perform(); //get the result -TopoDS_Shape NewShape = Context-Apply(Shape1); +TopoDS_Shape NewShape = Context->Apply(Shape1); //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()*. - 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*). ~~~~~ -TopoDS_Shape modifsubshape = fixtool-Context() --Apply(initsubshape); +TopoDS_Shape modifsubshape = fixtool->Context() -> 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); -Sfs- FixWireTool ()-FixSmallMode () =0; -if(Sfs-Perform()) - TopoDS_Shape resShape = Sfs-Shape(); +Sfs-> FixWireTool ()->FixSmallMode () =0; +if(Sfs->Perform()) + TopoDS_Shape resShape = Sfs->Shape(); ~~~~~ @@ -224,19 +223,19 @@ Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape(face); sfs->SetPrecision(prec); sfs->SetMaxTolerance(maxTol); //set the value of flag for forcing the removal of 2D curves -sfs->FixWireTool()-FixRemovePCurveMode() =1; +sfs->FixWireTool()->FixRemovePCurveMode() =1; //reform fixes sfs->Perform(); //getting the result if(sfs->Status(ShapeExtend_DONE) ) { - cout << Shape was fixed << endl; + cout << "Shape was fixed" << endl; TopoDS_Shape resFace = sfs->Shape(); } 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)) { -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); //Creates a tool and loads objects into it sfw.FixReorder(); -//Orders edges in the wire so that each edge -//starts at the end of the one before it +//Orders edges in the wire so that each edge starts at the end of the one before it. sfw.FixConnected(); //Forces all adjacent edges to share //the same vertex Standard_Boolean LockVertex = Standard_True; -if (sfw.FixSmall (LockVertex, precision)) { - //Removes all edges which are shorter than - //the given precision and have the same vertex at both ends + if (sfw.FixSmall (LockVertex, precision)) { + //Removes all edges which are shorter than the given precision and have the same vertex at both ends. } -if (sfw.FixSelfIntersection()) { - //Fixes self-intersecting edges and intersecting - //adjacent edges - cout;Wire was slightly self-intersecting. Repaired;endl; + if (sfw.FixSelfIntersection()) { + //Fixes self-intersecting edges and intersecting adjacent edges. + cout <<"Wire was slightly self-intersecting. Repaired"<SetPrecision(prec); sfwf->SetMaxTolerance(maxTol); //fixing of gaps @@ -574,8 +566,7 @@ ShapeFix_ShapeTolerance Sft; Sft.SetTolerance(shape,toler); //setting a specified tolerance for vertices only Sft.SetTolerance(shape,toler,TopAbs_VERTEX); -//limiting the tolerance on the shape and its sub-shapes between minimum and -//maximum tolerances +//limiting the tolerance on the shape and its sub-shapes between minimum and maximum tolerances Sft.LimitTolerance(shape,tolermin,tolermax); ~~~~~ @@ -600,7 +591,7 @@ ShapeAnalysis_Edge sae; for(TopExp_Explorer Exp(face,TopAbs_EDGE);Exp.More();Exp.Next()) { TopoDS_Edge edge = TopoDS::Edge (Exp.Current()); 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 if(!ShapeAnalysis::IsOuterBound(face)) { -cout*Face has not outer boundary**endl; +cout<<"Face has not outer boundary"< MaxAllowed) { + cout<<"Maximum tolerance of the vertices exceeds maximum allowed"< 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. ~~~~~ -//creation of new tools for geometry splitting by a specified //criterion. -Handle(MyTools_SplitSurfaceTool) MySplitSurfaceTool = -new MyTools_SplitSurfaceTool; -Handle(MyTools_SplitCurve3DTool) MySplitCurve3Dtool = -new MyTools_SplitCurve3DTool; -Handle(MyTools_SplitCurve2DTool) MySplitCurve2Dtool = -new MyTools_SplitCurve2DTool; +//creation of new tools for geometry splitting by a specified criterion. +Handle(MyTools_SplitSurfaceTool) MySplitSurfaceTool = new MyTools_SplitSurfaceTool; +Handle(MyTools_SplitCurve3DTool) MySplitCurve3Dtool = 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 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.SetMaxTolerance(MaxTol); -//setting of new splitting geometry tools in the shape splitting //tools -Handle(ShapeUpgrade_FaceDivide) FaceDivide = -ShapeDivide-GetSplitFaceTool(); -Handle(ShapeUpgrade_WireDivide) WireDivide = -FaceDivide-GetWireDivideTool(); -FaceDivide-SetSplitSurfaceTool(MySplitSurfaceTool); -WireDivide-SetSplitCurve3dTool(MySplitCurve3DTool); -WireDivide-SetSplitCurve2dTool(MySplitCurve2DTool); +//setting of new splitting geometry tools in the shape splitting tools +Handle(ShapeUpgrade_FaceDivide) FaceDivide = ShapeDivide->GetSplitFaceTool(); +Handle(ShapeUpgrade_WireDivide) WireDivide = FaceDivide->GetWireDivideTool(); +FaceDivide->SetSplitSurfaceTool(MySplitSurfaceTool); +WireDivide->SetSplitCurve3dTool(MySplitCurve3DTool); +WireDivide->SetSplitCurve2dTool(MySplitCurve2DTool); //setting of the value criterion. ShapeDivide.SetValCriterion(val); @@ -974,8 +955,7 @@ TopoDS_Shape splitShape = ShapeDivide.GetResult(); //getting the history of modifications of faces for(TopExp_Explorer aExp(initShape,TopAbs_FACE); aExp.More(0; aExp.Next()) { -TopoDS_Shape modifShape = ShapeDivide.GetContext()- -Apply(aExp.Current()); +TopoDS_Shape modifShape = ShapeDivide.GetContext()-> Apply(aExp.Current()); } ~~~~~ @@ -1027,6 +1007,7 @@ This tool provides access to the tool for dividing and splitting 3D and 2D curve * *GetSplitCurve2dTool*. @subsubsection occt_shg_4_2_5 General tools for geometry splitting + There are three general tools for geometry splitting. * General tool for surface splitting.(*ShapeUpgrade_SplitSurface*) * 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 { 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 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 ~ShapeUpgrade_SplitSurfaceContinuity(); private: @@ -1080,12 +1061,12 @@ sdc.SetPCurveCriterion (GeomAbs_C2); // for Curves 2D sdc.SetSurfaceCriterion (GeomAbs_C2); // for Surfaces sdc.Perform (); 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(); -.. on a given shape +//.. on a given shape if (ctx.IsRecorded (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 } ~~~~~ @@ -1126,7 +1107,7 @@ Let us attempt to produce a conversion of planes to Bezier surfaces. //Creation and initialization of a tool. ShapeUpgrade_ShapeConvertToBezier SCB (Shape); //setting tolerances -….. +... //setting mode for conversion of planes SCB.SetSurfaceConversion (Standard_True); SCB.SetPlaneMode(Standard_True); @@ -1149,7 +1130,7 @@ tool.SetMaxTolerance(maxTol); Standard_Integer NbSplitPoints = …; tool.SetNbSplitPoints(num); if ( ! tool.Perform() && tool.Status (ShapeExtend_FAIL) ) { - cout;Splitting of closed faces failed;endl; + cout<<"Splitting of closed faces failed"<MinArea() = aMinArea; +aTool->RemoveFaceMode() = aModeRemoveFaces; //when method Perform is carried out on separate shapes. -aTool-Perform(aSeqShapes); +aTool->Perform(aSeqShapes); //when method Perform is carried out on whole shape. -aTool-Perform(); +aTool->Perform(); //check status set after method Perform -if(aTool-Status(ShapeExtend_FAIL) { - cout*Operation failed* ;;\n;; +if(aTool->Status(ShapeExtend_FAIL) { + cout<<"Operation failed"<< <<"\n"; return; } -if(aTool-Status(ShapeExtend_DONE1)) { - const TopTools_SequenceOfShape& aRemovedWires =aTool-RemovedWires(); - coutaRemovedWires.Length(); internal wires were removed;;\n;; +if(aTool->Status(ShapeExtend_DONE1)) { + const TopTools_SequenceOfShape& aRemovedWires =aTool->RemovedWires(); + cout<Status(ShapeExtend_DONE2)) { + const TopTools_SequenceOfShape& aRemovedFaces =aTool->RemovedFaces(); + cout<GetResult(); ~~~~~ @subsubsection occt_shg_4_4_8 Conversion of surfaces @@ -1457,45 +1438,44 @@ TopoDS_Shape initialShape… //creation of a rebuilding tool Handle(ShapeBuild_ReShape) Context = new ShapeBuild_ReShape. -//next step is optional. It can be used for keeping -//the assembly structure. -Context- ModeConsiderLocation = Standard_True; +//next step is optional. It can be used for keeping the assembly structure. +Context-> ModeConsiderLocation = Standard_True; //initialization of this tool by the initial shape -Context-Apply(initialShape); +Context->Apply(initialShape); … -//getting the intermediate result for replacing subshape1 with -//the modified subshape1. -TopoDS_Shape tempshape1 = Context-Apply(subshape1); +//getting the intermediate result for replacing subshape1 with the modified subshape1. +TopoDS_Shape tempshape1 = Context->Apply(subshape1); -//replacing the intermediate shape obtained from subshape1 with the //newsubshape1. -Context-Replace(tempsubshape1,newsubshape1); +//replacing the intermediate shape obtained from subshape1 with the newsubshape1. +Context->Replace(tempsubshape1,newsubshape1); … //for removing the subshape -TopoDS_Shape tempshape2 = Context-Apply(subshape2); -Context-Remove(tempsubshape2); +TopoDS_Shape tempshape2 = Context->Apply(subshape2); +Context->Remove(tempsubshape2); //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. -TopoDS_Shape result_subshape1 = Context-Apply(subshape1); +//getting the resulting subshape from the subshape1 of the initial shape. +TopoDS_Shape result_subshape1 = Context->Apply(subshape1); ~~~~~ @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: + | Value | Meaning | | :----- | :----------------- | -|*OK,* | Nothing is done, everything OK | -|*DONE1,* | Something was done, case 1 | -|*DONE8*, | Something was done, case 8 | -|*DONE*, | Something was done (any of DONE#) | -|*FAIL1*, | The method failed, case 1 | -|*FAIL8*, | The method failed, case 8 | -|*FAIL* | The method failed (any of FAIL# occurred) | +| *OK,* | Nothing is done, everything OK | +| *DONE1,* | Something was done, case 1 | +| *DONE8*, | Something was done, case 8 | +| *DONE*, | Something was done (any of DONE#) | +| *FAIL1*, | The method failed, case 1 | +| *FAIL8*, | The method failed, case 8 | +| *FAIL* | The method failed (any of FAIL# occurred) | @subsection occt_shg_5_3 Tool representing a wire @@ -1538,12 +1518,11 @@ Handle(ShapeExtend_MsgRegistrator) MessageReg = new ShapeExtend_MsgRegistrator; //attaches messages to an object (shape or entity) Message_Msg msg.. TopoDS_Shape Shape1… -MessageReg-Send(Shape1,msg,Message_WARNING); +MessageReg->Send(Shape1,msg,Message_WARNING); Handle(Standard_Transient) ent .. -MessageReg-Send(ent,msg,Message_WARNING); +MessageReg->Send(ent,msg,Message_WARNING); //gets messages attached to shape -const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = -MessageReg-MapShape(); +const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = MessageReg->MapShape(); if (msgmap.IsBound (Shape1)) { const Message_ListOfMsg &msglist = msgmap.Find (Shape1); for (Message_ListIteratorOfListOfMsg iter (msglist); @@ -1592,9 +1571,12 @@ IGESBRep_Reader.cxx } ~~~~~ -The result of *DumpTimer()* after translation of a file 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 +The result of *DumpTimer()* after file translation is as follows: + +| 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 @@ -1613,8 +1595,7 @@ Standard_Real Prec = …, Standard_Real MaxTol = …; TopoDS_Shape aResult; Handle(Standard_Transient) info; -TopoDS_Shape aResult = XSAlgo::AlgoContainer()-ProcessShape(aShape, - Prec, MaxTol., *Name of ResourceFile*, *NameSequence*, info ); +TopoDS_Shape aResult = XSAlgo::AlgoContainer()->ProcessShape(aShape, Prec, MaxTol., "Name of ResourceFile", "NameSequence", info ); ~~~~~ 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 Handle(ShapeProcess_Context)& context) { - Handle(ShapeProcess_ShapeContext) ctx = - Handle(ShapeProcess_ShapeContext)::DownCast(context); + Handle(ShapeProcess_ShapeContext) ctx = Handle(ShapeProcess_ShapeContext)::DownCast(context); if(ctx.IsNull()) return Standard_False; TopoDS_Shape aShape = ctx->Result(); //receive our parameter: @@ -1660,7 +1640,7 @@ For example: input of the following string: ~~~~~ 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. @@ -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. 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). -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*. -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). +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. +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 \\n between each line (but not at the end). + 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 @@ -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. 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: -* string - coded in the text as *%s*, -* integer - coded in the text as *%d*, -* real - coded in the text as *%f*. +* string - coded in the text as \%s, +* integer - coded in the text as \%d, +* 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. ~~~~~ Message_Msg msg01 (;SampleKeyword;); @@ -1908,14 +1889,14 @@ msg1.AddString (;SampleFile;); @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: * 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 constructor method to define the target file and the level of the messages as in the example below: ~~~~~ Message_TraceFile myTF - (tracelevel, *tracefile.log*, Standard_False); + (tracelevel, "tracefile.log", Standard_False); ~~~~~ The parameters are as follows: * *tracelevel* is a Standard_Integer and modifies the level of messages. It has the following values and semantics: diff --git a/dox/user_guides/step/step.md b/dox/user_guides/step/step.md index 77190c228a..5d6b238dce 100644 --- a/dox/user_guides/step/step.md +++ b/dox/user_guides/step/step.md @@ -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. | | 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. | -| 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. | | 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 | @@ -597,7 +597,7 @@ Not all entities defining the assembly structure in the STEP file are translated @subsection occt_step_2_5 Tolerance management @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.

3D (spatial) tolerance

* 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 ~~~~~ -#include STEPControl_Reader.hxx -#include TopoDS_Shape.hxx -#include BRepTools.hxx +#include +#include +#include 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 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. -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. +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. Please see also Mapping OCCT shapes to STEP entities @@ -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) * 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: * *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 @@ -1013,11 +1013,11 @@ The highlighted classes are intended to translate geometry. @subsection occt_step_3_7 Example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} -#include STEPControl.hxx -#include STEPControl_Writer.hxx -#include TopoDS_Shape.hxx -#include BRepTools.hxx -#include BRep_Builder.hxx +#include +#include +#include +#include +#include Standard_Integer main() { @@ -1125,7 +1125,7 @@ A set of parameters for importing and exporting STEP data is defined in the XSTE ~~~~~ Draw:> param [ []] ~~~~~ -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. @@ -1177,18 +1177,19 @@ 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. -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 get the number of a STEP entity, corresponding to an OCCT shape, use the command *Draw:> fromshape \*. +To create an OCCT shape, corresponding to a STEP entity, use the command @code Draw:> tpdraw #*. @endcode -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 . @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 The procedure of analysis of data import can be divided into two stages: - 1.to check the file contents, - 2.to estimate the translation results (conversion and validated ratios). + 1. to check the file contents, + 2. to estimate the translation results (conversion and validated ratios). @subsubsection occt_step_6_4_1 Checking file contents @@ -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; * 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 \* prints a list of a subset of loaded entities defined by the \ argument: +Command @code Draw:> givelist @endcode prints a list of a subset of loaded entities defined by the \ argument: * *xst-model-all* all entities of the model; * *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. -Optional argument \ can limit the action of the command to the selection, not to all entities. +Optional argument \ can limit the action of the command to the selection, not to all entities. To get help, run this command without arguments. diff --git a/dox/user_guides/tobj/tobj.md b/dox/user_guides/tobj/tobj.md index 633783b190..f6de4915c0 100644 --- a/dox/user_guides/tobj/tobj.md +++ b/dox/user_guides/tobj/tobj.md @@ -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 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. @@ -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: ~~~~~{.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 @@ -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. ~~~~~{.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. ~~~~~{.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. @@ -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*. 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 latex /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" @subsection occt_tobj_3_2 Basic features @@ -465,7 +465,7 @@ The *TObj_Object* class provides some basic features that can be inherited (or, * Provides the ability to contain child objects, as it is actual for partition objects (methods *GetChildren*, *GetFatherObject*) * Organizes its data in the OCAF structure by separating the sub-labels of the main label intended for various kinds of data and providing tools to organize these data (see below). The kinds of data stored separately are: * Child objects stored in the label returned by the method *GetChildLabel* - * References to other objects stored in the label returned by the method* GetReferenceLabel* + * References to other objects stored in the label returned by the method *GetReferenceLabel* * Other data, both common to all objects and specific for each subtype of the model object, are stored in the label returned by the method *GetDataLabel* * Provides unique names of all objects in the model (methods *GetDictionary*, *GetName*, *SetName*) * Provides unified means to maintain persistence (implemented in descendants with the help of macros *DECLARE_TOBJOCAF_PERSISTENCE* and *IMPLEMENT_TOBJOCAF_PERSISTENCE*) diff --git a/dox/user_guides/visualization/visualization.md b/dox/user_guides/visualization/visualization.md index e1eb70f339..a8c3a1a4c9 100644 --- a/dox/user_guides/visualization/visualization.md +++ b/dox/user_guides/visualization/visualization.md @@ -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. -The packages used to display 3D objects are the following: - * AIS - * StdPrs - * Prs3d - * PrsMgr - * V3d - * Graphic3d +The the following packages are used to display 3D objects : + * *AIS*; + * *StdPrs*; + * *Prs3d*; + * *PrsMgr*; + * *V3d*; + * *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. @@ -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 user’s guide offers the following three paths in reading it.   * If the 3D services proposed in AIS meet your requirements, you need only read chapter 3 AIS: Application Interactive Services. - * If you need more detail, for example, a selection filter on another type of entity - you should read chapter 2 Fundamental Concepts, chapter 3 AIS: Application Interactive Services, and possibly chapters 4 and 5 3D Presentations and 3D Resources. 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 Fundamental Concepts, chapter 3 AIS: Application Interactive Services, and possibly chapters 4 3D Presentations and 5 3D Resources. You may want to begin with the chapter presenting AIS. @section occt_visu_2  Fundamental Concepts @@ -90,7 +90,7 @@ BRepPrimAPI_MakeWedge w(dx, dy, dz, ltx); TopoDS_Solid & = w.Solid(); Handle(AIS_Shape) anAis = new AIS_Shape(S); //creation of the presentable object -aContext - Display(anAis); +aContext -> Display(anAis); //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*. -*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*. *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 (Const Handle(SelectMgr_Selection)& Sel,  const Standard_Integer mode { -  switch(mode){  case 0: //Selection of the rooms - {  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. +  switch(mode){   + case 0: //Selection of the rooms + {   + 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; aSensitiveBox = new Select3d_SensitiveBox (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 ~~~~~ @@ -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: * *Aspect_POM_None* * *Aspect_POM_Off* - * Aspect_POM_Fill - * Aspect_POM_Line - * Aspect_POM_Point - * Aspect_POM_All + * *Aspect_POM_Fill* + * *Aspect_POM_Line* + * *Aspect_POM_Point* + * *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: ~~~~~ @@ -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); - myIntContext-Display(TheAISShape); - myIntContext-SetDisplayMode(TheAISShape ,1); - myIntContext-SetColor(TheAISShape,Quantity_NOC_RED); + myIntContext->Display(TheAISShape); + myIntContext->SetDisplayMode(TheAISShape ,1); + myIntContext->SetColor(TheAISShape,Quantity_NOC_RED); ~~~~~ You can also write ~~~~~ Handle (AIS_Shape) TheAISShape = new AIS_Shape (ashape); - TheAISShape-SetColor(Quantity_NOC_RED); - TheAISShape-SetDisplayMode(1); - myIntContext-Display(TheAISShape); + TheAISShape->SetColor(Quantity_NOC_RED); + TheAISShape->SetDisplayMode(1); + myIntContext->Display(TheAISShape); ~~~~~ @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*: ~~~~~ -TheCtx-Display(obj1,Standard_False); // False = no viewer update -TheCtx-Display(obj2,Standard_True); // True = viewer update -TheCtx-SetDisplayMode(obj1,3,Standard_False); -TheCtx-SetDisplayMode(2); +TheCtx->Display(obj1,Standard_False); // False = no viewer update +TheCtx->Display(obj2,Standard_True); // True = viewer update +TheCtx->SetDisplayMode(obj1,3,Standard_False); +TheCtx->SetDisplayMode(2); // obj2 is visualised in mode 2 (if it accepts this mode) // obj1 stays visualised in its mode 3. ~~~~~ @@ -638,7 +647,7 @@ The specific modes of selection only concern the interactive objects, which are @subsubsection occt_visu_3_4_2 Management of Local Context The local context can be opened using method *AIS_InteractiveContext::OpenLocalContext*. The following options are available: - * *UseDisplayedObjects*: allows loading the interactive objects visualized at Neutral Point in the opened local context. If* FALSE*, the local context is empty after being opened. If *TRUE*, the objects at Neutral Point are modified by their default selection mode. + * *UseDisplayedObjects*: allows loading the interactive objects visualized at Neutral Point in the opened local context. If *FALSE*, the local context is empty after being opened. If *TRUE*, the objects at Neutral Point are modified by their default selection mode. * *AllowShapeDecomposition*: *AIS_Shape* allows or prevents decomposition in standard shape location mode of objects at Neutral Point, which are type-privileged (see Selection chapter). This Flag is only taken into account when *UseDisplayedObjects* is *TRUE*. * *AcceptEraseOfObjects*: authorises other local contexts to erase the interactive objects present in this context. This option is rarely used. The last option has no current use. @@ -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. * The second *Display* function should only be used in Neutral Point to visualize a supplementary mode for the object, which you can erase by *EraseMode (...)*. You activate the selection mode. This is passed as an argument. By convention, if you do not want to activate a selection mode, you must set the *SelectionMode* argument to -1. This function is especially interesting in open local context, as we will see below. * In Neutral Point, it is not advisable to activate other selection modes than the default selection one. It is preferable to open a local context in order to activate particular selection modes. - * When you call *Erase *(Interactive object) function, the *PutIncollector* argument, which is FALSE by default, allows you to visualize the object directly in the Collector and makes it selectable (by activation of 0 mode). You can nonetheless block its passage through the Collector by changing the value of this option. In this case, the object is present in the Interactive Context, but is not seen anywhere. + * 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 object’s presentation temporarily. * Visualization attributes and graphic behavior can be modified through a set of functions similar to those for the interactive object (color, thickness of line, material, transparency, locations, etc.) The context then manages immediate and deferred updates. * Call *Remove()* method of *InteractiveContext* as soon as the interactive object is no longer needed and you want to destroy it.. Otherwise, references to *InteractiveObject* are kept by *InteractiveContext*, and the *Object* is not destroyed, which results in memory leaks. In general, if the presentation of an interactive object can be computed quickly, it is recommended to *Remove()* it instead of using *Erase()* method. @@ -725,7 +734,7 @@ This activates the corresponding selection mode for all objects in Local Contex **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 (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)*. 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 -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 (SelectMgr_EntityOwner) 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()*: @@ -762,36 +771,36 @@ As there are specific behaviors on shapes, each new Filter class must, if neces Only type filters are activated in Neutral Point to make it possible to identify a specific type of visualized object. For filters to come into play, one or more object selection modes must be activated. There are several functions to manipulate filters: - * *AIS_InteractiveContext::AddFilter* adds 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::Filters* gets the list of filters active in a local context. +* *AIS_InteractiveContext::AddFilter* adds 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::Filters* gets the list of filters active in a local context.

Example

~~~~~ -myContext-OpenLocalContext(Standard_False); +myContext->OpenLocalContext(Standard_False); // no object in neutral point is loaded -myContext-ActivateStandardMode(TopAbs_Face); +myContext->ActivateStandardMode(TopAbs_Face); //activates decomposition of shapes into faces. 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 StdSelect_FaceFilter(StdSelect_Revol); Handle(StdSelect_FaceFilter) Fil2= new       StdSelect_FaceFilter(StdSelect_Plane); -myContext-AddFilter(Fil1); -myContext-AddFilter(Fil2); +myContext->AddFilter(Fil1); +myContext->AddFilter(Fil2); //only faces of revolution or planar faces will be selected -myContext-MoveTo( xpix,ypix,Vue); +myContext->MoveTo( xpix,ypix,Vue); // detects the mouse position ~~~~~ @@ -847,20 +856,20 @@ In the Local Context, you can explore the list of selected objects available. T

Example

~~~~~ -myAISCtx-InitSelected(); -while (myAISCtx-MoreSelected()) +myAISCtx->InitSelected(); +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             } else { - Handle_AIS_InteractiveObject aniobj = myAISCtx-Interactive(); + Handle_AIS_InteractiveObject anyobj = myAISCtx->Interactive(); // to be able to use the picked interactive object } -myAISCtx-NextSelected(); +myAISCtx->NextSelected(); } ~~~~~ @@ -938,7 +947,7 @@ myIHMEditor::myIHMEditor myIHMEditor::PrepareContext() { -myIndex =myCtx-OpenLocalContext(); +myIndex =myCtx->OpenLocalContext(); //the filters @@ -952,40 +961,40 @@ Handle(StdSelect_FaceFilter) F3 = new StdSelect_FaceFilter(AIS_Cylinder); //cylindrical face filters //... // activation of standard modes on the shapes.. -myCtx-ActivateStandardMode(TopAbs_FACE); -myCtx-ActivateStandardMode(TopAbs_VERTEX); -myCTX-Add(F1); -myCTX-Add(F2); -myCTX-Add(F3); +myCtx->ActivateStandardMode(TopAbs_FACE); +myCtx->ActivateStandardMode(TopAbs_VERTEX); +myCTX->Add(F1); +myCTX->Add(F2); +myCTX->Add(F3); // at this point, you can call the selection/detection function } void myIHMEditor::MoveTo(xpix,ypix,Vue) -{ myCTX-MoveTo(xpix,ypix,vue); +{ myCTX->MoveTo(xpix,ypix,vue); // the highlight of what is detected is automatic. } Standard_Boolean myIHMEditor::Select() { // returns true if you should continue the selection - myCTX-Select(); - myCTX-InitSelected(); - if(myCTX-MoreSelected()) + myCTX->Select(); + myCTX->InitSelected(); + if(myCTX->MoreSelected())  { -  if(myCTX-HasSelectedShape()) - { const TopoDS_Shape& sh = myCTX-SelectedShape(); +  if(myCTX->HasSelectedShape()) + { const TopoDS_Shape& sh = myCTX->SelectedShape(); if( vertex){ if(myFirstV...) { - //if it’s 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 = ....; - myCtx-RemoveFilters(); - myCTX-DeactivateStandardMode(TopAbs_FACE); - myCtx-Add(F1); + myCtx->RemoveFilters(); + myCTX->DeactivateStandardMode(TopAbs_FACE); + myCtx->Add(F1); // the filter on the AIS_Points - myFirstV = Standard_False; - return Standard_True; + myFirstV = Standard_False; + return Standard_True;  } else  { @@ -1003,10 +1012,10 @@ Standard_Boolean myIHMEditor::Select() else { Handle(AIS_InteractiveObject) - SelObj = myCTX-SelectedInteractive(); - if(SelObj-Type()==AIS_KOI_Datum) + SelObj = myCTX->SelectedInteractive(); + if(SelObj->Type()==AIS_KOI_Datum) { - if(SelObj-Signature()==1) + if(SelObj->Signature()==1) { if (firstPoint) { @@ -1171,11 +1180,11 @@ Handle (XSDRAWSTLVRML_DataSource) aDataSource = new XSDRAWSTLVRML_DataSource (a // create mesh Handle (MeshVS_Mesh) aMesh = new MeshVS(); -aMesh-SetDataSource (aDataSource); +aMesh->SetDataSource (aDataSource); // use default presentation builder 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. @@ -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 Handle (MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder     (aMesh,MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); -aBuilder-UseTexture (Standard_True); +aBuilder->UseTexture (Standard_True); // prepare color map Aspect_SequenceOfColor aColorMap; @@ -1202,10 +1211,10 @@ TColStd_DataMapOfIntegerReal aScaleMap; aScaleMap.Bind (anId, aValue);   // pass color map and color scale values to the builder -aBuilder-SetColorMap (aColorMap); -aBuilder-SetInvalidColor (Quantity_NOC_BLACK); -aBuilder-SetTextureCoords (aScaleMap); -aMesh-AddBuilder (aBuilder, Standard_True); +aBuilder->SetColorMap (aColorMap); +aBuilder->SetInvalidColor (Quantity_NOC_BLACK); +aBuilder->SetTextureCoords (aScaleMap); +aMesh->AddBuilder (aBuilder, Standard_True); ~~~~~ @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... { 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 Select3D_TypeOfSensitivity value - Sel-Add(new -Select3D_SensitiveFace(Ownr,Array,Sensitivity)); + Sel->Add(new Select3D_SensitiveFace(Ownr,Array,Sensitivity)); } break;    }   case 1: // locates the edges { - for(Standard_Integer i=1;i=12;i++) + for(Standard_Integer i=1;i<=12;i++) { // 1 owner per edge... - Handle(mypk_EdgeOwner) Ownr = - new mypk_EdgeOwner(this,i,6); - //6-priority - Sel-Add(new Select3D_SensitiveSegment (Ownr,firstpt(i),lastpt(i))); + Handle(mypk_EdgeOwner) Ownr = new mypk_EdgeOwner(this,i,6); + //6->priority + Sel->Add(new Select3D_SensitiveSegment (Ownr,firstpt(i),lastpt(i))); } break; } @@ -1303,23 +1310,23 @@ NOTE: This procedure is completely hidden if you use the Add(VS); + SM->Load(box1);SM->Load(box2);SM->Load(box3); // box load. - SM-Activate(box1,0,VS); + SM->Activate(box1,0,VS); // activates mode 0 of box 1 in the selector VS - SM-Activate(box1,1,VS); - M-Activate(box3,1,VS); -VS-Pick(xpix,ypix,vue3d) + SM->Activate(box1,1,VS); + M->Activate(box3,1,VS); +VS->Pick(xpix,ypix,vue3d) // detection of primitives by mouse position. -Handle(EntityOwner) POwnr = VS-OnePicked(); +Handle(EntityOwner) POwnr = VS->OnePicked(); // 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   } - SM-Deactivate(box1); + SM->Deactivate(box1); // deactivate all active modes of box1 ~~~~~ @@ -1373,17 +1380,17 @@ Create line attributes. Handle(Graphic3d_AspectLine3d) CTXLBROWN = new Graphic3d_AspectLine3d (); Handle(Graphic3d_AspectLine3d) CTXLBLUE = new Graphic3d_AspectLine3d (); Handle(Graphic3d_AspectLine3d) CTXLWHITE = new Graphic3d_AspectLine3d(); - CTXLBROWN-SetColor (Brown); - CTXLBLUE-SetColor (Blue); - CTXLWHITE-SetColor (White); + CTXLBROWN->SetColor (Brown); + CTXLBLUE->SetColor (Blue); + CTXLWHITE->SetColor (White); ~~~~~ Create marker attributes. ~~~~~ Handle(Graphic3d_AspectMarker3d) CTXMFIREBRICK = new Graphic3d_AspectMarker3d(); - CTXMFIREBRICK-SetColor (Firebrick); - CTXMFIREBRICK-SetScale (1.0); - CTXMFIREBRICK-SetType (Aspect_TOM_BALL); + CTXMFIREBRICK->SetColor (Firebrick); + CTXMFIREBRICK->SetScale (1.0); + CTXMFIREBRICK->SetType (Aspect_TOM_BALL); ~~~~~ Create facet attributes. @@ -1391,12 +1398,12 @@ Create facet attributes. Handle(Graphic3d_AspectFillArea3d) CTXF = new Graphic3d_AspectFillArea3d (); Graphic3d_MaterialAspect BrassMaterial (Graphic3d_NOM_BRASS); Graphic3d_MaterialAspect GoldMaterial (Graphic3d_NOM_GOLD); - CTXF-SetInteriorStyle (Aspect_IS_SOLID); - CTXF-SetInteriorColor (MyColor); - CTXF-SetDistinguishOn (); - CTXF-SetFrontMaterial (GoldMaterial); - CTXF-SetBackMaterial (BrassMaterial); - CTXF-SetEdgeOn (); + CTXF->SetInteriorStyle (Aspect_IS_SOLID); + CTXF->SetInteriorColor (MyColor); + CTXF->SetDistinguishOn (); + CTXF->SetFrontMaterial (GoldMaterial); + CTXF->SetBackMaterial (BrassMaterial); + CTXF->SetEdgeOn (); ~~~~~ Create text attributes. @@ -1411,8 +1418,8 @@ Handle(Aspect_DisplayConnection) aDisplayConnection; Handle(Graphic3d_GraphicDriver) aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection); TCollection_ExtendedString aName("3DV"); myViewer = new V3d_Viewer (aGraphicDriver,aName.ToExtString (), ""); -myViewer - SetDefaultLights (); -myViewer - SetLightOn (); +myViewer -> SetDefaultLights (); +myViewer -> SetLightOn (); ~~~~~ @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(); 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 @@ -1482,7 +1489,7 @@ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPrs); Update the group attributes. ~~~~~ -TheGroup - SetPrimitivesAspect(CTXLBLUE); +TheGroup -> SetPrimitivesAspect(CTXLBLUE); ~~~~~ Create two triangles in *TheGroup*. @@ -1491,15 +1498,15 @@ Create two triangles in *TheGroup*. Standard_Integer aNbTria = 2; Handle(Graphic3d_ArrayOfTriangles) aTriangles = new Graphic3d_ArrayOfTriangles(3 * aNbTria, 0, Standard_True); 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 + 5, 0., 0., 1., 1., 1.); -  aTriangles-AddVertex(anIndex * 5 + 2.5, 5., 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 + 2.5, 5., 0., 1., 1., 1.); } -TheGroup-BeginPrimitives (); -mygroup-AddPrimitiveArray(aTriangles); -TheGroup-EndPrimitives (); +TheGroup->BeginPrimitives (); +mygroup->AddPrimitiveArray(aTriangles); +TheGroup->EndPrimitives (); ~~~~~ 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; -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); -aPolylines-AddBound (4); -aPolylines-AddVertex (Xm, Ym, Zm); -aPolylines-AddVertex (Xm, Ym, ZM); -aPolylines-AddVertex (Xm, YM, ZM); -aPolylines-AddVertex (Xm, YM, Zm); -aPolylines-AddBound (4); -aPolylines-AddVertex (Xm, Ym, Zm); -aPolylines-AddVertex (XM, Ym, Zm); -aPolylines-AddVertex (XM, Ym, ZM); -aPolylines-AddVertex (XM, YM, ZM); -aPolylines-AddBound (4); -aPolylines-AddVertex (XM, YM, Zm); -aPolylines-AddVertex (XM, Ym, Zm); -aPolylines-AddVertex (XM, YM, Zm); -aPolylines-AddVertex (Xm, YM, Zm); -aPolylines-AddBound (4); -aPolylines-AddVertex (Xm, YM, ZM); -aPolylines-AddVertex (XM, YM, ZM); -aPolylines-AddVertex (XM, Ym, ZM); -aPolylines-AddVertex (Xm, Ym, ZM); - -TheGroup-BeginPrimitives (); -TheGroup-AddPrimitiveArray(aPolylines); -TheGroup-EndPrimitives (); +aPolylines->AddBound (4); +aPolylines->AddVertex (Xm, Ym, Zm); +aPolylines->AddVertex (Xm, Ym, ZM); +aPolylines->AddVertex (Xm, YM, ZM); +aPolylines->AddVertex (Xm, YM, Zm); +aPolylines->AddBound (4); +aPolylines->AddVertex (Xm, Ym, Zm); +aPolylines->AddVertex (XM, Ym, Zm); +aPolylines->AddVertex (XM, Ym, ZM); +aPolylines->AddVertex (XM, YM, ZM); +aPolylines->AddBound (4); +aPolylines->AddVertex (XM, YM, Zm); +aPolylines->AddVertex (XM, Ym, Zm); +aPolylines->AddVertex (XM, YM, Zm); +aPolylines->AddVertex (Xm, YM, Zm); +aPolylines->AddBound (4); +aPolylines->AddVertex (Xm, YM, ZM); +aPolylines->AddVertex (XM, YM, ZM); +aPolylines->AddVertex (XM, Ym, ZM); +aPolylines->AddVertex (Xm, Ym, ZM); + +TheGroup->BeginPrimitives (); +TheGroup->AddPrimitiveArray(aPolylines); +TheGroup->EndPrimitives (); ~~~~~ Create text and markers in group *TheGroup*. @@ -1541,18 +1548,18 @@ Create text and markers in group *TheGroup*. ~~~~~ static char *texte[3] = {  "Application title", "My company", - "My company address." }; + "My company address." }; Graphic3d_Array1OfVertex Tpts8 (0, 1); Tpts8(0).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); -for (i=0; i=2; i++) { +for (i=0; i<=2; i++) {   Marker.SetCoord (-(Standard_Real)i*4 + 30,                     (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: ~~~~~ -*// get the graphic driver* +// get the graphic driver Handle (Graphic3d_GraphicDriver) aDriver = -  myAISContext-CurrentViewer()-Driver(); +  myAISContext->CurrentViewer()->Driver(); -*// disable VBO support* -aDriver-EnableVBO (Standard_False); +// disable VBO support +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*. @@ -1667,14 +1674,14 @@ The following example shows how to define an array of points: Handle (Graphic3d_ArrayOfPoints) anArray = new Graphic3d_ArrayOfPoints (aVerticiesMaxCount); // add vertices to the array -anArray-AddVertex (10.0, 10.0, 10.0); -anArray-AddVertex (0.0, 10.0, 10.0); +anArray->AddVertex (10.0, 10.0, 10.0); +anArray->AddVertex (0.0, 10.0, 10.0); // add the array to the structure Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); -aGroup-BeginPrimitives (); -aGroup-AddPrimitiveArray (anArray); -aGroup-EndPrimitives (); +aGroup->BeginPrimitives (); +aGroup->AddPrimitiveArray (anArray); +aGroup->EndPrimitives (); ~~~~~ 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,                                           IsTextureCrds); // add vertices to the array -anArray-AddVertex (-1.0, 0.0, 0.0);   // vertex 1 -anArray-AddVertex ( 1.0, 0.0, 0.0);   // vertex 2 -anArray-AddVertex ( 0.0, 1.0, 0.0);   // vertex 3 -anArray-AddVertex ( 0.0,-1.0, 0.0);   // vertex 4 +anArray->AddVertex (-1.0, 0.0, 0.0);   // vertex 1 +anArray->AddVertex ( 1.0, 0.0, 0.0);   // vertex 2 +anArray->AddVertex ( 0.0, 1.0, 0.0);   // vertex 3 +anArray->AddVertex ( 0.0,-1.0, 0.0);   // vertex 4 // add edges to the array -anArray-AddEdge (1);  // first triangle -anArray-AddEdge (2); -anArray-AddEdge (3); -anArray-AddEdge (1);  // second triangle -anArray-AddEdge (2); -anArray-AddEdge (4); +anArray->AddEdge (1);  // first triangle +anArray->AddEdge (2); +anArray->AddEdge (3); +anArray->AddEdge (1);  // second triangle +anArray->AddEdge (2); +anArray->AddEdge (4); // add the array to the structure Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); -aGroup-BeginPrimitives (); -aGroup-AddPrimitiveArray (anArray); -aGroup-EndPrimitives (); +aGroup->BeginPrimitives (); +aGroup->AddPrimitiveArray (anArray); +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. @@ -1744,23 +1751,23 @@ Handle (Graphic3d_ArrayOfPolygons) anArray =                                          IsTextureCrds); // add bounds to the array, first polygon -anArray-AddBound (3); -anArray-AddVertex (-1.0, 0.0, 0.0);   -anArray-AddVertex ( 1.0, 0.0, 0.0);   -anArray-AddVertex ( 0.0, 1.0, 0.0);   +anArray->AddBound (3); +anArray->AddVertex (-1.0, 0.0, 0.0);   +anArray->AddVertex ( 1.0, 0.0, 0.0);   +anArray->AddVertex ( 0.0, 1.0, 0.0);   // add bounds to the array, second polygon -anArray-AddBound (4); -anArray-AddVertex (-1.0, 0.0, 0.0);   -anArray-AddVertex ( 1.0, 0.0, 0.0);   -anArray-AddVertex ( 1.0,-1.0, 0.0);   -anArray-AddVertex (-1.0,-1.0, 0.0);   +anArray->AddBound (4); +anArray->AddVertex (-1.0, 0.0, 0.0);   +anArray->AddVertex ( 1.0, 0.0, 0.0);   +anArray->AddVertex ( 1.0,-1.0, 0.0);   +anArray->AddVertex (-1.0,-1.0, 0.0);   // add the array to the structure Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs); -aGroup-BeginPrimitives (); -aGroup-AddPrimitiveArray (anArray); -aGroup-EndPrimitives (); +aGroup->BeginPrimitives (); +aGroup->AddPrimitiveArray (anArray); +aGroup->EndPrimitives (); ~~~~~ 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 Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d (); -aTextAspect-SetTextZoomable (Standard_True); -aTextAspect-SetTextAngle (45.0); -aGroup-SetPrimitivesAspect (aTextAspect); +aTextAspect->SetTextZoomable (Standard_True); +aTextAspect->SetTextAngle (45.0); +aGroup->SetPrimitivesAspect (aTextAspect); // add a text primitive to the structure 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 @@ -1906,69 +1913,69 @@ This sample TEST program for the *V3d* Package uses primary packages *Xw* and * //Create a default display connection 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); //Create a Viewer to this Driver Handle(V3d_Viewer) VM = new V3d_Viewer(GD, 400., -// Space size -V3d_Xpos,// Default projection Quantity_NOC_DARKVIOLET, -// Default background -V3d_ZBUFFER, -// Type of visualization -V3d_GOURAUD, -// Shading model -V3d_WAIT); -// Update mode -*// Create a structure in this Viewer * -Handle(Graphic3d_Structure) S = -new Graphic3d_Structure(VM-Viewer()) ; - -*// Type of structure * -S-SetVisual (Graphic3d_TOS_SHADING); - -*// Create a group of primitives in this structure* + // Space size + V3d_Xpos, + // Default projection + Quantity_NOC_DARKVIOLET, + // Default background + V3d_ZBUFFER, + // Type of visualization + V3d_GOURAUD, + // Shading model + V3d_WAIT); + // Update mode +// Create a structure in this Viewer +Handle(Graphic3d_Structure) S = new Graphic3d_Structure(VM->Viewer()) ; + +// Type of structure +S->SetVisual (Graphic3d_TOS_SHADING); + +// Create a group of primitives in this structure 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) ; Points(0).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(3).SetCoord( 100./2.,-100./2.,-100./2.) ; Normal.SetCoord(0.,0.,1.) ; -G-Polygon(Points,Normal) ; +Points(3).SetCoord( 100./2.,-100./2.,-100./2.) ; +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 -(VM,Quantity_NOC_GRAY50) ; + (VM,Quantity_NOC_GRAY50) ; 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* -Handle(Xw_Window) W = -new Xw_Window(aDisplayConnection,"Test V3d",0.5,0.5,0.5,0.5) ; +// Create a 3D quality Window with the same DisplayConnection +Handle(Xw_Window) W = new Xw_Window(aDisplayConnection,"Test V3d",0.5,0.5,0.5,0.5) ; -*// Map this Window to this screen* - W-Map() ; +// Map this Window to this screen +W->Map() ; -*// Create a Perspective View in this Viewer* -Handle(V3d_PerspectiveView) V = -new V3d_PerspectiveView(VM); +// Create a Perspective View in this Viewer +Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM); -*// Set the Eye position* -V-SetEye(100.,100.,100.) ; +// Set the Eye position +V->SetEye(100.,100.,100.) ; -*// Associate this View with the Window * -V-SetWindow(W) ; +// Associate this View with the Window +V->SetWindow(W) ; -*// Activate ALL defined Lights in this View * -V-SetLightOn() ; +// Activate ALL defined Lights in this View +V->SetLightOn() ; -*// Display ALL structures in this View * -(VM-Viewer())-Display() ; +// Display ALL structures in this View +(VM-Viewer())->Display() ; -*// Finally update the Visualization in this View * -V-Update() ; +// Finally update the Visualization in this View +V->Update() ; ~~~~~ @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); // Set the ZSize -V-SetZSize(2000.) ; +V->SetZSize(2000.) ; // Set the Depth value -V-SetDepth(20.) ; +V->SetDepth(20.) ; // 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. @@ -2035,19 +2042,19 @@ As an alternative to manual setting of perspective parameters the *V3d_View::De ~~~~~ // Display  shape in Viewer VM Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext(VM); -aContext-Display(shape); +aContext->Display(shape); // Create a Perspective View in Viewer VM Handle(V3d_PerspectiveView) V = new V3d_PerspectiveView(VM); // Set automatically the perspective parameters -V-DepthFitAll() ; +V->DepthFitAll() ; // Fit view to object size -V-FitAll(); +V->FitAll(); // 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. @@ -2089,8 +2096,8 @@ The following example demonstrates how to draw overlay graphics by the *V3d_Lay void MyLayerMgr::Redraw () {   Quantity_Color aRed (Quantity_NOC_RED); -  myOverlayLayer-SetColor (aRed); -  myOverlayLayer-DrawRectangle (0, 0, 100, 100); +  myOverlayLayer->SetColor (aRed); +  myOverlayLayer->DrawRectangle (0, 0, 100, 100); } ~~~~~ @@ -2127,13 +2134,13 @@ void V3d_ColorScaleLayerItem::RedrawLayerPrs () {   Visual3d_LayerItem::RedrawLayerPrs ()   if (!MyColorScale.IsNull ()) -    MyColorScale-DrawScale (); +    MyColorScale->DrawScale (); } // V3d_ColorScale has a reference to a LayerMgr void V3d_ColorScale::DrawScale () { -    // calls *V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc … +    // calls V3d_ColorScale::PaintRect, V3d_ColorScale::PaintText, etc … } // PaintRect method uses overlay layer of LayerMgr to draw a rectangle @@ -2143,12 +2150,11 @@ void V3d_ColorScale::PaintRect         const Quantity_Color aColor,         const Standard_Boolean aFilled) { -  const Handle (Visual3d_Layer)& theLayer = -                                 myLayerMgr-Overlay (); -    … -  theLayer-SetColor (aColor); -  theLayer-DrawRectangle (X, Y, W, H); -   … +  const Handle (Visual3d_Layer)& theLayer = myLayerMgr->Overlay (); +   ... +  theLayer->SetColor (aColor); +  theLayer->DrawRectangle (X, Y, W, H); +   ... } ~~~~~ @@ -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: ~~~~~ - * void V3d_View::SetBackgroundImage + void V3d_View::SetBackgroundImage (const Standard_CString FileName,  const Aspect_FillMethod FillStyle,  const Standard_Boolean update) - * void V3d_View::SetBgImageStyle + void V3d_View::SetBgImageStyle (const Aspect_FillMethod FillStyle,  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& 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 Quantity_Color& aColor) - * void V3d_Plane::Erase () - * Standard_Boolean V3d_Plane::IsDisplayed () + void V3d_Plane::Erase () + Standard_Boolean V3d_Plane::IsDisplayed () ~~~~~ 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 Handle(V3d_Plane) aCustomPlane; -myView-InitActivePlanes (); -if (myView-MoreActivePlanes ()) -  aCustomPlane = myView-ActivePlane (); +myView->InitActivePlanes (); +if (myView->MoreActivePlanes ()) +  aCustomPlane = myView->ActivePlane (); else   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); // update plane -aCustomPlane-SetPlane (a, b, c, d); -myView-SetPlaneOn (aCustomPlane); +aCustomPlane->SetPlane (a, b, c, d); +myView->SetPlaneOn (aCustomPlane); ~~~~~ @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 *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. 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 (RGB, RGBA, floating-point, RGBF, RGBAF). 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. -* 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 (RGB, RGBA, floating-point, RGBF, RGBAF). 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: * Create display connection; @@ -2329,37 +2356,32 @@ Handle (Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (aDispl // create a window Standard_Integer aDefWidth  = 800; Standard_Integer aDefHeight = 600; -Handle (WNT_WClass) aWClass = -             new WNT_WClass ("Virtual Class",DefWindowProc, +Handle (WNT_WClass) aWClass = new WNT_WClass ("Virtual Class",DefWindowProc,                              CS_VREDRAW | CS_HREDRAW, 0, 0,                              ::LoadCursor (NULL, IDC_ARROW)); -Handle (WNT_Window) aWindow = -             new WNT_Window ("VirtualWnd",  aWClass, +Handle (WNT_Window) aWindow = new WNT_Window ("VirtualWnd",  aWClass,                              WS_OVERLAPPEDWINDOW, 0, 0,                              aDefWidth, aDefHeight); // set up the window as virtual -aWindow-SetVirtual (Standard_True); +aWindow->SetVirtual (Standard_True); // create a view and an interactive context -Handle (V3d_Viewer) aViewer = -             new V3d_Viewer (aDriver, +Handle (V3d_Viewer) aViewer = new V3d_Viewer (aDriver,                              Standard_ExtString ("Virtual")); -Handle (AIS_InteractiveContext) aContext = -             new AIS_InteractiveContext (aViewer); -Handle (V3d_View) aView = aViewer-CreateView (); +Handle (AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer); +Handle (V3d_View) aView = aViewer->CreateView (); // assign the virtual window to the view -aView-SetWindow (aWindow); +aView->SetWindow (aWindow); // display a 3D scene -Handle (AIS_Shape) aBox = -             new AIS_Shape (BRepPrimAPI_MakeBox (5, 5, 5)); -aContext-Display (aBox); -aView-FitAll(); +Handle (AIS_Shape) aBox = new AIS_Shape (BRepPrimAPI_MakeBox (5, 5, 5)); +aContext->Display (aBox); +aView->FitAll(); // 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 diff --git a/dox/user_guides/xde/xde.md b/dox/user_guides/xde/xde.md index 4fee9b67cc..08b55aa76f 100644 --- a/dox/user_guides/xde/xde.md +++ b/dox/user_guides/xde/xde.md @@ -16,8 +16,8 @@ The Extended Data Exchange (XDE) component requires Advanced Shape Healing for o @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: - * *CSF_PluginDefaults* points to sources of *\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)*. - * *CSF_XCAFDefaults* points to sources of *\%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources)*. + * *CSF_PluginDefaults* points to sources of \%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources). + * *CSF_XCAFDefaults* points to sources of \%CASROOT%/src/XCAFResources ($CASROOT/src/XCAFResources). @subsubsection occt_xde_1_1_3 Basic terms For better understanding of XDE, certain key terms are defined: * **Shape** - a standalone shape, which does not belong to the assembly structure. @@ -64,27 +64,28 @@ Validation properties are geometric characteristics of Shapes (volume, centroid, Advanced Data Exchange supports both reading and writing of validation properties, and provides a tool to check them. - @image html /user_guides/xde/images/xde_image005.png "Validation Property Descriptions" - @image latex /user_guides/xde/images/xde_image005.png "Validation Property Descriptions" +@image html /user_guides/xde/images/xde_image005.png "Validation Property Descriptions" +@image latex /user_guides/xde/images/xde_image005.png "Validation Property Descriptions" 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 -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:3 -2.3 (0%) -52.5 (0%) -0.00 0.00 0.00 "MAIN_BODY_BACK" -0:1:1:4 -2.3 (0%) -51.6 (0%) 0.00 0.00 -0.00 "MAIN_BODY_FRONT" -0:1:1:5 2.0 (0%) 10.0 (0%) -0.00 0.00 -0.00 "HEAD" -0:1:1:6 0.4 (0%) 0.0 (0%) 0.00 -0.00 -0.00 "HEAD_FRONT" -0:1:1:7 0.4 (0%) 0.0 (0%) 0.00 -0.00 -0.00 "HEAD_BACK" -0:1:1:8 -320.6 (0%) 10.9 (0%) -0.00 0.00 0.00 "TAIL" -0:1:1:9 0.0 (0%) 0.0 (0%) -0.00 -0.00 0.00 "TAIL_MIDDLE" -0:1:1:10 -186.2 (0%) 4.8 (0%) -0.00 0.00 -0.00 "TAIL_TURBINE" -0:1:1:11 0.3 (0%) -0.0 (0%) -0.00 -0.00 0.00 "FOOT" -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" +| 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:3 | -2.3 (0%) | -52.5 (0%) | -0.00 | 0.00 | 0.00 | "MAIN_BODY_BACK" | +| 0:1:1:4 | -2.3 (0%) | -51.6 (0%) | 0.00 | 0.00 | -0.00 | "MAIN_BODY_FRONT" | +| 0:1:1:5 | 2.0 (0%) | 10.0 (0%) | -0.00 | 0.00 | -0.00 | "HEAD" | +| 0:1:1:6 | 0.4 (0%) | 0.0 (0%) | 0.00 | -0.00 | -0.00 | "HEAD_FRONT" | +| 0:1:1:7 | 0.4 (0%) | 0.0 (0%) | 0.00 | -0.00 | -0.00 | "HEAD_BACK" | +| 0:1:1:8 | -320.6 (0%) | 10.9 (0%) | -0.00 | 0.00 | 0.00 | "TAIL" | +| 0:1:1:9 | 0.0 (0%) | 0.0 (0%) | -0.00 | -0.00 | 0.00 | "TAIL_MIDDLE" | +| 0:1:1:10 | -186.2 (0%) | 4.8 (0%) | -0.00 | 0.00 | -0.00 | "TAIL_TURBINE" | +| 0:1:1:11 | 0.3 (0%) | -0.0 (0%) | -0.00 | -0.00 | 0.00 | "FOOT" | +| 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. @@ -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. @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*: - * generic color *(XCAFDoc_ColorGen)* - * surface color *(XCAFDoc_ColorSurf)* - * curve color *(XCAFDoc_ColorCurv)* + * generic color (XCAFDoc_ColorGen) + * surface color (XCAFDoc_ColorSurf) + * curve color (XCAFDoc_ColorCurv) @image html /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 * Attaching properties to shapes The Document used by XDE usually starts as a TDocStd_Document. + @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. @@ -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. -@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: ~~~~~ Handle(TDocStd_Document) aDoc; -Handle(XCAFApp_Application) anApp = -XCAFApp_Application::GetApplication(); +Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication(); anApp->NewDocument(;MDTV-XCAF;,aDoc); ~~~~~ @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: ~~~~~ Handle(TDocStd_Document) doc... Handle (XCAFDoc_ShapeTool) myAssembly = -XCAFDoc_DocumentTool::ShapeTool (Doc-Main()); +XCAFDoc_DocumentTool::ShapeTool (Doc->Main()); 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*. -@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: ~~~~~ Handle(TDocStd_Document) doc... -Handle(XCAFDoc_ShapeTool) myAssembly = -XCAFDoc_DocumentTool::ShapeTool (aLabel); +Handle(XCAFDoc_ShapeTool) myAssembly = 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). @@ -159,7 +160,7 @@ Some actions in this chapter affect the content of the document, considered as a 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. @@ -180,7 +181,7 @@ To break down a Compound in the assembly structure, use: Standard_Boolean makeAssembly; // True to interpret a Compound as an Assembly, // 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. @@ -193,7 +194,7 @@ Standard_CString LabelString ...; // identifies the Label (form ;0:i:j...;) TDF_Label aLabel...; // 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 @@ -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: ~~~~~ -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: @@ -242,12 +243,12 @@ if ( myAssembly->IsTopLevel(aLabel) ) { .. yes .. } To get a list of top-level shapes added by the *AddShape* method, use: ~~~~~ 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: ~~~~~ -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: @@ -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: ~~~~~ -if ( myAssembly-IsFree(aLabel) ) { .. yes .. } +if ( myAssembly->IsFree(aLabel) ) { .. yes .. } ~~~~~ 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: ~~~~~ 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. #### Assembly and Components 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: ~~~~~ -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: ~~~~~ Standard_Boolean subchilds = Standard_False; //default -Standard_Integer nbc = myAssembly-NbComponents (aLabel -[,subchilds]); +Standard_Integer nbc = myAssembly->NbComponents (aLabel [,subchilds]); ~~~~~ 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 TDF_LabelSequence comps; -Standard_Boolean isassembly = myAssembly-GetComponents +Standard_Boolean isassembly = myAssembly->GetComponents (aLabel,comps[,subchilds]); ~~~~~ @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: ~~~~~ -if ( myAssembly-IsReference(aLabel) ) { .. yes .. } +if ( myAssembly->IsReference(aLabel) ) { .. yes .. } ~~~~~ 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: ~~~~~ -Standard_Boolean isref = myAssembly-GetReferredShape +Standard_Boolean isref = myAssembly->GetReferredShape (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: ~~~~~ -Standard_Boolean remsh = myAssembly-RemoveShape(aLabel); +Standard_Boolean remsh = myAssembly->RemoveShape(aLabel); // remsh is returned True if done ~~~~~ 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: ~~~~~ 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. @@ -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: ~~~~~ 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. @@ -509,7 +509,7 @@ XCAFDoc_ColorType ctype ..; // XCAFDoc_ColorGen : all types of geometries // XCAFDoc_ColorSurf : surfaces 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: ~~~~~ @@ -582,7 +582,7 @@ TDF_Label ColLabel = myColors-FindColor (Col); 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: To unset a Color on a Shape, use: -- 2.20.1