From 361cc345b077e94c7f1a08ae0778f3ec8bfba6fc Mon Sep 17 00:00:00 2001 From: btokarev Date: Wed, 28 Apr 2021 18:07:05 +0300 Subject: [PATCH] 0031896: Documentation - Proofreading User manual MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Task № 3 - Syntax highlighting Added missing {.cpp} markers to the first code block border for C++ code snippets; Extensive "~~~~~~~" code block borders are reduced to required minimum of "~~~~" (4); Removed obsolete space bars after code block borders. --- dox/build/build_occt/building_occt.md | 44 +- dox/contribution/coding_rules.md | 156 +- dox/contribution/git_guide/git_guide.md | 44 +- dox/contribution/tests/tests.md | 292 +- dox/debug/debug.md | 60 +- dox/samples/ocaf.md | 18 +- dox/samples/ocaf_func.md | 8 +- .../boolean_operations/boolean_operations.md | 104 +- dox/specification/brep_format.md | 28 +- dox/tutorial/tutorial.md | 180 +- dox/upgrade/upgrade.md | 206 +- .../draw_test_harness/draw_test_harness.md | 3976 ++++++++--------- .../foundation_classes/foundation_classes.md | 204 +- dox/user_guides/iges/iges.md | 346 +- dox/user_guides/inspector/inspector.md | 8 +- dox/user_guides/mesh/mesh.md | 12 +- .../modeling_algos/modeling_algos.md | 586 +-- .../modeling_data/modeling_data.md | 86 +- dox/user_guides/ocaf/ocaf.md | 420 +- .../shape_healing/shape_healing.md | 256 +- dox/user_guides/step/step.md | 298 +- dox/user_guides/vis/vis.md | 70 +- .../visualization/visualization.md | 248 +- dox/user_guides/xde/xde.md | 304 +- 24 files changed, 3977 insertions(+), 3977 deletions(-) diff --git a/dox/build/build_occt/building_occt.md b/dox/build/build_occt/building_occt.md index 748ffba835..e921e9e99b 100644 --- a/dox/build/build_occt/building_occt.md +++ b/dox/build/build_occt/building_occt.md @@ -243,9 +243,9 @@ The environment is defined in the file *custom.sh* (on Linux and OS X) or *custo * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; * "HardLink* - hard links to headers located in *src* will be created. * For optional third-party libraries, set corresponding environment variable HAVE_ to either *false*, e.g.: -~~~~~ +~~~~ export HAVE_FREEIMAGE=false -~~~~~ +~~~~ Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively: @@ -257,10 +257,10 @@ Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files: -~~~~~ +~~~~ $ cd /dev/OCCT/opencascade-7.0.0 $ ./genproj cbp -~~~~~ +~~~~ The generated Code::Blocks project are placed into subfolder *adm/<OS>/cbp*. @@ -273,9 +273,9 @@ To start **Code::Blocks**, launch script *codeblocks.sh*. To build all toolkits, click **Build->Build workspace** in the menu bar. To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script -~~~~~ +~~~~ ./draw.sh cbp [d] -~~~~~ +~~~~ Option *d* is used if OCCT has been built in **Debug** mode. @subsection build_occt_genproj Building with Genproj tool @@ -344,9 +344,9 @@ Launch **genproj** to update content of *inc* folder and generate project files @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH. If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found. -~~~~~ +~~~~ $ genproj.bat -~~~~~ +~~~~ Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment. @@ -470,9 +470,9 @@ The environment is defined in the file *custom.sh* which can be edited directly: * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; * "HardLink* - hard links to headers located in *src* will be created. * For optional third-party libraries, set corresponding environment variable HAVE_ to either *false*, e.g.: -~~~~~ +~~~~ export HAVE_FREEIMAGE=false -~~~~~ +~~~~ Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively: @@ -488,10 +488,10 @@ Launch **genproj** tool to update content of *inc* folder and generate project f For instance, in Terminal application: -~~~~~ +~~~~ $ cd /dev/OCCT/opencascade-7.0.0 $ ./genproj -~~~~~ +~~~~

Building

@@ -513,14 +513,14 @@ To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the fol 1.Open Terminal application 2.Enter \: -~~~~~ +~~~~ cd \ -~~~~~ +~~~~ 3.Run the script -~~~~~ +~~~~ ./draw_cbp.sh xcd [d] -~~~~~ +~~~~ Option *d* is used if OCCT has been built in **Debug** mode. @@ -543,9 +543,9 @@ directly: * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; * "HardLink* - hard links to headers located in *src* will be created. * For optional third-party libraries, set corresponding environment variable HAVE_ to either *false*, e.g.: -~~~~~ +~~~~ export HAVE_FREEIMAGE=false -~~~~~ +~~~~ Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively: @@ -559,10 +559,10 @@ Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files: -~~~~~ +~~~~ $ cd /dev/OCCT/opencascade-7.0.0 $ ./genproj cbp -~~~~~ +~~~~ The generated Code::Blocks project are placed into subfolder *adm/<OS>/cbp*. @@ -575,7 +575,7 @@ To start **Code::Blocks**, launch script *codeblocks.sh*. To build all toolkits, click **Build->Build workspace** in the menu bar. To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script -~~~~~ +~~~~ ./draw_cbp.sh cbp [d] -~~~~~ +~~~~ Option *d* is used if OCCT has been built in **Debug** mode. diff --git a/dox/contribution/coding_rules.md b/dox/contribution/coding_rules.md index 7f8f6238c7..6593fd2fe2 100644 --- a/dox/contribution/coding_rules.md +++ b/dox/contribution/coding_rules.md @@ -48,11 +48,11 @@ For example, method *GetCoord* returns a triple of real values and is defined fo Camel Case style is preferred for names. For example: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer awidthofbox; // this is bad Standard_Integer width_of_box; // this is bad Standard_Integer aWidthOfBox; // this is OK -~~~~~ +~~~~ @subsection occt_coding_rules_2_2 Names of development units @@ -80,9 +80,9 @@ Toolkit names are prefixed by *TK*, followed by a meaningful part of the name ex Names of public classes and other types (structures, enums, typedefs) should match the common pattern: name of the package followed by underscore and suffix (the own name of the type): -~~~~~ +~~~~{.cpp} _ -~~~~~ +~~~~ Static methods related to the whole package are defined in the class with the same name as package (without suffix). @@ -95,9 +95,9 @@ This rule also applies to complex types constructed by instantiation of template Such types should be given own names using *typedef* statement, located in same-named header file. For example, see definition in the file *TColStd_IndexedDataMapOfStringString.hxx*: -~~~~~ +~~~~{.cpp} typedef NCollection_IndexedDataMap TColStd_IndexedDataMapOfStringString; -~~~~~ +~~~~ ### Names of functions @@ -109,7 +109,7 @@ The term **function** here is defined as: It is preferred to start names of public methods from an upper case character and to start names of protected and private methods from a lower case character. -~~~~~{.cpp} +~~~~{.cpp} class MyPackage_MyClass { @@ -123,7 +123,7 @@ private: void setIntegerValue (const Standard_Integer theValue); }; -~~~~~ +~~~~ @subsection occt_coding_rules_2_3 Names of variables @@ -137,13 +137,13 @@ The name of a variable should not start with an underscore. See the following examples: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer Elapsed_Time = 0; // this is bad - possible class name Standard_Integer gp = 0; // this is bad - existing package name Standard_Integer aGp = 0; // this is OK Standard_Integer _KERNEL = 0; // this is bad Standard_Integer THE_KERNEL = 0; // this is OK -~~~~~ +~~~~ ### Names of function parameters @@ -151,11 +151,11 @@ The name of a function (procedure, class method) parameter should start with pre See the following examples: -~~~~~{.cpp} +~~~~{.cpp} void Package_MyClass::MyFunction (const gp_Pnt& p); // this is bad void Package_MyClass::MyFunction (const gp_Pnt& theP); // this is OK void Package_MyClass::MyFunction (const gp_Pnt& thePoint); // this is preferred -~~~~~ +~~~~ ### Names of class member variables @@ -163,11 +163,11 @@ The name of a class member variable should start with prefix *my* followed by th See the following examples: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer counter; // This is bad Standard_Integer myC; // This is OK Standard_Integer myCounter; // This is preferred -~~~~~ +~~~~ ### Names of global variables @@ -176,18 +176,18 @@ However, as soon as a global variable is necessary, its name should be prefixed See the following examples: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer MyPackage_myGlobalVariable = 0; Standard_Integer MyPackage_MyClass_myGlobalVariable = 0; -~~~~~ +~~~~ Static constants within the file should be written in upper-case and begin with prefix *THE_*: -~~~~~{.cpp} +~~~~{.cpp} namespace { static const Standard_Real THE_CONSTANT_COEF = 3.14; }; -~~~~~ +~~~~ ### Names of local variables @@ -197,12 +197,12 @@ It is preferred to prefix local variable names with *a* and *an* (or *is*, *to* See the following example: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer theI; // this is bad Standard_Integer i; // this is bad Standard_Integer index; // this is bad Standard_Integer anIndex; // this is OK -~~~~~ +~~~~ ### Avoid dummy names Avoid dummy names, such as i, j, k. Such names are meaningless and easy to mix up. @@ -211,7 +211,7 @@ The code becomes more and more complicated when such dummy names are used there See the following examples for preferred style: -~~~~~{.cpp} +~~~~{.cpp} void Average (const Standard_Real** theArray, Standard_Integer theRowsNb, Standard_Integer theRowLen, @@ -227,7 +227,7 @@ void Average (const Standard_Real** theArray, theResult /= Standard_Real(aRowsNb * aRowLen); } } -~~~~~ +~~~~ @section occt_coding_rules_3 Formatting rules @@ -262,7 +262,7 @@ Punctuation rules follow the rules of the English language. * For better readability it is also recommended to surround conventional operators by a space character. Examples: -~~~~~{.cpp} +~~~~{.cpp} while (true) // NOT: while( true ) ... { DoSomething (theA, theB, theC, theD); // NOT: DoSomething(theA,theB,theC,theD); @@ -271,7 +271,7 @@ for (anIter = 0; anIter < 10; ++anIter) // NOT: for (anIter=0;anIter<10;++anIter { theA = (theB + theC) * theD; // NOT: theA=(theB+theC)*theD } -~~~~~ +~~~~ ### Declaration of pointers and references @@ -281,7 +281,7 @@ Since declaration of several variables with mixed pointer types contrudicts this Examples: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer *theVariable; // not recommended Standard_Integer * theVariable; // not recommended Standard_Integer* theVariable; // this is OK @@ -295,7 +295,7 @@ Standard_Integer ** theVariable; // not recommended Standard_Integer** theVariable; // this is OK Standard_Integer *theA, theB, **theC; // not recommended (declare each variable independently) -~~~~~ +~~~~ ### Separate logical blocks @@ -303,7 +303,7 @@ Separate logical blocks of code with one blank line and comments. See the following example: -~~~~~{.cpp} +~~~~{.cpp} // check arguments Standard_Integer anArgsNb = argCount(); if (anArgsNb < 3 || isSmthInvalid) @@ -318,7 +318,7 @@ if (anArgsNb < 3 || isSmthInvalid) // do our job ... ... -~~~~~ +~~~~ Notice that multiple blank lines should be avoided. @@ -329,7 +329,7 @@ Each descriptive block should contain at least a function name and purpose descr See the following example: -~~~~~{.cpp} +~~~~{.cpp} // ======================================================================= // function : TellMeSmthGood // purpose : Gives me good news @@ -347,19 +347,19 @@ void TellMeSmthBad() { ... } -~~~~~ +~~~~ ### Block layout [MANDATORY] Figure brackets { } and each operator (for, if, else, try, catch) should be written on a dedicated line. In general, the layout should be as follows: -~~~~~{.cpp} +~~~~{.cpp} while (expression) { ... } -~~~~~ +~~~~ Entering a block increases and leaving a block decreases the indentation by one tabulation. @@ -367,7 +367,7 @@ Entering a block increases and leaving a block decreases the indentation by one Single-line conditional operators (if, while, for, etc.) can be written without brackets on the following line. -~~~~~{.cpp} +~~~~{.cpp} if (!myIsInit) return Standard_False; // bad if (thePtr == NULL) // OK @@ -377,7 +377,7 @@ if (!theAlgo.IsNull()) // preferred { DoSomething(); } -~~~~~ +~~~~ Having all code in the same line is less convenient for debugging. @@ -386,7 +386,7 @@ Having all code in the same line is less convenient for debugging. In comparisons, put the variable (in the current context) on the left side and constant on the right side of expression. That is, the so called "Yoda style" is to be avoided. -~~~~~{.cpp} +~~~~{.cpp} if (NULL != thePointer) // Yoda style, not recommended if (thePointer != NULL) // OK @@ -398,13 +398,13 @@ if (anIter <= theNbValues) // OK if (THE_LIMIT == theValue) // bad style (global constant vs. variable) if (theValue == THE_LIMIT) // OK -~~~~~ +~~~~ ### Alignment Use alignment wherever it enhances the readability. See the following example: -~~~~~{.cpp} +~~~~{.cpp} MyPackage_MyClass anObject; Standard_Real aMinimum = 0.0; Standard_Integer aVal = theVal; @@ -415,7 +415,7 @@ switch (aVal) case 3: default: computeSomethingElseYet(); break; } -~~~~~ +~~~~ ### Indentation of comments @@ -425,7 +425,7 @@ The text of the comment should be separated from the slash character by a single See the following example: -~~~~~{.cpp} +~~~~{.cpp} while (expression) //bad comment { // this is a long multi-line comment @@ -433,7 +433,7 @@ while (expression) //bad comment DoSomething(); // maybe, enough DoSomethingMore(); // again } -~~~~~ +~~~~ ### Early return statement @@ -441,7 +441,7 @@ Use an early return condition rather than collect indentations. Write like this: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer ComputeSumm (const Standard_Integer* theArray, const Standard_Size theSize) { @@ -454,11 +454,11 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray, ... computing summ ... return aSumm; } -~~~~~ +~~~~ Rather than: -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer ComputeSumm (const Standard_Integer* theArray, const Standard_Size theSize) { @@ -469,7 +469,7 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray, } return aSumm; } -~~~~~ +~~~~ This helps to improve readability and reduce the unnecessary indentation depth. @@ -490,7 +490,7 @@ An exception to the rule is ordering system headers generating a macros declarat The source or header file should include only minimal set of headers necessary for compilation, without duplicates (considering nested includes). -~~~~~{.cpp} +~~~~{.cpp} // the header file of implemented class #include @@ -506,7 +506,7 @@ The source or header file should include only minimal set of headers necessary f // system headers #include #include -~~~~~ +~~~~ @section occt_coding_rules_4 Documentation rules @@ -623,7 +623,7 @@ A class with virtual function(s) ought to have a virtual destructor. Declaration of overriding method should contains specifiers "virtual" and "override" (using Standard_OVERRIDE alias for compatibility with old compilers). -~~~~~{.cpp} +~~~~{.cpp} class MyPackage_BaseClass { @@ -641,7 +641,7 @@ public: Standard_EXPORT virtual Standard_Boolean Perform() Standard_OVERRIDE; }; -~~~~~ +~~~~ This makes class definition more clear (virtual methods become highlighted). @@ -667,20 +667,20 @@ Avoid *goto* statement unless it is really needed. Declare a cycle variable in the header of the *for()* statement if not used out of cycle. -~~~~~{.cpp} +~~~~{.cpp} Standard_Real aMinDist = Precision::Infinite(); for (NCollection_Sequence::Iterator aPntIter (theSequence); aPntIter.More(); aPntIter.Next()) { aMinDist = Min (aMinDist, theOrigin.Distance (aPntIter.Value())); } -~~~~~ +~~~~ ### Condition statements within zero Avoid usage of C-style comparison for non-boolean variables: -~~~~~{.cpp} +~~~~{.cpp} void Function (Standard_Integer theValue, Standard_Real* thePointer) { @@ -699,7 +699,7 @@ void Function (Standard_Integer theValue, DoSome2(); } } -~~~~~ +~~~~ @section occt_coding_rules_7 Portability issues @@ -791,11 +791,11 @@ In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try Use the same form of new and delete. -~~~~~{.cpp} +~~~~{.cpp} aPtr1 = new TypeA[n]; ... ; delete[] aPtr1; aPtr2 = new TypeB(); ... ; delete aPtr2; aPtr3 = Standard::Allocate (4096); ... ; Standard::Free (aPtr3); -~~~~~ +~~~~ ### Methods managing dynamical allocation [MANDATORY] @@ -805,10 +805,10 @@ Define a destructor, a copy constructor and an assignment operator for classes w Every variable should be initialized. -~~~~~{.cpp} +~~~~{.cpp} Standard_Integer aTmpVar1; // bad Standard_Integer aTmpVar2 = 0; // OK -~~~~~ +~~~~ Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code. @@ -824,12 +824,12 @@ In *operator=()* assign to all data members and check for assignment to self. Don't check floats for equality or non-equality; check for GT, GE, LT or LE. -~~~~~{.cpp} +~~~~{.cpp} if (Abs (theFloat1 - theFloat2) < theTolerance) { DoSome(); } -~~~~~ +~~~~ Package *Precision* provides standard values for SI units and widely adopted by existing modeling algorithms: @@ -872,7 +872,7 @@ Generally, try to reduce misaligned accesses since they impact the performance ( List class data members in the constructor's initialization list in the order they are declared. -~~~~~{.cpp} +~~~~{.cpp} class MyPackage_MyClass { @@ -892,19 +892,19 @@ private: Standard_Integer myPropertyB; }; -~~~~~ +~~~~ ### Initialization over assignment Prefer initialization over assignment in class constructors. -~~~~~{.cpp} +~~~~{.cpp} MyPackage_MyClass() : myPropertyA (1) // preferred { myPropertyB = 2; // not recommended } -~~~~~ +~~~~ ### Optimize caching @@ -912,23 +912,23 @@ When programming procedures with extensive memory access, try to optimize them i On x86 this code -~~~~~{.cpp} +~~~~{.cpp} Standard_Real anArray[4096][2]; for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) { anArray[anIter][0] = anArray[anIter][1]; } -~~~~~ +~~~~ is more efficient then -~~~~~{.cpp} +~~~~{.cpp} Standard_Real anArray[2][4096]; for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) { anArray[0][anIter] = anArray[1][anIter]; } -~~~~~ +~~~~ since linear access does not invalidate cache too often. @@ -952,7 +952,7 @@ Command arguments should be validated before usage. The user should see a human- Command should warn the user about unknown arguments, including cases when extra parameters have been pushed for the command with a fixed number of arguments. -~~~~~{.cpp} +~~~~{.cpp} if (theArgsNb != 3) { std::cout << "Syntax error - wrong number of arguments!\n"; @@ -971,7 +971,7 @@ Command should warn the user about unknown arguments, including cases when extra } DBRep::Set (aResName, aFaceShape); return 0; -~~~~~ +~~~~ ### Message printing @@ -984,9 +984,9 @@ Information printed into Draw Interpreter should be well-structured to allow usa Any command with a long list of obligatory parameters should be considered as ill-formed by design. Optional parameters should start with flag name (with '-' prefix) and followed by its values: -~~~~~{.tcl} +~~~~{.tcl} myCommand -flag1 value1 value2 -flag2 value3 -~~~~~ +~~~~ ### Arguments parser @@ -996,7 +996,7 @@ myCommand -flag1 value1 value2 -flag2 value3 Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values in C-locale. -~~~~~{.cpp} +~~~~{.cpp} Standard_Real aPosition[3] = {0.0, 0.0, 0.0}; for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) { @@ -1020,7 +1020,7 @@ Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values return 1; } } -~~~~~ +~~~~ @section occt_coding_rules_11 Examples @@ -1051,7 +1051,7 @@ private: //! \@name private fields @endverbatim -~~~~~ +~~~~{.cpp} #include // ========================================================== // function : Square @@ -1071,11 +1071,11 @@ void Package_Class::increment() { ++myCounter; } -~~~~~ +~~~~ ### TCL script for Draw Harness -~~~~~{.tcl} +~~~~{.tcl} # show fragments (solids) in shading with different colors proc DisplayColored {theShape} { set aSolids [uplevel #0 explode $theShape so] @@ -1106,10 +1106,10 @@ vzbufftrihedron DisplayColored c vfit vdump $imagedir/${casename}.png 512 512 -~~~~~ +~~~~ ### GLSL program: -~~~~~{.fs} +~~~~{.cpp}{.fs} vec3 Ambient; //!< Ambient contribution of light sources vec3 Diffuse; //!< Diffuse contribution of light sources vec3 Specular; //!< Specular contribution of light sources @@ -1149,4 +1149,4 @@ void main() normalize (View), Position); } -~~~~~ +~~~~ diff --git a/dox/contribution/git_guide/git_guide.md b/dox/contribution/git_guide/git_guide.md index da07e71f3f..bf18ce21f6 100644 --- a/dox/contribution/git_guide/git_guide.md +++ b/dox/contribution/git_guide/git_guide.md @@ -152,11 +152,11 @@ The official repository contains: 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: -~~~~~ +~~~~ > git config --global user.name "Your User Name" > git config --global user.email your@mail.address > git config --global your@mail.address -~~~~~ +~~~~ @section occt_gitguide_3 Getting access to the repository @@ -213,9 +213,9 @@ The official repository contains: On Windows, you might need to start **Git Bash** command prompt window. Use the following command to generate SSH keys: -~~~~~ +~~~~ > ssh-keygen -t rsa -C "your@mail.address" -~~~~~ +~~~~ 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. @@ -290,9 +290,9 @@ Click **Save** to input the key to the system. * From command line by command: -~~~~~ +~~~~ > git clone gitolite@git.dev.opencascade.org:occt -~~~~~ +~~~~ where \ is the path to the new folder which will be created for the repository. @@ -314,9 +314,9 @@ Click **Save** to input the key to the system. In the console: -~~~~~ +~~~~ > git checkout -b CR12345 origin/master -~~~~~ +~~~~ In TortoiseGit: * Go to the local copy of the repository. @@ -332,9 +332,9 @@ In TortoiseGit: If you need to switch to another branch, use Git command checkout for that. In the console: -~~~~~ +~~~~ > git checkout CR12345 -~~~~~ +~~~~ In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Switch/Checkout**. @@ -351,11 +351,11 @@ In TortoiseGit: * In the console: -~~~~~ +~~~~ > git diff … > git commit -a -m "Write meaningful commit message here" -~~~~~ +~~~~ Option -a tells the command to automatically include (stage) files that have been modified or deleted, but it will omit the new files that might have been added by you. @@ -363,12 +363,12 @@ In TortoiseGit: To find new unstaged files and them to commit, use commands: -~~~~~ +~~~~ > git status -s ?? file1.hxx ?? file2.cxx > git add file1.hxx file2.cxx -~~~~~ +~~~~ * In TortoiseGit: right-click in the explorer window and select in the context menu Git Commit -> CR…: @@ -384,9 +384,9 @@ In TortoiseGit: * In the console: -~~~~~ +~~~~ > git push "origin" CR12345:CR12345 -~~~~~ +~~~~ * In TortoiseGit: right-click in the explorer window and select in the context menu, TortoiseGit -> **Push** @@ -410,9 +410,9 @@ Note that Git forbids pushing a branch if the corresponding remote branch alread Use Git command *fetch* with option *prune* to get the update of all branches from the remote repository and to clean your local repository from the remote branches that have been deleted. * In the console: -~~~~~ +~~~~ > git fetch --prune -~~~~~ +~~~~ * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Fetch**. Check in **Prune** check-box. @@ -423,9 +423,9 @@ Note that Git forbids pushing a branch if the corresponding remote branch alread This operation is required in particular to update your local master branch when the remote master changes. * In console: -~~~~~ +~~~~ > git pull -~~~~~ +~~~~ * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Pull**. @@ -436,9 +436,9 @@ Note that the local branches of your repository are the primary place, where you Remove the local branches that you do not need any more. Note that you cannot delete the current branch. It means that you need to switch to another one (e.g. master) if the branch you are going to delete is the current one. * In the console: -~~~~~ +~~~~ > git branch -d CR12345 -~~~~~ +~~~~ * In TortoiseGit: right-click in the explorer window and select in the context menu **TortoiseGit** -> **Git Show Log**. diff --git a/dox/contribution/tests/tests.md b/dox/contribution/tests/tests.md index 8f73b0ccea..0785a269dd 100644 --- a/dox/contribution/tests/tests.md +++ b/dox/contribution/tests/tests.md @@ -51,9 +51,9 @@ For this it is recommended to add a file *DrawAppliInit* in the directory which Example (Windows) -~~~~~{.tcl} +~~~~{.tcl} set env(CSF_TestDataPath) $env(CSF_TestDataPath)\;d:/occt/test-data -~~~~~ +~~~~ 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 ";". @@ -66,18 +66,18 @@ To run all tests, type command *testgrid* Example: -~~~~~ +~~~~{.cpp} Draw[]> testgrid -~~~~~ +~~~~ To run only a subset of test cases, give masks for group, grid, and test case names to be executed. Each argument is a list of file masks separated with commas or spaces; by default "*" is assumed. Example: -~~~~~ +~~~~{.cpp} Draw[]> testgrid bugs caf,moddata*,xde -~~~~~ +~~~~ As the tests progress, the result of each test case is reported. At the end of the log a summary of test cases is output, @@ -86,7 +86,7 @@ including the list of detected regressions and improvements, if any. Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} Tests summary CASE 3rdparty export A1: OK @@ -97,7 +97,7 @@ Example: Total cases: 208 BAD, 31 SKIPPED, 3 IMPROVEMENT, 1791 OK Elapsed time: 1 Hours 14 Minutes 33.7384512019 Seconds Detailed logs are saved in D:/occt/results_2012-06-04T0919 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The tests are considered as non-regressive if only OK, BAD (i.e. known problem), and SKIPPED (i.e. not executed, typically because of lack of a data file) statuses are reported. See @ref testmanual_details_results "Interpretation of test results" for details. @@ -105,22 +105,22 @@ The results and detailed logs of the tests are saved by default to a new subdire If necessary, a non-default output directory can be specified using option -outdir followed by a path to the directory. This directory should be new or empty; use option -overwrite to allow writing results in the existing non-empty directory. Example: -~~~~~ +~~~~{.cpp} Draw[]> testgrid -outdir d:/occt/last_results -overwrite -~~~~~ +~~~~ In the output directory, a cumulative HTML report summary.html provides links to reports on each test case. An additional report in JUnit-style XML format can be output for use in Jenkins or other continuous integration system. To re-run the test cases, which were detected as regressions on the previous run, option -regress dirname should be used. dirname is a path to the directory containing the results of the previous run. Only the test cases with *FAILED* and *IMPROVEMENT* statuses will be tested. Example: -~~~~~ +~~~~{.cpp} Draw[]> testgrid -regress d:/occt/last_results -~~~~~ +~~~~ Type help testgrid in DRAW prompt to get help on options supported by *testgrid* command: -~~~~~ +~~~~{.cpp} Draw[3]> help testgrid testgrid: Run all tests, or specified group, or one grid Use: testgrid [groupmask [gridmask [casemask]]] [options...] @@ -135,7 +135,7 @@ testgrid: Run all tests, or specified group, or one grid Here "dirname" is a path to the directory containing the results of the previous run. Groups, grids, and test cases to be executed can be specified by the list of file masks separated by spaces or commas; default is all (*). -~~~~~ +~~~~ @subsubsection testmanual_1_3_3 Running a Single Test @@ -143,11 +143,11 @@ To run a single test, type command *test* followed by names of group, grid, and Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} Draw[1]> test blend simple A1 CASE blend simple A1: OK Draw[2]> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Note that normally an intermediate output of the script is not shown. The detailed log of the test can be obtained after the test execution by running command "dlog get". @@ -156,7 +156,7 @@ To see intermediate commands and their output during the test execution, add one Type help test in DRAW prompt to get help on options supported by *test* command: -~~~~~ +~~~~{.cpp} Draw[3]> help test test: Run specified test case Use: test group grid casename [options...] @@ -174,7 +174,7 @@ test: Run specified test case -beep: play sound signal at the end of the test -errors: show all lines from the log report that are recognized as errors This key will be ignored if the "-echo" key is already set. -~~~~~ +~~~~ @subsubsection testmanual_intro_quick_create Creating a New Test @@ -203,29 +203,29 @@ Example: * Added files: -~~~~~ +~~~~{.cpp} git status -short A tests/bugs/heal/data/bug210_a.brep A tests/bugs/heal/data/bug210_b.brep A tests/bugs/heal/bug210_1 A tests/bugs/heal/bug210_2 -~~~~~ +~~~~ * Test script -~~~~~{.tcl} +~~~~{.tcl} puts "OCC210 (case 1): Improve FixShape for touching wires" restore [locate_data_file bug210_a.brep] a fixshape result a 0.01 0.01 checkshape result -~~~~~ +~~~~ DRAW command *testfile* should be used to check the data files used by the test for possible duplication of content or names. The command accepts the list of paths to files to be checked (as a single argument) and gives a conclusion on each of the files, for instance: -~~~~~ +~~~~{.cpp} Draw[1]> testfile [glob /my/data/path/bug12345*] Collecting info on test data files repository... Checking new file(s)... @@ -247,7 +247,7 @@ Checking new file(s)... * /my/data/path/case_8_wire4.brep: error name is already used by existing file --> //server/occt_tests_data/public/brep/case_8_wire4.brep -~~~~~ +~~~~ @section testmanual_2 Organization of Test Scripts @@ -284,11 +284,11 @@ The names of directories of test groups containing systematic test grids corresp Example: -~~~~~ +~~~~{.cpp} caf mesh offset -~~~~~ +~~~~ Test group *bugs* is used to collect the tests coming from bug reports. Group *demo* collects tests of the test system, DRAW, samples, etc. @@ -296,19 +296,19 @@ Test group *bugs* is used to collect the tests coming from bug reports. Group *d This test group contains file *grids.list*, which defines an ordered list of grids in this group in the following format: -~~~~~~~~~~~~~~~~~ +~~~~{.cpp} 001 gridname1 002 gridname2 ... NNN gridnameN -~~~~~~~~~~~~~~~~~ +~~~~ Example: -~~~~~~~~~~~~~~~~~ +~~~~{.cpp} 001 basic 002 advanced -~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection testmanual_2_2_3 File "begin" @@ -318,10 +318,10 @@ additional Tcl functions used in test scripts. Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} pload TOPTEST ;# load topological command set cpulimit 300 ;# set maximum time allowed for script execution -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection testmanual_2_2_4 File "end" @@ -332,14 +332,14 @@ Note: *TEST COMPLETED* string should be present in the output to indicate that t See @ref testmanual_3 "Creation and modification of tests" chapter for more information. Example: -~~~~~ +~~~~{.cpp} if { [isdraw result] } { checkshape result } else { puts "Error: The result shape can not be built" } puts "TEST COMPLETED" -~~~~~ +~~~~ @subsubsection testmanual_2_2_5 File "parse.rules" @@ -353,12 +353,12 @@ The rest of the line can contain a comment message, which will be added to the t Example: -~~~~~ +~~~~{.cpp} FAILED /\b[Ee]xception\b/ exception FAILED /\bError\b/ error SKIPPED /Cannot open file for reading/ data file is missing SKIPPED /Could not read file .*, abandon/ data file is missing -~~~~~ +~~~~ Lines starting with a *#* character and blank lines are ignored to allow comments and spacing. @@ -368,11 +368,11 @@ If a line matches several rules, the first one applies. Rules defined in the gri Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} FAILED /\\bFaulty\\b/ bad shape IGNORE /^Error [23]d = [\d.-]+/ debug output of blend command IGNORE /^Tcl Exception: tolerance ang : [\d.-]+/ blend failure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection testmanual_2_2_6 Directory "data" The test group may contain subdirectory *data*, where test scripts shared by different test grids can be put. See also @ref testmanual_2_3_5 "Directory data". @@ -386,12 +386,12 @@ Each directory contains a set of related test cases. The name of a directory sho Example: -~~~~~ +~~~~{.cpp} caf basic bugs presentation -~~~~~ +~~~~ Here *caf* is the name of the test group and *basic*, *bugs*, *presentation*, etc. are the names of grids. @@ -403,9 +403,9 @@ Usually it sets variables specific for the current grid. Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} set command bopfuse ;# command tested in this grid -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection testmanual_2_3_3 File "end" @@ -415,9 +415,9 @@ Usually it executes a specific sequence of commands common for all tests in the Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} vdump $imagedir/${casename}.png ;# makes a snap-shot of AIS viewer -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection testmanual_2_3_4 File "cases.list" @@ -427,9 +427,9 @@ This file should contain a single line defining the relative path to the collect Example: -~~~~~ +~~~~{.cpp} ../data/simple -~~~~~ +~~~~ This option is used for creation of several grids of tests with the same data files and operations but performed with differing parameters. The common scripts are usually located place in the common subdirectory of the test group, data/simple for example. @@ -450,25 +450,25 @@ and produces meaningful messages that can be used to check the validity of the r Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} pcylinder c1 10 20 ;# create first cylinder pcylinder c2 5 20 ;# create second cylinder ttranslate c2 5 0 10 ;# translate second cylinder to x,y,z bsection result c1 c2 ;# create a section of two cylinders checksection result ;# will output error message if result is bad -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The test case can have any name (except for the reserved names *begin, end, data, cases.list* and *parse.rules*). For systematic grids it is usually a capital English letter followed by a number. Example: -~~~~~ +~~~~{.cpp} A1 A2 B1 B2 -~~~~~ +~~~~ Such naming facilitates compact representation of tests execution results in tabular format within HTML reports. @@ -488,11 +488,11 @@ The test case name in the bugs group should be prefixed by the ID of the corresp Example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.tcl} +~~~~{.tcl} bug12345_coaxial bug12345_orthogonal_1 bug12345_orthogonal_2 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ If the new test corresponds to a functionality already covered by the existing systematic test grid (e.g. group *mesh* for *BRepMesh* issues), this test can be added (or moved later by OCC team) to that grid. @@ -526,32 +526,32 @@ The test should run commands necessary to perform the tested operations, in gene Usually the script represents a set of commands that a person would run interactively to perform the operation and see its results, with additional comments to explain what happens. Example: -~~~~~ +~~~~{.cpp} # Simple test of fusing box and sphere box b 10 10 10 sphere s 5 bfuse result b s checkshape result -~~~~~ +~~~~ Make sure that file *parse.rules* in the grid or group directory contains a regular expression to catch possible messages indicating the failure of the test. For instance, for catching errors reported by *checkshape* command relevant grids define a rule to recognize its report by the word *Faulty*: -~~~~~ +~~~~{.cpp} FAILED /\bFaulty\b/ bad shape -~~~~~ +~~~~ For the messages generated in the script it is recommended to use the word 'Error' in the error message. Example: -~~~~~ +~~~~{.cpp} set expected_length 11 if { [expr $actual_length - $expected_length] > 0.001 } { puts "Error: The length of the edge should be $expected_length" } -~~~~~ +~~~~ At the end, the test script should output *TEST COMPLETED* string to mark a successful completion of the script. This is often done by the *end* script in the grid. @@ -571,9 +571,9 @@ During execution of the test, location of such data file can be constructed usin Example: -~~~~~ +~~~~{.cpp} checkresult $result $::dirname/$::groupname/$::gridname/data/${::casename}.txt -~~~~~ +~~~~ CAD models and other data files which are not going to change over time should be stored separately from the source repository. Use Tcl procedure *locate_data_file* to get a path to such data files, instead of coding the path explicitly. @@ -583,9 +583,9 @@ If the file is not found, *locate_data_file* will raise exception, and the test Example: -~~~~~ +~~~~{.cpp} stepread [locate_data_file CAROSKI_COUPELLE.step] a * -~~~~~ +~~~~ When the test needs to produce some snapshots or other artefacts, use Tcl variable *imagedir* as the location where such files should be put. * Command *testgrid* sets this variable to the subdirectory of the results folder corresponding to the grid. @@ -601,20 +601,20 @@ The test system can recognize an image file (snapshot) and include it in HTML lo The image format (defined by extension) should be *png*. Example: -~~~~~ +~~~~{.cpp} xwd $::imagedir/${::casename}.png vdisplay result; vfit vdump $::imagedir/${::casename}-axo.png vfront; vfit vdump $::imagedir/${::casename}-front.png -~~~~~ +~~~~ would produce: -~~~~~ +~~~~{.cpp} A1.png A1-axo.png A1-front.png -~~~~~ +~~~~ Note that OCCT must be built with FreeImage support to be able to produce usable images. @@ -644,26 +644,26 @@ The new test created for an unsolved problem should return BAD. The new test cre If the test produces an invalid result at a certain moment then the corresponding bug should be created in the OCCT issue tracker located at https://tracker.dev.opencascade.org, and the problem should be marked as TODO in the test script. The following statement should be added to such a test script: -~~~~~ +~~~~{.cpp} puts "TODO BugNumber ListOfPlatforms: RegularExpression" -~~~~~ +~~~~ Here: * *BugNumber* is the bug ID in the tracker. For example: #12345. * *ListOfPlatforms* is a list of platforms, at which the bug is reproduced (Linux, Windows, MacOS, or All). Note that the platform name is custom for the OCCT test system; Use procedure *checkplatform* to get the platform name. Example: -~~~~~ +~~~~{.cpp} Draw[2]> checkplatform Windows -~~~~~ +~~~~ * RegularExpression is a regular expression, which should be matched against the line indicating the problem in the script output. Example: -~~~~~ +~~~~{.cpp} puts "TODO #22622 Mandriva2008: Abort .* an exception was raised" -~~~~~ +~~~~ The parser checks the test output and if an output line matches the *RegularExpression* then it will be assigned a BAD status instead of FAILED. @@ -673,29 +673,29 @@ To mark the test as BAD for an incomplete case (when the final *TEST COMPLETE* m Example: -~~~~~ +~~~~{.cpp} puts "TODO OCC22817 All: exception.+There are no suitable edges" puts "TODO OCC22817 All: \\*\\* Exception \\*\\*" puts "TODO OCC22817 All: TEST INCOMPLETE" -~~~~~ +~~~~ @subsection testmanual_3_7 Marking required output To check the obtained test output matches the expected results considered correct, add REQUIRED statement for each specific message. For that, the following statement should be added to the corresponding test script: -~~~~~ +~~~~{.cpp} puts "REQUIRED ListOfPlatforms: RegularExpression" -~~~~~ +~~~~ Here *ListOfPlatforms* and *RegularExpression* have the same meaning as in TODO statements described above. The REQUIRED statement can also be used to mask the message that would normally be interpreted as error (according to the rules defined in *parse.rules*) but should not be considered as such within the current test. Example: -~~~~~ +~~~~{.cpp} puts "REQUIRED Linux: Faulty shapes in variables faulty_1 to faulty_5" -~~~~~ +~~~~ This statement notifies test system that errors reported by *checkshape* command are expected in that test case, and test should be considered as OK if this message appears, despite of presence of general rule stating that 'Faulty' signals failure. @@ -711,13 +711,13 @@ Note: in OCCT 6.5.3, file *DrawAppliInit* already exists in $CASROOT/src/Draw For example, let us assume that *d:/occt* contains an up-to-date version of OCCT sources with tests, and the test data archive is unpacked to *d:/test-data*): -~~~~~ +~~~~{.cpp} set env(CASROOT) d:/occt set env(CSF_TestScriptsPath) $env(CASROOT)/tests source $env(CASROOT)/src/DrawResources/TestCommands.tcl set env(CSF_TestDataPath) $env(CASROOT)/data;d:/test-data return -~~~~~ +~~~~ Note that on older versions of OCCT the tests are run in compatibility mode and thus not all output of the test command can be captured; this can lead to absence of some error messages (can be reported as either a failure or an improvement). @@ -728,13 +728,13 @@ You can extend the test system by adding your own tests. For that it is necessar Use Tcl command _path_separator to insert a platform-dependent separator to the path list. For example: -~~~~~ +~~~~{.cpp} set env(CSF_TestScriptsPath) \ $env(TestScriptsPath)[_path_separator]d:/MyOCCTProject/tests set env(CSF_TestDataPath) \ d:/occt/test-data[_path_separator]d:/MyOCCTProject/data return ;# this is to avoid an echo of the last command above in cout -~~~~~ +~~~~ @subsection testmanual_4_3 Parallel execution of tests @@ -749,9 +749,9 @@ Some test results are very dependent on the characteristics of the workstation, OCCT test system provides a dedicated command *testdiff* for comparing CPU time of execution, memory usage, and images produced by the tests. -~~~~~ +~~~~{.cpp} testdiff dir1 dir2 [groupname [gridname]] [options...] -~~~~~ +~~~~ Here *dir1* and *dir2* are directories containing logs of two test runs. Possible options are: @@ -771,18 +771,18 @@ Possible options are: Example: -~~~~~ +~~~~{.cpp} Draw[]> testdiff results/CR12345-2012-10-10T08:00 results/master-2012-10-09T21:20 -~~~~~ +~~~~ Particular tests can generate additional data that need to be compared by *testdiff* command. For that, for each parameter to be controlled, the test should produce the line containing keyword "COUNTER* followed by arbitrary name of the parameter, then colon and numeric value of the parameter. Example of test code: -~~~~~ +~~~~{.cpp} puts "COUNTER Memory heap usage at step 5: [meminfo h]" -~~~~~ +~~~~ @section testmanual_5 APPENDIX @@ -1106,50 +1106,50 @@ This group allows testing extended data exchange packages. Run command *checkshape* on the result (or intermediate) shape and make sure that *parse.rules* of the test grid or group reports bad shapes (usually recognized by word "Faulty") as error. Example -~~~~~ +~~~~{.cpp} checkshape result -~~~~~ +~~~~ To check the number of faults in the shape command *checkfaults* can be used. Use: checkfaults shape source_shape [ref_value=0] The default syntax of *checkfaults* command: -~~~~~ +~~~~{.cpp} checkfaults results a_1 -~~~~~ +~~~~ The command will check the number of faults in the source shape (*a_1*) and compare it with number of faults in the resulting shape (*result*). If shape *result* contains more faults, you will get an error: -~~~~~ +~~~~{.cpp} checkfaults results a_1 Error : Number of faults is 5 -~~~~~ +~~~~ It is possible to set the reference value for comparison (reference value is 4): -~~~~~ +~~~~{.cpp} checkfaults results a_1 4 -~~~~~ +~~~~ If number of faults in the resulting shape is unstable, reference value should be set to "-1". As a result command *checkfaults* will return the following error: -~~~~~ +~~~~{.cpp} checkfaults results a_1 -1 Error : Number of faults is UNSTABLE -~~~~~ +~~~~ @subsubsection testmanual_5_3_2 Shape tolerance The maximal tolerance of sub-shapes of each kind of the resulting shape can be extracted from output of tolerance command as follows: -~~~~~ +~~~~{.cpp} set tolerance [tolerance result] regexp { *FACE +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_face regexp { *EDGE +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_edgee regexp { *VERTEX +: +MAX=([-0-9.+eE]+)} $tolerance dummy max_vertex -~~~~~ +~~~~ It is possible to use command *checkmaxtol* to check maximal tolerance of shape and compare it with reference value. @@ -1162,39 +1162,39 @@ Allowed options are: * -multi_tol -- tolerance multiplier. The default syntax of *checkmaxtol* command for comparison with the reference value: -~~~~~ +~~~~{.cpp} checkmaxtol result -ref 0.00001 -~~~~~ +~~~~ There is an opportunity to compare max tolerance of resulting shape with max tolerance of source shape. In the following example command *checkmaxtol* gets max tolerance among objects *a_1* and *a_2*. Then it chooses the maximum value between founded tolerance and value -min_tol (0.000001) and multiply it on the coefficient -multi_tol (i.e. 2): -~~~~~ +~~~~{.cpp} checkmaxtol result -source {a_1 a_2} -min_tol 0.000001 -multi_tol 2 -~~~~~ +~~~~ If the value of maximum tolerance more than founded tolerance for comparison, the command will return an error. Also, command *checkmaxtol* can be used to get max tolerance of the shape: -~~~~~ +~~~~{.cpp} set maxtol [checkmaxtol result] -~~~~~ +~~~~ @subsubsection testmanual_5_3_3 Shape volume, area, or length Use command *vprops, sprops,* or *lprops* to correspondingly measure volume, area, or length of the shape produced by the test. The value can be extracted from the result of the command by *regexp*. Example: -~~~~~ +~~~~{.cpp} # check area of shape result with 1% tolerance regexp {Mass +: +([-0-9.+eE]+)} [sprops result] dummy area if { abs($area - $expected) > 0.1 + 0.01 * abs ($area) } { puts "Error: The area of result shape is $area, while expected $expected" } -~~~~~ +~~~~ @subsubsection testmanual_5_3_4 Memory leaks @@ -1204,7 +1204,7 @@ To check memory leak on a particular operation, run it in a cycle, measure the m The command *checktrend* (defined in *tests/bugs/begin*) can be used to analyze a sequence of memory measurements and to get a statistically based evaluation of the leak presence. Example: -~~~~~ +~~~~{.cpp} set listmem {} for {set i 1} {$i < 100} {incr i} { # run suspect operation @@ -1216,13 +1216,13 @@ for {set i 1} {$i < 100} {incr i} { break } } -~~~~~ +~~~~ @subsubsection testmanual_5_3_5 Visualization The following command sequence allows you to take a snapshot of the viewer, give it the name of the test case, and save in the directory indicated by Tcl variable *imagedir*. -~~~~~ +~~~~{.cpp} vinit vclear vdisplay result @@ -1230,7 +1230,7 @@ vsetdispmode 1 vfit vzfit vdump $imagedir/${casename}_shading.png -~~~~~ +~~~~ This image will be included in the HTML log produced by *testgrid* command and will be checked for non-regression through comparison of images by command *testdiff*. @@ -1256,21 +1256,21 @@ Allowed options are: Note that is required to use either option -2d or option -3d. Examples: -~~~~~ +~~~~{.cpp} checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -3d -path ${imagedir}/${test_image}.png checkview -display result_2d -2d v2d -path ${imagedir}/${test_image}.png -~~~~~ +~~~~ -~~~~~ +~~~~{.cpp} box a 10 10 10 box b 5 5 5 10 10 10 bcut result b a set result_vertices [explode result v] checkview -display result -2d -with ${result_vertices} -otherwise { a b } -l -path ${imagedir}/${test_image}.png -~~~~~ +~~~~ -~~~~~ +~~~~{.cpp} box a 10 10 10 box b 5 5 5 10 10 10 bcut result b a @@ -1278,7 +1278,7 @@ vinit vdisplay a b vfit checkview -screenshot -3d -path ${imagedir}/${test_image}.png -~~~~~ +~~~~ @subsubsection testmanual_5_3_6 Number of free edges @@ -1290,9 +1290,9 @@ Allowed options are: * -tol N -- used tolerance (default -0.01); * -type N -- used type, possible values are "closed" and "opened" (default "closed"). -~~~~~ +~~~~{.cpp} checkfreebounds result 13 -~~~~~ +~~~~ Option -tol N defines tolerance for command *freebounds*, which is used within command *checkfreebounds*. @@ -1301,10 +1301,10 @@ Option -type N is used to select the type of counted free edges: closed o If the number of free edges in the resulting shape is unstable, the reference value should be set to "-1". As a result command *checkfreebounds* will return the following error: -~~~~~ +~~~~{.cpp} checkfreebounds result -1 Error : Number of free edges is UNSTABLE -~~~~~ +~~~~ @subsubsection testmanual_5_3_7 Compare numbers @@ -1312,9 +1312,9 @@ Procedure *checkreal* checks the equality of two reals with a tolerance (relativ Use: checkreal name value expected tol_abs tol_rel -~~~~~ +~~~~{.cpp} checkreal "Some important value" $value 5 0.0001 0.01 -~~~~~ +~~~~ @subsubsection testmanual_5_3_8 Check number of sub-shapes @@ -1336,9 +1336,9 @@ Allowed options are: the same sub-shapes with different location as different sub-shapes. * -m msg -- prints "msg" in case of error -~~~~~ +~~~~{.cpp} checknbshapes result -vertex 8 -edge 4 -~~~~~ +~~~~ @subsubsection testmanual_5_3_9 Check pixel color @@ -1354,9 +1354,9 @@ This procedure checks color with tolerance (5x5 area). Next example will compare color of point with coordinates x=100 y=100 with RGB color R=1 G=0 B=0. If colors are not equal, procedure will check the nearest ones points (5x5 area) -~~~~~ +~~~~{.cpp} checkcolor 100 100 1 0 0 -~~~~~ +~~~~ @subsubsection testmanual_5_3_10 Compute length, area and volume of input shape @@ -1375,10 +1375,10 @@ Allowed options are: Options -l, -s and -v are independent and can be used in any order. Tolerance *epsilon* is the same for all options. -~~~~~ +~~~~{.cpp} checkprops result -s 6265.68 checkprops result -s -equal FaceBrep -~~~~~ +~~~~ @subsubsection testmanual_5_3_11 Parse output dump and compare it with reference values @@ -1391,9 +1391,9 @@ Allowed options are: * -ref VALUE -- list of reference values for each parameter in *NAME*; * -eps EPSILON -- the epsilon defines relative precision of computation. -~~~~~ +~~~~{.cpp} checkdump result -name {Center Axis XAxis YAxis Radii} -ref {{-70 0} {-1 -0} {-1 -0} {0 -1} {20 10}} -eps 0.01 -~~~~~ +~~~~ @subsubsection testmanual_5_3_12 Compute length of input curve @@ -1407,10 +1407,10 @@ Allowed options are: * -equal CURVE -- compares the length of input curves. Puts error if they are not equal; * -notequal CURVE -- compares the length of input curves. Puts error if they are equal. -~~~~~ +~~~~{.cpp} checklength cp1 -l 7.278 checklength res -l -equal ext_1 -~~~~~ +~~~~ @subsubsection testmanual_5_3_13 Check maximum deflection, number of triangles and nodes in mesh Command *checktrinfo* can be used to to check the maximum deflection, as well as the number of nodes and triangles in mesh. @@ -1438,33 +1438,33 @@ Note that options -tri, -nod and -defl do not work together wi Examples: Comparison with some reference values: -~~~~~ +~~~~{.cpp} checktrinfo result -tri 129 -nod 131 -defl 0.01 -~~~~~ +~~~~ Comparison with another mesh: -~~~~~ +~~~~{.cpp} checktrinfo result -ref [tringo a] -~~~~~ +~~~~ Comparison of deflection with the max possible value: -~~~~~ +~~~~{.cpp} checktrinfo result -max_defl 1 -~~~~~ +~~~~ Check that the current values are not equal to zero: -~~~~~ +~~~~{.cpp} checktrinfo result -tri -nod -defl -~~~~~ +~~~~ Check that the number of triangles and the number of nodes are not equal to some specific values: -~~~~~ +~~~~{.cpp} checktrinfo result -tri !10 -nod !8 -~~~~~ +~~~~ It is possible to compare current values with reference values with some tolerances. Use options -tol_\* for that. -~~~~~ +~~~~{.cpp} checktrinfo result -defl 1 -tol_abs_defl 0.001 -~~~~~ +~~~~ diff --git a/dox/debug/debug.md b/dox/debug/debug.md index cbd67cae58..58da605d08 100644 --- a/dox/debug/debug.md +++ b/dox/debug/debug.md @@ -49,34 +49,34 @@ Open CASCADE Test Harness or @ref occt_user_guides__test_harness "DRAW" provides In some cases the objects to be inspected are available in DRAW as results of DRAW commands. In other cases, however, it is necessary to inspect intermediate objects created by the debugged algorithm. To support this, DRAW provides a set of commands allowing the developer to store intermediate objects directly from the debugger stopped at some point during the program execution (usually at a breakpoint). -~~~~~ +~~~~{.cpp} const char* Draw_Eval (const char *theCommandStr) -~~~~~ +~~~~ Evaluates a DRAW command or script. A command is passed as a string parameter. -~~~~~ +~~~~{.cpp} const char* DBRep_Set (const char* theNameStr, void* theShapePtr) -~~~~~ +~~~~ Sets the specified shape as a value of DRAW interpreter variable with the given name. - *theNameStr* -- the DRAW interpreter variable name to set. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable. -~~~~~ +~~~~{.cpp} const char* DBRep_SetComp (const char* theNameStr, void* theListPtr) -~~~~~ +~~~~ Makes a compound from the specified list of shapes and sets it as a value of DRAW interpreter variable with the given name. - *theNameStr* -- the DRAW interpreter variable name to set. - *theListPtr* -- a pointer to *TopTools_ListOfShape* variable. -~~~~~ +~~~~{.cpp} const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr) const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr) const char* DrawTrSurf_SetPnt2d (const char* theNameStr, void* thePnt2dPtr) -~~~~~ +~~~~ Sets the specified geometric object as a value of DRAW interpreter variable with the given name. - *theNameStr* -- the DRAW interpreter variable name to set. @@ -90,27 +90,27 @@ All these functions are defined in *TKDraw* toolkit and return a string indicati The following functions are provided by *TKBRep* toolkit and can be used from debugger prompt: -~~~~~ +~~~~{.cpp} const char* BRepTools_Write (const char* theFileNameStr, void* theShapePtr) -~~~~~ +~~~~ Saves the specified shape to a file with the given name. - *theFileNameStr* -- the name of the file where the shape is saved. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable. -~~~~~ +~~~~{.cpp} const char* BRepTools_Dump (void* theShapePtr) const char* BRepTools_DumpLoc (void* theShapePtr) -~~~~~ +~~~~ Dumps shape or its location to cout. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable. The following function is provided by *TKMesh* toolkit: -~~~~~ +~~~~{.cpp} const char* BRepMesh_Dump (void* theMeshHandlePtr, const char* theFileNameStr) -~~~~~ +~~~~ Stores mesh produced in parametric space to BREP file. - *theMeshHandlePtr* -- a pointer to *Handle(BRepMesh_DataStructureOfDelaun)* variable. @@ -118,10 +118,10 @@ Stores mesh produced in parametric space to BREP file. The following functions are provided by *TKTopTest* toolkit: -~~~~~ +~~~~{.cpp} const char* MeshTest_DrawLinks(const char* theNameStr, void* theFaceAttr) const char* MeshTest_DrawTriangles(const char* theNameStr, void* theFaceAttr) -~~~~~ +~~~~ Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_FaceAttribute)* as DRAW interpreter variables, assigning a unique name in the form "_" to each object. - *theNameStr* -- the prefix to use in names of objects. @@ -129,9 +129,9 @@ Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_Fa The following additional function is provided by *TKGeomBase* toolkit: -~~~~~ +~~~~{.cpp} const char* GeomTools_Dump (void* theHandlePtr) -~~~~~ +~~~~ Dump geometric object to cout. - *theHandlePtr* -- a pointer to the geometric variable (Handle to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set. @@ -174,7 +174,7 @@ It is implemented in 'vaspect' and 'boundingbox' commands. Json output for Bnd_OBB (using command 'bounding v -obb -dumpJson'): -~~~~~ +~~~~{.cpp} "Bnd_OBB": { "Center": { "gp_XYZ": [1, 2, 3] @@ -193,7 +193,7 @@ Json output for Bnd_OBB (using command 'bounding v -obb -dumpJson'): "HDims[2]": 0, "IsAABox": 1, } -~~~~~ +~~~~ @section occt_debug_vstudio Using Visual Studio debugger @@ -206,18 +206,18 @@ When the execution is interrupted by a breakpoint, you can use this window to ca For example, assume that you are debugging a function, where local variable *TopoDS_Edge* *anEdge1* is of interest. The following set of commands in the Command window will save this edge to file *edge1.brep*, then put it to DRAW variable *e1* and show it maximized in the axonometric DRAW view: -~~~~~ +~~~~{.cpp} >? ({,,TKBRep.dll}BRepTools_Write)("d:/edge1.brep",(void*)&anEdge1) 0x04a2f234 "d:/edge1.brep" >? ({,,TKDraw.dll}DBRep_Set)("e1",(void*)&anEdge1) 0x0369eba8 "e1" >? ({,,TKDraw.dll}Draw_Eval)("donly e1; axo; fit") 0x029a48f0 "" -~~~~~ +~~~~ For convenience it is possible to define aliases to commands in this window, for instance (here ">" is prompt provided by the command window; in the Immediate window this symbol should be entered manually): -~~~~~ +~~~~{.cpp} >alias deval ? ({,,TKDraw}Draw_Eval) >alias dsetshape ? ({,,TKDraw}DBRep_Set) >alias dsetcomp ? ({,,TKDraw}DBRep_SetComp) @@ -229,18 +229,18 @@ For convenience it is possible to define aliases to commands in this window, for >alias dumploc ? ({,,TKBRep}BRepTools_DumpLoc) >alias dumpmesh ? ({,,TKMesh}BRepMesh_Dump) >alias dumpgeom ? ({,,TKGeomBase}GeomTools_Dump) -~~~~~ +~~~~ Note that aliases are stored in the Visual Studio user's preferences and it is sufficient to define them once on a workstation. With these aliases, the above example can be reproduced easier (note the space symbol after alias name!): -~~~~~ +~~~~{.cpp} >saveshape ("d:/edge1.brep",(void*)&anEdge1) 0x04a2f234 "d:/edge1.brep" >dsetshape ("e1",(void*)&anEdge1) 0x0369eba8 "e1" >deval ("donly e1; axo; fit") 0x029a48f0 "" -~~~~~ +~~~~ Note that there is no guarantee that the call will succeed and will not affect the program execution, thus use this feature at your own risk. In particular, the commands interacting with window system (such as *axo*, *vinit*, etc.) are known to cause application crash when the program is built in 64-bit mode. To avoid this, it is recommended to prepare all necessary view windows in advance, and arrange these windows to avoid overlapping with the Visual Studio window, to ensure that they are visible during debug. @@ -252,7 +252,7 @@ In Visual Studio 2005-2010 the rules for this display are defined in file *autoe ### \[AutoExpand\] section -~~~~~ +~~~~{.cpp} ; Open CASCADE classes Standard_Transient=<,t> count= Handle_Standard_Transient= count=count,d> <,t> @@ -274,11 +274,11 @@ gp_Dir2d=, gp_Vec2d=, gp_Mat2d={,}, {,} gp_Ax1=loc={, , } vdir={, , } -~~~~~ +~~~~ ### \[Visualizer\] section -~~~~~ +~~~~{.cpp} ; Open CASCADE classes NCollection_Handle<*> { @@ -342,7 +342,7 @@ Handle_TCollection_HAsciiString { #array( expr: ((TCollection_HAsciiString*)$e.entity)->myString.mystring[$i], size: ((TCollection_HAsciiString*)$e.entity)->myString.mylength) ) ) } -~~~~~ +~~~~ In Visual Studio 2012 and later, visualizers can be put in a separate file in subdirectory *Visualizers*. See file *occt.natvis* for example. diff --git a/dox/samples/ocaf.md b/dox/samples/ocaf.md index f267d962b2..852338ae14 100644 --- a/dox/samples/ocaf.md +++ b/dox/samples/ocaf.md @@ -42,7 +42,7 @@ In the Formats method, add the format of the documents, which need to b For example: -~~~~ +~~~~{.cpp} void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats) { Formats.Append(TCollection_ExtendedString ("OCAF-myApplication")); @@ -53,7 +53,7 @@ In the ResourcesName method, you only define the name of the resource fi file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file. -~~~~ +~~~~{.cpp} Standard_CString myApplication::ResourcesName() { return Standard_CString ("Resources"); @@ -62,7 +62,7 @@ with each format and calling of the plug-in file. To obtain the saving and opening mechanisms, it is necessary to set two environment variables: CSF_PluginDefaults, which defines the path of the plug-in file, and CSF_ResourcesDefault, which defines the resource file: -~~~~ +~~~~{.cpp} SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory); SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory); ~~~~ @@ -91,7 +91,7 @@ These drivers are provided as plug-ins and are located in the PappStdPlugin< For example, this is a resource file, which declares a new model document OCAF-MyApplication: -~~~~ +~~~~{.cpp} formatlist:OCAF-MyApplication OCAF-MyApplication.Description: MyApplication Document Version 1.0 OCAF-MyApplication.FileExtension: sta @@ -116,7 +116,7 @@ The syntax of each item is Identification.Location Library_Name, where: For example, this is a Plugin file: -~~~~ +~~~~{.cpp} a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin ! base document drivers plugin ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin @@ -128,7 +128,7 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin ## Implementation of Attribute Transformation in a HXX file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} \#include \#include @@ -223,11 +223,11 @@ private: gp_Pnt myFirstPoint; gp_Pnt mySecondPoint; }; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ ## Implementation of Attribute Transformation in a CPP file -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} \#include //======================================================================= @@ -526,7 +526,7 @@ Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& anOS) const MyPackage_Transformation::MyPackage_Transformation():myType(gp_Identity){ } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ ## Implementation of typical actions with standard OCAF attributes. diff --git a/dox/samples/ocaf_func.md b/dox/samples/ocaf_func.md index 12576ab2ba..dec2b81bec 100644 --- a/dox/samples/ocaf_func.md +++ b/dox/samples/ocaf_func.md @@ -160,7 +160,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl This is an example of the code for iteration and execution of functions. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} // The scope of functions is defined. Handle(TFunction_Scope) scope = TFunction_Scope::Set( anyLabel ); @@ -200,14 +200,14 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl } // end of iteration of current functions } // end of iteration of functions. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ ### Example 2: Cylinder function driver This is an example of the code for a cylinder function driver. To make the things clearer, the methods \::Arguments() and \::Results() from the base class are also mentioned. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} // A virtual method ::Arguments() returns a list of arguments of the function. CylinderDriver::Arguments( TDF_LabelList& args ) @@ -283,4 +283,4 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl return 0; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ diff --git a/dox/specification/boolean_operations/boolean_operations.md b/dox/specification/boolean_operations/boolean_operations.md index 96de5fe0c1..29e8c3e6f8 100644 --- a/dox/specification/boolean_operations/boolean_operations.md +++ b/dox/specification/boolean_operations/boolean_operations.md @@ -335,7 +335,7 @@ Pave block *PV* of curve *C* is bounded by vertices *V1* and *V2* with tolerance The theoretical parametric range of the pave block is [t1C, t2C]. The positions of the vertices *V1* and *V2* of the pave block can be different. The positions are determined by the following conditions: -~~~~ +~~~~{.cpp} Distance (P1, P1c) is equal or less than Tol(V1) + Tol(C) Distance (P2, P2c) is equal or less than Tol(V2) + Tol(C) ~~~~ @@ -811,7 +811,7 @@ The following example illustrates how to use the GF algorithm: #### Usage of the GF algorithm on C++ level -~~~~ +~~~~{.cpp} BOPAlgo_Builder aBuilder; // Setting arguments TopTools_ListOfShape aLSObjects = …; // Objects @@ -865,7 +865,7 @@ const TopoDS_Shape& aResult = aBuilder.Shape(); #### Usage of the GF algorithm on Tcl level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 3 4 5 10 10 10 @@ -1199,7 +1199,7 @@ It is based on the General Fuse algorithm, thus all options of the General Fuse @subsubsection specification__boolean_8_3_1 API On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitter*. The usage of this algorithm looks as follows: -~~~~~ +~~~~{.cpp} BOPAlgo_Splitter aSplitter; // Setting arguments and tools TopTools_ListOfShape aLSObjects = …; // Objects @@ -1218,12 +1218,12 @@ if (aSplitter.HasErrors()) { //check error status } // const TopoDS_Shape& aResult = aSplitter.Shape(); // result of the operation -~~~~~ +~~~~ @subsubsection specification__boolean_8_3_2 DRAW The command *bsplit* implements the Splitter algorithm in DRAW. Similarly to the *bbuild* command for the General Fuse algorithm, the *bsplit* command should be used after the Pave Filler is filled. -~~~~~ +~~~~{.cpp} # s1 s2 s3 - objects # t1 t2 t3 - tools bclearobjects @@ -1232,7 +1232,7 @@ baddobjects s1 s2 s3 baddtools t1 t2 t3 bfillds bsplit result -~~~~~ +~~~~ @subsection specification__boolean_8_4 Examples @@ -1240,7 +1240,7 @@ bsplit result Splitting a face by the set of edges: -~~~~ +~~~~{.cpp} # draw script for reproducing bclearobjects bcleartools @@ -1286,7 +1286,7 @@ bsplit result Splitting a plate by the set of cylinders: -~~~~ +~~~~{.cpp} # draw script for reproducing: bclearobjects bcleartools @@ -2182,7 +2182,7 @@ This option is useful e.g. for building a solid from the faces of one shell or f #### C++ Level The usage of the algorithm on the API level: -~~~~ +~~~~{.cpp} BOPAlgo_MakerVolume aMV; // Set the arguments TopTools_ListOfShape aLS = …; // arguments @@ -2206,7 +2206,7 @@ const TopoDS_Shape& aResult = aMV.Shape(); // result of the operation #### Tcl Level To use the algorithm in Draw the command mkvolume has been implemented. The usage of this command is following: -~~~~ +~~~~{.cpp} Usage: mkvolume r b1 b2 ... [-c] [-ni] [-ai] Options: -c - use this option to have input compounds considered as set of separate arguments (allows passing multiple arguments as one compound); @@ -2272,7 +2272,7 @@ It is possible to create typed Containers from the parts added into result by us #### API usage Here is the example of the algorithm use on the API level: -~~~~ +~~~~{.cpp} BOPAlgo_CellsBuilder aCBuilder; // Set the arguments TopTools_ListOfShape aLS = …; // arguments @@ -2309,7 +2309,7 @@ aResult = aCBuilder.Shape(); // the result #### DRAW usage The following set of new commands has been implemented to run the algorithm in DRAW Test Harness: -~~~~ +~~~~{.cpp} bcbuild : Initialization of the Cells Builder. Use: *bcbuild r* bcadd : Add parts to result. Use: *bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]* bcaddall : Add all parts to result. Use: *bcaddall r [-m material [-u]]* @@ -2320,7 +2320,7 @@ bcmakecontainers : Make containers from the parts added to result. Use: *bcmakec ~~~~ Here is the example of the algorithm use on the DRAW level: -~~~~ +~~~~{.cpp} psphere s1 15 psphere s2 15 psphere s3 15 @@ -2343,7 +2343,7 @@ bcremoveint res @subsection specification__boolean_10c_Cells_2 Examples The following simple example illustrates the possibilities of the algorithm working on a cylinder and a sphere intersected by a plane: -~~~~ +~~~~{.cpp} pcylinder c 10 30 psphere s 15 ttranslate s 0 0 30 @@ -2353,7 +2353,7 @@ mkface f p -25 30 -17 17 @figure{/specification/boolean_operations/images/cells_algorithm_001.png,"Arguments",160} -~~~~ +~~~~{.cpp} bclearobjects bcleartools baddobjects c s f @@ -2363,7 +2363,7 @@ bcbuild r #### 1. Common for all arguments -~~~~ +~~~~{.cpp} bcremoveall bcadd res c 1 s 1 f 1 ~~~~ @@ -2372,7 +2372,7 @@ bcadd res c 1 s 1 f 1 #### 2. Common between cylinder and face -~~~~ +~~~~{.cpp} bcremoveall bcadd res f 1 c 1 ~~~~ @@ -2381,7 +2381,7 @@ bcadd res f 1 c 1 #### 3. Common between cylinder and sphere -~~~~ +~~~~{.cpp} bcremoveall bcadd res c 1 s 1 ~~~~ @@ -2390,7 +2390,7 @@ bcadd res c 1 s 1 #### 4. Fuse of cylinder and sphere -~~~~ +~~~~{.cpp} bcremoveall bcadd res c 1 -m 1 bcadd res s 1 -m 1 @@ -2401,7 +2401,7 @@ bcremoveint res #### 5. Parts of the face inside solids - FUSE(COMMON(f, c), COMMON(f, s)) -~~~~ +~~~~{.cpp} bcremoveall bcadd res f 1 s 1 -m 1 bcadd res f 1 c 1 -m 1 @@ -2409,7 +2409,7 @@ bcadd res f 1 c 1 -m 1 @figure{/specification/boolean_operations/images/cells_algorithm_006_1.png,"Parts of the face inside solids",160} -~~~~ +~~~~{.cpp} bcremoveint res ~~~~ @@ -2417,7 +2417,7 @@ bcremoveint res #### 6. Part of the face outside solids -~~~~ +~~~~{.cpp} bcremoveall bcadd res f 1 c 0 s 0 ~~~~ @@ -2426,7 +2426,7 @@ bcadd res f 1 c 0 s 0 #### 7. Fuse operation (impossible using standard Boolean Fuse operation) -~~~~ +~~~~{.cpp} bcremoveall bcadd res c 1 -m 1 bcadd res s 1 -m 1 @@ -2772,7 +2772,7 @@ The Gluing option is an enumeration implemented in BOPAlgo_GlueEnum.hxx: #### API level For setting the Gluing options for the algorithm it is just necessary to call the SetGlue(const BOPAlgo_Glue) method with appropriate value: -~~~~ +~~~~{.cpp} BOPAlgo_Builder aGF; // .... @@ -2788,7 +2788,7 @@ For setting the Gluing options in DRAW it is necessary to call the bglue * 1 - for partial coincidence; * 2 - for full coincidence -~~~~ +~~~~{.cpp} bglue 1 ~~~~ @@ -2821,7 +2821,7 @@ The option is also available in the Intersection algorithm - *BOPAlgo_PaveFiller #### API level To enable/disable the safe processing mode for the algorithm, it is necessary to call *SetNonDestructive()* method with the appropriate value: -~~~~ +~~~~{.cpp} BOPAlgo_Builder aGF; // .... @@ -2836,7 +2836,7 @@ To enable the safe processing mode for the operation in DRAW, it is necessary to * 0 - default value, the safe mode is switched off; * 1 - the safe mode will be switched on. -~~~~ +~~~~{.cpp} bnondestructive 1 ~~~~ @@ -2852,7 +2852,7 @@ The classification should be disabled only if the user is sure that there are no #### API level To enable/disable the classification of the input solids it is necessary to call *SetCheckInverted()* method with the appropriate value: -~~~~ +~~~~{.cpp} BOPAlgo_Builder aGF; // .... @@ -2867,7 +2867,7 @@ To enable/disable the classification of the solids in DRAW, it is necessary to c * 0 - disabling the classification; * 1 - default value, enabling the classification. -~~~~ +~~~~{.cpp} bcheckinverted 0 ~~~~ @@ -2879,7 +2879,7 @@ Since Oriented Bounding Boxes are usually much tighter than Axes Aligned Boundin #### API level To enable/disable the usage of OBB in the operation it is necessary to call the *SetUseOBB()* method with the appropriate value: -~~~~ +~~~~{.cpp} BOPAlgo_Builder aGF; // .... @@ -2893,7 +2893,7 @@ aGF.SetUseOBB(Standard_True); To enable/disable the usage of OBB in the operation in DRAW it is necessary to call the *buseobb* command with the appropriate value: * 0 - disabling the usage of OBB; * 1 - enabling the usage of OBB. -~~~~ +~~~~{.cpp} buseobb 1 ~~~~ @@ -2919,7 +2919,7 @@ Note that messages corresponding to errors and warnings are defined in resource These messages can be localized; for that put translated version to separate file and load it in the application by call to *Message_MsgFile::Load()* . Here is the example of how to use this system: -~~~~~ +~~~~{.cpp} BOPAlgo_PaveFiller aPF; aPF.SetArguments(...); aPF.Perform(); @@ -2934,17 +2934,17 @@ if (aPF.HasErrors()) { } ... } -~~~~~ +~~~~ DRAW commands executing Boolean operations output errors and warnings generated by these operations in textual form. Additional option allows saving shapes for which warnings have been generated, as DRAW variables. To activate this option, run command *bdrawwarnshapes* with argument 1 (or with 0 to deactivate): -~~~~ +~~~~{.cpp} bdrawwarnshapes 1 ~~~~ After setting this option and running an algorithm the result will look as follows: -~~~~ +~~~~{.cpp} Warning: The interfering vertices of the same argument: ws_1_1 ws_1_2 Warning: The positioning of the shapes leads to creation of small edges without valid range: ws_2_1 ~~~~ @@ -2978,7 +2978,7 @@ But if the faces are fully coinciding, the result must be empty, and both faces Example of the overlapping faces: -~~~~ +~~~~{.cpp} plane p 0 0 0 0 0 1 mkface f1 p -10 10 -10 10 mkface f2 p 0 20 -10 10 @@ -3005,7 +3005,7 @@ Thus, each of the input edges will be Modified into its two splits. But in the CUT operation on the same edges, the tool edge will be Deleted from the result and, thus, will not have any Modified shapes. Example of the intersecting edges: -~~~~ +~~~~{.cpp} line l1 0 0 0 1 0 0 mkedge e1 l1 -10 10 @@ -3051,7 +3051,7 @@ Two intersecting edges will both have the intersection vertices Generated from t As for the operation with intersecting faces, consider the following example: -~~~~ +~~~~{.cpp} plane p1 0 0 0 0 0 1 mkface f1 p1 -10 10 -10 10 @@ -3115,7 +3115,7 @@ For controlling this possibility in DRAW the command **bsimplify** has been impl Here is the simple example of simplification of the result of Fuse operation of two boxes: -~~~~ +~~~~{.cpp} bsimplify -f 1 box b1 10 10 15 @@ -3173,7 +3173,7 @@ The following example illustrates how to use General Fuse operator: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include @@ -3205,7 +3205,7 @@ The following example illustrates how to use General Fuse operator: #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 3 4 5 10 10 10 @@ -3231,7 +3231,7 @@ The following example illustrates how to use the Splitter operator: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include @@ -3265,7 +3265,7 @@ const TopoDS_Shape& aResult = aSplitter.Shape(); #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments # objects box b1 10 10 10 @@ -3297,7 +3297,7 @@ The following example illustrates how to use Common operation: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include < BRepAlgoAPI_Common.hxx> @@ -3336,7 +3336,7 @@ The following example illustrates how to use Common operation: #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 7 0 4 10 10 10 @@ -3364,7 +3364,7 @@ The following example illustrates how to use Fuse operation: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include < BRepAlgoAPI_Fuse.hxx> @@ -3403,7 +3403,7 @@ The following example illustrates how to use Fuse operation: #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 7 0 4 10 10 10 @@ -3431,7 +3431,7 @@ The following example illustrates how to use Cut operation: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include < BRepAlgoAPI_Cut.hxx> @@ -3470,7 +3470,7 @@ The following example illustrates how to use Cut operation: #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 7 0 4 10 10 10 @@ -3499,7 +3499,7 @@ The following example illustrates how to use Section operation: #### C++ Level -~~~~ +~~~~{.cpp} #include #include #include < BRepAlgoAPI_Section.hxx> @@ -3538,7 +3538,7 @@ The following example illustrates how to use Section operation: #### Tcl Level -~~~~ +~~~~{.cpp} # prepare the arguments box b1 10 10 10 box b2 3 4 5 10 10 10 diff --git a/dox/specification/brep_format.md b/dox/specification/brep_format.md index 767a59d313..4565bb21ac 100644 --- a/dox/specification/brep_format.md +++ b/dox/specification/brep_format.md @@ -35,12 +35,12 @@ Each of these methods has two arguments: The following sample code reads a shape from ASCII file and writes it to a binary one: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Shape aShape; if (BRepTools::Read (aShape, "source_file.txt")) { BinTools::Write (aShape, "result_file.bin"); } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @section specification__brep_format_3 Format Common Structure @@ -250,7 +250,7 @@ The example record is interpreted as a line which passes through a point *P*=(1 **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 2> = "2" <_> <3D circle center> <_> <3D circle N> <_> <3D circle Dx> <_> <3D circle Dy> <_> <3D circle radius> <_\n>; <3D circle center> = <3D point>; @@ -283,7 +283,7 @@ The example record is interpreted as a circle which has its center *P*=(1, 2, 3 **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 3> = "3" <_> <3D ellipse center> <_> <3D ellipse N> <_> <3D ellipse Dmaj> <_> <3D ellipse Dmin> <_> <3D ellipse Rmaj> <_> <3D ellipse Rmin> <_\n>; <3D ellipse center> = <3D point>; @@ -318,7 +318,7 @@ The example record is interpreted as an ellipse which has its center *P*=(1, 2, **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 4> = "4" <_> <3D parabola origin> <_> <3D parabola N> <_> <3D parabola Dx> <_> <3D parabola Dy> <_> <3D parabola focal length> <_\n>; <3D parabola origin> = <3D point>; @@ -352,7 +352,7 @@ The example record is interpreted as a parabola in plane which passes through a **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 5> = "5" <_> <3D hyperbola origin> <_> <3D hyperbola N> <_> <3D hyperbola Dx> <_> <3D hyperbola Dy> <_> <3D hyperbola Kx> <_> <3D hyperbola Ky> <_\n>; <3D hyperbola origin> = <3D point>; @@ -428,7 +428,7 @@ The example record is interpreted as a Bezier curve with a rational flag *r*=1, **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 7> = "7" <_> <3D B-spline rational flag> <_> "0" <_> <3D B-spline degree> <_> <3D B-spline pole count> <_> <3D B-spline multiplicity knot count> <3D B-spline weight poles> <_\n> <3D B-spline multiplicity knots> <_\n>; @@ -492,7 +492,7 @@ The example record is interpreted as a B-spline curve with a rational flag *r*= **BNF-like Definition** -~~~~ +~~~~{.cpp} <3D curve record 8> = "8" <_> <3D trimmed curve u min> <_> <3D trimmed curve u max> <_\n> <3D curve record>; <3D trimmed curve u min> = ; @@ -764,7 +764,7 @@ where @f$ V(v)=(5,2,0)+4 \cdot (cos(v) \cdot (1,0,0)+sin(v) \cdot (0,1,0)), V_{D **BNF-like Definition** -~~~~ +~~~~{.cpp} = "8" <_> <_> <_> <_> <_> ; @@ -1076,7 +1076,7 @@ The example record is interpreted as a line which passes through a point *P*=(3 **BNF-like Definition** -~~~~ +~~~~{.cpp} <2D curve record 2> = "2" <_> <2D circle center> <_> <2D circle Dx> <_> <2D circle Dy> <_> <2D circle radius> <_\n>; <2D circle center> = <2D point>; @@ -1247,7 +1247,7 @@ The example record is interpreted as a Bezier curve with a rational flag *r*=1, **BNF-like Definition** -~~~~ +~~~~{.cpp} <2D curve record 7> = "7" <_> <2D B-spline rational flag> <_> "0" <_> <2D B-spline degree> <_> <2D B-spline pole count> <_> <2D B-spline multiplicity knot count> <2D B-spline weight poles> <_\n> <2D B-spline multiplicity knots> <_\n>; <2D B-spline rational flag> = ; @@ -1430,7 +1430,7 @@ The example record describes a polyline from *m*=2 nodes with a parameter prese **BNF-like Definition** -~~~~ +~~~~{.cpp} = <_\n> ; = "Triangulations" <_> ; @@ -1785,7 +1785,7 @@ The usage of \ *U* is described belo **BNF-like Definition** -~~~~ +~~~~{.cpp} = <_> <_> <_> edge data same range flag> <_> <_\n> ; = ; @@ -1855,7 +1855,7 @@ Flags \, \ and \ = <_> <_> <_> <\n> ["2" <_> ]; = ; diff --git a/dox/tutorial/tutorial.md b/dox/tutorial/tutorial.md index 5447e2f237..7858488bef 100644 --- a/dox/tutorial/tutorial.md +++ b/dox/tutorial/tutorial.md @@ -66,19 +66,19 @@ To choose the best class for this application, consider the following: Since all the points you will define are only used to create the profile's curves, an object with a limited lifetime will do. Choose the *gp_Pnt* class. To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of the points in the global Cartesian coordinate system: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt aPnt1(-myWidth / 2., 0, 0); gp_Pnt aPnt2(-myWidth / 2., -myThickness / 4., 0); gp_Pnt aPnt3(0, -myThickness / 2., 0); gp_Pnt aPnt4(myWidth / 2., -myThickness / 4., 0); gp_Pnt aPnt5(myWidth / 2., 0, 0); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Once your objects are instantiated, you can use methods provided by the class to access and modify its data. For example, to get the X coordinate of a point: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Standard_Real xValue1 = aPnt1.X(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB2_2 Profile: Defining the Geometry With the help of the previously defined points, you can compute a part of the bottle's profile geometry. As shown in the figure below, it will consist of two segments and one arc. @@ -95,15 +95,15 @@ This is because the *GC* provides two algorithm classes which are exactly what i Both of these classes return a *Geom_TrimmedCurve* manipulated by handle. This entity represents a base curve (line or circle, in our case), limited between two of its parameter values. For example, circle C is parameterized between 0 and 2PI. If you need to create a quarter of a circle, you create a *Geom_TrimmedCurve* on C limited between 0 and M_PI/2. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2); Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ All *GC* classes provide a casting method to obtain a result automatically with a function-like call. Note that this method will raise an exception if construction has failed. To handle possible errors more explicitly, you may use the *IsDone* and *Value* methods. For example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} GC_MakeSegment mkSeg (aPnt1, aPnt2); Handle(Geom_TrimmedCurve) aSegment1; if(mkSegment.IsDone()){ @@ -112,7 +112,7 @@ All *GC* classes provide a casting method to obtain a result automatically with else { // handle error } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB2_3 Profile: Defining the Topology @@ -144,18 +144,18 @@ Referring to the previous table, to build the profile, you will create: However, the *TopoDS* package provides only the data structure of the topological entities. Algorithm classes available to compute standard topological objects can be found in the *BRepBuilderAPI* package. To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aSegment1); TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aArcOfCircle); TopoDS_Edge aEdge3 = BRepBuilderAPI_MakeEdge(aSegment2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ In Open CASCADE Technology, you can create edges in several ways. One possibility is to create an edge directly from two points, in which case the underlying geometry of this edge is a line, bounded by two vertices being automatically computed from the two input points. For example, aEdge1 and aEdge3 could have been computed in a simpler way: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Edge aEdge1 = BRepBuilderAPI_MakeEdge(aPnt1, aPnt3); TopoDS_Edge aEdge2 = BRepBuilderAPI_MakeEdge(aPnt4, aPnt5); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWire* class. There are two ways of building a wire with this class: @@ -164,9 +164,9 @@ To connect the edges, you need to create a wire with the *BRepBuilderAPI_MakeWir When building a wire from less than four edges, as in the present case, you can use the constructor directly as follows: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(aEdge1, aEdge2, aEdge3); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB2_4 Profile: Completing the Profile @@ -186,17 +186,17 @@ The first way is to define it from scratch, using its geometric definition: * X axis is located at (0, 0, 0) - use the *gp_Pnt* class. * X axis direction is (1, 0, 0) - use the *gp_Dir* class. A *gp_Dir* instance is created out of its X, Y and Z coordinates. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt aOrigin(0, 0, 0); gp_Dir xDir(1, 0, 0); gp_Ax1 xAxis(aOrigin, xDir); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The second and simplest way is to use the geometric constants defined in the gp package (origin, main directions and axis of the global coordinate system). To get the X axis, just call the *gp::OX* method: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Ax1 xAxis = gp::OX(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ As previously explained, the 3D geometric transformation is defined with the *gp_Trsf* class. There are two different ways to use this class: @@ -205,43 +205,43 @@ As previously explained, the 3D geometric transformation is defined with the *gp Since the simplest approach is always the best one, you should use the SetMirror method with the axis as the center of symmetry. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Trsf aTrsf; aTrsf.SetMirror(xAxis); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ You now have all necessary data to apply the transformation with the BRepBuilderAPI_Transform class by specifying: * the shape on which the transformation must be applied. * the geometric transformation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepBuilderAPI_Transform aBRepTrsf(aWire, aTrsf); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ *BRepBuilderAPI_Transform* does not modify the nature of the shape: the result of the reflected wire remains a wire. But the function-like call or the *BRepBuilderAPI_Transform::Shape* method returns a *TopoDS_Shape* object: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Shape aMirroredShape = aBRepTrsf.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ What you need is a method to consider the resulting reflected shape as a wire. The *TopoDS* global functions provide this kind of service by casting a shape into its real type. To cast the transformed wire, use the *TopoDS::Wire* method. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Wire aMirroredWire = TopoDS::Wire(aMirroredShape); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The bottle's profile is almost finished. You have created two wires: *aWire* and *aMirroredWire*. You need to concatenate them to compute a single shape. To do this, you use the *BRepBuilderAPI_MakeWire* class as follows: * create an instance of *BRepBuilderAPI_MakeWire*. * add all edges of the two wires by using the *Add* method on this object. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepBuilderAPI_MakeWire mkWire; mkWire.Add(aWire); mkWire.Add(aMirroredWire); TopoDS_Wire myWireProfile = mkWire.Wire(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @section sec3 Building the Body @@ -266,9 +266,9 @@ Your current profile is a wire. Referring to the Shape/Generates table, you need To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires. When the wire lies on a plane, the surface is automatically computed. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The *BRepPrimAPI* package provides all the classes to create topological primitive constructions: boxes, cones, cylinders, spheres, etc. Among them is the *BRepPrimAPI_MakePrism* class. As specified above, the prism is defined by: @@ -277,15 +277,15 @@ The *BRepPrimAPI* package provides all the classes to create topological primiti You want the solid to be finite, swept along the Z axis and to be myHeight height. The vector, defined with the *gp_Vec* class on its X, Y and Z coordinates, is: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Vec aPrismVec(0, 0, myHeight); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ All the necessary data to create the main body of your bottle is now available. Just apply the *BRepPrimAPI_MakePrism* class to compute the solid: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile, aPrismVec); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB3_2 Applying Fillets @@ -305,9 +305,9 @@ To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* * Add the fillet descriptions (an edge and a radius) using the *Add* method (you can add as many edges as you need). * Ask for the resulting filleted shape with the *Shape* method. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepFilletAPI_MakeFillet mkFillet(myBody); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ To add the fillet description, you need to know the edges belonging to your shape. The best solution is to explore your solid to retrieve its edges. This kind of functionality is provided with the *TopExp_Explorer* class, which explores the data structure described in a *TopoDS_Shape* and extracts the sub-shapes you specifically need. Generally, this explorer is created by providing the following information: @@ -315,9 +315,9 @@ Generally, this explorer is created by providing the following information: * the shape to explore * the type of sub-shapes to be found. This information is given with the *TopAbs_ShapeEnum* enumeration. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopExp_Explorer anEdgeExplorer(myBody, TopAbs_EDGE); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ An explorer is usually applied in a loop by using its three main methods: @@ -326,26 +326,26 @@ An explorer is usually applied in a loop by using its three main methods: * *Next()* to move onto the next sub-shape to explore. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} while(anEdgeExplorer.More()){ TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExplorer.Current()); //Add edge to fillet algorithm ... anEdgeExplorer.Next(); } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ In the explorer loop, you have found all the edges of the bottle shape. Each one must then be added in the *BRepFilletAPI_MakeFillet* instance with the *Add()* method. Do not forget to specify the radius of the fillet along with it. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} mkFillet.Add(myThickness / 12., anEdge); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Once this is done, you perform the last step of the procedure by asking for the filleted shape. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} myBody = mkFillet.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB3_3 Adding the Neck @@ -358,31 +358,31 @@ To add a neck to the bottle, you will create a cylinder and fuse it to the body. To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two). To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt neckLocation(0, 0, myHeight); gp_Dir neckAxis = gp::DZ(); gp_Ax2 neckAx2(neckLocation, neckAxis); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ To create a cylinder, use another class from the primitives construction package: the *BRepPrimAPI_MakeCylinder* class. The information you must provide is: * the coordinate system where the cylinder will be located; * the radius and height. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Standard_Real myNeckRadius = myThickness / 4.; Standard_Real myNeckHeight = myHeight / 10; BRepPrimAPI_MakeCylinder MKCylinder(neckAx2, myNeckRadius, myNeckHeight); TopoDS_Shape myNeck = MKCylinder.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ You now have two separate parts: a main body and a neck that you need to fuse together. The *BRepAlgoAPI* package provides services to perform Boolean operations between shapes, and especially: *common* (Boolean intersection), *cut* (Boolean subtraction) and *fuse* (Boolean union). Use *BRepAlgoAPI_Fuse* to fuse the two shapes: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} myBody = BRepAlgoAPI_Fuse(myBody, myNeck); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB3_4 Creating a Hollowed Solid @@ -411,11 +411,11 @@ The challenging part in this procedure is to find the face to remove from your s To find the face with such characteristics, you will once again use an explorer to iterate on all the bottle's faces to find the appropriate one. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} for(TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){ TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current()); } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ For each detected face, you need to access the geometric properties of the shape: use the *BRep_Tool* class for that. The most commonly used methods of this class are: @@ -423,9 +423,9 @@ For each detected face, you need to access the geometric properties of the shape * *Curve* to access the 3D curve of an edge; * *Point* to access the 3D point of a vertex. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ As you can see, the *BRep_Tool::Surface* method returns an instance of the *Geom_Surface* class manipulated by handle. However, the *Geom_Surface* class does not provide information about the real type of the object *aSurface*, which could be an instance of *Geom_Plane*, *Geom_CylindricalSurface*, etc. All objects manipulated by handle, like *Geom_Surface*, inherit from the *Standard_Transient* class which provides two very useful methods concerning types: @@ -436,52 +436,52 @@ All objects manipulated by handle, like *Geom_Surface*, inherit from the *Standa DynamicType returns the real type of the object, but you need to compare it with the existing known types to determine whether *aSurface* is a plane, a cylindrical surface or some other type. To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, which returns the type of a class: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){ // } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ If this comparison is true, you know that the *aSurface* real type is *Geom_Plane*. You can then convert it from *Geom_Surface* to *Geom_Plane* by using the *DownCast()* method provided by each class inheriting *Standard_Transient*. As its name implies, this static method is used to downcast objects to a given type with the following syntax: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Remember that the goal of all these conversions is to find the highest face of the bottle lying on a plane. Suppose that you have these two global variables: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Face faceToRemove; Standard_Real zMax = -1; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ You can easily find the plane whose origin is the biggest in Z knowing that the location of the plane is given with the *Geom_Plane::Location* method. For example: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt aPnt = aPlane->Location(); Standard_Real aZ = aPnt.Z(); if(aZ > zMax){ zMax = aZ; faceToRemove = aFace; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ You have now found the top face of the neck. Your final step before creating the hollowed solid is to put this face in a list. Since more than one face can be removed from the initial solid, the *BRepOffsetAPI_MakeThickSolid* constructor takes a list of faces as arguments. Open CASCADE Technology provides many collections for different kinds of objects: see *TColGeom* package for collections of objects from *Geom* package, *TColgp* package for collections of objects from gp package, etc. The collection for shapes can be found in the *TopTools* package. As *BRepOffsetAPI_MakeThickSolid* requires a list, use the *TopTools_ListOfShape* class. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopTools_ListOfShape facesToRemove; facesToRemove.Append(faceToRemove); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ All the necessary data are now available so you can create your hollowed solid by calling the *BRepOffsetAPI_MakeThickSolid* MakeThickSolidByJoin method: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepOffsetAPI_MakeThickSolid BodyMaker; BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); myBody = BodyMaker.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @section sec4 Building the Threading @@ -504,11 +504,11 @@ Using the same coordinate system *neckAx2* used to position the neck, you create Notice that one of the cylindrical surfaces is smaller than the neck. There is a good reason for this: after the thread creation, you will fuse it with the neck. So, we must make sure that the two shapes remain in contact. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB4_2 Defining 2D Curves @@ -564,11 +564,11 @@ To use 2D primitive geometry types of Open CASCADE Technology for defining a poi * To define a 2D direction (unit vector) from its X and Y coordinates, use the gp_Dir2d class. The coordinates will automatically be normalized. * To define a 2D right-handed coordinate system, use the *gp_Ax2d* class, which is computed from a point (origin of the coordinate system) and a direction - the X direction of the coordinate system. The Y direction will be automatically computed. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt2d aPnt(2. * M_PI, myNeckHeight / 2.); gp_Dir2d aDir(2. * M_PI, myNeckHeight / 4.); gp_Ax2d anAx2d(aPnt, aDir); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ You will now define the curves. As previously mentioned, these thread profiles are computed on two cylindrical surfaces. In the following figure, curves on the left define the base (on *aCyl1* surface) and the curves on the right define the top of the thread's shape (on *aCyl2* surface). @@ -588,36 +588,36 @@ Supposing that: Your ellipses are defined as follows: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Standard_Real aMajor = 2. * M_PI; Standard_Real aMinor = myNeckHeight / 10; Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ To describe portions of curves for the arcs drawn above, you define *Geom2d_TrimmedCurve* trimmed curves out of the created ellipses and two parameters to limit them. As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * XDirection) + (MinorRadius * sin(U) * YDirection), the ellipses need to be limited between 0 and M_PI. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom2d_TrimmedCurve) anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); Handle(Geom2d_TrimmedCurve) anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs. To access the point corresponding to the parameter of a curve or a surface, you use the Value or D0 method (meaning 0th derivative), D1 method is for first derivative, D2 for the second one. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0); gp_Pnt2d anEllipsePnt2; anEllipse1->D0(M_PI, anEllipsePnt2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ When creating the bottle's profile, you used classes from the *GC* package, providing algorithms to create elementary geometries. In 2D geometry, this kind of algorithms is found in the *GCE2d* package. Class names and behaviors are similar to those in *GC*. For example, to create a 2D segment out of two points: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB4_3 Building Edges and Wires @@ -637,28 +637,28 @@ Previously, you have built: To compute the edges out of these curves, once again use the *BRepBuilderAPI_MakeEdge* class. One of its constructors allows you to build an edge out of a curve described in the 2D parametric space of a surface. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Edge anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(anArc1, aCyl1); TopoDS_Edge anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment, aCyl1); TopoDS_Edge anEdge1OnSurf2 = BRepBuilderAPI_MakeEdge(anArc2, aCyl2); TopoDS_Edge anEdge2OnSurf2 = BRepBuilderAPI_MakeEdge(aSegment, aCyl2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Now, you can create the two profiles of the threading, lying on each surface. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Wire threadingWire1 = BRepBuilderAPI_MakeWire(anEdge1OnSurf1, anEdge2OnSurf1); TopoDS_Wire threadingWire2 = BRepBuilderAPI_MakeWire(anEdge1OnSurf2, anEdge2OnSurf2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Remember that these wires were built out of a surface and 2D curves. One important data item is missing as far as these wires are concerned: there is no information on the 3D curves. Fortunately, you do not need to compute this yourself, which can be a difficult task since the mathematics can be quite complex. When a shape contains all the necessary information except 3D curves, Open CASCADE Technology provides a tool to build them automatically. In the BRepLib tool package, you can use the *BuildCurves3d* method to compute 3D curves for all the edges of a shape. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepLib::BuildCurves3d(threadingWire1); BRepLib::BuildCurves3d(threadingWire2); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection OCCT_TUTORIAL_SUB4_4 Creating Threading @@ -675,12 +675,12 @@ The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, whic * Use the *CheckCompatibility* method to activate (or deactivate) the option that checks whether the wires have the same number of edges. In this case, wires have two edges each, so you can deactivate this option. * Ask for the resulting loft shape with the Shape method. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepOffsetAPI_ThruSections aTool(Standard_True); aTool.AddWire(threadingWire1); aTool.AddWire(threadingWire2); aTool.CheckCompatibility(Standard_False); TopoDS_Shape myThreading = aTool.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @section sec5 Building the Resulting Compound @@ -688,13 +688,13 @@ The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, whic You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Builder* classes to build single shape from *myBody* and *myThreading*: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Compound aRes; BRep_Builder aBuilder; aBuilder.MakeCompound (aRes); aBuilder.Add (aRes, myBody); aBuilder.Add (aRes, myThreading); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application: @@ -709,7 +709,7 @@ If you want to know more and develop major projects using Open CASCADE Technolog Complete definition of MakeBottle function (defined in the file src/MakeBottle.cxx of the Tutorial): -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} TopoDS_Shape MakeBottle(const Standard_Real myWidth, const Standard_Real myHeight, const Standard_Real myThickness) { @@ -846,5 +846,5 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c return aRes; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ diff --git a/dox/upgrade/upgrade.md b/dox/upgrade/upgrade.md index d41c636374..dd2bae3b1e 100644 --- a/dox/upgrade/upgrade.md +++ b/dox/upgrade/upgrade.md @@ -39,7 +39,7 @@ Porting of user applications from an earlier OCCT version to version 6.5 require Porting of user applications from an earlier OCCT version to version 6.5.1 requires taking into account the following major changes: * Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection: -~~~~ +~~~~{.cpp} const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups(); Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup(); Standard_Integer aLen = aGroupsSeq.Length(); @@ -62,7 +62,7 @@ Porting of user applications from an earlier OCCT version to version 6.5.2 requi * If the callback mechanism in call_togl_redraw function was used in the application code, it is necessary to revise it to take into account the new callback execution and provide a check of reason value of Aspect_GraphicCallbackStruct in callback methods to confirm that the callback code is executed at the right moment. Now the callbacks are executed before redrawing the underlayer, before redrawing the overlayer and at the end of redrawing. The information about the moment when the callback is invoked is provided with the reason value in form of an additional bit flag (OCC_PRE_REDRAW, OCC_PRE_OVERLAY). The state of OpenGl changed in callback methods will not be restored automatically, which might lead to unwanted behavior in redrawing procedure. * The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting. * It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner: -~~~~ +~~~~{.cpp} Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler); if (!aMeshAlgo.IsNull()) {} ~~~~ @@ -88,7 +88,7 @@ Porting of user applications from an earlier OCCT version to version 6.5.3 requi Porting of user applications from an earlier OCCT version to version 6.5.4 requires taking into account the following major changes: * The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below: -~~~~ +~~~~{.cpp} #include void dump (Handle(V3d_View)& theView3D) { @@ -121,7 +121,7 @@ Correspondingly, the code using methods *SetAnimationModeOn(), SetAnimationModeO * Interactive selection of 2D presentations should be set up inside *ComputeSelection()* virtual method of a custom interactive object class, using standard sensitive entities from *Select3D* package and standard or custom entity owners derived from *SelectMgr_EntityOwner* base. Refer to the Visualization User's Guide for further details concerning OCCT 3D visualization and selection classes. See also *Viewer2D* OCCT sample application, which shows how 2D drawing can be implemented using TKV3d API. * Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code: -~~~~ +~~~~{.cpp} // initialize a new viewer with OpenGl graphic driver Handle(Graphic3d_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver ("TKOpenGl"); @@ -264,7 +264,7 @@ Custom Interactive Objects should implement new virtual method *SelectMgr_Select Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example: -~~~~ +~~~~{.cpp} Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode); for (aSelection->Init(); aSelection->More(); aSelection->Next()) { @@ -286,7 +286,7 @@ The depth and distance to the center of geometry must be calculated for the 3D p Here is an example of overlap/inclusion test for a box: -~~~~ +~~~~{.cpp} if (!theMgr.IsOverlapAllowed()) // check for inclusion { Standard_Boolean isInside = Standard_True; @@ -404,26 +404,26 @@ Most of typical changes required for upgrading code for OCCT 7.0 can be done aut This tool is a Tcl script, thus Tcl should be available on your workstation to run it. Example: -~~~~~ +~~~~{.cpp} $ tclsh % source /adm/upgrade.tcl % upgrade -recurse -all -src= -~~~~~ +~~~~ On Windows, the helper batch script *upgrade.bat* can be used, provided that Tcl is either available in *PATH*, or configured via *custom.bat* script (for instance, if you use OCCT installed from Windows installer package). Start it from the command prompt: -~~~~~ +~~~~{.cpp} cmd> \upgrade.bat -recurse -all -inc=\inc -src= [options] -~~~~~ +~~~~ Run the upgrade tool without arguments to see the list of available options. The upgrade tool performs the following changes in the code. 1. Replaces macro *DEFINE_STANDARD_RTTI* by *DEFINE_STANDARD_RTTIEXT*, with second argument indicating base class for the main argument class (if inheritance is recognized by the script): -~~~~~ +~~~~{.cpp} DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base) -~~~~~ +~~~~ @note If macro *DEFINE_STANDARD_RTTI* with two arguments (used in intermediate development versions of OCCT 7.0) is found, the script will convert it to either *DEFINE_STANDARD_RTTIEXT* or *DEFINE_STANDARD_RTTI_INLINE*. The former case is used if current file is header and source file with the same name is found in the same folder. @@ -431,50 +431,50 @@ DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base) The latter variant defines all methods for RTTI as inline, and does not require *IMPLEMENT_STANDARD_RTTIEXT* macro. 2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in *TCollection* package) by inclusion of the corresponding header: -~~~~~ +~~~~{.cpp} class TColStd_Array1OfReal; -> #include -~~~~~ +~~~~ 3. Replaces underscored names of *Handle* classes by usage of a macro: -~~~~~ +~~~~{.cpp} Handle_Class -> Handle(Class) -~~~~~ +~~~~ This change is not applied if the source or header file is recognized as containing the definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see https://doc.qt.io/qt-4.8/signalsandslots.html). The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*. 4. Removes forward declarations of classes with names Handle(C) or *Handle_C*, replacing them either by forward declaration of its argument class, or (for files defining Qt objects) \#include statement for a header with the name of the argument class and extension .hxx: -~~~~~ +~~~~{.cpp} class Handle(TColStd_HArray1OfReal); -> #include -~~~~~ +~~~~ 5. Removes \#includes of files Handle_...hxx that have disappeared in OCCT 7.0: -~~~~~ +~~~~{.cpp} #include -> -~~~~~ +~~~~ 6. Removes *typedef* statements that use *Handle* macro to generate the name: -~~~~~ +~~~~{.cpp} typedef NCollection_Handle Handle(Message_Msg); -> -~~~~~ +~~~~ 7. Converts C-style casts applied to Handles into calls to DownCast() method: -~~~~~ +~~~~{.cpp} ((Handle(A)&)b) -> Handle(A)::DownCast(b) (Handle(A)&)b -> Handle(A)::DownCast(b) (*((Handle(A)*)&b)) -> Handle(A)::DownCast(b) *((Handle(A)*)&b) -> Handle(A)::DownCast(b) (*(Handle(A)*)&b) -> Handle(A)::DownCast(b) -~~~~~ +~~~~ 8. Moves Handle() macro out of namespace scope: -~~~~~ +~~~~{.cpp} Namespace::Handle(Class) -> Handle(Namespace::Class) -~~~~~ +~~~~ 9. Converts local variables of reference type, which are initialized by a temporary object returned by call to DownCast(), to the variables of non-reference type (to avoid using references to destroyed memory): -~~~~~ +~~~~{.cpp} const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b)); -~~~~~ +~~~~ 10. Adds \#include for all classes used as argument to macro STANDARD_TYPE(), except for already included ones; @@ -487,9 +487,9 @@ Namespace::Handle(Class) -> Handle(Namespace::Class) As long as the upgrade routine runs, some information messages are sent to the standard output. In some cases the warnings or errors like the following may appear: -~~~~~ +~~~~{.cpp} Error in {HEADER_FILE}: Macro DEFINE_STANDARD_RTTI used for class {CLASS_NAME} whose declaration is not found in this file, cannot fix -~~~~~ +~~~~ Be sure to check carefully all reported errors and warnings, as the corresponding code will likely require manual corrections. In some cases these messages may help you to detect errors in your code, for instance, cases where *DEFINE_STANDARD_RTTI* macro is used with incorrect class name as an argument. @@ -506,12 +506,12 @@ The use of handle objects (construction, comparison using operators == or !=, us For example, the following lines will fail to compile if *Geom_Line.hxx* is not included: -~~~~~ +~~~~{.cpp} Handle(Geom_Line) aLine = 0; if (aLine != aCurve) {...} if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...} aLine = Handle(Geom_Line)::DownCast (aCurve); -~~~~~ +~~~~ Note that it is not necessary to include header of the class to declare Handle to it. However, if you define a class *B* that uses Handle(*A*) in its fields, or contains a method returning Handle(*A*), it is advisable to have header defining *A* included in the header of *B*. @@ -523,31 +523,31 @@ This issue appears in the compilers that do not support default arguments in tem The problem is that operator const handle& is defined for any type *T2*, thus the compiler cannot make the right choice. Example: -~~~~~ +~~~~{.cpp} void func (const Handle(Geom_Curve)&); void func (const Handle(Geom_Surface)&); Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...); func (aCurve); // ambiguity error in VC++ 10 -~~~~~ +~~~~ Note that this problem can be avoided in many cases if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below". To resolve this ambiguity, change your code so that argument type should correspond exactly to the function signature. In some cases this can be done by using the relevant type for the corresponding variable, like in the example above: -~~~~~ +~~~~{.cpp} Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...); -~~~~~ +~~~~ Other variants consist in assigning the argument to a local variable of the correct type and using the direct cast or constructor: -~~~~~ +~~~~{.cpp} const Handle(Geom_Curve)& aGCurve (aTrimmedCurve); func (aGCurve); // OK - argument has exact type func (static_cast(aCurve)); // OK - direct cast func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed -~~~~~ +~~~~ Another possibility consists in defining additional template variant of the overloaded function causing ambiguity, and using *SFINAE* to resolve the ambiguity. This technique can be illustrated by the definition of the template variant of method IGESData_IGESWriter::Send(). @@ -558,31 +558,31 @@ As the cast of a handle to the reference to another handle to the base type has For example: -~~~~~ +~~~~{.cpp} Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error -~~~~~ +~~~~ The problem is that the class *GC_MakeLine* has a user-defined conversion to const Handle(Geom_TrimmedCurve)&, which is not the same as the type of the local variable *aC*. To resolve this, use method Value(): -~~~~~ +~~~~{.cpp} Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok -~~~~~ +~~~~ or use variable of the appropriate type: -~~~~~ +~~~~{.cpp} Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok -~~~~~ +~~~~ A similar problem appears with GCC compiler, when *const* handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance: -~~~~~ +~~~~{.cpp} const Handle(Geom_Line) aLine; Handle(Geom_Curve) c1 = aLine; // GCC error Handle(Geom_Curve) c2 (aLine); // ok -~~~~~ +~~~~ This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below". @@ -593,20 +593,20 @@ You might need to clean your code from incorrect use of macros *STANDARD_TYPE*() 1. Explicit definitions of static functions with names generated by macro *STANDARD_TYPE()*, which are artifacts of old implementation of RTTI, should be removed. Example: -~~~~~ +~~~~{.cpp} const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin) { static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin)); return _atype; } -~~~~~ +~~~~ 2. Incorrect location of closing parenthesis of *Handle()* macro that was not detectable in OCCT 6.x will cause a compiler error and must be corrected. Example (note misplaced closing parenthesis): -~~~~~ +~~~~{.cpp} aBSpline = Handle( Geom2d_BSplineCurve::DownCast(BS->Copy()) ); -~~~~~ +~~~~ #### Use of class Standard_AncestorIterator @@ -617,20 +617,20 @@ Class *Standard_AncestorIterator* has been removed; use method *Parent()* of *St Handles in OCCT 7.0 do not have the operator of conversion to Standard_Transient*, which was present in earlier versions. This is done to prevent possible unintended errors like this: -~~~~~ +~~~~{.cpp} Handle(Geom_Line) aLine = ...; Handle(Geom_Surface) aSurf = ...; ... if (aLine == aSurf) {...} // will cause a compiler error in OCCT 7.0, but not OCCT 6.x -~~~~~ +~~~~ The places where this implicit cast has been used should be corrected manually. The typical situation is when Handle is passed to stream: -~~~~~ +~~~~{.cpp} Handle(Geom_Line) aLine = ...; os << aLine; // in OCCT 6.9.0, resolves to operator << (void*) -~~~~~ +~~~~ Call method get() explicitly to output the address of the Handle. @@ -639,24 +639,24 @@ Call method get() explicitly to output the address of the Handle. Method *DownCast()* in OCCT 7.0 is made templated; if its argument is not a base class, "deprecated" compiler warning is generated. This is done to prevent possible unintended errors like this: -~~~~~ +~~~~{.cpp} Handle(Geom_Surface) aSurf = ; Handle(Geom_Line) aLine = Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x -~~~~~ +~~~~ The places where this cast has been used should be corrected manually. If down casting is used in a template context where the argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.: -~~~~~ +~~~~{.cpp} template bool CheckLine (const Handle(T) theArg) { Handle(Geom_Line) aLine = dynamic_cast (theArg.get()); ... } -~~~~~ +~~~~ @subsubsection upgrade_occt700_cdl_runtime Possible runtime problems @@ -671,19 +671,19 @@ This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compil Example: -~~~~~ +~~~~{.cpp} // note that DownCast() returns new temporary object! const Handle(Geom_BoundedCurve)& aBC = Handle(Geom_TrimmedCurve)::DownCast(aCurve); aBC->Transform (T); // access violation in OCCT 7.0 -~~~~~ +~~~~ @subsubsection upgrade_occt700_cdl_nocast Option to avoid cast of handle to reference to base type In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing the hierarchy of the corresponding object classes . This automatically enabled the possibility to use the handle to a derived class in all contexts where the handle to a base class was needed, e.g. to pass it in a function by reference without copying: -~~~~ +~~~~{.cpp} Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve); .... Handle(Geom_Line) aLine; @@ -705,13 +705,13 @@ This implies creation of temporary objects and hence may be more expensive at ru The code that relies on the possibility of casting to base should be amended to always use the handle of argument type in function call and to use *DownCast()* to safely convert the result to the desired type. For instance, the code from the example below can be changed as follows: -~~~~~ +~~~~{.cpp} Handle(Geom_Line) aLine; Handle(Geom_Curve) aCurve; if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) { // use aLine safely } -~~~~~ +~~~~ @subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x @@ -724,12 +724,12 @@ If you like to preserve the compatibility of your application code with OCCT ver 3. Define macros *DEFINE_STANDARD_RTTIEXT* and *DEFINE_STANDARD_RTTI_INLINE* when building with previous versions of OCCT, resolving to *DEFINE_STANDARD_RTTI* with single argument Example: -~~~~~ +~~~~{.cpp} #if OCC_VERSION_HEX < 0x070000 #define DEFINE_STANDARD_RTTIEXT(C1,C2) DEFINE_STANDARD_RTTI(C1) #define DEFINE_STANDARD_RTTI_INLINE(C1,C2) DEFINE_STANDARD_RTTI(C1) #endif -~~~~~ +~~~~ @subsubsection upgrade_occt700_cdl_wok Applications based on CDL and WOK @@ -768,7 +768,7 @@ The code that used the tools provided by that package should be corrected manual The recommended approach is to use sorting algorithms provided by STL. For instance: -~~~~~ +~~~~{.cpp} #include #include #include @@ -777,15 +777,15 @@ TCollection_Array1OfReal aValues = ...; ... TCollection_CompareOfReal aCompReal; SortTools_StraightInsertionSortOfReal::Sort(aValues, aCompReal); -~~~~~ +~~~~ can be replaced by: -~~~~~ +~~~~{.cpp} #include ... TCollection_Array1OfReal aValues = ...; ... std::stable_sort (aValues.begin(), aValues.end()); -~~~~~ +~~~~ @subsection upgrade_occt700_2dlayers On-screen objects and ColorScale @@ -802,7 +802,7 @@ Predefined Z-layers *Graphic3d_ZLayerId_TopOSD* and *Graphic3d_ZLayerId_BotOSD* The property of *V3d_View* storing the global *ColorScale* object has been removed with associated methods *V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed()* and *V3d_View::ColorScale()* as well as the classes *V3d_ColorScale, V3d_ColorScaleLayerItem* and *Aspect_ColorScale*. Here is an example of creating *ColorScale* using the updated API: -~~~~~ +~~~~{.cpp} Handle(AIS_ColorScale) aCS = new AIS_ColorScale(); // configuring Standard_Integer aWidth, aHeight; @@ -815,13 +815,13 @@ aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD); aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); aCS->SetToUpdate(); theContextAIS->Display (aCS); -~~~~~ +~~~~ To see how 2d objects are implemented in OCCT you can call Draw commands *vcolorscale, vlayerline* or *vdrawtext* (with -2d option). Draw command *vcolorscale* now requires the name of *ColorScale* object as argument. To display this object use command *vdisplay*. For example: -~~~~~ +~~~~{.cpp} pload VISUALIZATION vinit vcolorscale cs -demo @@ -832,16 +832,16 @@ vsetdispmode 1 vfit vlayerline 0 300 300 300 10 vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red -~~~~~ +~~~~ Here is a small example in C++ illustrating how to display a custom AIS object in 2d: -~~~~~ +~~~~{.cpp} Handle(AIS_InteractiveContext) aContext = ...; Handle(AIS_InteractiveObject) anObj =...; // create an AIS object anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); // display object in overlay anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); // set 2d flag, coordinate origin is set to down-left corner aContext->Display (anObj); // display the object -~~~~~ +~~~~ @subsection upgrade_occt700_userdraw UserDraw and Visual3d @@ -879,7 +879,7 @@ The functionality previously provided by *Visual3d* package has been redesigned Old APIs based on global callback functions for creating *UserDraw* objects and for performing custom OpenGL rendering within the view have been dropped. *UserDraw* callbacks are no more required since *OpenGl_Group* now inherits *Graphic3d_Group* and thus can be accessed directly from *AIS_InteractiveObject*: -~~~~~ +~~~~{.cpp} //! Class implementing custom OpenGL element. class UserDrawElement : public OpenGl_Element {}; @@ -901,12 +901,12 @@ void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMg // invalidate bounding box of the scene thePrsMgr->StructureManager()->Update(); } -~~~~~ +~~~~ To perform a custom OpenGL code within the view, it is necessary to inherit from class *OpenGl_View*. See the following code sample: -~~~~~ +~~~~{.cpp} //! Custom view. class UserView : public OpenGl_View { @@ -953,7 +953,7 @@ public: } }; -~~~~~ +~~~~ @subsection upgrade_occt700_localcontext Deprecation of Local Context @@ -1172,22 +1172,22 @@ Class *BRepOffsetAPI_MakeOffsetShape*: * *BRepOffsetAPI_MakeOffsetShape::PerformByJoin()* - method has been added. This method is old algorithm behaviour. The code below shows new calling procedure: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepOffsetAPI_MakeOffsetShape OffsetMaker; OffsetMaker.PerformByJoin(Shape, OffsetValue, Tolerance); NewShape = OffsetMaker.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Class *BRepOffsetAPI_MakeThickSolid*: * *BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()* - constructor with parameters has been deleted. * *BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin()* - method has been added. This method is old algorithm behaviour. The code below shows new calling procedure: -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} BRepOffsetAPI_MakeThickSolid BodyMaker; BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); myBody = BodyMaker.Shape(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection upgrade_720_highlight Highlight style @@ -1317,7 +1317,7 @@ One can use this functionality in two ways: The code example below demonstrates how to read shapes from a storage driver using *StdStorage* class. -~~~~ +~~~~{.cpp} // aDriver should be created and opened for reading Handle(StdStorage_Data) aData; @@ -1355,7 +1355,7 @@ if (!aRoots.IsNull()) The following code demonstrates how to write shapes in OCCT 7.2.0 using *StdStorage* class. -~~~~ +~~~~{.cpp} // Create a file driver NCollection_Handle aFileDriver(new FSD_File()); @@ -1640,7 +1640,7 @@ The following changes have been introduced in the API of *BRepMesh_IncrementalMe Example of usage: Case 1 (explicit parameters): -~~~~ +~~~~{.cpp} #include #include #include @@ -1688,7 +1688,7 @@ In fact, drawing points or lines with lighting applied is a valid use case, but As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties. Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated. For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property: -~~~~ +~~~~{.cpp} Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect @@ -1700,7 +1700,7 @@ aGroup->AddPrimitiveArray (aTris); ~~~~ To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order: -~~~~ +~~~~{.cpp} Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); @@ -1718,7 +1718,7 @@ Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eli As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive(). Previously, computation of final value required the following code: -~~~~ +~~~~{.cpp} Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; Graphic3d_Vec3 anAmbient (0.0f); if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT)) @@ -1730,7 +1730,7 @@ if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT)) ~~~~ New code looks like this: -~~~~ +~~~~{.cpp} Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor(); if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; } @@ -1751,7 +1751,7 @@ Existing code should be updated to: Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*. The previous code: -~~~~ +~~~~{.cpp} Standard_Real x, y, z; theAttachmentPoint.Coord(x,y,z); theGroup->Text (theText, @@ -1763,7 +1763,7 @@ theGroup->Text (theText, theAspect->VerticalJustification()); ~~~~ should be replaced by the new code: -~~~~ +~~~~{.cpp} Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height()); aText->SetText (theText.ToExtString()); aText->SetPosition (theAttachmentPoint); @@ -1927,7 +1927,7 @@ The method Select3D_SensitiveEntity::NbSubElements() has been changed to be cons @subsection upgrade_750_Booleans Changes in Boolean operations algorithm * TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional: -~~~~ +~~~~{.cpp} void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS, TopTools_ListOfShape& theLS, TopTools_MapOfShape* theMap = NULL); @@ -2094,25 +2094,25 @@ corresponding type of the message. The code that used operator << for messenger, should be ported as follows. Before the change: -~~~~~ +~~~~{.cpp} Handle(Message_Messenger) theMessenger = ...; theMessenger << "Value = " << anInteger << Message_EndLine; -~~~~~ +~~~~ After the change, single-line variant: -~~~~~ +~~~~{.cpp} Handle(Message_Messenger) theMessenger = ...; theMessenger->SendInfo() << "Value = " << anInteger << std::endl; -~~~~~ +~~~~ After the change, extended variant: -~~~~~ +~~~~{.cpp} Handle(Message_Messenger) theMessenger = ...; Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo(); aSender << "Array: [ "; for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; } aSender << "]" << std::endl; // aSender can be used further for other messages -~~~~~ +~~~~ @subsection upgrade_750_message_printer Message_Printer interface change @@ -2136,13 +2136,13 @@ provided that each thread deals with its own instance of *TDataStd_Application* Note that neither *TDataStd_Application* nor *TDocStd_Document* is protected from concurrent access from several threads. Such protection, if necessary, shall be implemented on the application level. For an example, access to labels and attributes could be protected by mutex if there is a probability that different threads access the same labels / attributes: -~~~~~ +~~~~{.cpp} { Standard_Mutex::Sentry aSentry (myMainLabelAccess); TDF_Label aChildLab = aDocument->Main().NewChild(); TDataStd_Integer::Set(aChildLab, 0); } -~~~~~ +~~~~ @subsection upgrade_750_draw_hotkeys Draw Harness hotkeys @@ -2179,10 +2179,10 @@ Existing code relying on old behavior, if any, shall be rewritten. Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim. For example: -~~~~~ +~~~~{.cpp} Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V -~~~~~ +~~~~ gives different result. In current version ST1 - surface trimmed only along V, U trim is removed; After modification ST1 - surface trimmed along U and V, U trim is kept. diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index ccc6625139..d68bb10d4d 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -50,18 +50,18 @@ This documentation describes: This document is a reference manual. It contains a full description of each command. All descriptions have the format illustrated below for the exit command. -~~~~~ +~~~~{.cpp} exit -~~~~~ +~~~~ Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file. **Example:** -~~~~~ +~~~~{.cpp} # this is a very short example exit -~~~~~ +~~~~ @subsection occt_draw_1_3 Getting started @@ -86,22 +86,22 @@ The format of the file is compliant with standard Open CASCADE Technology resour Each key defines a sequence of either further (nested) keys or a name of the dynamic library. Keys can be nested down to an arbitrary level. However, cyclic dependencies between the keys are not checked. **Example:** (excerpt from DrawPlugin): -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} OCAF : VISUALIZATION, OCAFKERNEL VISUALIZATION : AISV OCAFKERNEL : DCAF DCAF : TKDCAF AISV : TKViewerTest -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_1_3_3 Activation of commands implemented in the plug-in To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness: -~~~~~ +~~~~{.cpp} pload [-PluginFileName] [[Key1] [Key2]...] -~~~~~ +~~~~ where: @@ -110,14 +110,14 @@ where: According to the OCCT resource file management rules, to access the resource file the environment variable *CSF_PluginFileNameDefaults* (and optionally *CSF_PluginFileNameUserDefaults*) must be set and point to the directory storing the resource file. If it is omitted then the plug-in resource file will be searched in the $CASROOT/src/DrawResources directory. -~~~~~ +~~~~{.cpp} Draw[] pload -DrawPlugin OCAF -~~~~~ +~~~~ This command will search the resource file *DrawPlugin* using variable *CSF_DrawPluginDefaults* (and *CSF_DrawPluginUserDefaults*) and will start with the OCAF key. Since the *DrawPlugin* is the file shipped with Open CASCADE Technology it will be found in the $CASROOT/src/DrawResources directory (unless this location is redefined by user's variables). The OCAF key will be recursively extracted into two toolkits/plug-ins: *TKDCAF* and *TKViewerTest* (e.g. on Windows they correspond to *TKDCAF.dll* and *TKViewerTest.dll*). Thus, commands implemented for Visualization and OCAF will be loaded and activated in Test Harness. -~~~~~ +~~~~{.cpp} Draw[] pload (equivalent to pload -DrawPlugin DEFAULT). -~~~~~ +~~~~ This command will find the default DrawPlugin file and the DEFAULT key. The latter finally maps to the TKTopTest toolkit which implements basic modeling commands. @@ -140,11 +140,11 @@ TCL is an interpreted command language, not a structured language like C, Pascal The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} set a 24 set b 15 set a 25; set b 15 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Each command consists of one or more *words*; the first word is the name of a command and additional words are arguments to that command. @@ -157,7 +157,7 @@ The following substitutions are performed by TCL: Variable substitution is triggered by the $ character (as with csh), the content of the variable is substituted; { } may be used as in csh to enclose the name of the variable. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # set a variable value set file documentation puts $file #to display file contents on the screen @@ -172,19 +172,19 @@ set pfile ${file}PS # a last one, # delete files NEWdocumentation and OLDdocumentation foreach prefix {NEW OLD} {rm $prefix$file} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted. Compare command construction in csh. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} set degree 30 set pi 3.14159265 # expr is a command evaluating a numeric expression set radian [expr $pi*$degree/180] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Backslash substitution is triggered by the backslash character. It is used to insert special characters like $, [ , ] , etc. It is also useful to insert a new line, a backslash terminated line is continued on the following line. @@ -193,16 +193,16 @@ TCL uses two forms of *quoting* to prevent substitution and word breaking. Double quote *quoting* enables the definition of a string with space and tabs as a single word. Substitutions are still performed inside the inverted commas " ". **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # set msg to ;the price is 12.00; set price 12.00 set msg ;the price is $price; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Braces *quoting* prevents all substitutions. Braces are also nested. The main use of braces is to defer evaluation when defining procedures and control structures. Braces are used for a clearer presentation of TCL scripts on several lines. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} set x 0 # this will loop for ever # because while argument is ;0 < 3; @@ -220,22 +220,22 @@ while {$x < 3} { set x [expr $x+1] } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Comments start with a \# character as the first non-blank character in a command. To add a comment at the end of the line, the comment must be preceded by a semi-colon to end the preceding command. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # This is a comment set a 1 # this is not a comment set b 1; # this is a comment -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ The number of words is never changed by substitution when parsing in TCL. For example, the result of a substitution is always a single word. This is different from csh but convenient as the behavior of the parser is more predictable. It may sometimes be necessary to force a second round of parsing. **eval** accomplishes this: it accepts several arguments, concatenates them and executes the resulting script. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~{.cpp} # I want to delete two files set files ;foo bar; @@ -246,7 +246,7 @@ set files ;foo bar; exec rm $files # a second evaluation will do it -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection occt_draw_2_3 Accessing variables in TCL and Draw @@ -261,22 +261,22 @@ There are many kinds of Draw variables, and new ones may be added with C++. Geom Draw numeric variables can be used within an expression anywhere a Draw command requires a numeric value. The *expr* command is useless in this case as the variables are stored not as strings but as floating point values. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # dset is used for numeric variables # pi is a predefined Draw variable dset angle pi/3 radius 10 point p radius*cos(angle) radius*sin(angle) 0 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ It is recommended that you use TCL variables only for strings and Draw for numerals. That way, you will avoid the *expr* command. As a rule, Geometry and Topology require numbers but no strings. @subsubsection occt_draw_2_3_1 set, unset Syntax: -~~~~~ +~~~~{.cpp} set varname [value] unset varname [varname varname ...] -~~~~~ +~~~~ *set* assigns a string value to a variable. If the variable does not already exist, it is created. @@ -285,14 +285,14 @@ Without a value, *set* returns the content of the variable. *unset* deletes variables. It is also used to delete Draw variables. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} set a "Hello world" set b "Goodbye" set a == "Hello world" unset a b set a -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ **Note**, that the *set* command can set only one variable, unlike the *dset* command. @@ -301,10 +301,10 @@ set a Syntax -~~~~~ +~~~~{.cpp} dset var1 value1 vr2 value2 ... dval name -~~~~~ +~~~~ *dset* assigns values to Draw numeric variables. The argument can be any numeric expression including Draw numeric variables. Since all Draw commands expect a numeric expression, there is no need to use $ or *expr*. The *dset* command can assign several variables. If there is an odd number of arguments, the last variable will be assigned a value of 0. If the variable does not exist, it will be created. @@ -312,7 +312,7 @@ dval name **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # z is set to 0 dset x 10 y 15 z == 0 @@ -323,17 +323,17 @@ point p x y z # "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. @subsubsection occt_draw_2_3_3 del, dall Syntax: -~~~~~ +~~~~{.cpp} del varname_pattern [varname_pattern ...] dall -~~~~~ +~~~~ *del* command does the same thing as *unset*, but it deletes the variables matched by the pattern. @@ -346,13 +346,13 @@ TCL uses lists. A list is a string containing elements separated by spaces or ta This allows you to insert lists within lists. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # a list of 3 strings ;a b c; # a list of two strings the first is a list of 2 ;{a b} c; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ Many TCL commands return lists and **foreach** is a useful way to create loops on list elements. @@ -368,16 +368,16 @@ TCL allows looping using control structures. The control structures are implemen Syntax -~~~~~ +~~~~{.cpp} if condition script [elseif script .... else script] -~~~~~ +~~~~ **If** evaluates the condition and the script to see whether the condition is true. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} if {$x > 0} { puts ;positive; } elseif {$x == 0} { @@ -385,23 +385,23 @@ puts ;null; } else { puts ;negative; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_2_5_2 while, for, foreach Syntax: -~~~~~ +~~~~{.cpp} while condition script for init condition reinit script foreach varname list script -~~~~~ +~~~~ The three loop structures are similar to their C or csh equivalent. It is important to use braces to delay evaluation. **foreach** will assign the elements of the list to the variable before evaluating the script. \ **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # while example dset x 1.1 while {[dval x] < 100} { @@ -416,28 +416,28 @@ for {set i 0} {$i < 10} {incr i} { } # foreach example foreach object {crapo tomson lucas} {display $object} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_2_5_3 break, continue Syntax: -~~~~~ +~~~~{.cpp} break continue -~~~~~ +~~~~ Within loops, the **break** and **continue** commands have the same effect as in C. **break** interrupts the innermost loop and **continue** jumps to the next iteration. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # search the index for which t$i has value ;secret; for {set i 1} {$i <= 100} {incr i} { if {[set t$i] == ;secret;} break; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection occt_draw_2_6 Procedures @@ -454,16 +454,16 @@ As TCL is not a strongly typed language it is very difficult to detect programmi Syntax: -~~~~~ +~~~~{.cpp} proc argumentlist script -~~~~~ +~~~~ **proc** defines a procedure. An argument may have a default value. It is then a list of the form {argument value}. The script is the body of the procedure. **return** gives a return value to the procedure. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # simple procedure proc hello {} { puts ;hello world; @@ -478,17 +478,17 @@ proc fact n { return [expr n*[fact [expr n -1]]] } } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_2_6_2 global, upvar Syntax: -~~~~~ +~~~~{.cpp} global varname [varname ...] upvar varname localname [varname localname ...] -~~~~~ +~~~~ **global** accesses high level variables. Unlike C, global variables are not visible in procedures. @@ -498,7 +498,7 @@ upvar varname localname [varname localname ...] **Note** that in the following examples the \$ character is always necessarily used to access the arguments. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # convert degree to radian # pi is a global variable proc deg2rad (degree} { @@ -509,7 +509,7 @@ proc linang {linename x y angle} { upvar linename l line l $x $y cos($angle) sin($angle) } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @section occt_draw_3 Basic Commands @@ -538,9 +538,9 @@ This section describes several useful commands: Syntax: -~~~~~ +~~~~{.cpp} help [command [helpstring group]] -~~~~~ +~~~~ Provides help or modifies the help information. @@ -549,18 +549,18 @@ Provides help or modifies the help information. Specifying the command returns its syntax and in some cases, information on the command, The joker \* is automatically added at the end so that all completing commands are returned as well. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # Gives help on all commands starting with *a* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_3_1_2 source Syntax: -~~~~~ +~~~~{.cpp} source filename -~~~~~ +~~~~ Executes a file. The **exit** command will terminate the file. @@ -569,9 +569,9 @@ The **exit** command will terminate the file. Syntax: -~~~~~ +~~~~{.cpp} spy [filename] -~~~~~ +~~~~ Saves interactive commands in the file. If spying has already been performed, the current file is closed. **spy** without an argument closes the current file and stops spying. If a file already exists, the file is overwritten. Commands are not appended. @@ -580,12 +580,12 @@ If a command returns an error it is saved with a comment mark. The file created by **spy** can be executed with the **source** command. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # all commands will be saved in the file ;session; spy session # the file ;session; is closed and commands are not saved spy -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @@ -593,38 +593,38 @@ spy Syntax: -~~~~~ +~~~~{.cpp} cpulimit [nbseconds] -~~~~~ +~~~~ **cpulimit**limits a process after the number of seconds specified in nbseconds. It is used in tests to avoid infinite loops. **cpulimit** without arguments removes all existing limits. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} #limit cpu to one hour cpulimit 3600 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_3_1_5 wait Syntax: -~~~~~ +~~~~{.cpp} wait [nbseconds] -~~~~~ +~~~~ Suspends execution for the number of seconds specified in *nbseconds*. The default value is ten (10) seconds. This is a useful command for a slide show. -~~~~~ +~~~~{.cpp} # You have ten seconds ... wait -~~~~~ +~~~~ @subsubsection occt_draw_3_1_6 chrono Syntax: -~~~~~ +~~~~{.cpp} chrono [ name start/stop/reset/show/restart/[counter text]] -~~~~~ +~~~~ Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed. @@ -637,31 +637,31 @@ With arguments, **chrono** is used to manage activated chronometers. You can per * display the current time with specified text (output example - *COUNTER text: N*), command testdiff will compare such outputs between two test runs (counter). **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} chrono ==Chronometers activated. ptorus t 20 5 ==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds ==CPU user time: 0.01 seconds ==CPU system time: 0 seconds -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection occt_draw_3_2 Variable management commands @subsubsection occt_draw_3_2_1 isdraw, directory Syntax: -~~~~~ +~~~~{.cpp} isdraw varname directory [pattern] -~~~~~ +~~~~ **isdraw** tests to see if a variable is a Draw variable. **isdraw** will return 1 if there is a Draw value attached to the variable. Use **directory** to return a list of all Draw global variables matching a pattern. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} set a 1 isdraw a === 0 @@ -676,24 +676,24 @@ isdraw c # to destroy all Draw objects with name containing curve foreach var [directory *curve*] {unset $var} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_3_2_2 whatis, dump Syntax: -~~~~~ +~~~~{.cpp} whatis varname [varname ...] dump varname [varname ...] -~~~~~ +~~~~ **whatis** returns short information about a Draw variable. This is usually the type name. **dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} circle c 0 0 1 0 5 whatis c c is a 2d curve @@ -706,7 +706,7 @@ Center :0, 0 XAxis :1, 0 YAxis :-0, 1 Radius :5 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ **Note** The behavior of *whatis* on other variables (not Draw) is not excellent. @@ -714,31 +714,31 @@ Radius :5 @subsubsection occt_draw_3_2_3 renamevar, copy Syntax: -~~~~~ +~~~~{.cpp} renamevar varname tovarname [varname tovarname ...] copy varname tovarname [varname tovarname ...] -~~~~~ +~~~~ * **renamevar** changes the name of a Draw variable. The original variable will no longer exist. Note that the content is not modified. Only the name is changed. * **copy** creates a new variable with a copy of the content of an existing variable. The exact behavior of **copy** is type dependent; in the case of certain topological variables, the content may still be shared. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} circle c1 0 0 1 0 5 renamevar c1 c2 # curves are copied, c2 will not be modified copy c2 c3 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_3_2_4 datadir, save, restore Syntax: -~~~~~ +~~~~{.cpp} datadir [directory] save variable [filename] restore filename [variablename] -~~~~~ +~~~~ * **datadir** without arguments prints the path of the current data directory. * **datadir** with an argument sets the data directory path. \ @@ -751,7 +751,7 @@ If the path starts with a dot (.) only the last directory name will be changed i The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # note how TCL accesses shell environment variables # using $env() datadir @@ -770,7 +770,7 @@ ls [datadir] restore theBox == theBox -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsection occt_draw_3_3 User defined commands @@ -782,7 +782,7 @@ restore theBox #### In *DrawTrSurf* package: -~~~~~ +~~~~{.cpp} void Set(Standard_CString& Name,const gp_Pnt& G) ; void Set(Standard_CString& Name,const gp_Pnt2d& G) ; void Set(Standard_CString& Name, @@ -795,51 +795,51 @@ void Set(Standard_CString& Name, const Handle(Poly_Polygon3D)& P) ; void Set(Standard_CString& Name, const Handle(Poly_Polygon2D)& P) ; -~~~~~ +~~~~ #### In *DBRep* package: -~~~~~ +~~~~{.cpp} void Set(const Standard_CString Name, const TopoDS_Shape& S) ; -~~~~~ +~~~~ Example of *DrawTrSurf* -~~~~~ +~~~~{.cpp} Handle(Geom2d_Circle) C1 = new Geom2d_Circle (gce_MakeCirc2d (gp_Pnt2d(50,0,) 25)); DrawTrSurf::Set(char*, C1); -~~~~~ +~~~~ Example of *DBRep* -~~~~~ +~~~~{.cpp} TopoDS_Solid B; B = BRepPrimAPI_MakeBox (10,10,10); DBRep::Set(char*,B); -~~~~~ +~~~~ @subsubsection occt_draw_3_3_2 get #### In *DrawTrSurf* package: -~~~~~ +~~~~{.cpp} Handle_Geom_Geometry Get(Standard_CString& Name) ; -~~~~~ +~~~~ #### In *DBRep* package: -~~~~~ +~~~~{.cpp} TopoDS_Shape Get(Standard_CString& Name, const TopAbs_ShapeEnum Typ = TopAbs_SHAPE, const Standard_Boolean Complain = Standard_True) ; -~~~~~ +~~~~ Example of *DrawTrSurf* -~~~~~ +~~~~{.cpp} Standard_Integer MyCommand (Draw_Interpretor& theCommands, Standard_Integer argc, char** argv) @@ -848,11 +848,11 @@ Standard_Integer argc, char** argv) // name Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]); } -~~~~~ +~~~~ Example of *DBRep* -~~~~~ +~~~~{.cpp} Standard_Integer MyCommand (Draw_Interpretor& theCommands, Standard_Integer argc, char** argv) @@ -861,7 +861,7 @@ Standard_Integer argc, char** argv) // name TopoDS_Solid B = DBRep::Get(argv[1]); } -~~~~~ +~~~~ @section occt_draw_4 Graphic Commands @@ -872,10 +872,10 @@ Graphic commands are used to manage the Draw graphic system. Draw provides a 2d @subsubsection occt_draw_4_1_1 view, delete Syntax: -~~~~~ +~~~~{.cpp} view index type [X Y W H] delete [index] -~~~~~ +~~~~ **view** is the basic view creation command: it creates a new view with the given index. If a view with this index already exits, it is deleted. The view is created with default parameters and X Y W H are the position and dimensions of the window on the screen. Default values are 0, 0, 500, 500. @@ -893,7 +893,7 @@ Type selects from the following range: The index, the type, the current zoom are displayed in the window title . **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # this is the content of the mu4 procedure proc mu4 {} { delete @@ -902,7 +902,7 @@ view 2 +X+Y 320 450 400 400 view 3 +Y+Z 728 20 400 400 view 4 AXON 728 450 400 400 } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview** @@ -910,12 +910,12 @@ See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, sm Syntax: -~~~~~ +~~~~{.cpp} axo pers ... smallview type -~~~~~ +~~~~ All these commands are procedures used to define standard screen layout. They delete all existing views and create new ones. The layout usually complies with the European convention, i.e. a top view is under a front view. @@ -933,12 +933,12 @@ See also: **view**, **delete** Syntax: -~~~~~ +~~~~{.cpp} mu [index] value 2dmu [index] value zoom [index] value wzoom -~~~~~ +~~~~ * **mu** (magnify up) increases the zoom in one or several views by a factor of 10%. * **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd** @@ -947,7 +947,7 @@ perform the same on one or all 2d views. * **wzoom** (window zoom) allows you to select the area you want to zoom in on with the mouse. You will be prompted to give two of the corners of the area that you want to magnify and the rectangle so defined will occupy the window of the view. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # set a zoom of 2.5 zoom 2.5 @@ -955,7 +955,7 @@ perform the same on one or all 2d views. mu 1 # magnify by 20% -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ See also: **fit**, **2dfit** @@ -963,13 +963,13 @@ See also: **fit**, **2dfit** Syntax: -~~~~~ +~~~~{.cpp} pu [index] pd [index] -~~~~~ +~~~~ The p_ commands are used to pan. **pu** and **pd** pan up and down respectively; **pl** and **pr** pan to the left and to the right respectively. Each time the view is displaced by 40 pixels. When no index is given, all views will pan in the direction specified. -~~~~~ +~~~~{.cpp} # you have selected one anonometric view pu # or @@ -977,7 +977,7 @@ pu 1 # you have selected an mu4 view; the object in the third view will pan up pu 3 -~~~~~ +~~~~ See also: **fit**, **2dfit** @@ -985,22 +985,22 @@ See also: **fit**, **2dfit** Syntax: -~~~~~ +~~~~{.cpp} fit [index] 2dfit [index] -~~~~~ +~~~~ **fit** computes the best zoom and pans on the content of the view. The content of the view will be centered and fit the whole window. When fitting all views a unique zoom is computed for all the views. All views are on the same scale. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # fit only view 1 fit 1 # fit all 2d views 2dfit -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ See also: **zoom**, **mu**, **pu** @@ -1008,38 +1008,38 @@ See also: **zoom**, **mu**, **pu** Syntax: -~~~~~ +~~~~{.cpp} u [index] d [index] l [index] r [index] -~~~~~ +~~~~ **u**, **d**, **l**, **r** Rotate the object in view around its axis by five degrees up, down, left or right respectively. This command is restricted to axonometric and perspective views. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # rotate the view up u -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_7 focal, fu, fd Syntax: -~~~~~ +~~~~{.cpp} focal [f] fu [index] fd [index] -~~~~~ +~~~~ * **focal** changes the vantage point in perspective views. A low f value increases the perspective effect; a high one give a perspective similar to that of an axonometric view. The default value is 500. * **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} pers repeat 10 fd -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ **Note**: Do not use a negative or null focal value. @@ -1049,19 +1049,19 @@ See also: **pers** Syntax: -~~~~~ +~~~~{.cpp} color index name -~~~~~ +~~~~ **color** sets the color to a value. The index of the *color* is a value between 0 and 15. The name is an X window color name. The list of these can be found in the file *rgb.txt* in the X library directory. The default values are: 0 White, 1 Red, 2 Green, 3 Blue, 4 Cyan, 5 Gold, 6 Magenta, 7 Marron, 8 Orange, 9 Pink, 10 Salmon, 11 Violet, 12 Yellow, 13 Khaki, 14 Coral. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # change the value of blue color 3 "navy blue" -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ **Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc. @@ -1069,36 +1069,36 @@ color 3 "navy blue" @subsubsection occt_draw_4_1_9 dtext Syntax: -~~~~~ +~~~~{.cpp} dtext [x y [z]] string -~~~~~ +~~~~ **dtext** displays a string in all 3d or 2d views. If no coordinates are given, a graphic selection is required. If two coordinates are given, the text is created in a 2d view at the position specified. With 3 coordinates, the text is created in a 3d view. The coordinates are real space coordinates. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # mark the origins dtext 0 0 bebop dtext 0 0 0 bebop -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd Syntax: -~~~~~ +~~~~{.cpp} hardcopy [index] hcolor index width gray xwd [index] filename -~~~~~ +~~~~ * **hardcopy** creates a postcript file called a4.ps in the current directory. This file contains the postscript description of the view index, and will allow you to print the view. * **hcolor** lets you change the aspect of lines in the postscript file. It allows to specify a width and a gray level for one of the 16 colors. **width** is measured in points with default value as 1, **gray** is the gray level from 0 = black to 1 = white with default value as 0. All colors are bound to the default values at the beginning. * **xwd** creates an X window xwd file from an active view. By default, the index is set to1. To visualize an xwd file, use the unix command **xwud**. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # all blue lines (color 3) # will be half-width and gray hcolor 3 0.5 @@ -1110,7 +1110,7 @@ lpr a4.ps # make an xwd file and display it xwd theview xwud -in theview -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ **Note:** When more than one view is present, specify the index of the view. @@ -1122,10 +1122,10 @@ See also: **color** @subsubsection occt_draw_4_1_11 wclick, pick Syntax: -~~~~~ +~~~~{.cpp} wclick pick index X Y Z b [nowait] -~~~~~ +~~~~ **wclick** defers an event until the mouse button is clicked. The message just click is displayed. @@ -1141,7 +1141,7 @@ This option is useful for tracking the pointer. **Note** that the results are stored in Draw numeric variables. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # make a circle at mouse location pick index x y z b circle c x y z 0 0 1 1 0 0 0 30 @@ -1156,7 +1156,7 @@ pick index x y z b nowait circle c x y z 0 0 1 1 0 0 0 30 repaint } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ See also: **repaint** @@ -1171,7 +1171,7 @@ The variable name "." (dot) has a special status in Draw. Any Draw command expec * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # OK use dot to dump an object on the screen dump . @@ -1194,23 +1194,23 @@ point . x y z # give a name to a graphic object renamevar . x -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_12 autodisplay Syntax: -~~~~~ +~~~~{.cpp} autodisplay [0/1] -~~~~~ +~~~~ By default, Draw automatically displays any graphic object as soon as it is created. This behavior known as autodisplay can be removed with the command **autodisplay**. Without arguments, **autodisplay** toggles the autodisplay mode. The command always returns the current mode. When **autodisplay** is off, using the dot return argument is ineffective. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # c is displayed circle c 0 0 1 0 5 @@ -1221,38 +1221,38 @@ circle c 0 0 1 0 5 # c is erased, but not displayed display c -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_13 display, donly Syntax: -~~~~~ +~~~~{.cpp} display varname [varname ...] donly varname [varname ...] -~~~~~ +~~~~ * **display** makes objects visible. * **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} \# to see all objects foreach var [directory] {display $var} \# to select two objects and erase the other ones donly . . -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_14 erase, clear, 2dclear Syntax: -~~~~~ +~~~~{.cpp} erase [varname varname ...] clear 2dclear -~~~~~ +~~~~ **erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d. @@ -1260,31 +1260,31 @@ clear **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} # erase eveerything with a name starting with c_ foreach var [directory c_*] {erase $var} # clear 2d views 2dclear -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_1_14_1 disp, don, era These commands have the same meaning as correspondingly display, donly and erase, but with the difference that they evaluate the arguments using glob pattern rules. For example, to display all objects with names d_1, d_2, d_3, etc. it is enough to run the command: -~~~~~{.cpp} +~~~~{.cpp} disp d_* -~~~~~ +~~~~ @subsubsection occt_draw_4_1_15 repaint, dflush Syntax: -~~~~~ +~~~~{.cpp} repaint dflush -~~~~~ +~~~~ * **repaint** forces repainting of views. * **dflush** flushes the graphic buffers. @@ -1302,13 +1302,13 @@ See also: @ref occt_draw_4_1_11 "pick" command. @subsubsection occt_draw_4_2_1 vinit Syntax: -~~~~~ +~~~~{.cpp} vinit -~~~~~ +~~~~ Creates a new View window with the specified *view_name*. By default the view is created in the viewer and in the graphic driver shared with the active view. -~~~~ +~~~~{.cpp} name = {driverName/viewerName/viewName | viewerName/viewName | viewName} ~~~~ @@ -1318,110 +1318,110 @@ If *viewerName* is not specified the viewer will be shared with the active view. @subsubsection occt_draw_4_2_2 vhelp Syntax: -~~~~~ +~~~~{.cpp} vhelp -~~~~~ +~~~~ Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities. @subsubsection occt_draw_4_2_3 vtop Syntax: -~~~~~ +~~~~{.cpp} vtop -~~~~~ +~~~~ Displays top view in the 3D viewer window. Orientation +X+Y. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vfit vtop -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_2_4 vaxo Syntax: -~~~~~ +~~~~{.cpp} vaxo -~~~~~ +~~~~ Displays axonometric view in the 3D viewer window. Orientation +X-Y+Z. **Example:** -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp} +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vfit vaxo -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~ @subsubsection occt_draw_4_2_5 vsetbg Syntax: -~~~~~ +~~~~{.cpp} vsetbg imagefile [filltype] -~~~~~ +~~~~ Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH. **Example:** -~~~~~ +~~~~{.cpp} vinit vsetbg myimage.brep CENTERED -~~~~~ +~~~~ @subsubsection occt_draw_4_2_6 vclear Syntax: -~~~~~ +~~~~{.cpp} vclear -~~~~~ +~~~~ Removes all objects from the viewer. @subsubsection occt_draw_4_2_7 vrepaint Syntax: -~~~~~ +~~~~{.cpp} vrepaint -~~~~~ +~~~~ Forcibly redisplays the shape in the 3D viewer window. @subsubsection occt_draw_4_2_8 vfit Syntax: -~~~~~ +~~~~{.cpp} vfit -~~~~~ +~~~~ Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface. @subsubsection occt_draw_4_2_9 vzfit Syntax: -~~~~~ +~~~~{.cpp} vzfit -~~~~~ +~~~~ Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space. @subsubsection occt_draw_4_2_10 vreadpixel Syntax: -~~~~~ +~~~~{.cpp} vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name] -~~~~~ +~~~~ Read pixel value for active view. @subsubsection occt_draw_4_2_11 vselect Syntax: -~~~~~ +~~~~{.cpp} vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [shift_selection = 0|1] -~~~~~ +~~~~ Emulates different types of selection: @@ -1435,17 +1435,17 @@ Emulates different types of selection: Syntax: -~~~~~ +~~~~{.cpp} vmoveto x y -~~~~~ +~~~~ Emulates cursor movement to pixel position (x,y). @subsubsection occt_draw_4_2_13 vviewparams Syntax: -~~~~~ +~~~~{.cpp} vviewparams [-scale [s]] [-eye [x y z]] [-at [x y z]] [-up [x y z]] [-proj [x y z]] [-center x y] [-size sx] -~~~~~ +~~~~ Gets or sets the current view parameters. * If called without arguments, all view parameters are printed. * The options are: @@ -1460,25 +1460,25 @@ Gets or sets the current view parameters. @subsubsection occt_draw_4_2_14 vchangeselected Syntax: -~~~~~ +~~~~{.cpp} vchangeselected shape -~~~~~ +~~~~ Adds a shape to selection or removes one from it. @subsubsection occt_draw_4_2_16 vnbselected Syntax: -~~~~~ +~~~~{.cpp} vnbselected -~~~~~ +~~~~ Returns the number of selected objects in the interactive context. @subsubsection occt_draw_4_2_19 vhlr Syntax: -~~~~~ +~~~~{.cpp} vhlr is_enabled={on|off} [show_hidden={1|0}] -~~~~~ +~~~~ Hidden line removal algorithm: * is_enabled applies HLR algorithm. * show_hidden if equals to 1, hidden lines are drawn as dotted ones. @@ -1486,9 +1486,9 @@ Hidden line removal algorithm: @subsubsection occt_draw_4_2_20 vhlrtype Syntax: -~~~~~ +~~~~{.cpp} vhlrtype algo_type={algo|polyalgo} [shape_1 ... shape_n] -~~~~~ +~~~~ Changes the type of HLR algorithm used for shapes. If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes. @@ -1500,14 +1500,14 @@ If no shape is specified through the command arguments, the given HLR algorithm_ @subsubsection occt_draw_4_2_21 vcamera Syntax: -~~~~~ +~~~~{.cpp} vcamera [-ortho] [-projtype] [-persp] [-fovy [Angle]] [-distance [Distance]] [-stereo] [-leftEye] [-rightEye] [-iod [Distance]] [-iodType [absolute|relative]] [-zfocus [Value]] [-zfocusType [absolute|relative]] -~~~~~ +~~~~ Manages camera parameters. Prints the current value when the option is called without argument. @@ -1530,20 +1530,20 @@ Stereoscopic camera: * -zfocusType -- focus type, absolute or relative. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vfit vcamera -persp -~~~~~ +~~~~ @subsubsection occt_draw_4_2_22 vstereo Syntax: -~~~~~ +~~~~{.cpp} vstereo [0|1] [-mode Mode] [-reverse {0|1}] [-anaglyph Filter] -~~~~~ +~~~~ Defines the stereo output mode. The following modes are available: * quadBuffer -- OpenGL QuadBuffer stereo, requires driver support. Should be called BEFORE *vinit*! @@ -1557,7 +1557,7 @@ Available Anaglyph filters for -anaglyph: * redCyan, redCyanSimple, yellowBlue, yellowBlueSimple, greenMagentaSimple. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b @@ -1566,14 +1566,14 @@ vfit vcamera -stereo -iod 1 vcamera -lefteye vcamera -righteye -~~~~~ +~~~~ @subsubsection occt_draw_4_2_23 vfrustumculling Syntax: -~~~~~ +~~~~{.cpp} vfrustumculling [toEnable] -~~~~~ +~~~~ Enables/disables objects clipping. @@ -1583,14 +1583,14 @@ Enables/disables objects clipping. @subsubsection occt_draw_4_3_1 vdisplay Syntax: -~~~~~ +~~~~{.cpp} vdisplay [-noupdate|-update] [-local] [-mutable] [-neutral] [-trsfPers {pan|zoom|rotate|trihedron|full|none}=none] [-trsfPersPos X Y [Z]] [-3d|-2d|-2dTopDown] [-dispMode mode] [-highMode mode] [-layer index] [-top|-topmost|-overlay|-underlay] [-redisplay] name1 [name2] ... [name n] -~~~~~ +~~~~ Displays named objects. Option -local enables display of objects in the local selection context. @@ -1613,62 +1613,62 @@ Local selection context will be opened if there is not any. * *redisplay* recomputes presentation of objects. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 40 40 40 10 10 10 psphere s 20 vdisplay s b vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_3_2 vdonly Syntax: -~~~~~ +~~~~{.cpp} vdonly [-noupdate|-update] [name1] ... [name n] -~~~~~ +~~~~ Displays only selected or named objects. If there are no selected or named objects, nothing is done. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 40 40 40 10 10 10 psphere s 20 vdonly b vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_3_3 vdisplayall Syntax: -~~~~~ +~~~~{.cpp} vdisplayall [-local] -~~~~~ +~~~~ Displays all erased interactive objects (see vdir and vstate). Option -local enables displaying objects in the local selection context. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 40 40 40 10 10 10 psphere s 20 vdisplayall vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_3_4 verase Syntax: -~~~~~ +~~~~{.cpp} verase [name1] [name2] … [name n] -~~~~~ +~~~~ Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased. **Example:** -~~~~~ +~~~~{.cpp} vinit box b1 40 40 40 10 10 10 box b2 -40 -40 -40 10 10 10 @@ -1679,19 +1679,19 @@ vfit verase b1 # erase second box and sphere verase -~~~~~ +~~~~ @subsubsection occt_draw_4_3_5 veraseall Syntax: -~~~~~ +~~~~{.cpp} veraseall -~~~~~ +~~~~ Erases all objects displayed in the viewer. **Example:** -~~~~~ +~~~~{.cpp} vinit box b1 40 40 40 10 10 10 box b2 -40 -40 -40 10 10 10 @@ -1702,14 +1702,14 @@ vfit verase b1 # erase second box and sphere verseall -~~~~~ +~~~~ @subsubsection occt_draw_4_3_6 vsetdispmode Syntax: -~~~~~ +~~~~{.cpp} vsetdispmode [name] mode(0,1,2,3) -~~~~~ +~~~~ Sets display mode for all, selected or named objects. * *0* (*WireFrame*), @@ -1718,20 +1718,20 @@ Sets display mode for all, selected or named objects. * *3* (*Exact HideLineremoval*). **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vsetdispmode 1 vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_3_7 vdisplaytype Syntax: -~~~~~ +~~~~{.cpp} vdisplaytype type -~~~~~ +~~~~ Displays all objects of a given type. The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*. @@ -1739,9 +1739,9 @@ The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron* @subsubsection occt_draw_4_3_8 verasetype Syntax: -~~~~~ +~~~~{.cpp} verasetype type -~~~~~ +~~~~ Erases all objects of a given type. Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*. @@ -1749,16 +1749,16 @@ Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle @subsubsection occt_draw_4_3_9 vtypes Syntax: -~~~~~ +~~~~{.cpp} vtypes -~~~~~ +~~~~ Makes a list of known types and signatures in AIS. @subsubsection occt_draw_4_3_10 vaspects Syntax: -~~~~~ +~~~~{.cpp} vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults] [-setVisibility 0|1] [-setColor ColorName] [-setcolor R G B] [-unsetColor] @@ -1773,7 +1773,7 @@ vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults] [-isoontriangulation 0|1] [-setMaxParamValue {value}] -~~~~~ +~~~~ Manages presentation properties of all, selected or named objects. * *-subshapes* -- assigns presentation properties to the specified sub-shapes. @@ -1781,45 +1781,45 @@ Manages presentation properties of all, selected or named objects. If *-defaults* option is used there should not be any names of objects and *-subshapes* specifier. Aliases: -~~~~~ +~~~~{.cpp} vsetcolor [-noupdate|-update] [name] ColorName -~~~~~ +~~~~ Manages presentation properties (color, material, transparency) of all objects, selected or named. **Color**. The *ColorName* can be: *BLACK*, *MATRAGRAY*, *MATRABLUE*, *ALICEBLUE*, *ANTIQUEWHITE*, *ANTIQUEWHITE1*, *ANTIQUEWHITE2*, *ANTIQUEWHITE3*, *ANTIQUEWHITE4*, *AQUAMARINE1*, *AQUAMARINE2*, *AQUAMARINE4*, *AZURE*, *AZURE2*, *AZURE3*, *AZURE4*, *BEIGE*, *BISQUE*, *BISQUE2*, *BISQUE3*, *BISQUE4*, *BLANCHEDALMOND*, *BLUE1*, *BLUE2*, *BLUE3*, *BLUE4*, *BLUEVIOLET*, *BROWN*, *BROWN1*, *BROWN2*, *BROWN3*, *BROWN4*, *BURLYWOOD*, *BURLYWOOD1*, *BURLYWOOD2*, *BURLYWOOD3*, *BURLYWOOD4*, *CADETBLUE*, *CADETBLUE1*, *CADETBLUE2*, *CADETBLUE3*, *CADETBLUE4*, *CHARTREUSE*, *CHARTREUSE1*, *CHARTREUSE2*, *CHARTREUSE3*, *CHARTREUSE4*, *CHOCOLATE*, *CHOCOLATE1*, *CHOCOLATE2*, *CHOCOLATE3*, *CHOCOLATE4*, *CORAL*, *CORAL1*, *CORAL2*, *CORAL3*, *CORAL4*, *CORNFLOWERBLUE*, *CORNSILK1*, *CORNSILK2*, *CORNSILK3*, *CORNSILK4*, *CYAN1*, *CYAN2*, *CYAN3*, *CYAN4*, *DARKGOLDENROD*, *DARKGOLDENROD1*, *DARKGOLDENROD2*, *DARKGOLDENROD3*, *DARKGOLDENROD4*, *DARKGREEN*, *DARKKHAKI*, *DARKOLIVEGREEN*, *DARKOLIVEGREEN1*, *DARKOLIVEGREEN2*, *DARKOLIVEGREEN3*, *DARKOLIVEGREEN4*, *DARKORANGE*, *DARKORANGE1*, *DARKORANGE2*, *DARKORANGE3*, *DARKORANGE4*, *DARKORCHID*, *DARKORCHID1*, *DARKORCHID2*, *DARKORCHID3*, *DARKORCHID4*, *DARKSALMON*, *DARKSEAGREEN*, *DARKSEAGREEN1*, *DARKSEAGREEN2*, *DARKSEAGREEN3*, *DARKSEAGREEN4*, *DARKSLATEBLUE*, *DARKSLATEGRAY1*, *DARKSLATEGRAY2*, *DARKSLATEGRAY3*, *DARKSLATEGRAY4*, *DARKSLATEGRAY*, *DARKTURQUOISE*, *DARKVIOLET*, *DEEPPINK*, *DEEPPINK2*, *DEEPPINK3*, *DEEPPINK4*, *DEEPSKYBLUE1*, *DEEPSKYBLUE2*, *DEEPSKYBLUE3*, *DEEPSKYBLUE4*, *DODGERBLUE1*, *DODGERBLUE2*, *DODGERBLUE3*, *DODGERBLUE4*, *FIREBRICK*, *FIREBRICK1*, *FIREBRICK2*, *FIREBRICK3*, *FIREBRICK4*, *FLORALWHITE*, *FORESTGREEN*, *GAINSBORO*, *GHOSTWHITE*, *GOLD*, *GOLD1*, *GOLD2*, *GOLD3*, *GOLD4*, *GOLDENROD*, *GOLDENROD1*, *GOLDENROD2*, *GOLDENROD3*, *GOLDENROD4*, *GRAY*, *GRAY0*, *GRAY1*, *GRAY10*, *GRAY11*, *GRAY12*, *GRAY13*, *GRAY14*, *GRAY15*, *GRAY16*, *GRAY17*, *GRAY18*, *GRAY19*, *GRAY2*, *GRAY20*, *GRAY21*, *GRAY22*, *GRAY23*, *GRAY24*, *GRAY25*, *GRAY26*, *GRAY27*, *GRAY28*, *GRAY29*, *GRAY3*, *GRAY30*, *GRAY31*, *GRAY32*, *GRAY33*, *GRAY34*, *GRAY35*, *GRAY36*, *GRAY37*, *GRAY38*, *GRAY39*, *GRAY4*, *GRAY40*, *GRAY41*, *GRAY42*, *GRAY43*, *GRAY44*, *GRAY45*, *GRAY46*, *GRAY47*, *GRAY48*, *GRAY49*, *GRAY5*, *GRAY50*, *GRAY51*, *GRAY52*, *GRAY53*, *GRAY54*, *GRAY55*, *GRAY56*, *GRAY57*, *GRAY58*, *GRAY59*, *GRAY6*, *GRAY60*, *GRAY61*, *GRAY62*, *GRAY63*, *GRAY64*, *GRAY65*, *GRAY66*, *GRAY67*, *GRAY68*, *GRAY69*, *GRAY7*, *GRAY70*, *GRAY71*, *GRAY72*, *GRAY73*, *GRAY74*, *GRAY75*, *GRAY76*, *GRAY77*, *GRAY78*, *GRAY79*, *GRAY8*, *GRAY80*, *GRAY81*, *GRAY82*, *GRAY83*, *GRAY85*, *GRAY86*, *GRAY87*, *GRAY88*, *GRAY89*, *GRAY9*, *GRAY90*, *GRAY91*, *GRAY92*, *GRAY93*, *GRAY94*, *GRAY95*, *GREEN*, *GREEN1*, *GREEN2*, *GREEN3*, *GREEN4*, *GREENYELLOW*, *GRAY97*, *GRAY98*, *GRAY99*, *HONEYDEW*, *HONEYDEW2*, *HONEYDEW3*, *HONEYDEW4*, *HOTPINK*, *HOTPINK1*, *HOTPINK2*, *HOTPINK3*, *HOTPINK4*, *INDIANRED*, *INDIANRED1*, *INDIANRED2*, *INDIANRED3*, *INDIANRED4*, *IVORY*, *IVORY2*, *IVORY3*, *IVORY4*, *KHAKI*, *KHAKI1*, *KHAKI2*, *KHAKI3*, *KHAKI4*, *LAVENDER*, *LAVENDERBLUSH1*, *LAVENDERBLUSH2*, *LAVENDERBLUSH3*, *LAVENDERBLUSH4*, *LAWNGREEN*, *LEMONCHIFFON1*, *LEMONCHIFFON2*, *LEMONCHIFFON3*, *LEMONCHIFFON4*, *LIGHTBLUE*, *LIGHTBLUE1*, *LIGHTBLUE2*, *LIGHTBLUE3*, *LIGHTBLUE4*, *LIGHTCORAL*, *LIGHTCYAN1*, *LIGHTCYAN2*, *LIGHTCYAN3*, *LIGHTCYAN4*, *LIGHTGOLDENROD*, *LIGHTGOLDENROD1*, *LIGHTGOLDENROD2*, *LIGHTGOLDENROD3*, *LIGHTGOLDENROD4*, *LIGHTGOLDENRODYELLOW*, *LIGHTGRAY*, *LIGHTPINK*, *LIGHTPINK1*, *LIGHTPINK2*, *LIGHTPINK3*, *LIGHTPINK4*, *LIGHTSALMON1*, *LIGHTSALMON2*, *LIGHTSALMON3*, *LIGHTSALMON4*, *LIGHTSEAGREEN*, *LIGHTSKYBLUE*, *LIGHTSKYBLUE1*, *LIGHTSKYBLUE2*, *LIGHTSKYBLUE3*, *LIGHTSKYBLUE4*, *LIGHTSLATEBLUE*, *LIGHTSLATEGRAY*, *LIGHTSTEELBLUE*, *LIGHTSTEELBLUE1*, *LIGHTSTEELBLUE2*, *LIGHTSTEELBLUE3*, *LIGHTSTEELBLUE4*, *LIGHTYELLOW*, *LIGHTYELLOW2*, *LIGHTYELLOW3*, *LIGHTYELLOW4*, *LIMEGREEN*, *LINEN*, *MAGENTA1*, *MAGENTA2*, *MAGENTA3*, *MAGENTA4*, *MAROON*, *MAROON1*, *MAROON2*, *MAROON3*, *MAROON4*, *MEDIUMAQUAMARINE*, *MEDIUMORCHID*, *MEDIUMORCHID1*, *MEDIUMORCHID2*, *MEDIUMORCHID3*, *MEDIUMORCHID4*, *MEDIUMPURPLE*, *MEDIUMPURPLE1*, *MEDIUMPURPLE2*, *MEDIUMPURPLE3*, *MEDIUMPURPLE4*, *MEDIUMSEAGREEN*, *MEDIUMSLATEBLUE*, *MEDIUMSPRINGGREEN*, *MEDIUMTURQUOISE*, *MEDIUMVIOLETRED*, *MIDNIGHTBLUE*, *MINTCREAM*, *MISTYROSE*, *MISTYROSE2*, *MISTYROSE3*, *MISTYROSE4*, *MOCCASIN*, *NAVAJOWHITE1*, *NAVAJOWHITE2*, *NAVAJOWHITE3*, *NAVAJOWHITE4*, *NAVYBLUE*, *OLDLACE*, *OLIVEDRAB*, *OLIVEDRAB1*, *OLIVEDRAB2*, *OLIVEDRAB3*, *OLIVEDRAB4*, *ORANGE*, *ORANGE1*, *ORANGE2*, *ORANGE3*, *ORANGE4*, *ORANGERED*, *ORANGERED1*, *ORANGERED2*, *ORANGERED3*, *ORANGERED4*, *ORCHID*, *ORCHID1*, *ORCHID2*, *ORCHID3*, *ORCHID4*, *PALEGOLDENROD*, *PALEGREEN*, *PALEGREEN1*, *PALEGREEN2*, *PALEGREEN3*, *PALEGREEN4*, *PALETURQUOISE*, *PALETURQUOISE1*, *PALETURQUOISE2*, *PALETURQUOISE3*, *PALETURQUOISE4*, *PALEVIOLETRED*, *PALEVIOLETRED1*, *PALEVIOLETRED2*, *PALEVIOLETRED3*, *PALEVIOLETRED4*, *PAPAYAWHIP*, *PEACHPUFF*, *PEACHPUFF2*, *PEACHPUFF3*, *PEACHPUFF4*, *PERU*, *PINK*, *PINK1*, *PINK2*, *PINK3*, *PINK4*, *PLUM*, *PLUM1*, *PLUM2*, *PLUM3*, *PLUM4*, *POWDERBLUE*, *PURPLE*, *PURPLE1*, *PURPLE2*, *PURPLE3*, *PURPLE4*, *RED*, *RED1*, *RED2*, *RED3*, *RED4*, *ROSYBROWN*, *ROSYBROWN1*, *ROSYBROWN2*, *ROSYBROWN3*, *ROSYBROWN4*, *ROYALBLUE*, *ROYALBLUE1*, *ROYALBLUE2*, *ROYALBLUE3*, *ROYALBLUE4*, *SADDLEBROWN*, *SALMON*, *SALMON1*, *SALMON2*, *SALMON3*, *SALMON4*, *SANDYBROWN*, *SEAGREEN*, *SEAGREEN1*, *SEAGREEN2*, *SEAGREEN3*, *SEAGREEN4*, *SEASHELL*, *SEASHELL2*, *SEASHELL3*, *SEASHELL4*, *BEET*, *TEAL*, *SIENNA*, *SIENNA1*, *SIENNA2*, *SIENNA3*, *SIENNA4*, *SKYBLUE*, *SKYBLUE1*, *SKYBLUE2*, *SKYBLUE3*, *SKYBLUE4*, *SLATEBLUE*, *SLATEBLUE1*, *SLATEBLUE2*, *SLATEBLUE3*, *SLATEBLUE4*, *SLATEGRAY1*, *SLATEGRAY2*, *SLATEGRAY3*, *SLATEGRAY4*, *SLATEGRAY*, *SNOW*, *SNOW2*, *SNOW3*, *SNOW4*, *SPRINGGREEN*, *SPRINGGREEN2*, *SPRINGGREEN3*, *SPRINGGREEN4*, *STEELBLUE*, *STEELBLUE1*, *STEELBLUE2*, *STEELBLUE3*, *STEELBLUE4*, *TAN*, *TAN1*, *TAN2*, *TAN3*, *TAN4*, *THISTLE*, *THISTLE1*, *THISTLE2*, *THISTLE3*, *THISTLE4*, *TOMATO*, *TOMATO1*, *TOMATO2*, *TOMATO3*, *TOMATO4*, *TURQUOISE*, *TURQUOISE1*, *TURQUOISE2*, *TURQUOISE3*, *TURQUOISE4*, *VIOLET*, *VIOLETRED*, *VIOLETRED1*, *VIOLETRED2*, *VIOLETRED3*, *VIOLETRED4*, *WHEAT*, *WHEAT1*, *WHEAT2*, *WHEAT3*, *WHEAT4*, *WHITE*, *WHITESMOKE*, *YELLOW*, *YELLOW1*, *YELLOW2*, *YELLOW3*, *YELLOW4* and *YELLOWGREEN*. -~~~~~ +~~~~{.cpp} vaspects [name] [-setcolor ColorName] [-setcolor R G B] [-unsetcolor] vsetcolor [name] ColorName vunsetcolor [name] -~~~~~ +~~~~ **Transparency. The *Transp* may be between 0.0 (opaque) and 1.0 (fully transparent). **Warning**: at 1.0 the shape becomes invisible. -~~~~~ +~~~~{.cpp} vaspects [name] [-settransparency Transp] [-unsettransparency] vsettransparency [name] Transp vunsettransparency [name] -~~~~~ +~~~~ **Material**. The *MatName* can be *BRASS*, *BRONZE*, *COPPER*, *GOLD*, *PEWTER*, *PLASTER*, *PLASTIC*, *SILVER*, *STEEL*, *STONE*, *SHINY_PLASTIC*, *SATIN*, *METALIZED*, *NEON_GNC*, *CHROME*, *ALUMINIUM*, *OBSIDIAN*, *NEON_PHC*, *JADE*, *WATER*, *GLASS*, *DIAMOND* or *CHARCOAL*. -~~~~~ +~~~~{.cpp} vaspects [name] [-setmaterial MatName] [-unsetmaterial] vsetmaterial [name] MatName vunsetmaterial [name] -~~~~~ +~~~~ **Line width**. Specifies width of the edges. The *LineWidth* may be between 0.0 and 10.0. -~~~~~ +~~~~{.cpp} vaspects [name] [-setwidth LineWidth] [-unsetwidth] vsetwidth [name] LineWidth vunsetwidth [name] -~~~~~ +~~~~ **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b @@ -1828,7 +1828,7 @@ vfit vsetdispmode b 1 vaspects -setcolor red -settransparency 0.2 vrotate 10 10 10 -~~~~~ +~~~~ @@ -1838,37 +1838,37 @@ vrotate 10 10 10 @subsubsection occt_draw_4_3_11 vsetshading Syntax: -~~~~~ +~~~~{.cpp} vsetshading shapename [coefficient] -~~~~~ +~~~~ Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008. **Example:** -~~~~~ +~~~~{.cpp} vinit psphere s 20 vdisplay s vfit vsetdispmode 1 vsetshading s 0.005 -~~~~~ +~~~~ @subsubsection occt_draw_4_3_12 vunsetshading Syntax: -~~~~~ +~~~~{.cpp} vunsetshading [shapename] -~~~~~ +~~~~ Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode. @subsubsection occt_draw_4_3_13 vsetam Syntax: -~~~~~ +~~~~{.cpp} vsetam [shapename] mode -~~~~~ +~~~~ Activates selection mode for all selected or named shapes: * *0* for *shape* itself, @@ -1881,55 +1881,55 @@ Activates selection mode for all selected or named shapes: * *7* (*compounds*). **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vfit vsetam b 2 -~~~~~ +~~~~ @subsubsection occt_draw_4_3_14 vunsetam Syntax: -~~~~~ +~~~~{.cpp} vunsetam -~~~~~ +~~~~ Deactivates all selection modes for all shapes. @subsubsection occt_draw_4_3_15 vdump Syntax: -~~~~~ +~~~~{.cpp} vdump .{png|bmp|jpg|gif} [-width Width -height Height] [-buffer rgb|rgba|depth=rgb] [-stereo mono|left|right|blend|sideBySide|overUnder=mono] -~~~~~ +~~~~ Extracts the contents of the viewer window to a image file. @subsubsection occt_draw_4_3_16 vdir Syntax: -~~~~~ +~~~~{.cpp} vdir -~~~~~ +~~~~ Displays the list of displayed objects. @subsubsection occt_draw_4_3_17 vsub Syntax: -~~~~~ +~~~~{.cpp} vsub 0/1(on/off)[shapename] -~~~~~ +~~~~ Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 psphere s 20 @@ -1937,14 +1937,14 @@ vdisplay b s vfit vsetdispmode 1 vsub b 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_3_20 vsensdis Syntax: -~~~~~ +~~~~{.cpp} vsensdis -~~~~~ +~~~~ Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes). @@ -1962,33 +1962,33 @@ Custom (application-defined) sensitive entity types are not processed by this co @subsubsection occt_draw_4_3_21 vsensera Syntax: -~~~~~ +~~~~{.cpp} vsensera -~~~~~ +~~~~ Erases active entities. @subsubsection occt_draw_4_3_23 vr Syntax: -~~~~~ +~~~~{.cpp} vr filename -~~~~~ +~~~~ Reads shape from BREP-format file and displays it in the viewer. **Example:** -~~~~~ +~~~~{.cpp} vinit vr myshape.brep -~~~~~ +~~~~ @subsubsection occt_draw_4_3_24 vstate Syntax: -~~~~~ +~~~~{.cpp} vstate [-entities] [-hasSelected] [name1] ... [nameN] -~~~~~ +~~~~ Reports show/hidden state for selected or named objects: * *entities* -- prints low-level information about detected entities; @@ -1997,21 +1997,21 @@ Reports show/hidden state for selected or named objects: @subsubsection occt_draw_4_3_25 vraytrace Syntax: -~~~~~ +~~~~{.cpp} vraytrace [0/1] -~~~~~ +~~~~ Turns on/off ray tracing renderer. @subsubsection occt_draw_4_3_26 vrenderparams Syntax: -~~~~~ +~~~~{.cpp} vrenderparams [-rayTrace|-raster] [-rayDepth 0..10] [-shadows {on|off}] [-reflections {on|off}] [-fsaa {on|off}] [-gleam {on|off}] [-gi {on|off}] [-brng {on|off}] [-env {on|off}] [-shadin {color|flat|gouraud|phong}] -~~~~~ +~~~~ Manages rendering parameters: * rayTrace -- Enables GPU ray-tracing @@ -2030,46 +2030,46 @@ Unlike *vcaps*, these parameters dramatically change visual properties. The command is intended to control presentation quality depending on hardware capabilities and performance. **Example:** -~~~~~ +~~~~{.cpp} vinit box b 10 10 10 vdisplay b vfit vraytrace 1 vrenderparams -shadows 1 -reflections 1 -fsaa 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_3_27 vshaderprog Syntax: -~~~~~ +~~~~{.cpp} 'vshaderprog [name] pathToVertexShader pathToFragmentShader' or 'vshaderprog [name] off' to disable GLSL program or 'vshaderprog [name] phong' to enable per-pixel lighting calculations -~~~~~ +~~~~ Enables rendering using a shader program. @subsubsection occt_draw_4_3_28 vsetcolorbg Syntax: -~~~~~ +~~~~{.cpp} vsetcolorbg r g b -~~~~~ +~~~~ Sets background color. **Example:** -~~~~~ +~~~~{.cpp} vinit vsetcolorbg 200 0 200 -~~~~~ +~~~~ @subsection occt_draw_4_4 AIS viewer -- object commands @subsubsection occt_draw_4_4_1 vtrihedron Syntax: -~~~~~ +~~~~{.cpp} vtrihedron name [-dispMode {wf|sh|wireframe|shading}] [-origin x y z ] [-zaxis u v w -xaxis u v w ] @@ -2088,12 +2088,12 @@ vtrihedron name [-dispMode {wf|sh|wireframe|shading}] |YArrow|ZArrow|XOYAxis|YOZAxis" |XOZAxis|Whole} value] -~~~~~ +~~~~ Creates a new *AIS_Trihedron* object or changes existing trihedron. If no argument is set, the default trihedron (0XYZ) is created. **Example:** -~~~~~ +~~~~{.cpp} vinit vtrihedron tr1 @@ -2101,14 +2101,14 @@ vtrihedron t2 -dispmode shading -origin -200 -200 -300 vtrihedron t2 -color XAxis Quantity_NOC_RED vtrihedron t2 -color YAxis Quantity_NOC_GREEN vtrihedron t2 -color ZAxis|Origin Quantity_NOC_BLUE1 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_2 vplanetri Syntax: -~~~~~ +~~~~{.cpp} vplanetri name -~~~~~ +~~~~ Creates a plane from a trihedron selection. If no arguments are set, the default plane is created. @@ -2116,77 +2116,77 @@ Creates a plane from a trihedron selection. If no arguments are set, the default @subsubsection occt_draw_4_4_3 vsize Syntax: -~~~~~ +~~~~{.cpp} vsize [name] [size] -~~~~~ +~~~~ Changes the size of a named or selected trihedron. If the name is not defined: it affects the selected trihedrons otherwise nothing is done. If the value is not defined, it is set to 100 by default. **Example:** -~~~~~ +~~~~{.cpp} vinit vtrihedron tr1 vtrihedron tr2 0 0 0 1 0 0 1 0 0 vsize tr2 400 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_4 vaxis Syntax: -~~~~~ +~~~~{.cpp} vaxis name [Xa Ya Za Xb Yb Zb] -~~~~~ +~~~~ Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge **Example:** -~~~~~ +~~~~{.cpp} vinit vtrihedron tr vaxis axe1 0 0 0 1 0 0 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_5 vaxispara Syntax: -~~~~~ +~~~~{.cpp} vaxispara name -~~~~~ +~~~~ Creates an axis by interactive selection of an edge and a vertex. @subsubsection occt_draw_4_4_6 vaxisortho Syntax: -~~~~~ +~~~~{.cpp} vaxisotrho name -~~~~~ +~~~~ Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge. @subsubsection occt_draw_4_4_7 vpoint Syntax: -~~~~~ +~~~~{.cpp} vpoint name [Xa Ya Za] -~~~~~ +~~~~ Creates a point from coordinates. If the values are not defined, a point is created by interactive selection of a vertice or an edge (in the center of the edge). **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p 0 0 0 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_8 vplane Syntax: -~~~~~ +~~~~{.cpp} vplane name [AxisName] [PointName] vplane name [PointName] [PointName] [PointName] vplane name [PlaneName] [PointName] -~~~~~ +~~~~ Creates a plane from named or interactively selected entities. TypeOfSensitivity: @@ -2194,87 +2194,87 @@ TypeOfSensitivity: * 1 -- Boundary **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 50 0 vaxis axe1 0 0 0 0 0 1 vtrihedron tr vplane plane1 axe1 p1 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_9 vplanepara Syntax: -~~~~~ +~~~~{.cpp} vplanepara name -~~~~~ +~~~~ Creates a plane from interactively selected vertex and face. @subsubsection occt_draw_4_4_10 vplaneortho Syntax: -~~~~~ +~~~~{.cpp} vplaneortho name -~~~~~ +~~~~ Creates a plane from interactive selected face and coplanar edge. @subsubsection occt_draw_4_4_11 vline Syntax: -~~~~~ +~~~~{.cpp} vline name [PointName] [PointName] vline name [Xa Ya Za Xb Yb Zb] -~~~~~ +~~~~ Creates a line from coordinates, named or interactively selected vertices. **Example:** -~~~~~ +~~~~{.cpp} vinit vtrihedron tr vpoint p1 0 50 0 vpoint p2 50 0 0 vline line1 p1 p2 vline line2 0 0 0 50 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_12 vcircle Syntax: -~~~~~ +~~~~{.cpp} vcircle name [PointName PointName PointName IsFilled] vcircle name [PlaneName PointName Radius IsFilled] -~~~~~ +~~~~ Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1. **Example:** -~~~~~ +~~~~{.cpp} vinit vtrihedron tr vpoint p1 0 50 0 vpoint p2 50 0 0 vpoint p3 0 0 0 vcircle circle1 p1 p2 p3 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_13 vtri2d Syntax: -~~~~~ +~~~~{.cpp} vtri2d name -~~~~~ +~~~~ Creates a plane with a 2D trihedron from an interactively selected face. @subsubsection occt_draw_4_4_14 vselmode Syntax: -~~~~~ +~~~~{.cpp} vselmode [object] mode_number is_turned_on=(1|0) -~~~~~ +~~~~ Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects. *Mode_number* is a non-negative integer encoding different interactive object classes. @@ -2293,25 +2293,25 @@ For shapes the following *mode_number* values are allowed: * 0 if mode is to be switched off **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 0 0 vpoint p3 25 40 0 vtriangle triangle1 p1 p2 p3 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_15 vconnect Syntax: -~~~~~ +~~~~{.cpp} vconnect vconnect name Xo Yo Zo object1 object2 ... [color=NAME] -~~~~~ +~~~~ Creates *AIS_ConnectedInteractive* object from the input object and location and displays it. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 0 0 @@ -2319,49 +2319,49 @@ vsegment segment p1 p2 restore CrankArm.brep obj vdisplay obj vconnect new obj 100100100 1 0 0 0 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_16 vtriangle Syntax: -~~~~~ +~~~~{.cpp} vtriangle name PointName PointName PointName -~~~~~ +~~~~ Creates and displays a filled triangle from named points. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 0 0 vpoint p3 25 40 0 vtriangle triangle1 p1 p2 p3 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_17 vsegment Syntax: -~~~~~ +~~~~{.cpp} vsegment name PointName PointName -~~~~~ +~~~~ Creates and displays a segment from named points. **Example:** -~~~~~ +~~~~{.cpp} Vinit vpoint p1 0 0 0 vpoint p2 50 0 0 vsegment segment p1 p2 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_18 vpointcloud Syntax: -~~~~~ +~~~~{.cpp} vpointcloud name shape [-randColor] [-normals] [-noNormals] -~~~~~ +~~~~ Creates an interactive object for an arbitrary set of points from the triangulated shape. Additional options: @@ -2369,9 +2369,9 @@ Additional options: * *normals* -- generates a normal per point (default); * *noNormals* -- does not generate a normal per point. -~~~~~ +~~~~{.cpp} vpointcloud name x y z r npts {surface|volume} [-randColor] [-normals] [-noNormals] -~~~~~ +~~~~ Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r). Additional options: * *randColor* -- generates a random color per point; @@ -2379,16 +2379,16 @@ Additional options: * *noNormals* -- does not generate a normal per point. **Example:** -~~~~~ +~~~~{.cpp} vinit vpointcloud pc 0 0 0 100 100000 surface -randColor vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_4_19 vclipplane Syntax: -~~~~~ +~~~~{.cpp} vclipplane maxplanes -- gets plane limit for the view. vclipplane create -- creates a new plane. vclipplane delete -- deletes a plane. @@ -2404,12 +2404,12 @@ vclipplane change capping texscale -- sets texture scale. vclipplane change capping texorigin -- sets texture origin. vclipplane change capping texrotate -- sets texture rotation. vclipplane change capping hatch on/off/ -- sets hatching mask. -~~~~~ +~~~~ Manages clipping planes **Example:** -~~~~~ +~~~~{.cpp} vinit vclipplane create pln1 vclipplane change pln1 equation 1 0 0 -0.1 @@ -2420,12 +2420,12 @@ vsetdispmode 1 vfit vrotate 10 10 10 vselect 100 100 -~~~~~ +~~~~ @subsubsection occt_draw_4_4_20 vdimension Syntax: -~~~~~ +~~~~{.cpp} vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]] [-text 3d|2d wf|sh|wireframe|shading IntegerSize] [-label left|right|hcenter|hfit top|bottom|vcenter|vfit] @@ -2435,14 +2435,14 @@ vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape [-autovalue] [-value CustomRealValue] [-textvalue CustomTextValue] [-dispunits DisplayUnitsString] [-modelunits ModelUnitsString] [-showunits | -hideunits] -~~~~~ +~~~~ Builds angle, length, radius or diameter dimension interactive object **name**. **Attention:** length dimension can't be built without working plane. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 50 0 @@ -2454,12 +2454,12 @@ vdimension dim2 -angle -shapes p1 p2 p3 vcircle circle p1 p2 p3 0 vdimension dim3 -radius -shapes circle vfit -~~~~~ +~~~~ @subsubsection occt_draw_4_4_21 vdimparam Syntax: -~~~~~ +~~~~{.cpp} vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize] [-label left|right|hcenter|hfit top|bottom|vcenter|vfit] [-arrow external|internal|fit] @@ -2473,12 +2473,12 @@ vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize] [-dispunits DisplayUnitsString] [-modelunits ModelUnitsString] [-showunits | -hideunits] -~~~~~ +~~~~ Sets parameters for angle, length, radius and diameter dimension **name**. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 50 0 @@ -2487,20 +2487,20 @@ vdimparam dim1 -flyout -15 -arrowlength 4 -showunits -value 10 vfit vdimparam dim1 -textvalue "w_1" vdimparam dim1 -autovalue -~~~~~ +~~~~ @subsubsection occt_draw_4_4_22 vangleparam Syntax: -~~~~~ +~~~~{.cpp} vangleparam name [-type interior|exterior] [-showarrow first|second|both|none] -~~~~~ +~~~~ Sets parameters for angle dimension **name**. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 10 0 0 @@ -2508,20 +2508,20 @@ vpoint p3 10 5 0 vdimension dim1 -angle -plane xoy -shapes p1 p2 p3 vfit vangleparam dim1 -type exterior -showarrow first -~~~~~ +~~~~ @subsubsection occt_draw_4_4_23 vlengthparam Syntax: -~~~~~ +~~~~{.cpp} vlengthparam name [-type interior|exterior] [-showarrow first|second|both|none] -~~~~~ +~~~~ Sets parameters for length dimension **name**. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 20 20 0 vpoint p2 80 80 0 @@ -2530,14 +2530,14 @@ vtop vfit vzoom 0.5 vlengthparam dim1 -direction ox -~~~~~ +~~~~ @subsubsection occt_draw_4_4_24 vmovedim Syntax: -~~~~~ +~~~~{.cpp} vmovedim [name] [x y z] -~~~~~ +~~~~ Moves picked or named (if **name** parameter is defined) dimension to picked mouse position or input point with coordinates **x**,**y**,**z**. @@ -2545,13 +2545,13 @@ Text label of dimension **name** is moved to position, another parts of dimensio are adjusted. **Example:** -~~~~~ +~~~~{.cpp} vinit vpoint p1 0 0 0 vpoint p2 50 50 0 vdimension dim1 -length -plane xoy -shapes p1 p2 vmovedim dim1 -10 30 0 -~~~~~ +~~~~ @subsection occt_draw_4_5 AIS viewer -- Mesh Visualization Service @@ -2561,23 +2561,23 @@ vmovedim dim1 -10 30 0 @subsubsection occt_draw_4_5_1 meshfromstl Syntax: -~~~~~ +~~~~{.cpp} meshfromstl meshname file -~~~~~ +~~~~ Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately. **Example:** -~~~~~ +~~~~{.cpp} meshfromstl mesh myfile.stl -~~~~~ +~~~~ @subsubsection occt_draw_4_5_2 meshdispmode Syntax: -~~~~~ +~~~~{.cpp} meshdispmode meshname displaymode -~~~~~ +~~~~ Changes the display mode of object **meshname**. The **displaymode** is integer, which can be: * *1* for *wireframe*, @@ -2585,18 +2585,18 @@ Changes the display mode of object **meshname**. The **displaymode** is integer, * *3* for *shrink* mode. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshdispmode mesh 2 -~~~~~ +~~~~ @subsubsection occt_draw_4_5_3 meshselmode Syntax: -~~~~~ +~~~~{.cpp} meshselmode meshname selectionmode -~~~~~ +~~~~ Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following: * *1* -- node selection; @@ -2605,50 +2605,50 @@ Changes the selection mode of object **meshname**. The *selectionmode* is intege * *8* -- faces. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshselmode mesh 1 -~~~~~ +~~~~ @subsubsection occt_draw_4_5_4 meshshadcolor Syntax: -~~~~~ +~~~~{.cpp} meshshadcolor meshname red green blue -~~~~~ +~~~~ Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshshadcolormode mesh 0.5 0.5 0.5 -~~~~~ +~~~~ @subsubsection occt_draw_4_5_5 meshlinkcolor Syntax: -~~~~~ +~~~~{.cpp} meshlinkcolor meshname red green blue -~~~~~ +~~~~ Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshlinkcolormode mesh 0.5 0.5 0.5 -~~~~~ +~~~~ @subsubsection occt_draw_4_5_6 meshmat Syntax: -~~~~~ +~~~~{.cpp} meshmat meshname material -~~~~~ +~~~~ Changes the material of object **meshname**. @@ -2676,117 +2676,117 @@ Changes the material of object **meshname**. * *20 -- UserDefined* **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshmat mesh JADE -~~~~~ +~~~~ @subsubsection occt_draw_4_5_7 meshshrcoef Syntax: -~~~~~ +~~~~{.cpp} meshshrcoef meshname shrinkcoefficient -~~~~~ +~~~~ Changes the value of shrink coefficient used in the shrink mode. In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part. The *shrinkcoefficient* is a positive real number. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshshrcoef mesh 0.05 -~~~~~ +~~~~ @subsubsection occt_draw_4_5_8 meshshow Syntax: -~~~~~ +~~~~{.cpp} meshshow meshname -~~~~~ +~~~~ Displays **meshname** in the viewer (if it is erased). **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshshow mesh -~~~~~ +~~~~ @subsubsection occt_draw_4_5_9 meshhide Syntax: -~~~~~ +~~~~{.cpp} meshhide meshname -~~~~~ +~~~~ Hides **meshname** in the viewer. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshhide mesh -~~~~~ +~~~~ @subsubsection occt_draw_4_5_10 meshhidesel Syntax: -~~~~~ +~~~~{.cpp} meshhidesel meshname -~~~~~ +~~~~ Hides only selected entities. The other part of **meshname** remains visible. @subsubsection occt_draw_4_5_11 meshshowsel Syntax: -~~~~~ +~~~~{.cpp} meshshowsel meshname -~~~~~ +~~~~ Shows only selected entities. The other part of **meshname** becomes invisible. @subsubsection occt_draw_4_5_12 meshshowall Syntax: -~~~~~ +~~~~{.cpp} meshshowall meshname -~~~~~ +~~~~ Changes the state of all entities to visible for **meshname**. @subsubsection occt_draw_4_5_13 meshdelete Syntax: -~~~~~ +~~~~{.cpp} meshdelete meshname -~~~~~ +~~~~ Deletes MeshVS_Mesh object **meshname**. **Example:** -~~~~~ +~~~~{.cpp} vinit meshfromstl mesh myfile.stl meshdelete mesh -~~~~~ +~~~~ @subsection occt_draw_4_6 VIS Viewer commands A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness: -~~~~ +~~~~{.cpp} \> pload VIS ~~~~ @subsubsection occt_draw_4_6_1 ivtkinit Syntax: -~~~~~ +~~~~{.cpp} ivtkinit -~~~~~ +~~~~ Creates a window for VTK viewer. @@ -2795,19 +2795,19 @@ Creates a window for VTK viewer. @subsubsection occt_draw_4_6_2 ivtkdisplay Syntax: -~~~~~ +~~~~{.cpp} ivtkdisplay name1 [name2] …[name n] -~~~~~ +~~~~ Displays named objects. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit # create cone pcone c 5 0 10 ivtkdisplay c -~~~~~ +~~~~ @figure{/user_guides/draw_test_harness/images/draw_image002.png,"",261} @@ -2815,14 +2815,14 @@ ivtkdisplay c @subsubsection occt_draw_4_6_3 ivtkerase Syntax: -~~~~~ +~~~~{.cpp} ivtkerase [name1] [name2] … [name n] -~~~~~ +~~~~ Erases named objects. If no arguments are passed, erases all displayed objects. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit # create a sphere psphere s 10 @@ -2836,29 +2836,29 @@ ivtkdisplay s c cy ivtkerase cy # erase the sphere and the cone ivtkerase s c -~~~~~ +~~~~ @subsubsection occt_draw_4_6_4 ivtkfit Syntax: -~~~~~ +~~~~{.cpp} ivtkfit -~~~~~ +~~~~ Automatic zoom/panning. @subsubsection occt_draw_4_6_5 ivtkdispmode Syntax: -~~~~~ +~~~~{.cpp} ivtksetdispmode [name] {0|1} -~~~~~ +~~~~ Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects The possible modes are: 0 (WireFrame) and 1 (Shading). **Example:** -~~~~~ +~~~~{.cpp} ivtkinit # create a cone pcone c 5 0 10 @@ -2866,21 +2866,21 @@ pcone c 5 0 10 ivtkdisplay c # set shading mode for the cone ivtksetdispmode c 1 -~~~~~ +~~~~ @figure{/user_guides/draw_test_harness/images/draw_image003.png,"",262} @subsubsection occt_draw_4_6_6 ivtksetselmode Syntax: -~~~~~ +~~~~{.cpp} ivtksetselmode [name] mode {0|1} -~~~~~ +~~~~ Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit # load a shape from file restore CrankArm.brep a @@ -2888,50 +2888,50 @@ restore CrankArm.brep a ivtkdisplay a # set the face selection mode ivtksetselmode a 4 1 -~~~~~ +~~~~ @figure{/user_guides/draw_test_harness/images/draw_image004.png,"",291} @subsubsection occt_draw_4_6_7 ivtkmoveto Syntax: -~~~~~ +~~~~{.cpp} ivtkmoveto x y -~~~~~ +~~~~ Imitates mouse cursor moving to point with the given display coordinates **x**,**y**. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit pcone c 5 0 10 ivtkdisplay c ivtkmoveto 40 50 -~~~~~ +~~~~ @subsubsection occt_draw_4_6_8 ivtkselect Syntax: -~~~~~ +~~~~{.cpp} ivtkselect x y -~~~~~ +~~~~ Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit pcone c 5 0 10 ivtkdisplay c ivtkselect 40 50 -~~~~~ +~~~~ @subsubsection occt_draw_4_6_9 ivtkdump Syntax: -~~~~~ +~~~~{.cpp} ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}] -~~~~~ +~~~~ Dumps the contents of VTK viewer to image. It supports: * dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM. @@ -2940,34 +2940,34 @@ Dumps the contents of VTK viewer to image. It supports: * dumping of stereo projections (left or right). **Example:** -~~~~~ +~~~~{.cpp} ivtkinit pcone c 5 0 10 ivtkdisplay c ivtkdump D:/ConeSnapshot.png rgb 768 768 -~~~~~ +~~~~ @subsubsection occt_draw_4_6_10 ivtkbgcolor Syntax: -~~~~~ +~~~~{.cpp} ivtkbgcolor r g b [r2 g2 b2] -~~~~~ +~~~~ Sets uniform background color or gradient background if second triple of parameters is set. Color parameters r,g,b have to be chosen in the interval [0..255]. **Example:** -~~~~~ +~~~~{.cpp} ivtkinit ivtkbgcolor 200 220 250 -~~~~~ +~~~~ @figure{/user_guides/draw_test_harness/images/draw_image005.png,"",196} -~~~~~ +~~~~{.cpp} ivtkbgcolor 10 30 80 255 255 255 -~~~~~ +~~~~ @figure{/user_guides/draw_test_harness/images/draw_image006.png,"",190} @@ -2982,41 +2982,41 @@ This chapter contains a set of commands for Open CASCADE Technology Application @subsubsection occt_draw_5_1_1 NewDocument Syntax: -~~~~~ +~~~~{.cpp} NewDocument docname [format] -~~~~~ +~~~~ Creates a new **docname** document with MDTV-Standard or described format. **Example:** -~~~~~ +~~~~{.cpp} # Create new document with default (MDTV-Standard) format NewDocument D # Create new document with BinOcaf format NewDocument D2 BinOcaf -~~~~~ +~~~~ @subsubsection occt_draw_5_1_2 IsInSession Syntax: -~~~~~ +~~~~{.cpp} IsInSession path -~~~~~ +~~~~ Returns *0*, if **path** document is managed by the application session, *1* -- otherwise. **Example:** -~~~~~ +~~~~{.cpp} IsInSession /myPath/myFile.std -~~~~~ +~~~~ @subsubsection occt_draw_5_1_3 ListDocuments Syntax: -~~~~~ +~~~~{.cpp} ListDocuments -~~~~~ +~~~~ Makes a list of documents handled during the session of the application. @@ -3024,62 +3024,62 @@ Makes a list of documents handled during the session of the application. @subsubsection occt_draw_5_1_4 Open Syntax: -~~~~~ +~~~~{.cpp} Open path docname [-stream] -~~~~~ +~~~~ Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session. option -stream activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names. **Example:** -~~~~~ +~~~~{.cpp} Open /myPath/myFile.std D -~~~~~ +~~~~ @subsubsection occt_draw_5_1_5 Close Syntax: -~~~~~ +~~~~{.cpp} Close docname -~~~~~ +~~~~ Closes **docname** document. The document is no longer handled by the applicative session. **Example:** -~~~~~ +~~~~{.cpp} Close D -~~~~~ +~~~~ @subsubsection occt_draw_5_1_6 Save Syntax: -~~~~~ +~~~~{.cpp} Save docname -~~~~~ +~~~~ Saves **docname** active document. **Example:** -~~~~~ +~~~~{.cpp} Save D -~~~~~ +~~~~ @subsubsection occt_draw_5_1_7 SaveAs Syntax: -~~~~~ +~~~~{.cpp} SaveAs docname path [-stream] -~~~~~ +~~~~ Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists. option -stream activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names. **Example:** -~~~~~ +~~~~{.cpp} SaveAs D /myPath/myFile.std -~~~~~ +~~~~ @subsection occt_draw_5_2 Basic commands @@ -3087,61 +3087,61 @@ SaveAs D /myPath/myFile.std Syntax: -~~~~~ +~~~~{.cpp} Label docname entry -~~~~~ +~~~~ Creates the label expressed by \ if it does not exist. Example -~~~~~ +~~~~{.cpp} Label D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_2_2 NewChild Syntax: -~~~~~ +~~~~{.cpp} NewChild docname [taggerlabel = Root label] -~~~~~ +~~~~ Finds (or creates) a *TagSource* attribute located at father label of \ and makes a new child label. Example -~~~~~ +~~~~{.cpp} # Create new child of root label NewChild D # Create new child of existing label Label D 0:2 NewChild D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_2_3 Children Syntax: -~~~~~ +~~~~{.cpp} Children docname label -~~~~~ +~~~~ Returns the list of attributes of label. Example -~~~~~ +~~~~{.cpp} Children D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_2_4 ForgetAll Syntax: -~~~~~ +~~~~{.cpp} ForgetAll docname label -~~~~~ +~~~~ Forgets all attributes of the label. Example -~~~~~ +~~~~{.cpp} ForgetAll D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_3 Application commands @@ -3149,186 +3149,186 @@ ForgetAll D 0:2 @subsubsection occt_draw_5_3_1 Main Syntax: -~~~~~ +~~~~{.cpp} Main docname -~~~~~ +~~~~ Returns the main label of the framework. **Example:** -~~~~~ +~~~~{.cpp} Main D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_2 UndoLimit Syntax: -~~~~~ +~~~~{.cpp} UndoLimit docname [value=0] -~~~~~ +~~~~ Sets the limit on the number of Undo Delta stored. **0** will disable Undo on the document. A negative *value* means that there is no limit. Note that by default Undo is disabled. Enabling it will take effect with the next call to *NewCommand*. Of course, this limit is the same for Redo **Example:** -~~~~~ +~~~~{.cpp} UndoLimit D 100 -~~~~~ +~~~~ @subsubsection occt_draw_5_3_3 Undo Syntax: -~~~~~ +~~~~{.cpp} Undo docname [value=1] -~~~~~ +~~~~ Undoes **value** steps. **Example:** -~~~~~ +~~~~{.cpp} Undo D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_4 Redo Syntax: -~~~~~ +~~~~{.cpp} Redo docname [value=1] -~~~~~ +~~~~ Redoes **value** steps. **Example:** -~~~~~ +~~~~{.cpp} Redo D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_5 OpenCommand Syntax: -~~~~~ +~~~~{.cpp} OpenCommand docname -~~~~~ +~~~~ Opens a new command transaction. **Example:** -~~~~~ +~~~~{.cpp} OpenCommand D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_6 CommitCommand Syntax: -~~~~~ +~~~~{.cpp} CommitCommand docname -~~~~~ +~~~~ Commits the Command transaction. **Example:** -~~~~~ +~~~~{.cpp} CommitCommand D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_7 NewCommand Syntax: -~~~~~ +~~~~{.cpp} NewCommand docname -~~~~~ +~~~~ This is a shortcut for Commit and Open transaction. **Example:** -~~~~~ +~~~~{.cpp} NewCommand D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_8 AbortCommand Syntax: -~~~~~ +~~~~{.cpp} AbortCommand docname -~~~~~ +~~~~ Aborts the Command transaction. **Example:** -~~~~~ +~~~~{.cpp} AbortCommand D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_9 Copy Syntax: -~~~~~ +~~~~{.cpp} Copy docname entry Xdocname Xentry -~~~~~ +~~~~ Copies the contents of *entry* to *Xentry*. No links are registered. **Example:** -~~~~~ +~~~~{.cpp} Copy D1 0:2 D2 0:4 -~~~~~ +~~~~ @subsubsection occt_draw_5_3_10 UpdateLink Syntax: -~~~~~ +~~~~{.cpp} UpdateLink docname [entry] -~~~~~ +~~~~ Updates external reference set at *entry*. **Example:** -~~~~~ +~~~~{.cpp} UpdateLink D -~~~~~ +~~~~ @subsubsection occt_draw_5_3_11 CopyWithLink Syntax: -~~~~~ +~~~~{.cpp} CopyWithLink docname entry Xdocname Xentry -~~~~~ +~~~~ Aborts the Command transaction. Copies the content of *entry* to *Xentry*. The link is registered with an *Xlink* attribute at *Xentry* label. **Example:** -~~~~~ +~~~~{.cpp} CopyWithLink D1 0:2 D2 0:4 -~~~~~ +~~~~ @subsubsection occt_draw_5_3_12 UpdateXLinks Syntax: -~~~~~ +~~~~{.cpp} UpdateXLinks docname entry -~~~~~ +~~~~ Sets modifications on labels impacted by external references to the *entry*. The *document* becomes invalid and must be recomputed **Example:** -~~~~~ +~~~~{.cpp} UpdateXLinks D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_3_13 DumpDocument Syntax: -~~~~~ +~~~~{.cpp} DumpDocument docname -~~~~~ +~~~~ Displays parameters of *docname* document. **Example:** -~~~~~ +~~~~{.cpp} DumpDocument D -~~~~~ +~~~~ @subsection occt_draw_5_4 Data Framework commands @@ -3337,86 +3337,86 @@ DumpDocument D @subsubsection occt_draw_5_4_1 MakeDF Syntax: -~~~~~ +~~~~{.cpp} MakeDF dfname -~~~~~ +~~~~ Creates a new data framework. **Example:** -~~~~~ +~~~~{.cpp} MakeDF D -~~~~~ +~~~~ @subsubsection occt_draw_5_4_2 ClearDF Syntax: -~~~~~ +~~~~{.cpp} ClearDF dfname -~~~~~ +~~~~ Clears a data framework. **Example:** -~~~~~ +~~~~{.cpp} ClearDF D -~~~~~ +~~~~ @subsubsection occt_draw_5_4_3 CopyDF Syntax: -~~~~~ +~~~~{.cpp} CopyDF dfname1 entry1 [dfname2] entry2 -~~~~~ +~~~~ Copies a data framework. **Example:** -~~~~~ +~~~~{.cpp} CopyDF D 0:2 0:4 -~~~~~ +~~~~ @subsubsection occt_draw_5_4_4 CopyLabel Syntax: -~~~~~ +~~~~{.cpp} CopyLabel dfname fromlabel tolablel -~~~~~ +~~~~ Copies a label. **Example:** -~~~~~ +~~~~{.cpp} CopyLabel D1 0:2 0:4 -~~~~~ +~~~~ @subsubsection occt_draw_5_4_5 MiniDumpDF Syntax: -~~~~~ +~~~~{.cpp} MiniDumpDF dfname -~~~~~ +~~~~ Makes a mini-dump of a data framework. **Example:** -~~~~~ +~~~~{.cpp} MiniDumpDF D -~~~~~ +~~~~ @subsubsection occt_draw_5_4_6 XDumpDF Syntax: -~~~~~ +~~~~{.cpp} XDumpDF dfname -~~~~~ +~~~~ Makes an extended dump of a data framework. **Example:** -~~~~~ +~~~~{.cpp} XDumpDF D -~~~~~ +~~~~ @subsection occt_draw_5_5 General attributes commands @@ -3424,329 +3424,329 @@ XDumpDF D @subsubsection occt_draw_5_5_1 SetInteger Syntax: -~~~~~ +~~~~{.cpp} SetInteger dfname entry value -~~~~~ +~~~~ Finds or creates an Integer attribute at *entry* label and sets *value*. **Example:** -~~~~~ +~~~~{.cpp} SetInteger D 0:2 100 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_2 GetInteger Syntax: -~~~~~ +~~~~{.cpp} GetInteger dfname entry [drawname] -~~~~~ +~~~~ Gets a value of an Integer attribute at *entry* label and sets it to *drawname* variable, if it is defined. **Example:** -~~~~~ +~~~~{.cpp} GetInteger D 0:2 Int1 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_3 SetReal Syntax: -~~~~~ +~~~~{.cpp} SetReal dfname entry value -~~~~~ +~~~~ Finds or creates a Real attribute at *entry* label and sets *value*. **Example:** -~~~~~ +~~~~{.cpp} SetReal D 0:2 100. -~~~~~ +~~~~ @subsubsection occt_draw_5_5_4 GetReal Syntax: -~~~~~ +~~~~{.cpp} GetReal dfname entry [drawname] -~~~~~ +~~~~ Gets a value of a Real attribute at *entry* label and sets it to *drawname* variable, if it is defined. **Example:** -~~~~~ +~~~~{.cpp} GetReal D 0:2 Real1 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_5 SetIntArray Syntax: -~~~~~ +~~~~{.cpp} SetIntArray dfname entry lower upper value1 value2 … -~~~~~ +~~~~ Finds or creates an IntegerArray attribute at *entry* label with lower and upper bounds and sets **value1*, *value2*... **Example:** -~~~~~ +~~~~{.cpp} SetIntArray D 0:2 1 4 100 200 300 400 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_6 GetIntArray Syntax: -~~~~~ +~~~~{.cpp} GetIntArray dfname entry -~~~~~ +~~~~ Gets a value of an *IntegerArray* attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetIntArray D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_7 SetRealArray Syntax: -~~~~~ +~~~~{.cpp} SetRealArray dfname entry lower upper value1 value2 … -~~~~~ +~~~~ Finds or creates a RealArray attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*… **Example:** -~~~~~ +~~~~{.cpp} GetRealArray D 0:2 1 4 100. 200. 300. 400. -~~~~~ +~~~~ @subsubsection occt_draw_5_5_8 GetRealArray Syntax: -~~~~~ +~~~~{.cpp} GetRealArray dfname entry -~~~~~ +~~~~ Gets a value of a RealArray attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetRealArray D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_9 SetComment Syntax: -~~~~~ +~~~~{.cpp} SetComment dfname entry value -~~~~~ +~~~~ Finds or creates a Comment attribute at *entry* label and sets *value*. **Example:** -~~~~~ +~~~~{.cpp} SetComment D 0:2 "My comment" -~~~~~ +~~~~ @subsubsection occt_draw_5_5_10 GetComment Syntax: -~~~~~ +~~~~{.cpp} GetComment dfname entry -~~~~~ +~~~~ Gets a value of a Comment attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetComment D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_11 SetExtStringArray Syntax: -~~~~~ +~~~~{.cpp} SetExtStringArray dfname entry lower upper value1 value2 … -~~~~~ +~~~~ Finds or creates an *ExtStringArray* attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*… **Example:** -~~~~~ +~~~~{.cpp} SetExtStringArray D 0:2 1 3 *string1* *string2* *string3* -~~~~~ +~~~~ @subsubsection occt_draw_5_5_12 GetExtStringArray Syntax: -~~~~~ +~~~~{.cpp} GetExtStringArray dfname entry -~~~~~ +~~~~ Gets a value of an ExtStringArray attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetExtStringArray D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_13 SetName Syntax: -~~~~~ +~~~~{.cpp} SetName dfname entry value -~~~~~ +~~~~ Finds or creates a Name attribute at *entry* label and sets *value*. **Example:** -~~~~~ +~~~~{.cpp} SetName D 0:2 *My name* -~~~~~ +~~~~ @subsubsection occt_draw_5_5_14 GetName Syntax: -~~~~~ +~~~~{.cpp} GetName dfname entry -~~~~~ +~~~~ Gets a value of a Name attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetName D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_15 SetReference Syntax: -~~~~~ +~~~~{.cpp} SetReference dfname entry reference -~~~~~ +~~~~ Creates a Reference attribute at *entry* label and sets *reference*. **Example:** -~~~~~ +~~~~{.cpp} SetReference D 0:2 0:4 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_16 GetReference Syntax: -~~~~~ +~~~~{.cpp} GetReference dfname entry -~~~~~ +~~~~ Gets a value of a Reference attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetReference D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_17 SetUAttribute Syntax: -~~~~~ +~~~~{.cpp} SetUAttribute dfname entry localGUID -~~~~~ +~~~~ Creates a UAttribute attribute at *entry* label with *localGUID*. **Example:** -~~~~~ +~~~~{.cpp} set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" SetUAttribute D 0:2 ${localGUID} -~~~~~ +~~~~ @subsubsection occt_draw_5_5_18 GetUAttribute Syntax: -~~~~~ +~~~~{.cpp} GetUAttribute dfname entry loacalGUID -~~~~~ +~~~~ Finds a *UAttribute* at *entry* label with *localGUID*. **Example:** -~~~~~ +~~~~{.cpp} set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" GetUAttribute D 0:2 ${localGUID} -~~~~~ +~~~~ @subsubsection occt_draw_5_5_19 SetFunction Syntax: -~~~~~ +~~~~{.cpp} SetFunction dfname entry ID failure -~~~~~ +~~~~ Finds or creates a *Function* attribute at *entry* label with driver ID and *failure* index. **Example:** -~~~~~ +~~~~{.cpp} set ID "c73bd076-22ee-11d2-acde-080009dc4422" SetFunction D 0:2 ${ID} 1 -~~~~~ +~~~~ @subsubsection occt_draw_5_5_20 GetFunction Syntax: -~~~~~ +~~~~{.cpp} GetFunction dfname entry ID failure -~~~~~ +~~~~ Finds a Function attribute at *entry* label and sets driver ID to *ID* variable and failure index to *failure* variable. **Example:** -~~~~~ +~~~~{.cpp} GetFunction D 0:2 ID failure -~~~~~ +~~~~ @subsubsection occt_draw_5_5_21 NewShape Syntax: -~~~~~ +~~~~{.cpp} NewShape dfname entry [shape] -~~~~~ +~~~~ Finds or creates a Shape attribute at *entry* label. Creates or updates the associated *NamedShape* attribute by *shape* if *shape* is defined. **Example:** -~~~~~ +~~~~{.cpp} box b 10 10 10 NewShape D 0:2 b -~~~~~ +~~~~ @subsubsection occt_draw_5_5_22 SetShape Syntax: -~~~~~ +~~~~{.cpp} SetShape dfname entry shape -~~~~~ +~~~~ Creates or updates a *NamedShape* attribute at *entry* label by *shape*. **Example:** -~~~~~ +~~~~{.cpp} box b 10 10 10 SetShape D 0:2 b -~~~~~ +~~~~ @subsubsection occt_draw_5_5_23 GetShape Syntax: -~~~~~ +~~~~{.cpp} GetShape2 dfname entry shape -~~~~~ +~~~~ Sets a shape from NamedShape attribute associated with *entry* label to *shape* draw variable. **Example:** -~~~~~ +~~~~{.cpp} GetShape2 D 0:2 b -~~~~~ +~~~~ @subsection occt_draw_5_6 Geometric attributes commands @@ -3754,127 +3754,127 @@ GetShape2 D 0:2 b @subsubsection occt_draw_5_6_1 SetPoint Syntax: -~~~~~ +~~~~{.cpp} SetPoint dfname entry point -~~~~~ +~~~~ Finds or creates a Point attribute at *entry* label and sets *point* as generated in the associated *NamedShape* attribute. **Example:** -~~~~~ +~~~~{.cpp} point p 10 10 10 SetPoint D 0:2 p -~~~~~ +~~~~ @subsubsection occt_draw_5_6_2 GetPoint Syntax: -~~~~~ +~~~~{.cpp} GetPoint dfname entry [drawname] -~~~~~ +~~~~ Gets a vertex from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. **Example:** -~~~~~ +~~~~{.cpp} GetPoint D 0:2 p -~~~~~ +~~~~ @subsubsection occt_draw_5_6_3 SetAxis Syntax: -~~~~~ +~~~~{.cpp} SetAxis dfname entry axis -~~~~~ +~~~~ Finds or creates an Axis attribute at *entry* label and sets *axis* as generated in the associated *NamedShape* attribute. **Example:** -~~~~~ +~~~~{.cpp} line l 10 20 30 100 200 300 SetAxis D 0:2 l -~~~~~ +~~~~ @subsubsection occt_draw_5_6_4 GetAxis Syntax: -~~~~~ +~~~~{.cpp} GetAxis dfname entry [drawname] -~~~~~ +~~~~ Gets a line from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. **Example:** -~~~~~ +~~~~{.cpp} GetAxis D 0:2 l -~~~~~ +~~~~ @subsubsection occt_draw_5_6_5 SetPlane Syntax: -~~~~~ +~~~~{.cpp} SetPlane dfname entry plane -~~~~~ +~~~~ Finds or creates a Plane attribute at *entry* label and sets *plane* as generated in the associated *NamedShape* attribute. **Example:** -~~~~~ +~~~~{.cpp} plane pl 10 20 30 -1 0 0 SetPlane D 0:2 pl -~~~~~ +~~~~ @subsubsection occt_draw_5_6_6 GetPlane Syntax: -~~~~~ +~~~~{.cpp} GetPlane dfname entry [drawname] -~~~~~ +~~~~ Gets a plane from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. **Example:** -~~~~~ +~~~~{.cpp} GetPlane D 0:2 pl -~~~~~ +~~~~ @subsubsection occt_draw_5_6_7 SetGeometry Syntax: -~~~~~ +~~~~{.cpp} SetGeometry dfname entry [type] [shape] -~~~~~ +~~~~ Creates a Geometry attribute at *entry* label and sets *type* and *shape* as generated in the associated *NamedShape* attribute if they are defined. *type* must be one of the following: *any, pnt, lin, cir, ell, spl, pln, cyl*. **Example:** -~~~~~ +~~~~{.cpp} point p 10 10 10 SetGeometry D 0:2 pnt p -~~~~~ +~~~~ @subsubsection occt_draw_5_6_8 GetGeometryType Syntax: -~~~~~ +~~~~{.cpp} GetGeometryType dfname entry -~~~~~ +~~~~ Gets a geometry type from Geometry attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetGeometryType D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_6_9 SetConstraint Syntax: -~~~~~ +~~~~{.cpp} SetConstraint dfname entry keyword geometrie [geometrie …] SetConstraint dfname entry "plane" geometrie SetConstraint dfname entry "value" value -~~~~~ +~~~~ 1. Creates a Constraint attribute at *entry* label and sets *keyword* constraint between geometry(ies). *keyword* must be one of the following: @@ -3883,53 +3883,53 @@ SetConstraint dfname entry "value" value 3. Sets value for the existing constraint. **Example:** -~~~~~ +~~~~{.cpp} SetConstraint D 0:2 "value" 5 -~~~~~ +~~~~ @subsubsection occt_draw_5_6_10 GetConstraint Syntax: -~~~~~ +~~~~{.cpp} GetConstraint dfname entry -~~~~~ +~~~~ Dumps a Constraint attribute at *entry* label **Example:** -~~~~~ +~~~~{.cpp} GetConstraint D 0:2 -~~~~~ +~~~~ @subsubsection occt_draw_5_6_11 SetVariable Syntax: -~~~~~ +~~~~{.cpp} SetVariable dfname entry isconstant(0/1) units -~~~~~ +~~~~ Creates a Variable attribute at *entry* label and sets *isconstant* flag and *units* as a string. **Example:** -~~~~~ +~~~~{.cpp} SetVariable D 0:2 1 "mm" -~~~~~ +~~~~ @subsubsection occt_draw_5_6_12 GetVariable Syntax: -~~~~~ +~~~~{.cpp} GetVariable dfname entry isconstant units -~~~~~ +~~~~ Gets an *isconstant* flag and units of a Variable attribute at *entry* label. **Example:** -~~~~~ +~~~~{.cpp} GetVariable D 0:2 isconstant units puts "IsConstant=${isconstant}" puts "Units=${units}" -~~~~~ +~~~~ @subsection occt_draw_5_7 Tree attributes commands @@ -3937,9 +3937,9 @@ puts "Units=${units}" @subsubsection occt_draw_5_7_1 RootNode Syntax: -~~~~~ +~~~~{.cpp} RootNode dfname treenodeentry [ID] -~~~~~ +~~~~ Returns the ultimate father of *TreeNode* attribute identified by its *treenodeentry* and its *ID* (or default ID, if *ID* is not defined). @@ -3947,9 +3947,9 @@ Returns the ultimate father of *TreeNode* attribute identified by its *treenodee @subsubsection occt_draw_5_7_2 SetNode Syntax: -~~~~~ +~~~~{.cpp} SetNode dfname treenodeentry [ID] -~~~~~ +~~~~ Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* (or assigns a default ID, if the *ID* is not defined). @@ -3957,9 +3957,9 @@ Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* ( @subsubsection occt_draw_5_7_3 AppendNode Syntax: -~~~~~ +~~~~{.cpp} AppendNode dfname fatherentry childentry [fatherID] -~~~~~ +~~~~ Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as last child of *fatherentry*. @@ -3970,9 +3970,9 @@ Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fath @subsubsection occt_draw_5_7_4 PrependNode Syntax: -~~~~~ +~~~~{.cpp} PrependNode dfname fatherentry childentry [fatherID] -~~~~~ +~~~~ Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as first child of *fatherentry*. @@ -3981,9 +3981,9 @@ Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fath @subsubsection occt_draw_5_7_5 InsertNodeBefore Syntax: -~~~~~ +~~~~{.cpp} InsertNodeBefore dfname treenodeentry beforetreenode [ID] -~~~~~ +~~~~ Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *beforetreenode* before *treenodeentry*. @@ -3991,9 +3991,9 @@ Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not def @subsubsection occt_draw_5_7_6 InsertNodeAfter Syntax: -~~~~~ +~~~~{.cpp} InsertNodeAfter dfname treenodeentry aftertreenode [ID] -~~~~~ +~~~~ Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *aftertreenode* after *treenodeentry*. @@ -4001,9 +4001,9 @@ Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not def @subsubsection occt_draw_5_7_7 DetachNode Syntax: -~~~~~ +~~~~{.cpp} DetachNode dfname treenodeentry [ID] -~~~~~ +~~~~ Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) from *treenodeentry*. @@ -4011,15 +4011,15 @@ Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not def @subsubsection occt_draw_5_7_8 ChildNodeIterate Syntax: -~~~~~ +~~~~{.cpp} ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID] -~~~~~ +~~~~ Iterates on the tree of *TreeNode* attributes with tree *ID* (or default ID, if *ID* is not defined). If *alllevels* is set to *1* it explores not only the first, but all the sub Step levels. **Example:** -~~~~~ +~~~~{.cpp} Label D 0:2 Label D 0:3 Label D 0:4 @@ -4062,20 +4062,20 @@ ChildNodeIterate D 0:2 1 ==0:7 ==0:6 ==0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_7_9 InitChildNodeIterator Syntax: -~~~~~ +~~~~{.cpp} InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID] -~~~~~ +~~~~ Initializes the iteration on the tree of *TreeNode* attributes with tree *ID* (or default ID, if *ID* is not defined). If *alllevels* is set to *1* it explores not only the first, but also all sub Step levels. **Example:** -~~~~~ +~~~~{.cpp} InitChildNodeIterate D 0:5 1 set aChildNumber 0 for {set i 1} {$i < 100} {incr i} { @@ -4086,14 +4086,14 @@ for {set i 1} {$i < 100} {incr i} { } } puts "aChildNumber=$aChildNumber" -~~~~~ +~~~~ @subsubsection occt_draw_5_7_10 ChildNodeMore Syntax: -~~~~~ +~~~~{.cpp} ChildNodeMore -~~~~~ +~~~~ Returns TRUE if there is a current item in the iteration. @@ -4101,9 +4101,9 @@ Returns TRUE if there is a current item in the iteration. @subsubsection occt_draw_5_7_11 ChildNodeNext Syntax: -~~~~~ +~~~~{.cpp} ChildNodeNext -~~~~~ +~~~~ Moves to the next Item. @@ -4111,9 +4111,9 @@ Moves to the next Item. @subsubsection occt_draw_5_7_12 ChildNodeValue Syntax: -~~~~~ +~~~~{.cpp} ChildNodeValue -~~~~~ +~~~~ Returns the current treenode of *ChildNodeIterator*. @@ -4121,9 +4121,9 @@ Returns the current treenode of *ChildNodeIterator*. @subsubsection occt_draw_5_7_13 ChildNodeNextBrother Syntax: -~~~~~ +~~~~{.cpp} ChildNodeNextBrother -~~~~~ +~~~~ Moves to the next *Brother*. If there is none, goes up. This method is interesting only with *allLevels* behavior. @@ -4134,213 +4134,213 @@ Moves to the next *Brother*. If there is none, goes up. This method is interesti @subsubsection occt_draw_5_8_1 AISInitViewer Syntax: -~~~~~ +~~~~{.cpp} AISInitViewer docname -~~~~~ +~~~~ Creates and sets *AISViewer* attribute at root label, creates AIS viewer window. **Example:** -~~~~~ +~~~~{.cpp} AISInitViewer D -~~~~~ +~~~~ @subsubsection occt_draw_5_8_2 AISRepaint Syntax: -~~~~~ +~~~~{.cpp} AISRepaint docname -~~~~~ +~~~~ Updates the AIS viewer window. **Example:** -~~~~~ +~~~~{.cpp} AISRepaint D -~~~~~ +~~~~ @subsubsection occt_draw_5_8_3 AISDisplay Syntax: -~~~~~ +~~~~{.cpp} AISDisplay docname entry [not_update] -~~~~~ +~~~~ Displays a presantation of *AISobject* from *entry* label in AIS viewer. If *not_update* is not defined then *AISobject* is recomputed and all visualization settings are applied. **Example:** -~~~~~ +~~~~{.cpp} AISDisplay D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_4 AISUpdate Syntax: -~~~~~ +~~~~{.cpp} AISUpdate docname entry -~~~~~ +~~~~ Recomputes a presentation of *AISobject* from *entry* label and applies the visualization setting in AIS viewer. **Example:** -~~~~~ +~~~~{.cpp} AISUpdate D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_5 AISErase Syntax: -~~~~~ +~~~~{.cpp} AISErase docname entry -~~~~~ +~~~~ Erases *AISobject* of *entry* label in AIS viewer. **Example:** -~~~~~ +~~~~{.cpp} AISErase D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_6 AISRemove Syntax: -~~~~~ +~~~~{.cpp} AISRemove docname entry -~~~~~ +~~~~ Erases *AISobject* of *entry* label in AIS viewer, then *AISobject* is removed from *AIS_InteractiveContext*. **Example:** -~~~~~ +~~~~{.cpp} AISRemove D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_7 AISSet Syntax: -~~~~~ +~~~~{.cpp} AISSet docname entry ID -~~~~~ +~~~~ Creates *AISPresentation* attribute at *entry* label and sets as driver ID. ID must be one of the following: *A* (*axis*), *C* (*constraint*), *NS* (*namedshape*), *G* (*geometry*), *PL* (*plane*), *PT* (*point*). **Example:** -~~~~~ +~~~~{.cpp} AISSet D 0:5 NS -~~~~~ +~~~~ @subsubsection occt_draw_5_8_8 AISDriver Syntax: -~~~~~ +~~~~{.cpp} AISDriver docname entry [ID] -~~~~~ +~~~~ Returns DriverGUID stored in *AISPresentation* attribute of an *entry* label or sets a new one. ID must be one of the following: *A* (*axis*), *C* (*constraint*), *NS* (*namedshape*), *G* (*geometry*), *PL* (*plane*), *PT* (*point*). **Example:** -~~~~~ +~~~~{.cpp} # Get Driver GUID AISDriver D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_9 AISUnset Syntax: -~~~~~ +~~~~{.cpp} AISUnset docname entry -~~~~~ +~~~~ Deletes *AISPresentation* attribute (if it exists) of an *entry* label. **Example:** -~~~~~ +~~~~{.cpp} AISUnset D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_10 AISTransparency Syntax: -~~~~~ +~~~~{.cpp} AISTransparency docname entry [transparency] -~~~~~ +~~~~ Sets (if *transparency* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label. **Example:** -~~~~~ +~~~~{.cpp} AISTransparency D 0:5 0.5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_11 AISHasOwnTransparency Syntax: -~~~~~ +~~~~{.cpp} AISHasOwnTransparency docname entry -~~~~~ +~~~~ Tests *AISPresentation* attribute of an *entry* label by own transparency. **Example:** -~~~~~ +~~~~{.cpp} AISHasOwnTransparency D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_12 AISMaterial Syntax: -~~~~~ +~~~~{.cpp} AISMaterial docname entry [material] -~~~~~ +~~~~ Sets (if *material* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label. *material* is integer from 0 to 20 (see @ref occt_draw_4_5_6 "meshmat" command). **Example:** -~~~~~ +~~~~{.cpp} AISMaterial D 0:5 5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_13 AISHasOwnMaterial Syntax: -~~~~~ +~~~~{.cpp} AISHasOwnMaterial docname entry -~~~~~ +~~~~ Tests *AISPresentation* attribute of an *entry* label by own material. **Example:** -~~~~~ +~~~~{.cpp} AISHasOwnMaterial D 0:5 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_14 AISColor Syntax: -~~~~~ +~~~~{.cpp} AISColor docname entry [color] -~~~~~ +~~~~ Sets (if *color* is defined) or gets value of color for *AISPresentation* attribute of an *entry* label. *color* is integer from 0 to 516 (see color names in *vsetcolor*). **Example:** -~~~~~ +~~~~{.cpp} AISColor D 0:5 25 -~~~~~ +~~~~ @subsubsection occt_draw_5_8_15 AISHasOwnColor Syntax: -~~~~~ +~~~~{.cpp} AISHasOwnColor docname entry -~~~~~ +~~~~ Tests *AISPresentation* attribute of an *entry* label by own color. **Example:** -~~~~~ +~~~~{.cpp} AISHasOwnColor D 0:5 -~~~~~ +~~~~ @section occt_draw_6 Geometry commands @@ -4389,27 +4389,27 @@ Curves are displayed with an arrow showing the last parameter. @subsubsection occt_draw_6_2_1 point Syntax: -~~~~~ +~~~~{.cpp} point name x y [z] -~~~~~ +~~~~ Creates a 2d or 3d point, depending on the number of arguments. **Example:** -~~~~~ +~~~~{.cpp} # 2d point point p1 1 2 # 3d point point p2 10 20 -5 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_2 line Syntax: -~~~~~ +~~~~{.cpp} line name x y [z] dx dy [dz] -~~~~~ +~~~~ Creates a 2d or 3d line. *x y z* are the coordinates of the line’s point of origin; *dx, dy, dz* give the direction vector. @@ -4417,20 +4417,20 @@ Creates a 2d or 3d line. *x y z* are the coordinates of the line’s point of or A 2d line will be represented as *x y dx dy*, and a 3d line as *x y z dx dy dz* . A line is parameterized along its length starting from the point of origin along the direction vector. The direction vector is normalized and must not be null. Lines are infinite, even though their representation is not. **Example:** -~~~~~ +~~~~{.cpp} # a 2d line at 45 degrees of the X axis line l 2 0 1 1 # a 3d line through the point 10 0 0 and parallel to Z line l 10 0 0 0 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_3 circle Syntax: -~~~~~ +~~~~{.cpp} circle name x y [z [dx dy dz]] [ux uy [uz]] radius -~~~~~ +~~~~ Creates a 2d or a 3d circle. @@ -4441,7 +4441,7 @@ In 3d, *x, y, z* are the coordinates of the center; *dx, dy, dz* give the vector The circle is parameterized by the angle in [0,2*pi] starting from the origin and. Note that the specification of origin direction and plane is the same for all analytical curves and surfaces. **Example:** -~~~~~ +~~~~{.cpp} # A 2d circle of radius 5 centered at 10,-2 circle c1 10 -2 5 @@ -4458,27 +4458,27 @@ circle c4 10 20 -5 0 1 0 17 # full 3d circle, axis X, origin on Z circle c5 10 20 -5 1 0 0 0 0 1 17 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_4 ellipse Syntax: -~~~~~ +~~~~{.cpp} ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius -~~~~~ +~~~~ Creates a 2d or 3d ellipse. In a 2d ellipse, the first two arguments define the center; in a 3d ellipse, the first three. The axis system is given by *firstradius*, the major radius, and *secondradius*, the minor radius. The parameter range of the ellipse is [0,2.*pi] starting from the X axis and going towards the Y axis. The Draw ellipse is parameterized by an angle: -~~~~~ +~~~~{.cpp} P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir -~~~~~ +~~~~ where: * P is the point of parameter *u*, * *O, Xdir* and *Ydir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system. **Example:** -~~~~~ +~~~~{.cpp} # default 2d ellipse ellipse e1 10 5 20 10 @@ -4490,28 +4490,28 @@ ellipse e3 0 0 0 25 5 # 3d ellipse in the X,Z plane with axis 1, 0 ,1 ellipse e4 0 0 0 0 1 0 1 0 1 25 5 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_5 hyperbola Syntax: -~~~~~ +~~~~{.cpp} hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius -~~~~~ +~~~~ Creates a 2d or 3d conic. The first arguments define the center. The axis system is given by *firstradius*, the major radius, and *secondradius*, the minor radius. Note that the hyperbola has only one branch, that in the X direction. The Draw hyperbola is parameterized as follows: -~~~~~ +~~~~{.cpp} P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir -~~~~~ +~~~~ where: * *P* is the point of parameter *U*, * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *YDirection* of its local coordinate system. **Example:** -~~~~~ +~~~~{.cpp} # default 2d hyperbola, with asymptotes 1,1 -1,1 hyperbola h1 0 0 30 30 @@ -4520,22 +4520,22 @@ hyperbola h2 0 0 1 2 20 20 # 3d hyperbola, in the XY plane hyperbola h3 0 0 0 50 50 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_6 parabola Syntax: -~~~~~ +~~~~{.cpp} parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength -~~~~~ +~~~~ Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola. The *Geom_Parabola* is parameterized as follows: -~~~~~ +~~~~{.cpp} P(u) = O + u*u/(4.*F)*XDir + u*YDir -~~~~~ +~~~~ where: * *P* is the point of parameter *u*, @@ -4543,7 +4543,7 @@ where: * *F* is the focal length of the parabola. **Example:** -~~~~~ +~~~~{.cpp} # 2d parabola parabola p1 0 0 50 @@ -4552,37 +4552,37 @@ parabola p2 0 0 0 1 50 # 3d parabola in the Y-Z plane, convexity +Z parabola p3 0 0 0 1 0 0 0 0 1 50 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_7 beziercurve, 2dbeziercurve Syntax: -~~~~~ +~~~~{.cpp} beziercurve name nbpole pole, [weight] 2dbeziercurve name nbpole pole, [weight] -~~~~~ +~~~~ Creates a 3d rational or non-rational Bezier curve. Give the number of poles (control points,) and the coordinates of the poles *(x1 y1 z1 [w1] x2 y2 z2 [w2])*. The degree will be *nbpoles-1*. To create a rational curve, give weights with the poles. You must give weights for all poles or for none. If the weights of all the poles are equal, the curve is polynomial, and therefore non-rational. **Example:** -~~~~~ +~~~~{.cpp} # a rational 2d bezier curve (arc of circle) 2dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1 # a 3d bezier curve, not rational beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10 -~~~~~ +~~~~ @subsubsection occt_draw_6_2_8 bsplinecurve, 2dbsplinecurve, pbsplinecurve, 2dpbsplinecurve Syntax: -~~~~~ +~~~~{.cpp} bsplinecurve name degree nbknots knot, umult pole, weight 2dbsplinecurve name degree nbknots knot, umult pole, weight pbsplinecurve name degree nbknots knot, umult pole, weight (periodic) 2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic) -~~~~~ +~~~~ Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves. @@ -4597,7 +4597,7 @@ The poles must be given with their weights, use weights of 1 for a non rational * For a periodic curve: Sum of multiplicities - last multiplicity **Example:** -~~~~~ +~~~~{.cpp} # a bspline curve with 4 poles and 3 knots bsplinecurve bc 2 3 0 3 1 1 2 3 \ 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1 @@ -4612,7 +4612,7 @@ dset h sqrt(3)/2 -0.25 h/6 1 \ -0.5 -h/3 0.5 \ 0 -h/3 1 -~~~~~ +~~~~ **Note** that you can create the **NURBS** subset of bspline curves and surfaces by trimming analytical curves and surfaces and executing the command *convert*. @@ -4620,21 +4620,21 @@ dset h sqrt(3)/2 @subsubsection occt_draw_6_2_9 uiso, viso Syntax: -~~~~~ +~~~~{.cpp} uiso name surface u viso name surface u -~~~~~ +~~~~ Creates a U or V isoparametric curve from a surface. **Example:** -~~~~~ +~~~~{.cpp} # create a cylinder and extract iso curves cylinder c 10 uiso c1 c pi/6 viso c2 c -~~~~~ +~~~~ **Note** that this cannot be done from offset surfaces. @@ -4642,15 +4642,15 @@ viso c2 c @subsubsection occt_draw_6_2_10 to3d, to2d Syntax: -~~~~~ +~~~~{.cpp} to3d name curve2d [plane] to2d name curve3d [plane] -~~~~~ +~~~~ Create respectively a 3d curve from a 2d curve and a 2d curve from a 3d curve. The transformation uses a planar surface to define the XY plane in 3d (by default this plane is the default OXYplane). **to3d** always gives a correct result, but as **to2d** is not a projection, it may surprise you. It is always correct if the curve is planar and parallel to the plane of projection. The points defining the curve are projected on the plane. A circle, however, will remain a circle and will not be changed to an ellipse. **Example:** -~~~~~ +~~~~{.cpp} # the following commands circle c 0 0 5 plane p -2 1 0 1 2 3 @@ -4658,7 +4658,7 @@ to3d c c p # will create the same circle as circle c -2 1 0 1 2 3 5 -~~~~~ +~~~~ See also: **project** @@ -4666,20 +4666,20 @@ See also: **project** @subsubsection occt_draw_6_2_11 project Syntax: -~~~~~ +~~~~{.cpp} project name curve3d surface -~~~~~ +~~~~ Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces. If we, for example, intersect a cylinder and a plane and project the resulting ellipse on the cylinder, this will create a 2d sinusoid-like bspline. -~~~~~ +~~~~{.cpp} cylinder c 5 plane p 0 0 0 0 1 1 intersect i c p project i2d i c -~~~~~ +~~~~ @subsection occt_draw_6_3 Surface creation @@ -4695,9 +4695,9 @@ Surfaces are displayed with isoparametric lines. To show the parameterization, a @subsubsection occt_draw_6_3_1 plane Syntax: -~~~~~ +~~~~{.cpp} plane name [x y z [dx dy dz [ux uy uz]]] -~~~~~ +~~~~ Creates an infinite plane. @@ -4710,26 +4710,26 @@ There are default values for the coordinate system. If no arguments are given, t Note that this definition will be used for all analytical surfaces. **Example:** -~~~~~ +~~~~{.cpp} # a plane through the point 10,0,0 perpendicular to X # with U direction on Y plane p1 10 0 0 1 0 0 0 1 0 # an horixontal plane with origin 10, -20, -5 plane p2 10 -20 -5 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_2 cylinder Syntax: -~~~~~ +~~~~{.cpp} cylinder name [x y z [dx dy dz [ux uy uz]]] radius -~~~~~ +~~~~ A cylinder is defined by a coordinate system, and a radius. The surface generated is an infinite cylinder with the Z axis as the axis. The U parameter is the angle starting from X going in the Y direction. **Example:** -~~~~~ +~~~~{.cpp} # a cylinder on the default Z axis, radius 10 cylinder c1 10 @@ -4742,71 +4742,71 @@ cylinder c2 5 10 -3 10 dset lo pi/3. la pi/4. cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo) sin(la) 10 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_3 cone Syntax: -~~~~~ +~~~~{.cpp} cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius -~~~~~ +~~~~ Creates a cone in the infinite coordinate system along the Z-axis. The radius is that of the circle at the intersection of the cone and the XY plane. The semi-angle is the angle formed by the cone relative to the axis; it should be between -90 and 90. If the radius is 0, the vertex is the origin. **Example:** -~~~~~ +~~~~{.cpp} # a cone at 45 degrees at the origin on Z cone c1 45 0 # a cone on axis Z with radius r1 at z1 and r2 at z2 cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_4 sphere Syntax: -~~~~~ +~~~~{.cpp} sphere name [x y z [dx dy dz [ux uy uz]]] radius -~~~~~ +~~~~ Creates a sphere in the local coordinate system defined in the **plane** command. The sphere is centered at the origin. To parameterize the sphere, *u* is the angle from X to Y, between 0 and 2*pi. *v* is the angle in the half-circle at angle *u* in the plane containing the Z axis. *v* is between -pi/2 and pi/2. The poles are the points Z = +/- radius; their parameters are u,+/-pi/2 for any u in 0,2*pi. **Example:** -~~~~~ +~~~~{.cpp} # a sphere at the origin sphere s1 10 # a sphere at 10 10 10, with poles on the axis 1,1,1 sphere s2 10 10 10 1 1 1 10 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_5 torus Syntax: -~~~~~ +~~~~{.cpp} torus name [x y z [dx dy dz [ux uy uz]]] major minor -~~~~~ +~~~~ Creates a torus in the local coordinate system with the given major and minor radii. *Z* is the axis for the major radius. The major radius may be lower in value than the minor radius. To parameterize a torus, *u* is the angle from X to Y; *v* is the angle in the plane at angle *u* from the XY plane to Z. *u* and *v* are in 0,2*pi. **Example:** -~~~~~ +~~~~{.cpp} # a torus at the origin torus t1 20 5 # a torus in another coordinate system torus t2 10 5 -2 2 1 0 20 5 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_6 beziersurf Syntax: -~~~~~ +~~~~{.cpp} beziersurf name nbupoles nbvolpes pole, [weight] -~~~~~ +~~~~ Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions. @@ -4815,25 +4815,25 @@ Then give the poles in the following order: *pole(1, 1), pole(nbupoles, 1), pole Weights may be omitted, but if you give one weight you must give all of them. **Example:** -~~~~~ +~~~~{.cpp} # a non-rational degree 2,3 surface beziersurf s 3 4 \ 0 0 0 10 0 5 20 0 0 \ 0 10 2 10 10 3 20 10 2 \ 0 20 10 10 20 20 20 20 10 \ 0 30 0 10 30 0 20 30 0 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_7 bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf Syntax: -~~~~~ +~~~~{.cpp} bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot vmult ... x y z w ... upbsplinesurf ... vpbsplinesurf ... uvpbsplinesurf ... -~~~~~ +~~~~ * **bsplinesurf** generates bspline surfaces; * **upbsplinesurf** creates a bspline surface periodic in u; @@ -4845,7 +4845,7 @@ The syntax is similar to the *bsplinecurve* command. First give the degree in u See *bsplinecurve* to compute the number of poles, the poles are first given in U as in the *beziersurf* command. You must give weights if the surface is rational. **Example:** -~~~~~ +~~~~{.cpp} # create a bspline surface of degree 1 2 # with two knots in U and three in V bsplinesurf s \ @@ -4855,17 +4855,17 @@ bsplinesurf s \ 0 10 2 1 10 10 3 1 \ 0 20 10 1 10 20 20 1 \ 0 30 0 1 10 30 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_8 trim, trimu, trimv Syntax: -~~~~~ +~~~~{.cpp} trim newname name [u1 u2 [v1 v2] [usense vsense]] trimu newname name u1 u2 [usense] trimv newname name v1 v2 [vsense] -~~~~~ +~~~~ The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package. * *trim* creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface. @@ -4877,7 +4877,7 @@ After an initial trim, a second execution with no parameters given recreates the **Note** that a trimmed curve or surface contains a copy of the basis geometry: modifying that will not modify the trimmed geometry. Trimming trimmed geometry will not create multiple levels of trimming. The basis geometry will be used. **Example:** -~~~~~ +~~~~{.cpp} # create a 3d circle circle c 0 0 0 10 @@ -4902,14 +4902,14 @@ trim cc c pi/2 2*pi # trim an infinite cylinder cylinder cy 10 trimv cy cy 0 50 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_9 offset Syntax: -~~~~~ +~~~~{.cpp} offset name basename distance [dx dy dz] -~~~~~ +~~~~ Creates offset curves or surfaces at a given distance from a basis curve or surface. Offset curves and surfaces are classes from the *Geom *package. @@ -4918,7 +4918,7 @@ The curve can be a 2d or a 3d curve. To compute the offsets for a 3d curve, you The offset curve or surface copies the basic geometry, which can be modified later. **Example:** -~~~~~ +~~~~{.cpp} # graphic demonstration that the outline of a torus # is the offset of an ellipse smallview +X+Y @@ -4928,14 +4928,14 @@ fit ellipse e 0 0 0 50 50*sin(angle) # note that the distance can be negative offset l1 e 20 0 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_10 revsurf Syntax: -~~~~~ +~~~~{.cpp} revsurf name curvename x y z dx dy dz -~~~~~ +~~~~ Creates a surface of revolution from a 3d curve. @@ -4944,18 +4944,18 @@ A surface of revolution or revolved surface is obtained by rotating a curve (cal To parameterize a surface of revolution: u is the angle of rotation around the axis. Its origin is given by the position of the meridian on the surface. v is the parameter of the meridian. **Example:** -~~~~~ +~~~~{.cpp} # another way of creating a torus like surface circle c 50 0 0 20 revsurf s c 0 0 0 0 1 0 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_11 extsurf Syntax: -~~~~~ +~~~~{.cpp} extsurf newname curvename dx dy dz -~~~~~ +~~~~ Creates a surface of linear extrusion from a 3d curve. The basis curve is swept in a given direction,the *direction of extrusion* defined by a vector. @@ -4964,25 +4964,25 @@ In the syntax, *dx,dy,dz* gives the direction of extrusion. To parameterize a surface of extrusion: *u* is the parameter along the extruded curve; the *v* parameter is along the direction of extrusion. **Example:** -~~~~~ +~~~~{.cpp} # an elliptic cylinder ellipse e 0 0 0 10 5 extsurf s e 0 0 1 # to make it finite trimv s s 0 10 -~~~~~ +~~~~ @subsubsection occt_draw_6_3_12 convert Syntax: -~~~~~ +~~~~{.cpp} convert newname name -~~~~~ +~~~~ Creates a 2d or 3d NURBS curve or a NURBS surface from any 2d curve, 3d curve or surface. In other words, conics, beziers and bsplines are turned into NURBS. Offsets are not processed. **Example:** -~~~~~ +~~~~{.cpp} # turn a 2d arc of a circle into a 2d NURBS circle c 0 0 5 trim c c 0 pi/3 @@ -4992,7 +4992,7 @@ convert c1 c plane p trim p p -1 1 -1 1 convert p1 p -~~~~~ +~~~~ **Note** that offset curves and surfaces are not processed by this command. @@ -5026,11 +5026,11 @@ Modifications for bspline: Syntax: -~~~~~ +~~~~{.cpp} reverse curvename ureverse surfacename vreverse surfacename -~~~~~ +~~~~ The **reverse** command reverses the parameterization and inverses the orientation of a 2d or 3d curve. Note that the geometry is modified. To keep the curve or the surface, you must copy it before modification. @@ -5039,7 +5039,7 @@ The **reverse** command reverses the parameterization and inverses the orientati Reversing a parameter on an analytical surface may create an indirect coordinate system. **Example:** -~~~~~ +~~~~{.cpp} # reverse a trimmed 2d circle circle c 0 0 5 trim c c pi/4 pi/2 @@ -5047,33 +5047,33 @@ reverse c # dumping c will show that it is now trimmed between # 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_2 exchuv Syntax: -~~~~~ +~~~~{.cpp} exchuv surfacename -~~~~~ +~~~~ For a bezier or bspline surface this command exchanges the u and v parameters. **Example:** -~~~~~ +~~~~{.cpp} # exchanging u and v on a spline (made from a cylinder) cylinder c 5 trimv c c 0 10 convert c1 c exchuv c1 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_3 segment, segsur Syntax: -~~~~~ +~~~~{.cpp} segment curve Ufirst Ulast segsur surface Ufirst Ulast Vfirst Vlast -~~~~~ +~~~~ **segment** and **segsur** segment a bezier curve and a bspline curve or surface respectively. @@ -5082,31 +5082,31 @@ These commands modify the curve to restrict it between the new parameters: *Ufir This command must not be confused with **trim** which creates a new geometry. **Example:** -~~~~~ +~~~~{.cpp} # segment a bezier curve in half beziercurve c 3 0 0 0 10 0 0 10 10 0 segment c ufirst ulast -~~~~~ +~~~~ @subsubsection occt_draw_6_4_4 iincudeg, incvdeg Syntax: -~~~~~ +~~~~{.cpp} incudeg surfacename newdegree incvdeg surfacename newdegree -~~~~~ +~~~~ **incudeg** and **incvdeg** increase the degree in the U or V parameter of a bezier or bspline surface. **Example:** -~~~~~ +~~~~{.cpp} # make a planar bspline and increase the degree to 2 3 plane p trim p p -1 1 -1 1 convert p1 p incudeg p1 2 incvdeg p1 3 -~~~~~ +~~~~ **Note** that the geometry is modified. @@ -5114,19 +5114,19 @@ incvdeg p1 3 @subsubsection occt_draw_6_4_5 cmovep, movep, movecolp, moverowp Syntax: -~~~~~ +~~~~{.cpp} cmovep curve index dx dy [dz] movep surface uindex vindex dx dy dz movecolp surface uindex dx dy dz moverowp surface vindex dx dy dz -~~~~~ +~~~~ **move** methods translate poles of a bezier curve, a bspline curve or a bspline surface. * **cmovep** and **movep** translate one pole with a given index. * **movecolp** and **moverowp** translate a whole column (expressed by the *uindex*) or row (expressed by the *vindex*) of poles. **Example:** -~~~~~ +~~~~{.cpp} # start with a plane # transform to bspline, raise degree and add relief plane p @@ -5137,17 +5137,17 @@ incvd p1 2 movecolp p1 2 0 0 5 moverowp p1 2 0 0 5 movep p1 2 2 0 0 5 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_6 insertpole, rempole, remcolpole, remrowpole Syntax: -~~~~~ +~~~~{.cpp} insertpole curvename index x y [z] [weight] rempole curvename index remcolpole surfacename index remrowpole surfacename index -~~~~~ +~~~~ **insertpole** inserts a new pole into a 2d or 3d bezier curve. You may add a weight for the pole. The default value for the weight is 1. The pole is added at the position after that of the index pole. Use an index 0 to insert the new pole before the first one already existing in your drawing. @@ -5156,57 +5156,57 @@ remrowpole surfacename index **remcolpole** and **remrowpole** remove a column or a row of poles from a bezier surface. A column is in the v direction and a row in the u direction The resulting degree must be at least 1; i.e there will be two rows and two columns left. **Example:** -~~~~~ +~~~~{.cpp} # start with a segment, insert a pole at end # then remove the central pole beziercurve c 2 0 0 0 10 0 0 insertpole c 2 10 10 0 rempole c 2 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_7 insertknot, insertuknot, insertvknot Syntax: -~~~~~ +~~~~{.cpp} insertknot name knot [mult = 1] [knot mult ...] insertuknot surfacename knot mult insertvknot surfacename knot mult -~~~~~ +~~~~ **insertknot** inserts knots in the knot sequence of a bspline curve. You must give a knot value and a target multiplicity. The default multiplicity is 1. If there is already a knot with the given value and a multiplicity lower than the target one, its multiplicity will be raised. **insertuknot** and **insertvknot** insert knots in a surface. **Example:** -~~~~~ +~~~~{.cpp} # create a cylindrical surface and insert a knot cylinder c 10 trim c c 0 pi/2 0 10 convert c1 c insertuknot c1 pi/4 1 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_8 remknot, remuknot, remvknot Syntax: -~~~~~ +~~~~{.cpp} remknot index [mult] [tol] remuknot index [mult] [tol] remvknot index [mult] [tol] -~~~~~ +~~~~ **remknot** removes a knot from the knot sequence of a curve or a surface. Give the index of the knot and optionally, the target multiplicity. If the target multiplicity is not 0, the multiplicity of the knot will be lowered. As the curve may be modified, you are allowed to set a tolerance to control the process. If the tolerance is low, the knot will only be removed if the curve will not be modified. By default, if no tolerance is given, the knot will always be removed. **Example:** -~~~~~ +~~~~{.cpp} # bspline circle, remove a knot circle c 0 0 5 convert c1 c incd c1 5 remknot c1 2 -~~~~~ +~~~~ **Note** that Curves or Surfaces may be modified. @@ -5214,46 +5214,46 @@ remknot c1 2 @subsubsection occt_draw_6_4_9 setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic Syntax: -~~~~~ +~~~~{.cpp} setperiodic curve setnotperiodic curve setuperiodic surface setunotperiodic surface setvperiodic surface setvnotperiodic surface -~~~~~ +~~~~ **setperiodic** turns a bspline curve into a periodic bspline curve; the knot vector stays the same and excess poles are truncated. The curve may be modified if it has not been closed. **setnotperiodic** removes the periodicity of a periodic curve. The pole table mau be modified. Note that knots are added at the beginning and the end of the knot vector and the multiplicities are knots set to degree+1 at the start and the end. **setuperiodic** and **setvperiodic** make the u or the v parameter of bspline surfaces periodic; **setunotperiodic**, and **setvnotperiodic** remove periodicity from the u or the v parameter of bspline surfaces. **Example:** -~~~~~ +~~~~{.cpp} # a circle deperiodicized circle c 0 0 5 convert c1 c setnotperiodic c1 -~~~~~ +~~~~ @subsubsection occt_draw_6_4_10 setorigin, setuorigin, setvorigin Syntax: -~~~~~ +~~~~{.cpp} setorigin curvename index setuorigin surfacename index setuorigin surfacename index -~~~~~ +~~~~ These commands change the origin of the parameters on periodic curves or surfaces. The new origin must be an existing knot. To set an origin other than an existing knot, you must first insert one with the *insertknot* command. **Example:** -~~~~~ +~~~~{.cpp} # a torus with new U and V origins torus t 20 5 convert t1 t setuorigin t1 2 setvorigin t1 2 -~~~~~ +~~~~ @subsection occt_draw_6_5 Transformations @@ -5263,23 +5263,23 @@ Draw provides commands to apply linear transformations to geometric objects: the @subsubsection occt_draw_6_5_1 translate, dtranslate Syntax: -~~~~~ +~~~~{.cpp} translate name [names ...] dx dy dz 2dtranslate name [names ...] dx dy -~~~~~ +~~~~ The **Translate** command translates 3d points, curves and surfaces along a vector *dx,dy,dz*. You can translate more than one object with the same command. For 2d points or curves, use the **2dtranslate** command. **Example:** -~~~~~ +~~~~{.cpp} # 3d translation point p 10 20 30 circle c 10 20 30 5 torus t 10 20 30 5 2 translate p c t 0 0 15 -~~~~~ +~~~~ *NOTE* *Objects are modified by this command.* @@ -5287,17 +5287,17 @@ translate p c t 0 0 15 @subsubsection occt_draw_6_5_2 rotate, 2drotate Syntax: -~~~~~ +~~~~{.cpp} rotate name [name ...] x y z dx dy dz angle 2drotate name [name ...] x y angle -~~~~~ +~~~~ The **rotate** command rotates a 3d point curve or surface. You must give an axis of rotation with a point *x,y,z*, a vector *dx,dy,dz* and an angle in degrees. For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative. **Example:** -~~~~~ +~~~~{.cpp} # make a helix of circles. create a script file with this code and execute it using **source**. circle c0 10 0 0 3 @@ -5306,18 +5306,18 @@ copy c[expr $i-1] c$i translate c$i 0 0 3 rotate c$i 0 0 0 0 0 1 36 } -~~~~~ +~~~~ @subsubsection occt_draw_6_5_3 pmirror, lmirror, smirror, dpmirror, dlmirror Syntax: -~~~~~ +~~~~{.cpp} pmirror name [names ...] x y z lmirror name [names ...] x y z dx dy dz smirror name [names ...] x y z dx dy dz 2dpmirror name [names ...] x y 2dlmirror name [names ...] x y dx dy -~~~~~ +~~~~ The mirror commands perform a mirror transformation of 2d or 3d geometry. @@ -5328,7 +5328,7 @@ The mirror commands perform a mirror transformation of 2d or 3d geometry. * **2dlmirror** is the axis symmetry mirror in 2D. **Example:** -~~~~~ +~~~~{.cpp} # build 3 images of a torus torus t 10 10 10 1 2 3 5 1 copy t t1 @@ -5337,25 +5337,25 @@ copy t t2 lmirror t2 0 0 0 1 0 0 copy t t3 smirror t3 0 0 0 1 0 0 -~~~~~ +~~~~ @subsubsection occt_draw_6_5_4 pscale, dpscale Syntax: -~~~~~ +~~~~{.cpp} pscale name [name ...] x y z s 2dpscale name [name ...] x y s -~~~~~ +~~~~ The **pscale** and **2dpscale** commands transform an object by point scaling. You must give the center and the scaling factor. Because other scalings modify the type of the object, they are not provided. For example, a sphere may be transformed into an ellipsoid. Using a scaling factor of -1 is similar to using **pmirror**. **Example:** -~~~~~ +~~~~{.cpp} # double the size of a sphere sphere s 0 0 0 10 pscale s 0 0 0 2 -~~~~~ +~~~~ @subsection occt_draw_6_6 Curve and surface analysis @@ -5372,29 +5372,29 @@ pscale s 0 0 0 2 @subsubsection occt_draw_6_6_1 coord Syntax: -~~~~~ +~~~~{.cpp} coord P x y [z] -~~~~~ +~~~~ Sets the x, y (and optionally z) coordinates of the point P. **Example:** -~~~~~ +~~~~{.cpp} # translate a point point p 10 5 5 translate p 5 0 0 coord p x y z # x value is 15 -~~~~~ +~~~~ @subsubsection occt_draw_6_6_2 cvalue, 2dcvalue Syntax: -~~~~~ +~~~~{.cpp} cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]] 2dcvalue curve U x y [d1x d1y [d2x d2y]] -~~~~~ +~~~~ For a curve at a given parameter, and depending on the number of arguments, **cvalue** computes the coordinates in *x,y,z*, the first derivative in *d1x,d1y,d1z* and the second derivative in *d2x,d2y,d2z*. @@ -5402,76 +5402,76 @@ For a curve at a given parameter, and depending on the number of arguments, **cv Let on a bezier curve at parameter 0 the point is the first pole; the first derivative is the vector to the second pole multiplied by the degree; the second derivative is the difference first to the second pole, second to the third pole multipied by *degree-1* : -~~~~~ +~~~~{.cpp} 2dbeziercurve c 4 0 0 1 1 2 1 3 0 2dcvalue c 0 x y d1x d1y d2x d2y # values of x y d1x d1y d2x d2y # are 0 0 3 3 0 -6 -~~~~~ +~~~~ @subsubsection occt_draw_6_6_3 svalue Syntax: -~~~~~ +~~~~{.cpp} svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]] -~~~~~ +~~~~ Computes points and derivatives on a surface for a pair of parameter values. The result depends on the number of arguments. You can compute the first and the second derivatives. **Example:** -~~~~~ +~~~~{.cpp} # display points on a sphere sphere s 10 for {dset t 0} {[dval t] <= 1} {dset t t+0.01} { svalue s t*2*pi t*pi-pi/2 x y z point . x y z } -~~~~~ +~~~~ @subsubsection occt_draw_6_6_4 localprop, minmaxcurandinf Syntax: -~~~~~ +~~~~{.cpp} localprop curvename U minmaxcurandinf curve -~~~~~ +~~~~ **localprop** computes the curvature of a curve. **minmaxcurandinf** computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve. **Example:** -~~~~~ +~~~~{.cpp} # show curvature at the center of a bezier curve beziercurve c 3 0 0 0 10 2 0 20 0 0 localprop c 0.5 == Curvature : 0.02 -~~~~~ +~~~~ @subsubsection occt_draw_6_6_5 parameters Syntax: -~~~~~ +~~~~{.cpp} parameters surf/curve x y z U [V] -~~~~~ +~~~~ Returns the parameters on the surface of the 3d point *x,y,z* in variables *u* and *v*. This command may only be used on analytical surfaces: plane, cylinder, cone, sphere and torus. **Example:** -~~~~~ +~~~~{.cpp} # Compute parameters on a plane plane p 0 0 10 1 1 0 parameters p 5 5 5 u v # the values of u and v are : 0 5 -~~~~~ +~~~~ @subsubsection occt_draw_6_6_6 proj, 2dproj Syntax: -~~~~~ +~~~~{.cpp} proj name x y z 2dproj name xy -~~~~~ +~~~~ Use **proj** to project a point on a 3d curve or a surface and **2dproj** for a 2d curve. @@ -5481,18 +5481,18 @@ The command will compute and display all points in the projection. The lines joi Let us project a point on a torus -~~~~~ +~~~~{.cpp} torus t 20 5 proj t 30 10 7 == ext_1 ext_2 ext_3 ext_4 -~~~~~ +~~~~ @subsubsection occt_draw_6_6_7 surface_radius Syntax: -~~~~~ +~~~~{.cpp} surface_radius surface u v [c1 c2] -~~~~~ +~~~~ Computes the main curvatures of a surface at parameters *(u,v)*. If there are extra arguments, their curvatures are stored in variables *c1* and *c2*. @@ -5500,12 +5500,12 @@ Computes the main curvatures of a surface at parameters *(u,v)*. If there are ex Let us compute curvatures of a cylinder: -~~~~~ +~~~~{.cpp} cylinder c 5 surface_radius c pi 3 c1 c2 == Min Radius of Curvature : -5 == Min Radius of Curvature : infinite -~~~~~ +~~~~ @subsection occt_draw_6_7 Intersections @@ -5517,26 +5517,26 @@ surface_radius c pi 3 c1 c2 @subsubsection occt_draw_6_7_1 intersect Syntax: -~~~~~ +~~~~{.cpp} intersect name surface1 surface2 -~~~~~ +~~~~ Intersects two surfaces; if there is one intersection curve it will be named *name*, if there are more than one they will be named *name_1*, *name_2*, ... **Example:** -~~~~~ +~~~~{.cpp} # create an ellipse cone c 45 0 plane p 0 0 40 0 1 5 intersect e c p -~~~~~ +~~~~ @subsubsection occt_draw_6_7_2 2dintersect Syntax: -~~~~~ +~~~~{.cpp} 2dintersect curve1 [curve2] [-tol tol] [-state] -~~~~~ +~~~~ Displays the intersection points between 2d curves. Options: @@ -5544,31 +5544,31 @@ Options: -state - allows printing the intersection state for each point. **Example:** -~~~~~ +~~~~{.cpp} # intersect two 2d ellipses ellipse e1 0 0 5 2 ellipse e2 0 0 0 1 5 2 2dintersect e1 e2 -tol 1.e-10 -state -~~~~~ +~~~~ @subsubsection occt_draw_6_7_3 intconcon Syntax: -~~~~~ +~~~~{.cpp} intconcon curve1 curve2 -~~~~~ +~~~~ Displays the intersection points between two 2d curves. Curves must be only conic sections: 2d lines, circles, ellipses, hyperbolas, parabolas. The algorithm from *IntAna2d_AnaIntersection* is used. **Example:** -~~~~~ +~~~~{.cpp} # intersect two 2d ellipses ellipse e1 0 0 5 2 ellipse e2 0 0 0 1 5 2 intconcon e1 e2 -~~~~~ +~~~~ @subsection occt_draw_6_8 Approximations @@ -5583,10 +5583,10 @@ Draw provides command to create curves and surfaces by approximation. @subsubsection occt_draw_6_8_1 appro, dapprox Syntax: -~~~~~ +~~~~{.cpp} appro result nbpoint [curve] 2dapprox result nbpoint [curve / x1 y1 x2 y2] -~~~~~ +~~~~ These commands fit a curve through a set of points. First give the number of points, then choose one of the three ways available to get the points. If you have no arguments, click on the points. If you have a curve argument or a list of points, the command launches computation of the points on the curve. @@ -5594,21 +5594,21 @@ These commands fit a curve through a set of points. First give the number of poi Let us pick points and they will be fitted -~~~~~ +~~~~{.cpp} 2dapprox c 10 -~~~~~ +~~~~ @subsubsection occt_draw_6_8_2 surfapp, grilapp, surfint Syntax: -~~~~~ +~~~~{.cpp} surfapp name nbupoints nbvpoints x y z .... or surfapp name nbupoints nbvpoints surf [periodic_flag = 0] grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ... surfint name surf nbupoints nbvpoints [periodic_flag = 0] -~~~~~ +~~~~ * **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints. * **grilapp** has the same function, but the x,y coordinates of the points are on a grid starting at x0,y0 with steps dx,dy. @@ -5622,7 +5622,7 @@ U direction of result surface corresponds columns of initial array of points. If **periodic_flag** = 1, algorithm uses first row of array as last row and builds periodical surface. **Example:** -~~~~~ +~~~~{.cpp} # a surface using the same data as in the beziersurf example sect 4.4 surfapp s 3 4 \ @@ -5630,7 +5630,7 @@ surfapp s 3 4 \ 0 10 2 10 10 3 20 10 2 \ 0 20 10 10 20 20 20 20 10 \ 0 30 0 10 30 0 20 30 0 -~~~~~ +~~~~ @subsection occt_draw_6_9 Projections @@ -5643,9 +5643,9 @@ Draw provides commands to project points/curves on curves/surfaces. @subsubsection occt_draw_6_9_1 projponf Syntax: -~~~~~ +~~~~{.cpp} projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)] -~~~~~ +~~~~ **projponf** projects point *pnt* on the face *face*. You can change the Extrema options: @@ -5658,7 +5658,7 @@ You can change the Extrema options: -minmax - to look for MinMax solutions. **Example** -~~~~~ +~~~~{.cpp} plane p 0 0 0 0 0 1 mkface f p point pnt 5 5 10 @@ -5667,7 +5667,7 @@ projponf f pnt # proj dist = 10 # uvproj = 5 5 # pproj = 5 5 0 -~~~~~ +~~~~ @subsection occt_draw_6_10 Constraints @@ -5678,9 +5678,9 @@ projponf f pnt @subsubsection occt_draw_6_10_1 cirtang Syntax: -~~~~~ +~~~~{.cpp} cirtang result [-t ] -c -p -r ... -~~~~~ +~~~~ Builds all circles satisfying the condition: 1. the circle must be tangent to every given curve; @@ -5690,35 +5690,35 @@ Builds all circles satisfying the condition: Only following set of input data is supported: Curve-Curve-Curve, Curve-Curve-Point, Curve-Curve-Radius, Curve-Point-Point, Curve-Point-Radius, Point-Point-Point, Point-Point-Radius. The solutions will be stored in variables *result_1*, *result_2*, etc. **Example:** -~~~~~ +~~~~{.cpp} # a point, a line and a radius. 2 solutions of type Curve-Point-Radius (C-P-R) point p 0 0 line l 10 0 -1 1 cirtang c -p p -c l -r 4 == Solution of type C-P-R is: c_1 c_2 -~~~~~ +~~~~ Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type). **Example:** -~~~~~ +~~~~{.cpp} point pp 1 1 2dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1 cirtang r -p pp -c cc == Solution of type C-P is: r_1 r_2 -~~~~~ +~~~~ @subsubsection occt_draw_6_10_2 lintan Syntax: -~~~~~ +~~~~{.cpp} lintan name curve curve [angle] -~~~~~ +~~~~ Builds all 2d lines tangent to two curves. If the third angle argument is given the second curve must be a line and **lintan** will build all lines tangent to the first curve and forming the given angle with the line. The angle is given in degrees. The solutions are named *name_1*, *name_2*, etc. **Example:** -~~~~~ +~~~~{.cpp} # lines tangent to 2 circles, 4 solutions circle c1 -10 0 10 circle c2 10 0 5 @@ -5729,7 +5729,7 @@ solutions: l1_1 l1_2 circle c1 -10 0 1 line l 2 0 1 1 lintan l1 c1 l 15 -~~~~~ +~~~~ @subsection occt_draw_6_11 Display @@ -5747,11 +5747,11 @@ On bspline curves and surfaces you can toggle the display of the knots with the @subsubsection occt_draw_6_11_1 dmod, discr, defle Syntax: -~~~~~ +~~~~{.cpp} dmode name [name ...] u/d discr name [name ...] nbintervals defle name [name ...] deflection -~~~~~ +~~~~ **dmod** command allows choosing the display mode for a curve or a surface. @@ -5762,39 +5762,39 @@ In *d*, or discretization mode, a fixed number of points is computed. This numbe If the curve or the isolines seem to present too many angles, you can either increase the discretization or lower the deflection, depending on the mode. This will increase the number of points. **Example:** -~~~~~ +~~~~{.cpp} # increment the number of points on a big circle circle c 0 0 50 50 discr 100 # change the mode dmode c u -~~~~~ +~~~~ @subsubsection occt_draw_6_11_2 nbiso Syntax: -~~~~~ +~~~~{.cpp} nbiso name [names...] nuiso nviso -~~~~~ +~~~~ Changes the number of isoparametric curves displayed on a surface in the U and V directions. On a bspline surface, isoparametric curves are displayed by default at knot values. Use *nbiso* to turn this feature off. **Example:** Let us display 35 meridians and 15 parallels on a sphere: -~~~~~ +~~~~{.cpp} sphere s 20 nbiso s 35 15 -~~~~~ +~~~~ @subsubsection occt_draw_6_11_3 clpoles, shpoles Syntax: -~~~~~ +~~~~{.cpp} clpoles name shpoles name -~~~~~ +~~~~ On bezier and bspline curves and surfaces, the control polygon is displayed by default: *clpoles* erases it and *shpoles* restores it. @@ -5802,28 +5802,28 @@ On bezier and bspline curves and surfaces, the control polygon is displayed by d Let us make a bezier curve and erase the poles -~~~~~ +~~~~{.cpp} beziercurve c 3 0 0 0 10 0 0 10 10 0 clpoles c -~~~~~ +~~~~ @subsubsection occt_draw_6_11_4 clknots, shknots Syntax: -~~~~~ +~~~~{.cpp} clknots name shknots name -~~~~~ +~~~~ By default, knots on a bspline curve or surface are displayed with markers at the points with parametric value equal to the knots. *clknots* removes them and *shknots* restores them. **Example:** -~~~~~ +~~~~{.cpp} # hide the knots on a bspline curve bsplinecurve bc 2 3 0 3 1 1 2 3 \ 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1 clknots bc -~~~~~ +~~~~ @section occt_draw_7 Topology commands @@ -5879,10 +5879,10 @@ In Draw, shapes are displayed using isoparametric curves. There is color coding @subsubsection occt_draw_7_1_1 isos, discretisation Syntax: -~~~~~ +~~~~{.cpp} isos [name ...][nbisos] discretisation nbpoints -~~~~~ +~~~~ Determines or changes the number of isoparametric curves on shapes. @@ -5891,10 +5891,10 @@ The same number is used for the u and v directions. With no arguments, *isos* pr *discretisation* changes the default number of points used to display the curves. The default value is 30. **Example:** -~~~~~ +~~~~{.cpp} # Display only the edges (the wireframe) isos 0 -~~~~~ +~~~~ **Warning**: don’t confuse *isos* and *discretisation* with the geometric commands *nbisos* and *discr*. @@ -5902,13 +5902,13 @@ isos 0 @subsubsection occt_draw_7_1_2 orientation, complement, invert, normals, range Syntax: -~~~~~ +~~~~{.cpp} orientation name [name ...] F/R/E/I complement name [name ...] invert name normals s (length = 10), disp normals range name value value -~~~~~ +~~~~ * **orientation** -- assigns the orientation of simple and complex shapes to one of the following four values: *FORWARD, REVERSED, INTERNAL, EXTERNAL*. * **complement** -- changes the current orientation of shapes to its complement: *FORWARD* to *REVERSED* and *INTERNAL* to *EXTERNAL*. @@ -5917,7 +5917,7 @@ range name value value * **range** -- defines the length of a selected edge by defining the values of a starting point and an end point. **Example:** -~~~~~ +~~~~{.cpp} # to invert normals of a box box b 10 20 30 normals b 5 @@ -5934,16 +5934,16 @@ makedge e 1 # to define the length of the edge as starting from 0 and finishing at 1 range e 0 1 -~~~~~ +~~~~ @subsubsection occt_draw_7_1_3 explode, exwire, nbshapes Syntax: -~~~~~ +~~~~{.cpp} explode name [C/So/Sh/F/W/E/V] exwire name nbshapes name -~~~~~ +~~~~ **explode** extracts subshapes from an entity. The subshapes will be named *name_1*, *name_2*, ... Note that they are not copied but shared with the original. @@ -5954,7 +5954,7 @@ With name only, **explode** will extract the first sublevel of shapes: the shell **nbshapes** counts the number of shapes of each type in an entity. **Example:** -~~~~~ +~~~~{.cpp} # on a box box b 10 20 30 @@ -5985,16 +5985,16 @@ SOLID : 1 COMPSOLID : 0 COMPOUND : 0 SHAPE : 34 -~~~~~ +~~~~ @subsubsection occt_draw_7_1_4 emptycopy, add, compound Syntax: -~~~~~ +~~~~{.cpp} emptycopy [newname] name add name toname compound [name ...] compoundname -~~~~~ +~~~~ **emptycopy** returns an empty shape with the same orientation, location, and geometry as the target shape, but with no sub-shapes. If the **newname** argument is not given, the new shape is stored with the same name. This command is used to modify a frozen shape. A frozen shape is a shape used by another one. To modify it, you must **emptycopy** it. Its subshape may be reinserted with the **add** command. @@ -6013,26 +6013,26 @@ compound [name ...] compoundname On the other hand, **compound** is a safe way to achieve a similar result. It creates a compound from shapes. If no shapes are given, the compound is empty. **Example:** -~~~~~ +~~~~{.cpp} # a compound with three boxes box b1 0 0 0 1 1 1 box b2 3 0 0 1 1 1 box b3 6 0 0 1 1 1 compound b1 b2 b3 c -~~~~~ +~~~~ @subsubsection occt_draw_7_1_5 compare Syntax: -~~~~~ +~~~~{.cpp} compare shape1 shape2 -~~~~~ +~~~~ **compare** compares the two shapes *shape1* and *shape2* using the methods *TopoDS_Shape::IsSame()* and *TopoDS_Shape::IsEqual()*. **Example** -~~~~~ +~~~~{.cpp} box b1 1 1 1 copy b1 b2 compare b1 b2 @@ -6046,24 +6046,24 @@ compare b1 b2 box b2 1 1 1 compare b1 b2 # shapes are not same -~~~~~ +~~~~ @subsubsection occt_draw_7_1_6 issubshape Syntax: -~~~~~ +~~~~{.cpp} issubshape subshape shape -~~~~~ +~~~~ **issubshape** checks if the shape *subshape* is sub-shape of the shape *shape* and gets its index in the shape. **Example** -~~~~~ +~~~~{.cpp} box b 1 1 1 explode b f issubshape b_2 b # b_2 is sub-shape of b. Index in the shape: 2. -~~~~~ +~~~~ @subsection occt_draw_7_2 Curve and surface topology @@ -6081,46 +6081,46 @@ This group of commands is used to create topology from shapes and to extract sha @subsubsection occt_draw_7_2_1 vertex Syntax: -~~~~~ +~~~~{.cpp} vertex name [x y z / p edge] -~~~~~ +~~~~ Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge. **Example:** -~~~~~ +~~~~{.cpp} vertex v1 10 20 30 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_1a mkpoint Syntax: -~~~~~ +~~~~{.cpp} mkpoint name vertex -~~~~~ +~~~~ Creates a point from the coordinates of a given vertex. **Example:** -~~~~~ +~~~~{.cpp} mkpoint p v1 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_2 edge, mkedge, uisoedge, visoedge Syntax: -~~~~~ +~~~~{.cpp} edge name vertex1 vertex2 mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] uisoedge edge face u v1 v2 visoedge edge face v u1 u2 -~~~~~ +~~~~ * **edge** creates a straight line edge between two vertices. * **mkedge** generates edges from curves<.Two parameters can be given for the vertices: the first and last parameters of the curve are given by default. Vertices can also be given with their parameters, this option allows blocking the creation of new vertices. If the parameters of the vertices are not given, they are computed by projection on the curve. Instead of a 3d curve, a 2d curve and a surface can be given. **Example:** -~~~~~ +~~~~{.cpp} # straight line edge vertex v1 10 0 0 vertex v2 10 10 0 @@ -6134,12 +6134,12 @@ mkedge e2 c 0 pi/2 # The trimming is removed by mkedge trim c c 0 pi/2 mkedge e2 c -~~~~~ +~~~~ * **visoedge** and **uisoedge** are commands that generate a *uiso* parameter edge or a *viso* parameter edge. **Example:** -~~~~~ +~~~~{.cpp} # to create an edge between v1 and v2 at point u # to create the example plane plane p @@ -6153,16 +6153,16 @@ mkface p p # to create the edge in the plane at the u axis point 0.5, and between the v axis points v=0.2 and v =0.8 uisoedge e p 0.5 0.20 0.8 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_3 wire, polyline, polyvertex Syntax: -~~~~~ +~~~~{.cpp} wire wirename e1/w1 [e2/w2 ...] polyline name x1 y1 z1 x2 y2 z2 ... polyvertex name v1 v2 ... -~~~~~ +~~~~ **wire** creates a wire from edges or wires. The order of the elements should ensure that the wire is connected, and vertex locations will be compared to detect connection. If the vertices are different, new edges will be created to ensure topological connectivity. The original edge may be copied in the new one. @@ -6171,20 +6171,20 @@ polyvertex name v1 v2 ... **polyvertex** creates a polygonal wire from vertices. **Example:** -~~~~~ +~~~~{.cpp} # create two polygonal wires # glue them and define as a single wire polyline w1 0 0 0 10 0 0 10 10 0 polyline w2 10 10 0 0 10 0 0 0 0 wire w w1 w2 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_4 profile Syntax -~~~~~ +~~~~{.cpp} profile name [code values] [code values] ... -~~~~~ +~~~~ **profile** builds a profile in a plane using a moving point and direction. By default, the profile is closed and a face is created. The original point is 0 0, and direction is 1 0 situated in the XY plane. @@ -6225,14 +6225,14 @@ The profile shape definition is the suffix; no suffix produces a face, *w* is a Code letters are not case-sensitive. **Example:** -~~~~~ +~~~~{.cpp} # to create a triangular plane using a vertex at the origin, in the xy plane profile p O 0 0 0 X 1 Y 0 x 1 y 1 -~~~~~ +~~~~ **Example:** -~~~~~ +~~~~{.cpp} # to create a contour using the different code possibilities @@ -6271,14 +6271,14 @@ profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 r 90 ix - # to create the plane with the same contour profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 r 90 ix -0.3 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_5 bsplineprof Syntax: -~~~~~ +~~~~{.cpp} bsplineprof name [S face] [W WW] -~~~~~ +~~~~ * for an edge : \ ... * to end profile : @@ -6290,7 +6290,7 @@ Builds a profile in the XY plane from digitizes. By default the profile is close The profile shape definition is the suffix; no suffix produces a face, **w** is a closed wire, **ww** is an open wire. **Example:** -~~~~~ +~~~~{.cpp} #to view the xy plane top #to create a 2d curve with the mouse @@ -6303,7 +6303,7 @@ bsplineprof res == # click mb1 to create the second curve # click mb3 to create the face -~~~~~ +~~~~ @subsubsection occt_draw_7_2_6 mkoffset @@ -6311,9 +6311,9 @@ bsplineprof res The offset distance defines the spacing and the positioning of the occurrences. Syntax: -~~~~~ +~~~~{.cpp} mkoffset result shape nboffset stepoffset [jointype(a/i) [alt]] -~~~~~ +~~~~ where: * *result* - the base name for the resulting wires. The index of the occurrence (starting with 1) will be added to this name, so the resulting wires will have the names - *result_1*, *result_2* ...; * *shape* - input shape (face or compound of wires); @@ -6324,7 +6324,7 @@ where: **Example:** -~~~~~ +~~~~{.cpp} # Create a box and select a face box b 1 2 3 explode b f @@ -6338,12 +6338,12 @@ mkoffset r b_1 3 2 i # Create one interior parallel contour with an offset value of 0.4 mkoffset r b_1 1 -0.4 -~~~~~ +~~~~ **Note** that on a concave input contour for an interior step *mkoffset* command may produce several wires which will be contained in a single compound. **Example:** -~~~~~ +~~~~{.cpp} # to create the example contour profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w # creates an incoherent interior offset @@ -6352,22 +6352,22 @@ mkoffset r p 1 -0.50 # creates two incoherent wires mkoffset r p 1 -0.55 # r_1 is a compound of two wires -~~~~~ +~~~~ @subsubsection occt_draw_7_2_7 mkplane, mkface Syntax: -~~~~~ +~~~~{.cpp} mkplane name wire mkface name surface [ufirst ulast vfirst vlast] -~~~~~ +~~~~ **mkplane** generates a face from a planar wire. The planar surface will be constructed with an orientation which keeps the face inside the wire. **mkface** generates a face from a surface. Parameter values can be given to trim a rectangular area. The default boundaries are those of the surface. **Example:** -~~~~~ +~~~~{.cpp} # make a polygonal face polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0 mkplane f f @@ -6376,40 +6376,40 @@ mkplane f f cylinder g 10 trim g g -pi/3 pi/2 0 15 mkface g g -~~~~~ +~~~~ @subsubsection occt_draw_7_2_8 mkcurve, mksurface Syntax: -~~~~~ +~~~~{.cpp} mkcurve curve edge mksurface name face -~~~~~ +~~~~ **mkcurve** creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries. **mksurface** creates a surface from a face. The surface will not be trimmed. **Example:** -~~~~~ +~~~~{.cpp} # make a line vertex v1 0 0 0 vertex v2 10 0 0 edge e v1 v2 -~~~~~ +~~~~ @subsubsection occt_draw_7_2_9 pcurve Syntax: -~~~~~ +~~~~{.cpp} pcurve [name edgename] facename -~~~~~ +~~~~ Extracts the 2d curve of an edge on a face. If only the face is specified, the command extracts all the curves and colors them according to their orientation. This is useful in checking to see if the edges in a face are correctly oriented, i.e. they turn counter-clockwise. To make curves visible, use a fitted 2d view. **Example:** -~~~~~ +~~~~{.cpp} # view the pcurves of a face plane p trim p p -1 1 -1 1 @@ -6417,14 +6417,14 @@ mkface p p av2d; # a 2d view pcurve p 2dfit -~~~~~ +~~~~ @subsubsection occt_draw_7_2_10 chfi2d Syntax: -~~~~~ +~~~~{.cpp} chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) .... -~~~~~ +~~~~ Creates chamfers and fillets on 2D objects. Select two adjacent edges and: @@ -6440,7 +6440,7 @@ The distance is the length value from the edge between the two selected faces in Let us create a 2d fillet: -~~~~~ +~~~~{.cpp} top profile p x 2 y 2 x -2 chfi2d cfr p . . F 0.3 @@ -6448,22 +6448,22 @@ chfi2d cfr p . . F 0.3 #select an edge ==Pick an object #select an edge -~~~~~ +~~~~ Let us create a 2d chamfer using two distances: -~~~~~ +~~~~{.cpp} profile p x 2 y 2 x -2 chfi2d cfr p . . CDD 0.3 0.6 ==Pick an object #select an edge ==Pick an object #select an edge -~~~~~ +~~~~ Let us create a 2d chamfer using a defined distance and angle -~~~~~ +~~~~{.cpp} top profile p x 2 y 2 x -2 chfi2d cfr p . . CDA 0.3 75 @@ -6471,20 +6471,20 @@ chfi2d cfr p . . CDA 0.3 75 #select an edge ==Pick an object #select an edge -~~~~~ +~~~~ @subsubsection occt_draw_7_2_11 nproject Syntax: -~~~~~ +~~~~{.cpp} nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol [continuity [maxdeg [maxseg]]] -~~~~~ +~~~~ Creates a shape projection which is normal to the target surface. **Example:** -~~~~~ +~~~~{.cpp} # create a curved surface line l 0 0 0 1 0 0 trim l l 0 2 @@ -6509,7 +6509,7 @@ mkedge e c donly p e # create the normal projection of the shape(circle) nproject r e p -~~~~~ +~~~~ @subsection occt_draw_7_3 Primitives @@ -6524,10 +6524,10 @@ Primitive commands make it possible to create simple shapes. They include: @subsubsection occt_draw_7_3_1 box, wedge Syntax: -~~~~~ +~~~~{.cpp} box name [x y z] dx dy dz wedge name dx dy dz ltx / xmin zmin xmax xmax -~~~~~ +~~~~ **box** creates a box parallel to the axes with dimensions *dx,dy,dz*. *x,y,z* is the corner of the box. It is the default origin. @@ -6536,7 +6536,7 @@ wedge name dx dy dz ltx / xmin zmin xmax xmax The other faces are defined between these faces. The face in the *y=yd* plane may be degenerated into a line if *ltx = 0*, or a point if *xmin = xmax* and *ymin = ymax*. In these cases, the line and the point both have 5 faces each. To position the wedge use the *ttranslate* and *trotate* commands. **Example:** -~~~~~ +~~~~{.cpp} # a box at the origin box b1 10 20 30 @@ -6551,18 +6551,18 @@ wedge w2 10 20 30 0 # a pyramid wedge w3 20 20 20 10 10 10 10 -~~~~~ +~~~~ @subsubsection occt_draw_7_3_2 pcylinder, pcone, psphere, ptorus Syntax: -~~~~~ +~~~~{.cpp} pcylinder name [plane] radius height [angle] pcone name [plane] radius1 radius2 height [angle] pcone name [plane] radius1 radius2 height [angle] psphere name [plane] radius1 [angle1 angle2] [angle] ptorus name [plane] radius1 radius2 [angle1 angle2] [angle] -~~~~~ +~~~~ All these commands create solid blocks in the default coordinate system, using the Z axis as the axis of revolution and the X axis as the origin of the angles. To use another system, translate and rotate the resulting solid or use a plane as first argument to specify a coordinate system. All primitives have an optional last argument which is an angle expressed in degrees and located on the Z axis, starting from the X axis. The default angle is 360. @@ -6575,7 +6575,7 @@ All these commands create solid blocks in the default coordinate system, using t **ptorus** creates a solid torus with the given radii, centered on the origin, which is a point along the z axis. If two angles increasing in degree in the range 0 -- 360 are given, the solid will be bounded by two planar surfaces at those positions on the circle. **Example:** -~~~~~ +~~~~{.cpp} # a can shape pcylinder cy 5 10 @@ -6587,24 +6587,24 @@ psphere sp 10 270 # half torus ptorus to 20 5 0 90 -~~~~~ +~~~~ @subsubsection occt_draw_7_3_3 halfspace Syntax: -~~~~~ +~~~~{.cpp} halfspace result face/shell x y z -~~~~~ +~~~~ **halfspace** creates an infinite solid volume based on a face in a defined direction. This volume can be used to perform the boolean operation of cutting a solid by a face or plane. **Example:** -~~~~~ +~~~~{.cpp} box b 0 0 0 1 2 3 explode b f ==b_1 b_2 b_3 b_4 b_5 b_6 halfspace hr b_3 0.5 0.5 0.5 -~~~~~ +~~~~ @subsection occt_draw_7_4 Sweeping @@ -6621,49 +6621,49 @@ Sweeping creates shapes by sweeping out a shape along a defined path: @subsubsection occt_draw_7_4_1 prism Syntax: -~~~~~ +~~~~{.cpp} prism result base dx dy dz [Copy | Inf | SemiInf] -~~~~~ +~~~~ Creates a new shape by sweeping a shape in a direction. Any shape can be swept: a vertex gives an edge; an edge gives a face; and a face gives a solid. The shape is swept along the vector *dx dy dz*. The original shape will be shared in the result unless *Copy* is specified. If *Inf* is specified the prism is infinite in both directions. If *SemiInf* is specified the prism is infinite in the *dx,dy,dz* direction, and the length of the vector has no importance. **Example:** -~~~~~ +~~~~{.cpp} # sweep a planar face to make a solid polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0 mkplane f f -~~~~~ +~~~~ @subsubsection occt_draw_7_4_2 revol Syntax: -~~~~~ +~~~~{.cpp} revol result base x y z dx dy dz angle [Copy] -~~~~~ +~~~~ Creates a new shape by sweeping a base shape through an angle along the axis *x,y,z dx,dy,dz*. As with the prism command, the shape can be of any type and is not shared if *Copy* is specified. **Example:** -~~~~~ +~~~~{.cpp} # shell by wire rotation polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 revol s w 20 0 0 0 1 0 90 -~~~~~ +~~~~ @subsubsection occt_draw_7_4_3 pipe Syntax: -~~~~~ +~~~~{.cpp} pipe name wire_spine Profile -~~~~~ +~~~~ Creates a new shape by sweeping a shape known as the profile along a wire known as the spine. **Example:** -~~~~~ +~~~~{.cpp} # sweep a circle along a bezier curve to make a solid pipe @@ -6675,19 +6675,19 @@ mkedge profile profile wire profile profile mkplane profile profile pipe p spine profile -~~~~~ +~~~~ @subsubsection occt_draw_7_4_4 mksweep, addsweep, setsweep, deletesweep, buildsweep, simulsweep Syntax: -~~~~~ +~~~~{.cpp} mksweep wire addsweep wire[vertex][-M][-C] [auxiilaryshape] deletesweep wire setsweep options [arg1 [arg2 [...]]] simulsweep r [n] [option] buildsweep [r] [option] [Tol] -~~~~~ +~~~~ options are : * *-FR* : Tangent and Normal are defined by a Frenet trihedron @@ -6708,7 +6708,7 @@ At least one other wire is used to define the sweep profile. * **buildsweep** -- creates the sweep using the arguments defined by all the commands. **Example:** -~~~~~ +~~~~{.cpp} #create a sweep based on a semi-circular wire using the Frenet algorithm #create a circular figure @@ -6727,20 +6727,20 @@ setsweep -CF addsweep w -R # to simulate the sweep with a visual approximation simulsweep w 3 -~~~~~ +~~~~ @subsubsection occt_draw_7_4_5 thrusections Syntax: -~~~~~ +~~~~{.cpp} thrusections [-N] result issolid isruled wire1 wire2 [..wire..] -~~~~~ +~~~~ **thrusections** creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices. A bezier curve is generated between the vertices of each wire. The option *[-N]* means that no check is made on wires for direction. **Example:** -~~~~~ +~~~~{.cpp} #create three wires in three planes polyline w1 0 0 0 5 0 0 5 5 0 2 3 0 polyline w2 0 1 3 4 1 3 4 4 3 1 3 3 @@ -6750,7 +6750,7 @@ thrusections th issolid isruled w1 w2 w3 ==thrusections th issolid isruled w1 w2 w3 Tolerances obtenues -- 3d : 0 -- 2d : 0 -~~~~~ +~~~~ @subsection occt_draw_7_5 Topological transformation @@ -6765,14 +6765,14 @@ Transformations are applications of matrices. When the transformation is nondefo @subsubsection occt_draw_7_5_1 tcopy Syntax: -~~~~~ +~~~~{.cpp} tcopy name toname [name toname ...] -~~~~~ +~~~~ Copies the structure of one shape, including the geometry, into another, newer shape. **Example:** -~~~~~ +~~~~{.cpp} # create an edge from a curve and copy it beziercurve c 3 0 0 0 10 0 0 20 10 0 mkedge e1 c @@ -6780,22 +6780,22 @@ ttranslate e1 0 5 0 tcopy e1 e2 ttranslate e2 0 5 0 # now modify the curve, only e1 and e2 will be modified -~~~~~ +~~~~ @subsubsection occt_draw_7_5_2 tmove, treset Syntax: -~~~~~ +~~~~{.cpp} tmove name [name ...] shape reset name [name ...] -~~~~~ +~~~~ **tmove** and **reset** modify the location, or the local coordinate system of a shape. **tmove** applies the location of a given shape to other shapes. **reset** restores one or several shapes it to its or their original coordinate system(s). **Example:** -~~~~~ +~~~~{.cpp} # create two boxes box b1 10 10 10 box b2 20 0 0 10 10 10 @@ -6805,15 +6805,15 @@ ttranslate b1 0 10 0 tmove b2 b1 # return to original positions reset b1 b2 -~~~~~ +~~~~ @subsubsection occt_draw_7_5_3 ttranslate, trotate Syntax: -~~~~~ +~~~~{.cpp} ttranslate [name ...] dx dy dz trotate [name ...] x y z dx dy dz angle -~~~~~ +~~~~ **ttranslate** translates a set of shapes by a given vector, and **trotate** rotates them by a given angle around an axis. Both commands only modify the location of the shape. When creating multiple shapes, the same location is used for all the shapes. (See *toto.tcl* example below. Note that the code of this file can also be directly executed in interactive mode.) @@ -6821,7 +6821,7 @@ When creating multiple shapes, the same location is used for all the shapes. (Se Locations are very economic in the data structure because multiple occurrences of an object share the topological description. **Example:** -~~~~~ +~~~~{.cpp} # make rotated copies of a sphere in between two cylinders # create a file source toto.tcl # toto.tcl code: @@ -6841,29 +6841,29 @@ ttranslate s 25 0 12.5 # call the source file for multiple copies source toto.tcl -~~~~~ +~~~~ @subsubsection occt_draw_7_5_4 tmirror, tscale Syntax: -~~~~~ +~~~~{.cpp} tmirror name x y z dx dy dz tscale name x y z scale -~~~~~ +~~~~ * **tmirror** makes a mirror copy of a shape about a plane x,y,z dx,dy,dz. * **Tscale** applies a central homotopic mapping to a shape. **Example:** -~~~~~ +~~~~{.cpp} # mirror a portion of cylinder about the YZ plane pcylinder c1 10 10 270 copy c1 c2 tmirror c2 15 0 0 1 0 0 # and scale it tscale c1 0 0 0 0.5 -~~~~~ +~~~~ @subsection occt_draw_7_6 Old Topological operations @@ -6879,11 +6879,11 @@ These commands are no longer supported, so the result may be unpredictable. Use the commands bfuse, bcut, bcommon instead. Syntax: -~~~~~ +~~~~{.cpp} fuse name shape1 shape2 cut name shape1 shape2 common name shape1 shape2 -~~~~~ +~~~~ **fuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact. @@ -6892,7 +6892,7 @@ common name shape1 shape2 **common** creates a new shape which contains only what is in common between the two original shapes in their intersection. **Example:** -~~~~~ +~~~~{.cpp} # all four boolean operations on a box and a cylinder box b 0 -10 5 20 20 10 @@ -6909,7 +6909,7 @@ ttranslate s3 0 40 0 common s4 b c ttranslate s4 0 -40 0 -~~~~~ +~~~~ @subsubsection occt_draw_7_6_2 section, psection @@ -6918,17 +6918,17 @@ These commands are no longer supported, so the result may be unpredictable. Use the command **bsection** instead. Syntax: -~~~~~ +~~~~{.cpp} section result shape1 shape2 psection name shape plane -~~~~~ +~~~~ **section** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes. **psection** creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane. **Example:** -~~~~~ +~~~~{.cpp} # section line between a cylinder and a box pcylinder c 10 20 box b 0 0 5 15 15 15 @@ -6939,26 +6939,26 @@ section s b c pcone c 10 30 30 plane p 0 0 15 1 1 2 psection s c p -~~~~~ +~~~~ @subsubsection occt_draw_7_6_3 sewing Syntax: -~~~~~ +~~~~{.cpp} sewing result [tolerance] shape1 shape2 ... -~~~~~ +~~~~ **Sewing** joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value. **Example:** -~~~~~ +~~~~{.cpp} # create two adjacent boxes box b 0 0 0 1 2 3 box b2 0 2 0 1 2 3 sewing sr b b2 whatis sr sr is a shape COMPOUND FORWARD Free Modified -~~~~~ +~~~~ @subsection occt_draw_7_7 New Topological operations @@ -6986,32 +6986,32 @@ Blending is the creation of a new shape by rounding edges to create a fillet. @subsubsection occt_draw_7_8_1 depouille Syntax: -~~~~~ +~~~~{.cpp} dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...] -~~~~~ +~~~~ Creates a new shape by drafting one or more faces of a shape. Identify the shape(s) to be drafted, the drafting direction, and the face(s) with an angle and an axis of rotation for each face. You can use dot syntax to identify the faces. **Example:** -~~~~~ +~~~~{.cpp} # draft a face of a box box b 10 10 10 explode b f == b_1 b_2 b_3 b_4 b_5 b_6 dep a b 0 0 1 b_2 10 0 10 0 1 0 5 -~~~~~ +~~~~ @subsubsection occt_draw_7_8_2 chamf Syntax: -~~~~~ +~~~~{.cpp} chamf newname shape edge face S dist chamf newname shape edge face dist1 dist2 chamf newname shape edge face A dist angle -~~~~~ +~~~~ Creates a chamfer along the edge between faces using: @@ -7024,7 +7024,7 @@ Use the dot syntax to select the faces and edges. **Examples:** Let us create a chamfer based on equal distances from the edge (45 degree angle): -~~~~~ +~~~~{.cpp} # create a box box b 1 2 3 chamf ch b . . S 0.5 @@ -7032,40 +7032,40 @@ chamf ch b . . S 0.5 # select an edge ==Pick an object # select an adjacent face -~~~~~ +~~~~ Let us create a chamfer based on different distances from the selected edge: -~~~~~ +~~~~{.cpp} box b 1 2 3 chamf ch b . . 0.3 0.4 ==Pick an object # select an edge ==Pick an object # select an adjacent face -~~~~~ +~~~~ Let us create a chamfer based on a distance from the edge and an angle: -~~~~~ +~~~~{.cpp} box b 1 2 3 chamf ch b . . A 0.4 30 ==Pick an object # select an edge ==Pick an object # select an adjacent face -~~~~~ +~~~~ @subsubsection occt_draw_7_8_3 blend Syntax: -~~~~~ +~~~~{.cpp} blend result object rad1 ed1 rad2 ed2 ... [R/Q/P] -~~~~~ +~~~~ Creates a new shape by filleting the edges of an existing shape. The edge must be inside the shape. You may use the dot syntax. Note that the blend is propagated to the edges of tangential planar, cylindrical or conical faces. **Example:** -~~~~~ +~~~~{.cpp} # blend a box, click on an edge box b 20 20 20 blend b b 2 . @@ -7084,54 +7084,54 @@ blend b b 2 . ==- FilDS 0s ==- Reconstruction 0.06s ==- SetRegul 0s -~~~~~ +~~~~ @subsubsection occt_draw_7_8_4 bfuseblend Syntax: -~~~~~ +~~~~{.cpp} bfuseblend name shape1 shape2 radius [-d] -~~~~~ +~~~~ Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius. Option [-d] enables the Debugging mode in which the error messages, if any, will be printed. **Example:** -~~~~~ +~~~~{.cpp} # fuse-blend two boxes box b1 20 20 5 copy b1 b2 ttranslate b2 -10 10 3 bfuseblend a b1 b2 1 -~~~~~ +~~~~ @subsubsection occt_draw_7_8_4a bcutblend Syntax: -~~~~~ +~~~~{.cpp} bcutblend name shape1 shape2 radius [-d] -~~~~~ +~~~~ Creates a boolean cut of two shapes and then blends (fillets) the intersection edges using the given radius. Option [-d] enables the Debugging mode in which the error messages, if any, will be printed. **Example:** -~~~~~ +~~~~{.cpp} # cut-blend two boxes box b1 20 20 5 copy b1 b2 ttranslate b2 -10 10 3 bcutblend a b1 b2 1 -~~~~~ +~~~~ @subsubsection occt_draw_7_8_5 mkevol, updatevol, buildevol Syntax: -~~~~~ +~~~~{.cpp} mkevol result object (then use updatevol) [R/Q/P] updatevol edge u1 radius1 [u2 radius2 ...] buildevol -~~~~~ +~~~~ These three commands work together to create fillets with evolving radii. @@ -7140,7 +7140,7 @@ These three commands work together to create fillets with evolving radii. * **buildevol** produces the result described previously in **mkevol** and **updatevol**. **Example:** -~~~~~ +~~~~{.cpp} # makes an evolved radius on a box box b 10 10 10 mkevol b b @@ -7168,7 +7168,7 @@ buildevol ==- FilDS 0.01s ==- Reconstruction 0.04s ==- SetRegul 0s -~~~~~ +~~~~ @subsection occt_draw_defeaturing Defeaturing @@ -7176,7 +7176,7 @@ buildevol Draw command **removefeatures** is intended for performing @ref occt_modalg_defeaturing "3D Model Defeaturing", i.e. it performs the removal of the requested features from the shape. Syntax: -~~~~ +~~~~{.cpp} removefeatures result shape f1 f2 ... [-nohist] [-parallel] Where: @@ -7204,7 +7204,7 @@ The command makes the shape periodic in the required directions with the require If trimming is given it trims the shape to fit the requested period. Syntax: -~~~~ +~~~~{.cpp} makeperiodic result shape [-x/y/z period [-trim first]] Where: @@ -7221,7 +7221,7 @@ The result contains the all the repeated shapes glued together. The command should be called after **makeperiodic** command. Syntax: -~~~~ +~~~~{.cpp} repeatshape result -x/y/z times Where: @@ -7236,7 +7236,7 @@ All periodic twins should have the same geometry. The command should be called after **makeperiodic** command. Syntax: -~~~~ +~~~~{.cpp} periodictwins twins shape Where: @@ -7265,7 +7265,7 @@ Draw module for @ref occt_modalg_makeconnected "making the touching same-dimensi The command makes the input touching shapes connected. Syntax: -~~~~ +~~~~{.cpp} makeconnected result shape1 shape2 ... Where: @@ -7279,7 +7279,7 @@ The command returns the materials located on the requested side of the shape. The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**. Syntax: -~~~~ +~~~~{.cpp} cmaterialson result +/- shape Where: @@ -7294,7 +7294,7 @@ The command makes the connected shape periodic in the required directions with t The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**. Syntax: -~~~~ +~~~~{.cpp} cmakeperiodic result [-x/y/z period [-trim first]] Where: @@ -7310,7 +7310,7 @@ The command repeats the connected periodic shape in the required periodic direct The command should be called after the shapes have been made connected and periodic, i.e. after the commands **makeconnected** and **cmakeperiodic**. Syntax: -~~~~ +~~~~{.cpp} crepeatshape result -x/y/z times Where: @@ -7324,7 +7324,7 @@ The command returns all periodic twins for the shape. The command should be called after the shapes have been made connected and periodic, i.e. after the commands **makeconnected** and **cmakeperiodic**. Syntax: -~~~~ +~~~~{.cpp} cperiodictwins twins shape Where: @@ -7339,7 +7339,7 @@ The command should be called after the shapes have been made connected, periodic Otherwise the command will have no effect. Syntax: -~~~~ +~~~~{.cpp} cclearrepetitions [result] ~~~~ @@ -7361,11 +7361,11 @@ Analysis of shapes includes commands to compute length, area, volumes and inerti @subsubsection occt_draw_7_9_1 lprops, sprops, vprops Syntax: -~~~~~ +~~~~{.cpp} lprops shape [x y z] [-skip] [-full] [-tri] sprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri] vprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri] -~~~~~ +~~~~ * **lprops** computes the mass properties of all edges in the shape with a linear density of 1; * **sprops** of all faces with a surface density of 1; @@ -7385,7 +7385,7 @@ If epsilon is given, exact geometry (curves, surfaces) are used for calculations All three commands print the mass, the coordinates of the center of gravity, the matrix of inertia and the moments. Mass is either the length, the area or the volume. The center and the main axis of inertia are displayed. **Example:** -~~~~~ +~~~~{.cpp} # volume of a cylinder pcylinder c 10 20 vprops c @@ -7408,15 +7408,15 @@ Moments : IX = 366519.141446336 IY = 366519.141444962 I.Z = 314159.265357595 -~~~~~ +~~~~ @subsubsection occt_draw_7_9_2 bounding Syntax: -~~~~~ +~~~~{.cpp} bounding {-s shape | -c xmin ymin zmin xmax ymax zmax} [-obb] [-shape name] [-dump] [-notriangulation] [-perfmeter name NbIters] [-save xmin ymin zmin xmax ymax zmax] [-nodraw] [-optimal] [-exttoler] -~~~~~ +~~~~ Computes and displays the bounding box (BndBox) of a shape. The bounding box is a cuboid that circumscribes the source shape. Generally, bounding boxes can be divided into two main types: @@ -7426,16 +7426,16 @@ Generally, bounding boxes can be divided into two main types: Detailed information about this command is available in DRAW help-system (enter "help bounding" in DRAW application). **Example 1: Creation of AABB with given corners** -~~~~~ +~~~~{.cpp} bounding -c 50 100 30 180 200 100 -shape result # look at the box vdisplay result vfit vsetdispmode 1 -~~~~~ +~~~~ **Example 2: Compare AABB and OBB** -~~~~~ +~~~~{.cpp} # Create a torus and rotate it ptorus t 20 5 trotate t 5 10 15 1 1 1 28 @@ -7474,11 +7474,11 @@ vprops ra 1.0e-12 # Let us check this value dval (x2-x1)*(y2-y1)*(z2-z1) ==64949.886543606823 -~~~~~ +~~~~ The same result is obtained. -~~~~~ +~~~~{.cpp} # Create OBB from the torus bounding -s t -shape ro -dump -obb ==Oriented bounding box @@ -7493,37 +7493,37 @@ bounding -s t -shape ro -dump -obb # Compute the volume of OBB vprops ro 1.0e-12 ==Mass : 28694.7 -~~~~~ +~~~~ As we can see, the volume of OBB is significantly less than the volume of AABB. @subsubsection occt_draw_7_9_2a isbbinterf Syntax: -~~~~~ +~~~~{.cpp} isbbinterf shape1 shape2 [-o] -~~~~~ +~~~~ Checks whether the bounding boxes created from the given shapes are interfered. If "-o"-option is switched on then the oriented boxes will be checked. Otherwise, axis-aligned boxes will be checked. **Example 1: Not interfered AABB** -~~~~~ +~~~~{.cpp} box b1 100 60 140 20 10 80 box b2 210 200 80 120 60 90 isbbinterf b1 b2 ==The shapes are NOT interfered by AABB. -~~~~~ +~~~~ **Example 2: Interfered AABB** -~~~~~ +~~~~{.cpp} box b1 300 300 300 box b2 100 100 100 50 50 50 isbbinterf b1 b2 ==The shapes are interfered by AABB. -~~~~~ +~~~~ **Example 3: Not interfered OBB** -~~~~~ +~~~~{.cpp} box b1 100 150 200 copy b1 b2 trotate b1 -150 -150 -150 1 2 3 -40 @@ -7532,10 +7532,10 @@ trotate b2 -150 -150 -150 1 5 2 60 # Check of interference isbbinterf b1 b2 -o ==The shapes are NOT interfered by OBB. -~~~~~ +~~~~ **Example 4: Interfered OBB** -~~~~~ +~~~~{.cpp} box b1 100 150 200 copy b1 b2 trotate b1 -50 -50 -50 1 1 1 -40 @@ -7544,19 +7544,19 @@ trotate b2 -50 -50 -50 1 1 1 60 # Check of interference isbbinterf b1 b2 -o ==The shapes are interfered by OBB. -~~~~~ +~~~~ @subsubsection occt_draw_7_9_3 distmini Syntax: -~~~~~ +~~~~{.cpp} distmini name Shape1 Shape2 -~~~~~ +~~~~ Calculates the minimum distance between two shapes. The calculation returns the number of solutions, if more than one solution exists. The options are displayed in the viewer in red and the results are listed in the shell window. The *distmini* lines are considered as shapes which have a value v. **Example:** -~~~~~ +~~~~{.cpp} box b 0 0 0 10 20 30 box b2 30 30 0 10 20 30 distmini d1 b b2 @@ -7582,18 +7582,18 @@ are: ==X=30 Y=30 Z=0 ==d1_val d1 d12 -~~~~~ +~~~~ @subsubsection occt_draw_7_9_4 xdistef, xdistcs, xdistcc, xdistc2dc2dss, xdistcc2ds Syntax: -~~~~~ +~~~~{.cpp} xdistef edge face xdistcs curve surface firstParam lastParam [NumberOfSamplePoints] xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints] xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints] xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints] -~~~~~ +~~~~ It is assumed that curves have the same parametrization range and *startParam* is less than *finishParam*. @@ -7605,21 +7605,21 @@ Commands with prefix *xdist* allow checking the distance between two objects on * **xdistc2dc2dss** -- distance between two 2d curves on surface. **Examples** -~~~~~ +~~~~{.cpp} bopcurves b1 b2 -2d mksurf s1 b1 mksurf s2 b2 xdistcs c_1 s1 0 1 100 xdistcc2ds c_1 c2d2_1 s2 0 1 xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000 -~~~~~ +~~~~ @subsubsection occt_draw_7_9_5 checkshape Syntax: -~~~~~ +~~~~{.cpp} checkshape [-top] shape [result] [-short] -~~~~~ +~~~~ Where: * *top* -- optional parameter, which allows checking only topological validity of a shape. @@ -7630,20 +7630,20 @@ Where: **checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape. **Example:** -~~~~~ +~~~~{.cpp} # checkshape returns a comment valid or invalid box b1 0 0 0 1 1 1 checkshape b1 # returns the comment this shape seems to be valid -~~~~~ +~~~~ @subsubsection occt_draw_7_9_6 tolsphere Syntax: -~~~~~ +~~~~{.cpp} tolsphere shape -~~~~~ +~~~~ Where: * *shape* -- the name of the shape to process. @@ -7651,21 +7651,21 @@ Where: **tolsphere** shows vertex tolerances by drawing spheres around each vertex in the shape. Each sphere is assigned a name of the shape with suffix "_vXXX", where XXX is the number of the vertex in the shape. **Example:** -~~~~~ +~~~~{.cpp} # tolsphere returns all names of created spheres. box b1 0 0 0 1 1 1 settolerance b1 0.05 tolsphere b1 # creates spheres and returns the names b1_v1 b1_v2 b1_v3 b1_v4 b1_v5 b1_v6 b1_v7 b1_v8 -~~~~~ +~~~~ @subsubsection occt_draw_7_9_7 validrange Syntax: -~~~~~ +~~~~{.cpp} validrange edge [(out) u1 u2] -~~~~~ +~~~~ Where: * *edge* -- the name of the edge to analyze. @@ -7674,7 +7674,7 @@ Where: **validrange** computes valid range of the edge. If *u1* and *u2* are not given, it returns the first and the last parameters. Otherwise, it sets variables *u1* and *u2*. **Example:** -~~~~~ +~~~~{.cpp} circle c 0 0 0 10 mkedge e c mkedge e c 0 pi @@ -7686,7 +7686,7 @@ dval u1 1.9884375000000002e-008 dval u2 3.1415926337054181 -~~~~~ +~~~~ @subsection occt_draw_7_10 Surface creation @@ -7698,14 +7698,14 @@ Surface creation commands include surfaces created from boundaries and from spac @subsubsection occt_draw_7_10_1 gplate, Syntax: -~~~~~ +~~~~{.cpp} gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ... -~~~~~ +~~~~ Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces. **Example:** -~~~~~ +~~~~{.cpp} plane p trim p p -1 3 -1 3 mkface p p @@ -7759,15 +7759,15 @@ Loop number: 1 Approximation results Approximation error : 0.000422195884750181 Criterium error : 3.43709808053967e-05 -~~~~~ +~~~~ @subsubsection occt_draw_7_10_2 filling, fillingparam Syntax: -~~~~~ +~~~~{.cpp} filling result nbB nbC nbP [SurfInit] [edge][face]order... edge[face]order... point/u v face order... -~~~~~ +~~~~ Creates a surface between borders. This command uses the **gplate** algorithm but creates a surface that is tangential to the adjacent surfaces. The result is a smooth continuous surface based on the G1 criterion. @@ -7789,7 +7789,7 @@ The options are: * -a maxdeg maxseg : Approximation option **Example:** -~~~~~ +~~~~{.cpp} # to create four curved survaces and a point plane p trim p p -1 3 -1 3 @@ -7832,7 +7832,7 @@ TolCurv = 0.1 MaxDeg = 8 MaxSegments = 9 -~~~~~ +~~~~ @subsection occt_draw_7_11 Complex Topology @@ -7843,10 +7843,10 @@ Complex topology is the group of commands that modify the topology of shapes. Th @subsubsection occt_draw_7_11_1 offsetshape, offsetcompshape Syntax: -~~~~~ +~~~~{.cpp} offsetshape r shape offset [tol] [face ...] offsetcompshape r shape offset [face ...] -~~~~~ +~~~~ **offsetshape** and **offsetcompshape** assign a thickness to the edges of a shape. The *offset* value can be negative or positive. This value defines the thickness and direction of the resulting shape. Each face can be removed to create a hollow object. @@ -7857,17 +7857,17 @@ In case of complex shapes, where intersections can occur from non-adjacent edges The opening between the object interior and exterior is defined by the argument face or faces. **Example:** -~~~~~ +~~~~{.cpp} box b1 10 20 30 explode b1 f == b1_1 b1_2 b1_3 b1_4 b1_5 b1_6 offsetcompshape r b1 -1 b1_3 -~~~~~ +~~~~ @subsubsection occt_draw_7_11_2 featprism, featdprism, featrevol, featlf, featrf Syntax: -~~~~~ +~~~~{.cpp} featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1) featdprism shape face skface angle Fuse(0/1/2) Modify(0/1) featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1) @@ -7875,7 +7875,7 @@ featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1) featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1) featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil] featperformval prism/revol/dprism/lf result value -~~~~~ +~~~~ **featprism** loads the arguments for a prism with contiguous sides normal to the face. @@ -7897,7 +7897,7 @@ All the features are created from a set of arguments which are defined when you Let us create a feature prism with a draft angle and a normal direction : -~~~~~ +~~~~{.cpp} # create a box with a wire contour on the upper face box b 1 1 1 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5 @@ -7911,11 +7911,11 @@ BRepFeat_Form::GlobalPerform () Gluer still Gluer Gluer result -~~~~~ +~~~~ Let us create a feature prism with circular direction : -~~~~~ +~~~~{.cpp} # create a box with a wire contour on the upper face box b 1 1 1 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5 @@ -7928,12 +7928,12 @@ BRepFeat_Form::GlobalPerform () Gluer still Gluer Gluer result -~~~~~ +~~~~ Let us create a slot using the linear feature : -~~~~~ +~~~~{.cpp} #create the base model using the multi viewer mu4 profile p x 5 y 1 x -3 y -0.5 x -1.5 y 0.5 x 0.5 y 4 x -1 y -5 @@ -7954,11 +7954,11 @@ plane pl 0.2 0.2 0.3 0 0 1 # loads the linear feature arguments featlf pr w pl 0 0 0.3 0 0 0 0 1 featperform lf result -~~~~~ +~~~~ Let us create a rib using the revolution feature : -~~~~~ +~~~~{.cpp} #create the base model using the multi viewer mu4 pcylinder c1 3 5 @@ -7971,14 +7971,14 @@ plane pl -3 0 1.5 0 1 0 # loads the revolution feature arguments featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1 featperform rf result -~~~~~ +~~~~ @subsubsection occt_draw_7_11_3 draft Syntax: -~~~~~ +~~~~{.cpp} draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal] -~~~~~ +~~~~ Computes a draft angle surface from a wire. The surface is determined by the draft direction, the inclination of the draft surface, a draft angle, and a limiting distance. @@ -7993,7 +7993,7 @@ Computes a draft angle surface from a wire. The surface is determined by the dra **Note** that the original aim of adding a draft angle to a shape is to produce a shape which can be removed easily from a mould. The Examples below use larger angles than are used normally and the calculation results returned are not indicated. **Example:** -~~~~~ +~~~~{.cpp} # to create a simple profile profile p F 0 0 x 2 y 4 tt 0 4 w # creates a draft with rounded angles @@ -8002,33 +8002,33 @@ draft res p 0 0 1 3 1 -Ro profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w # creates a draft with rounded external angles draft res p 0 0 1 3 1 -Ro -~~~~~ +~~~~ @subsubsection occt_draw_7_11_4 deform Syntax: -~~~~~ +~~~~{.cpp} deform newname name CoeffX CoeffY CoeffZ -~~~~~ +~~~~ Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions. **Example:** -~~~~~ +~~~~{.cpp} pcylinder c 20 20 deform a c 1 3 5 # the conversion to bspline is followed by the deformation -~~~~~ +~~~~ @subsubsection occt_draw_7_11_5 nurbsconvert Syntax: -~~~~~ +~~~~{.cpp} nurbsconvert result name [result name] -~~~~~ +~~~~ Changes the NURBS curve definition of a shape to a Bspline curve definition. This conversion is required for asymmetric deformation and prepares the arguments for other commands such as **deform**. @@ -8040,7 +8040,7 @@ The conversion can be necessary when transferring shape data to other applicatio **edgestofaces** - The command allows building planar faces from the planar edges randomly located in 3D space. It has the following syntax: -~~~~ +~~~~{.cpp} edgestofaces r_faces edges [-a AngTol -s Shared(0/1)] ~~~~ Options: @@ -8063,7 +8063,7 @@ Draw module for @ref occt_modalg_hist "History Information support" includes the By default it is TRUE, i.e. the history is filled and saved. Syntax: -~~~~ +~~~~{.cpp} setfillhistory : Controls the history collection by the algorithms and its saving into the session after algorithm is done. Usage: setfillhistory [flag] w/o arguments prints the current state of the option; @@ -8072,7 +8072,7 @@ setfillhistory : Controls the history collection by the algorithms and its savi ~~~~ Example: -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 10 10 10 setfillhistory 0 @@ -8095,7 +8095,7 @@ dump h *savehistory* command saves the history from the session into a drawable object with the given name. Syntax: -~~~~ +~~~~{.cpp} savehistory : savehistory name ~~~~ @@ -8103,7 +8103,7 @@ If the history of shape modifications performed during an operation is needed, t If another operation supporting history will be performed before the history of the first operation is saved it will be overwritten with the new history. Example: -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 5 0 0 10 10 15 bfuse r b1 b2 @@ -8131,12 +8131,12 @@ dump usd_hist *isdeleted* command checks if the given shape has been deleted in the given history. Syntax: -~~~~ +~~~~{.cpp} isdeleted : isdeleted history shape ~~~~ Example: -~~~~ +~~~~{.cpp} box b1 4 4 4 2 2 2 box b2 10 10 10 bcommon r b1 b2 @@ -8154,12 +8154,12 @@ foreach s [join [list [explode b2 v] [explode b2 e] [explode b2 f] ] ] { *modified* command returns the shapes Modified from the given shape in the given history. All modified shapes are put into a compound. If the shape has not been modified, the resulting compound will be empty. Note that if the shape has been modified into a single shape only, it will be returned without enclosure into the compound. Syntax: -~~~~ +~~~~{.cpp} modified : modified modified_shapes history shape ~~~~ Example: -~~~~ +~~~~{.cpp} box b 10 10 10 explode b e fillet r b 2 b_1 @@ -8177,12 +8177,12 @@ modified m5 fillet_hist b_5 *generated* command returns the shapes Generated from the given shape in the given history. All generated shapes are put into a compound. If no shapes have been generated from the shape, the resulting compound will be empty. Note that; if the shape has generated a single shape only, it will be returned without enclosure into the compound. Syntax: -~~~~ +~~~~{.cpp} generated : generated generated_shapes history shape ~~~~ Example: -~~~~ +~~~~{.cpp} polyline w1 0 0 0 10 0 0 10 10 0 polyline w2 5 1 10 9 1 10 9 5 10 @@ -8210,12 +8210,12 @@ compare g12 g22 Draw History mechanism allows fast and easy enabling of the Draw history support for the OCCT algorithms supporting standard history methods. To enable History commands for the algorithm it is necessary to save the history of the algorithm into the session. For that, it is necessary to put the following code into the command implementation just after the command is done: -~~~~ +~~~~{.cpp} BRepTest_Objects::SetHistory(ListOfArguments, Algorithm); ~~~~ Here is the example of how it is done in the command performing Split operation (see implementation of the *bapisplit* command): -~~~~ +~~~~{.cpp} BRepAlgoAPI_Splitter aSplitter; // setting arguments aSplitter.SetArguments(BOPTest_Objects::Shapes()); @@ -8253,23 +8253,23 @@ Texture mapping allows you to map textures on a shape. Textures are texture imag @subsubsection occt_draw_7_12_1 vtexture Syntax: -~~~~~ +~~~~{.cpp} vtexture NameOfShape TextureFile vtexture NameOfShape vtexture NameOfShape ? vtexture NameOfShape IdOfTexture -~~~~~ +~~~~ **TextureFile** identifies the file containing the texture you want. The same syntax without **TextureFile** disables texture mapping. The question-mark ? lists available textures. **IdOfTexture** allows applying predefined textures. @subsubsection occt_draw_7_12_2 vtexscale Syntax: -~~~~~ +~~~~{.cpp} vtexscale NameOfShape ScaleU ScaleV vtexscale NameOfShape ScaleUV vtexscale NameOfShape -~~~~~ +~~~~ *ScaleU* and *Scale V* allow scaling the texture according to the U and V parameters individually, while *ScaleUV* applies the same scale to both parameters. @@ -8278,11 +8278,11 @@ The syntax without *ScaleU*, *ScaleV* or *ScaleUV* disables texture scaling. @subsubsection occt_draw_7_12_3 vtexorigin Syntax: -~~~~~ +~~~~{.cpp} vtexorigin NameOfShape UOrigin VOrigin vtexorigin NameOfShape UVOrigin vtexorigin NameOfShape -~~~~~ +~~~~ *UOrigin* and *VOrigin* allow placing the texture according to the U and V parameters individually, while *UVOrigin* applies the same position value to both parameters. @@ -8291,11 +8291,11 @@ The syntax without *UOrigin*, *VOrigin* or *UVOrigin* disables origin positionin @subsubsection occt_draw_7_12_4 vtexrepeat Syntax: -~~~~~ +~~~~{.cpp} vtexrepeat NameOfShape URepeat VRepeat vtexrepeat NameOfShape UVRepeat vtexrepeat NameOfShape -~~~~~ +~~~~ *URepeat* and *VRepeat* allow repeating the texture along the U and V parameters individually, while *UVRepeat* applies the same number of repetitions for both parameters. @@ -8304,9 +8304,9 @@ The same syntax without *URepeat*, *VRepeat* or *UVRepeat* disables texture repe @subsubsection occt_draw_7_12_5 vtexdefault Syntax: -~~~~~ +~~~~{.cpp} vtexdefault NameOfShape -~~~~~ +~~~~ *Vtexdefault* sets or resets the texture mapping default parameters. @@ -8340,18 +8340,18 @@ These commands allow intersecting the shapes only once for building all types of It may be very useful as the intersection part is usually most time-consuming part of the operation. Syntax: -~~~~~ +~~~~{.cpp} bop shape1 shape2 bopcommon result bopfuse result bopcut result boptuc result -~~~~~ +~~~~ **Example:** Let's produce all four boolean operations on a box and a cylinder performing intersection only once: -~~~~~ +~~~~{.cpp} box b 0 -10 5 20 20 10 pcylinder c 5 20 @@ -8372,7 +8372,7 @@ bopcommon s4 # section operation bopsection s5 -~~~~~ +~~~~ @subsubsection occt_draw_bop_two_bapi bfuse, bcut, btuc, bcommon, bsection @@ -8381,15 +8381,15 @@ These commands also perform Boolean operations on two shapes. These are the shor Each of these commands performs both intersection and building the result and may be useful if you need only the result of a single boolean operation. Syntax: -~~~~~ +~~~~{.cpp} bcommon result shape1 shape2 bfuse result shape1 shape2 bcut result shape1 shape2 btuc result shape1 shape2 -~~~~~ +~~~~ **bection** command has some additional options for faces intersection: -~~~~ +~~~~{.cpp} bsection result shape1 shape2 [-n2d/-n2d1/-n2d2] [-na] Where: @@ -8437,7 +8437,7 @@ The command **bfillds** performs intersection of the arguments (**Objects** and The command **bbop** is used for building the result of Boolean Operation. It has to be used after **bfillds** command. Syntax: -~~~~ +~~~~{.cpp} bbop result iOp Where: @@ -8451,7 +8451,7 @@ iOp - type of Boolean Operation. It could have the following values: ~~~~ **Example** -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 5 5 5 10 10 10 box b3 -5 -5 -5 10 10 10 @@ -8479,11 +8479,11 @@ The command **bbuild** is used for building the result of General Fuse Operation General Fuse operation does not make the difference between Objects and Tools considering both as objects. Syntax: -~~~~ +~~~~{.cpp} bbuild result ~~~~ **Example** -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 5 5 5 10 10 10 box b3 -5 -5 -5 10 10 10 @@ -8507,7 +8507,7 @@ Split operation splits the **Objects** by the **Tools**. The command **bsplit** is used for building the result of Split operation. It has to be used after **bfillds** command. **Example** -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 5 5 5 10 10 10 box b3 -5 -5 -5 10 10 10 @@ -8534,7 +8534,7 @@ The command has the following features: * History information for solids will be lost. Syntax: -~~~~ +~~~~{.cpp} buildbop result -o s1 [s2 ...] -t s3 [s4 ...] -op operation (common/fuse/cut/tuc) Where: result - result shape of the operation @@ -8543,7 +8543,7 @@ operation - type of boolean operation ~~~~ **Example** -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 5 5 5 10 10 10 box b3 -5 -5 -5 10 10 10 @@ -8601,7 +8601,7 @@ These commands have the same syntax as the analogical commands described above. The algorithms in Boolean component have a wide range of options. To see the current state of all option the command **boptions** should be used. It has the following syntax: -~~~~ +~~~~{.cpp} boptions [-default] -default - allows to set all options to default state. @@ -8614,7 +8614,7 @@ To have an effect the options should be set before the operation (before *bfilld **brunparallel** command enables/disables the parallel processing mode of the operation. Syntax: -~~~~ +~~~~{.cpp} brunparallel flag Where: @@ -8630,7 +8630,7 @@ The command is applicable for all commands in the component. **bnondestructive** command enables/disables the safe processing mode in which the input arguments are protected from modification. Syntax: -~~~~ +~~~~{.cpp} bnondestructive flag Where: @@ -8646,7 +8646,7 @@ The command is applicable for all commands in the component. **bfuzzyvalue** command sets the additional tolerance for operations. Syntax: -~~~~ +~~~~{.cpp} bfuzzyvalue value ~~~~ @@ -8657,7 +8657,7 @@ The command is applicable for all commands in the component. **bglue** command sets the gluing mode for the BOP algorithms. Syntax: -~~~~ +~~~~{.cpp} bglue 0/1/2 Where: @@ -8673,7 +8673,7 @@ The command is applicable for all commands in the component. **bcheckinverted** command enables/disables the check of the input solids on inverted status in BOP algorithms. Syntax: -~~~~ +~~~~{.cpp} bcheckinverted 0 (off) / 1 (on) ~~~~ @@ -8684,7 +8684,7 @@ The command is applicable for all commands in the component. **buseobb** command enables/disables the usage of OBB in BOP algorithms. Syntax: -~~~~ +~~~~{.cpp} buseobb 0 (off) / 1 (on) ~~~~ @@ -8695,7 +8695,7 @@ The command is applicable for all commands in the component. **bsimplify** command enables/disables the result simplification after BOP. The command is applicable only to the API variants of GF, BOP and Split operations. Syntax: -~~~~ +~~~~{.cpp} bsimplify [-e 0/1] [-f 0/1] [-a tol] Where: @@ -8709,7 +8709,7 @@ Where: **bdrawwarnshapes** command enables/disables drawing of warning shapes of BOP algorithms. Syntax: -~~~~ +~~~~{.cpp} bdrawwarnshapes 0 (do not draw) / 1 (draw warning shapes) ~~~~ @@ -8723,7 +8723,7 @@ The following commands are analyzing the given shape on the validity of Boolean @subsubsection occt_draw_bop_check_1 bopcheck Syntax: -~~~~ +~~~~{.cpp} bopcheck shape [level of check: 0 - 9] ~~~~ @@ -8740,7 +8740,7 @@ It checks the given shape for self-interference. The optional level of check all * 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value) **Example:** -~~~~ +~~~~{.cpp} box b1 10 10 10 box b2 3 3 3 4 4 4 compound b1 b2 c @@ -8754,7 +8754,7 @@ In this example one box is completely included into other box. So the output sho @subsubsection occt_draw_bop_check_2 bopargcheck **bopargcheck** syntax: -~~~~ +~~~~{.cpp} bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] - @@ -8791,7 +8791,7 @@ As you can see *bopargcheck* performs more extended check of the given shapes th **Example:** Let's make an edge with big vertices: -~~~~ +~~~~{.cpp} vertex v1 0 0 0 settolerance v1 0.5 vertex v2 1 0 0 @@ -8803,7 +8803,7 @@ tolsphere e bopargcheck e ~~~~ Here is the output of this command: -~~~~ +~~~~{.cpp} Made faulty shape: s1si_1 Made faulty shape: s1se_1 Faulties for FIRST shape found : 2 @@ -8836,7 +8836,7 @@ All commands listed below are available when the Intersection Part of the algor **bopds** Syntax: -~~~~ +~~~~{.cpp} bopds -v [e, f] ~~~~ @@ -8851,7 +8851,7 @@ Displays: Prints contents of the DS. Example: -~~~~ +~~~~{.cpp} Draw[28]> bopdsdump *** DS *** Ranges:2 number of ranges @@ -8878,7 +8878,7 @@ Example: **bopindex** Syntax: -~~~~ +~~~~{.cpp} bopindex S ~~~~ Prints DS index of shape *S*. @@ -8887,9 +8887,9 @@ Prints DS index of shape *S*. **bopiterator** Syntax: -~~~~~ +~~~~{.cpp} bopiterator [t1 t2] -~~~~~ +~~~~ Prints pairs of DS indices of source shapes that are intersected in terms of bounding boxes. @@ -8899,7 +8899,7 @@ Prints pairs of DS indices of source shapes that are intersected in terms of bou * *4* -- face. Example: -~~~~ +~~~~{.cpp} Draw[104]> bopiterator 6 4 EF: ( z58 z12 ) EF: ( z17 z56 ) @@ -8916,7 +8916,7 @@ Example: **bopinterf** Syntax: -~~~~ +~~~~{.cpp} bopinterf t ~~~~ @@ -8928,7 +8928,7 @@ Prints contents of *myInterfTB* for the type of interference *t*: * *t=4* : edge/face. Example: -~~~~ +~~~~{.cpp} Draw[108]> bopinterf 4 EF: (58, 12, 68), (17, 56, 69), (19, 64, 70), (45, 26, 71), (29, 36, 72), (38, 32, 73), 6 EF found. ~~~~ @@ -8944,7 +8944,7 @@ Here, record (58, 12, 68) means: Displays split edges. Example: -~~~~ +~~~~{.cpp} Draw[33]> bopsp edge 58 : z58_74 z58_75 edge 17 : z17_76 z17_77 @@ -8960,7 +8960,7 @@ Example: **bopcb** Syntax: -~~~~ +~~~~{.cpp} bopcb [nE] ~~~~ @@ -8969,7 +8969,7 @@ Prints Common Blocks for: * the source edge with the specified index *nE*. Example: -~~~~ +~~~~{.cpp} Draw[43]> bopcb 17 -- CB: PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } } @@ -8989,13 +8989,13 @@ This command dumps common blocks for the source edge with index 17. **bopfin** Syntax: -~~~~ +~~~~{.cpp} bopfin nF ~~~~ Prints Face Info about IN-parts for the face with DS index *nF*. Example: -~~~~ +~~~~{.cpp} Draw[47]> bopfin 36 pave blocks In: PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } } @@ -9011,13 +9011,13 @@ Example: **bopfon** Syntax: -~~~~ +~~~~{.cpp} bopfon nF ~~~~ Print Face Info about ON-parts for the face with DS index *nF*. Example: -~~~~ +~~~~{.cpp} Draw[58]> bopfon 36 pave blocks On: PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } } @@ -9034,14 +9034,14 @@ Example: **bopwho** Syntax: -~~~~ +~~~~{.cpp} bopwho nS ~~~~ Prints the information about the shape with DS index *nF*. Example: -~~~~ +~~~~{.cpp} Draw[116]> bopwho 5 rank: 0 ~~~~ @@ -9049,7 +9049,7 @@ Example: * *rank: 0* -- means that shape 5 results from the Argument with index 0. Example: -~~~~ +~~~~{.cpp} Draw[118]> bopwho 68 the shape is new EF: (58, 12), @@ -9065,7 +9065,7 @@ This means that shape 68 is a result of the following interferences: **bopnews** Syntax: -~~~~ +~~~~{.cpp} bopnews -v [-e] ~~~~ @@ -9079,7 +9079,7 @@ The commands listed below are available when the Building Part of the algorithm **bopim** Syntax: -~~~~ +~~~~{.cpp} bopim S ~~~~ Shows the compound of shapes that are images of shape *S* from the argument. @@ -9109,9 +9109,9 @@ The model and the map are used for working with most of DE commands. @subsubsection occt_draw_8_1_1 igesread Syntax: -~~~~~ +~~~~{.cpp} igesread [] -~~~~~ +~~~~ Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted. @@ -9134,38 +9134,38 @@ The second parameter of this command defines the name of the loaded shape. If se See also the detailed description of Selecting IGES entities. **Example:** -~~~~~ +~~~~{.cpp} # translation all roots from file igesread /disk01/files/model.igs a * -~~~~~ +~~~~ @subsubsection occt_draw_8_1_2 tplosttrim Syntax: -~~~~~ +~~~~{.cpp} tplosttrim [] -~~~~~ +~~~~ Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails. This command gives us a number of lost trims and the number of corresponding IGES entities. It outputs the rank and numbers of faces that lost their trims and their numbers for each type (143, 144, 510) and their total number. If a face lost several of its trims it is output only once. Optional parameter \ can be *0TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces. **Example:** -~~~~~ +~~~~{.cpp} tplosttrim TrimmedSurface -~~~~~ +~~~~ @subsubsection occt_draw_8_1_3 brepiges Syntax: -~~~~~ +~~~~{.cpp} brepiges -~~~~~ +~~~~ Writes an OCCT shape to an IGES file. **Example:** -~~~~~ +~~~~{.cpp} # write shape with name aa to IGES file brepiges aa /disk1/tmp/aaa.igs == unit (write) : MM @@ -9175,7 +9175,7 @@ brepiges aa /disk1/tmp/aaa.igs == Now, to write a file, command : writeall filename == Output on file : /disk1/tmp/aaa.igs == Write OK -~~~~~ +~~~~ @subsection occt_draw_8_2 STEP commands @@ -9185,9 +9185,9 @@ These commands are used during the translation of STEP models. @subsubsection occt_draw_8_2_1 stepread Syntax: -~~~~~ +~~~~{.cpp} stepread file_name result_shape_name [selection] -~~~~~ +~~~~ Read a STEP file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted: @@ -9207,17 +9207,17 @@ The second parameter of this command defines the name of the loaded shape. If se See also the detailed description of Selecting STEP entities. **Example:** -~~~~~ +~~~~{.cpp} # translation all roots from file stepread /disk01/files/model.stp a * -~~~~~ +~~~~ @subsubsection occt_draw_8_2_2 stepwrite Syntax: -~~~~~ +~~~~{.cpp} stepwrite mode shape_name file_name -~~~~~ +~~~~ Writes an OCCT shape to a STEP file. @@ -9234,9 +9234,9 @@ For further information see Writ Let us write shape *a* to a STEP file in mode *0*. -~~~~~ +~~~~{.cpp} stepwrite 0 a /disk1/tmp/aaa.igs -~~~~~ +~~~~ @subsection occt_draw_8_3 General commands @@ -9246,9 +9246,9 @@ These are auxiliary commands used for the analysis of result of translation of I @subsubsection occt_draw_8_3_1 count Syntax: -~~~~~ +~~~~{.cpp} count [] -~~~~~ +~~~~ Calculates statistics on the entities in the model and outputs a count of entities. @@ -9260,25 +9260,25 @@ The optional selection argument, if specified, defines a subset of entities, whi | step214-types | Calculates how many entities of each STEP type exist | **Example:** -~~~~~ +~~~~{.cpp} count xst-types -~~~~~ +~~~~ @subsubsection occt_draw_8_3_2 data Syntax: -~~~~~ +~~~~{.cpp} data -~~~~~ +~~~~ Obtains general statistics on the loaded data. The information printed by this command depends on the symbol specified. **Example:** -~~~~~ +~~~~{.cpp} # print full information about warnings and fails data c -~~~~~ +~~~~ | Symbol | Output | | :------ | :------ | @@ -9294,99 +9294,99 @@ data c @subsubsection occt_draw_8_3_3 elabel Syntax: -~~~~~ +~~~~{.cpp} elabel -~~~~~ +~~~~ Entities in the IGES and STEP files are numbered in the succeeding order. An entity can be identified either by its number or by its label. Label is the letter ‘#'(for STEP, for IGES use ‘D’) followed by the rank. This command gives us a label for an entity with a known number. **Example:** -~~~~~ +~~~~{.cpp} elabel 84 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_4 entity Syntax: -~~~~~ +~~~~{.cpp} entity <#(D)>_or_ -~~~~~ +~~~~ The content of an IGES or STEP entity can be obtained by using this command. Entity can be determined by its number or label. \ has range [0-6]. You can get more information about this level using this command without parameters. **Example:** -~~~~~ +~~~~{.cpp} # full information for STEP entity with label 84 entity #84 6 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_5 enum Syntax: -~~~~~ +~~~~{.cpp} enum <#(D)> -~~~~~ +~~~~ Prints a number for the entity with a given label. **Example:** -~~~~~ +~~~~{.cpp} # give a number for IGES entity with label 21 enum D21 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_6 estatus Syntax: -~~~~~ +~~~~{.cpp} estatus <#(D)>_or_ -~~~~~ +~~~~ The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command. **Example:** -~~~~~ +~~~~{.cpp} estatus #315 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_7 fromshape Syntax: -~~~~~ +~~~~{.cpp} fromshape -~~~~~ +~~~~ Gives the number of an IGES or STEP entity corresponding to an OCCT shape. If no corresponding entity can be found and if OCCT shape is a compound the command explodes it to subshapes and try to find corresponding entities for them. **Example:** -~~~~~ +~~~~{.cpp} fromshape a_1_23 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_8 givecount Syntax: -~~~~~ +~~~~{.cpp} givecount [] -~~~~~ +~~~~ Prints a number of loaded entities defined by the selection argument. Possible values of \ you can find in the “IGES FORMAT Users’s Guide”. **Example:** -~~~~~ +~~~~{.cpp} givecount xst-model-roots -~~~~~ +~~~~ @subsubsection occt_draw_8_3_9 givelist Syntax: -~~~~~ +~~~~{.cpp} givelist -~~~~~ +~~~~ Prints a list of a subset of loaded entities defined by the selection argument: | Selection | Description | @@ -9399,10 +9399,10 @@ Prints a list of a subset of loaded entities defined by the selection argument: **Example:** -~~~~~ +~~~~{.cpp} # give a list of all entities of the model givelist xst-model-all -~~~~~ +~~~~ @subsubsection occt_draw_8_3_10 listcount @@ -9418,16 +9418,16 @@ Optional \ argument, if specified, defines a subset of entiti | iges-levels | Calculates how many entities lie in different IGES levels | **Example:** -~~~~~ +~~~~{.cpp} listcount xst-types -~~~~~ +~~~~ @subsubsection occt_draw_8_3_11 listitems Syntax: -~~~~~ +~~~~{.cpp} listitems -~~~~~ +~~~~ This command prints a list of objects (counters, selections etc.) defined in the current session. @@ -9435,9 +9435,9 @@ This command prints a list of objects (counters, selections etc.) defined in the @subsubsection occt_draw_8_3_12 listtypes Syntax: -~~~~~ +~~~~{.cpp} listtypes [ ...] -~~~~~ +~~~~ Gives a list of entity types which were encountered in the last loaded file (with a number of entities of each type). The list can be shown not for all entities but for a subset of them. This subset is defined by an optional selection argument. @@ -9445,9 +9445,9 @@ Gives a list of entity types which were encountered in the last loaded file (wit @subsubsection occt_draw_8_3_13 newmodel Syntax: -~~~~~ +~~~~{.cpp} newmodel -~~~~~ +~~~~ Clears the current model. @@ -9455,9 +9455,9 @@ Clears the current model. @subsubsection occt_draw_8_3_14 param Syntax: -~~~~~ +~~~~{.cpp} param [] [] -~~~~~ +~~~~ This command is used to manage translation parameters. Command without arguments gives a full list of parameters with current values. @@ -9467,30 +9467,30 @@ Command with \ (without ) gives us the current Let us get the information about possible schemes for writing STEP file : -~~~~~ +~~~~{.cpp} param write.step.schema -~~~~~ +~~~~ @subsubsection occt_draw_8_3_15 sumcount Syntax: -~~~~~ +~~~~{.cpp} sumcount [ ...] -~~~~~ +~~~~ Prints only a number of entities per each type matching the criteria defined by arguments. **Example:** -~~~~~ +~~~~{.cpp} sumcount xst-types -~~~~~ +~~~~ @subsubsection occt_draw_8_3_16 tpclear Syntax: -~~~~~ +~~~~{.cpp} tpclear -~~~~~ +~~~~ Clears the map of correspondences between IGES or STEP entities and OCCT shapes. @@ -9499,35 +9499,35 @@ Clears the map of correspondences between IGES or STEP entities and OCCT shapes. @subsubsection occt_draw_8_3_17 tpdraw Syntax: -~~~~~ +~~~~{.cpp} tpdraw <#(D)>_or_ -~~~~~ +~~~~ **Example:** -~~~~~ +~~~~{.cpp} tpdraw 57 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_18 tpent Syntax: -~~~~~ +~~~~{.cpp} tpent <#(D)>_or_ -~~~~~ +~~~~ Get information about the result of translation of the given IGES or STEP entity. **Example:** -~~~~~ +~~~~{.cpp} tpent \#23 -~~~~~ +~~~~ @subsubsection occt_draw_8_3_19 tpstat Syntax: -~~~~~ +~~~~{.cpp} tpstat [*|?] [] -~~~~~ +~~~~ Provides all statistics on the last transfer, including a list of transferred entities with mapping from IGES or STEP to OCCT types, as well as fail and warning messages. The parameter \ defines what information will be printed: @@ -9553,24 +9553,24 @@ Optional argument \ can limit the action of the command to the selec To get help, run this command without arguments. **Example:** -~~~~~ +~~~~{.cpp} # translation ratio on IGES faces tpstat *l iges-faces -~~~~~ +~~~~ @subsubsection occt_draw_8_3_20 xload Syntax: -~~~~~ +~~~~{.cpp} xload -~~~~~ +~~~~ This command loads an IGES or STEP file into memory (i.e. to fill the model with data from the file) without creation of an OCCT shape. **Example:** -~~~~~ +~~~~{.cpp} xload /disk1/tmp/aaa.stp -~~~~~ +~~~~ @subsection occt_draw_8_4 Overview of XDE commands @@ -9588,164 +9588,164 @@ Reminding: All operations of translation are performed with parameters managed b @subsubsection occt_draw_8_4_1 ReadIges Syntax: -~~~~~ +~~~~{.cpp} ReadIges document file_name -~~~~~ +~~~~ Reads information from an IGES file to an XCAF document. **Example:** -~~~~~ +~~~~{.cpp} ReadIges D /disk1/tmp/aaa.igs ==> Document saved with name D -~~~~~ +~~~~ @subsubsection occt_draw_8_4_2 ReadStep Syntax: -~~~~~ +~~~~{.cpp} ReadStep -~~~~~ +~~~~ Reads information from a STEP file to an XCAF document. **Example:** -~~~~~ +~~~~{.cpp} ReadStep D /disk1/tmp/aaa.stp == Document saved with name D -~~~~~ +~~~~ @subsubsection occt_draw_8_4_3 WriteIges Syntax: -~~~~~ +~~~~{.cpp} WriteIges -~~~~~ +~~~~ **Example:** -~~~~~ +~~~~{.cpp} WriteIges D /disk1/tmp/aaa.igs -~~~~~ +~~~~ @subsubsection occt_draw_8_4_4 WriteStep Syntax: -~~~~~ +~~~~{.cpp} WriteStep -~~~~~ +~~~~ Writes information from an XCAF document to a STEP file. **Example:** -~~~~~ +~~~~{.cpp} WriteStep D /disk1/tmp/aaa.stp -~~~~~ +~~~~ @subsubsection occt_draw_8_4_5 XFileCur Syntax: -~~~~~ +~~~~{.cpp} XFileCur -~~~~~ +~~~~ Returns the name of file which is set as the current one in the Draw session. **Example:** -~~~~~ +~~~~{.cpp} XFileCur == *as1-ct-203.stp* -~~~~~ +~~~~ @subsubsection occt_draw_8_4_6 XFileList Syntax: -~~~~~ +~~~~{.cpp} XFileList -~~~~~ +~~~~ Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file. **Example:** -~~~~~ +~~~~{.cpp} XFileList ==> *as1-ct-Bolt.stp* ==> *as1-ct-L-Bracktet.stp* ==> *as1-ct-LBA.stp* ==> *as1-ct-NBA.stp* ==> … -~~~~~ +~~~~ @subsubsection occt_draw_8_4_7 XFileSet Syntax: -~~~~~ +~~~~{.cpp} XFileSet -~~~~~ +~~~~ Sets the current file taking it from the components list of the assemble file. **Example:** -~~~~~ +~~~~{.cpp} XFileSet as1-ct-NBA.stp -~~~~~ +~~~~ @subsubsection occt_draw_8_4_8 XFromShape Syntax: -~~~~~ +~~~~{.cpp} XFromShape -~~~~~ +~~~~ This command is similar to the command @ref occt_draw_8_3_7 "fromshape", but gives additional information about the file name. It is useful if a shape was translated from several files. **Example:** -~~~~~ +~~~~{.cpp} XFromShape a ==> Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp -~~~~~ +~~~~ @subsection occt_draw_8_5 XDE general commands @subsubsection occt_draw_8_5_1 XNewDoc Syntax: -~~~~~ +~~~~{.cpp} XNewDoc -~~~~~ +~~~~ Creates a new XCAF document. **Example:** -~~~~~ +~~~~{.cpp} XNewDoc D -~~~~~ +~~~~ @subsubsection occt_draw_8_5_2 XShow Syntax: -~~~~~ +~~~~{.cpp} XShow [ … ] -~~~~~ +~~~~ Shows a shape from a given label in the 3D viewer. If the label is not given -- shows all shapes from the document. **Example:** -~~~~~ +~~~~{.cpp} # show shape from label 0:1:1:4 from document D XShow D 0:1:1:4 -~~~~~ +~~~~ @subsubsection occt_draw_8_5_3 XStat Syntax: -~~~~~ +~~~~{.cpp} XStat -~~~~~ +~~~~ Prints common information from an XCAF document. **Example:** -~~~~~ +~~~~{.cpp} XStat D ==>Statistis of shapes in the document: ==>level N 0 : 9 @@ -9762,34 +9762,34 @@ XStat D ==>Number of colors = 4 ==>BLUE1 RED YELLOW BLUE2 ==>Number of layers = 0 -~~~~~ +~~~~ @subsubsection occt_draw_8_5_4 XWdump Syntax: -~~~~~ +~~~~{.cpp} XWdump -~~~~~ +~~~~ Saves the contents of the viewer window as an image (XWD, png or BMP file). \ must have a corresponding extension. **Example:** -~~~~~ +~~~~{.cpp} XWdump D /disk1/tmp/image.png -~~~~~ +~~~~ @subsubsection occt_draw_8_5_5 Xdump Syntax: -~~~~~ +~~~~{.cpp} Xdump [int deep {0|1}] -~~~~~ +~~~~ Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes. **Example:** -~~~~~ +~~~~{.cpp} Xdump D 1 ==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448) ==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8) @@ -9803,16 +9803,16 @@ Xdump D 1 ==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8) ==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000) etc. -~~~~~ +~~~~ @subsection occt_draw_8_6 XDE shape commands @subsubsection occt_draw_8_6_1 XAddComponent Syntax: -~~~~~ +~~~~{.cpp} XAddComponent