1 Draw Test Harness {#occt_user_guides__test_harness}
2 ===============================
6 @section occt_draw_1 Introduction
8 This manual explains how to use Draw, the test harness for Open CASCADE Technology (**OCCT**).
9 Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
11 @subsection occt_draw_1_1 Overview
13 Draw is a test harness for Open CASCADE Technology. It provides a flexible and easy to use means of testing and demonstrating the OCCT modeling libraries.
15 Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
17 Scripts may be written to customize Draw and perform tests. New types of objects and new commands may be added using the C++ programing language.
21 * A command interpreter based on the TCL command language.
22 * A 3d graphic viewer based on the X system.
23 * A basic set of commands covering scripts, variables and graphics.
24 * A set of geometric commands allowing the user to create and modify curves and surfaces and to use OCCT geometry algorithms. This set of commands is optional.
25 * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
28 There is also a set of commands for each delivery unit in the modeling libraries:
37 @subsection occt_draw_1_2 Contents of this documentation
39 This documentation describes:
41 * The command language.
42 * The basic set of commands.
43 * The graphical commands.
44 * The Geometry set of commands.
45 * The Topology set of commands.
47 * Data Exchange commands
48 * Shape Healing commands
50 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.
56 Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file.
61 # this is a very short example
66 @subsection occt_draw_1_3 Getting started
68 Install Draw and launch Emacs. Get a command line in Emacs using *Esc x* and key in *woksh*.
70 All DRAW Test Harness can be activated in the common executable called **DRAWEXE**. They are grouped in toolkits and can be loaded at run-time thereby implementing dynamically loaded plug-ins. Thus, it is possible to work only with the required commands adding them dynamically without leaving the Test Harness session.
72 Declaration of available plug-ins is done through the special resource file(s). The *pload* command loads the plug-in in accordance with the specified resource file and activates the commands implemented in the plug-in.
74 @subsubsection occt_draw_1_3_1 Launching DRAW Test Harness
76 Test Harness executable *DRAWEXE* is located in the <i>$CASROOT/\<platform\>/bin</i> directory (where \<platform\> is Win for Windows and Linux for Linux operating systems). Prior to launching it is important to make sure that the environment is correctly setup (usually this is done automatically after the installation process on Windows or after launching specific scripts on Linux).
79 @subsubsection occt_draw_1_3_2 Plug-in resource file
81 Open CASCADE Technology is shipped with the DrawPlugin resource file located in the <i>$CASROOT/src/DrawResources</i> directory.
83 The format of the file is compliant with standard Open CASCADE Technology resource files (see the *Resource_Manager.hxx* file for details).
85 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.
87 **Example:** (excerpt from DrawPlugin):
88 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
89 OCAF : VISUALIZATION, OCAFKERNEL
95 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97 @subsubsection occt_draw_1_3_3 Activation of commands implemented in the plug-in
99 To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness:
102 pload [-PluginFileName] [[Key1] [Key2]...]
107 * <i>-PluginFileName</i> -- defines the name of a plug-in resource file (prefix "-" is mandatory) described above. If this parameter is omitted then the default name *DrawPlugin* is used.
108 * *Key* -- defines the key(s) enumerating plug-ins to be loaded. If no keys are specified then the key named *DEFAULT* is used (if there is no such key in the file then no plug-ins are loaded).
110 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 <i>$CASROOT/src/DrawResources</i> directory.
113 Draw[] pload -DrawPlugin OCAF
115 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 <i>$CASROOT/src/DrawResources</i> 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.
118 Draw[] pload (equivalent to pload -DrawPlugin DEFAULT).
120 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.
123 @section occt_draw_2 The Command Language
125 @subsection occt_draw_2_1 Overview
127 The command language used in Draw is Tcl. Tcl documentation such as "TCL and the TK Toolkit" by John K. Ousterhout (Addison-Wesley) will prove useful if you intend to use Draw extensively.
129 This chapter is designed to give you a short outline of both the TCL language and some extensions included in Draw. The following topics are covered:
131 * Syntax of the TCL language.
132 * Accessing variables in TCL and Draw.
133 * Control structures.
136 @subsection occt_draw_2_2 Syntax of TCL
138 TCL is an interpreted command language, not a structured language like C, Pascal, LISP or Basic. It uses a shell similar to that of csh. TCL is, however, easier to use than csh because control structures and procedures are easier to define. As well, because TCL does not assign a process to each command, it is faster than csh.
140 The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons.
142 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
146 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148 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.
150 Words are separated by spaces or tabs. In the preceding example each of the four commands has three words. A command may contain any number of words and each word is a string of arbitrary length.
152 The evaluation of a command by TCL is done in two steps. In the first step, the command is parsed and broken into words. Some substitutions are also performed. In the second step, the command procedure corresponding to the first word is called and the other words are interpreted as arguments. In the first step, there is only string manipulation, The words only acquire *meaning* in the second step by the command procedure.
154 The following substitutions are performed by TCL:
156 Variable substitution is triggered by the $ character (as with csh), the content of the variable is substitued; { } may be used as in csh to enclose the name of the variable.
159 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
160 # set a variable value
161 set file documentation
162 puts $file #to display file contents on the screen
164 # a simple substitution, set psfile to documentation.ps
168 # another substitution, set pfile to documentationPS
172 # delete files NEWdocumentation and OLDdocumentation
173 foreach prefix {NEW OLD} {rm $prefix$file}
174 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176 Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted.
178 Compare command construction in csh.
181 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
184 # expr is a command evaluating a numeric expression
185 set radian [expr $pi*$degree/180]
186 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 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.
190 TCL uses two forms of *quoting* to prevent substitution and word breaking.
192 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 " ".
195 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
196 # set msg to ;the price is 12.00;
198 set msg ;the price is $price;
199 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201 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.
204 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
206 # this will loop for ever
207 # because while argument is ;0 < 3;
208 while ;$x < 3; {set x [expr $x+1]}
209 # this will terminate as expected because
210 # while argument is {$x < 3}
211 while {$x < 3} {set x [expr $x+1]}
212 # this can be written also
216 # the following cannot be written
217 # because while requires two arguments
222 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 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.
227 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
229 set a 1 # this is not a comment
230 set b 1; # this is a comment
231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233 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.
237 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238 # I want to delete two files
242 # this will fail because rm will receive only one argument
243 # and complain that ;foo bar; does not exit
247 # a second evaluation will do it
248 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250 @subsection occt_draw_2_3 Accessing variables in TCL and Draw
252 TCL variables have only string values. Note that even numeric values are stored as string literals, and computations using the **expr** command start by parsing the strings. Draw, however, requires variables with other kinds of values such as curves, surfaces or topological shapes.
254 TCL provides a mechanism to link user data to variables. Using this functionality, Draw defines its variables as TCL variables with associated data.
256 The string value of a Draw variable is meaningless. It is usually set to the name of the variable itself. Consequently, preceding a Draw variable with a <i>$</i> does not change the result of a command. The content of a Draw variable is accessed using appropriate commands.
258 There are many kinds of Draw variables, and new ones may be added with C++. Geometric and topological variables are described below.
260 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.
263 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
264 # dset is used for numeric variables
265 # pi is a predefined Draw variable
266 dset angle pi/3 radius 10
267 point p radius*cos(angle) radius*sin(angle) 0
268 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269 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.
271 @subsubsection occt_draw_2_3_1 set, unset
277 unset varname [varname varname ...]
280 *set* assigns a string value to a variable. If the variable does not already exist, it is created.
282 Without a value, *set* returns the content of the variable.
284 *unset* deletes variables. It is is also used to delete Draw variables.
287 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
294 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296 **Note**, that the *set* command can set only one variable, unlike the *dset* command.
299 @subsubsection occt_draw_2_3_2 dset, dval
304 dset var1 value1 vr2 value2 ...
308 *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.
310 *dval* evaluates an expression containing Draw numeric variables and returns the result as a string, even in the case of a single variable. This is not used in Draw commands as these usually interpret the expression. It is used for basic TCL commands expecting strings.
314 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
319 # no $ required for Draw commands
322 # "puts" prints a string
323 puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)];
324 == x = 10, cos(x/pi) = -0.99913874099467914
325 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327 **Note,** that in TCL, parentheses are not considered to be special characters. Do not forget to quote an expression if it contains spaces in order to avoid parsing different words. <i>(a + b)</i> is parsed as three words: <i>"(a + b)"</i> or <i>(a+b)</i> are correct.
329 @subsubsection occt_draw_2_3_3 del, dall
333 del varname_pattern [varname_pattern ...]
337 *del* command does the same thing as *unset*, but it deletes the variables matched by the pattern.
339 *dall* command deletes all variables in the session.
341 @subsection occt_draw_2_4 lists
343 TCL uses lists. A list is a string containing elements separated by spaces or tabs. If the string contains braces, the braced part accounts as one element.
345 This allows you to insert lists within lists.
348 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
349 # a list of 3 strings
352 # a list of two strings the first is a list of 2
354 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356 Many TCL commands return lists and **foreach** is a useful way to create loops on list elements.
358 @subsubsection occt_draw_2_5 Control Structures
360 TCL allows looping using control structures. The control structures are implemented by commands and their syntax is very similar to that of their C counterparts (**if**, **while**, **switch**, etc.). In this case, there are two main differences between TCL and C:
362 * You use braces instead of parentheses to enclose conditions.
363 * You do not start the script on the next line of your command.
366 @subsubsection occt_draw_2_5_1 if
371 if condition script [elseif script .... else script]
374 **If** evaluates the condition and the script to see whether the condition is true.
379 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
387 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
389 @subsubsection occt_draw_2_5_2 while, for, foreach
395 while condition script
396 for init condition reinit script
397 foreach varname list script
400 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. \
403 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
406 while {[dval x] < 100} {
411 # incr var d, increments a variable of d (default 1)
412 for {set i 0} {$i < 10} {incr i} {
414 point p$i cos(angle0 sin(angle) 0
417 foreach object {crapo tomson lucas} {display $object}
418 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
420 @subsubsection occt_draw_2_5_3 break, continue
429 Within loops, the **break** and **continue** commands have the same effect as in C.
431 **break** interrupts the innermost loop and **continue** jumps to the next iteration.
434 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
435 # search the index for which t$i has value ;secret;
436 for {set i 1} {$i <= 100} {incr i} {
437 if {[set t$i] == ;secret;} break;
439 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
441 @subsection occt_draw_2_6 Procedures
443 TCL can be extended by defining procedures using the **proc** command, which sets up a context of local variables, binds arguments and executes a TCL script.
445 The only problematic aspect of procedures is that variables are strictly local, and as they are implicitly created when used, it may be difficult to detect errors.
447 There are two means of accessing a variable outside the scope of the current procedures: **global** declares a global variable (a variable outside all procedures); **upvar** accesses a variable in the scope of the caller. Since arguments in TCL are always string values, the only way to pass Draw variables is by reference, i.e. passing the name of the variable and using the **upvar** command as in the following examples.
449 As TCL is not a strongly typed language it is very difficult to detect programming errors and debugging can be tedious. TCL procedures are, of course, not designed for large scale software development but for testing and simple command or interactive writing.
452 @subsubsection occt_draw_2_6_1 proc
457 proc argumentlist script
460 **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.
462 **return** gives a return value to the procedure.
465 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
470 # procedure with arguments and default values
471 proc distance {x1 y1 {x2 0} {y2 0}} {
472 set d [expr (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)]
473 return [expr sqrt(d)]
476 if {$n == 0} {return 1} else {
477 return [expr n*[fact [expr n -1]]]
480 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
483 @subsubsection occt_draw_2_6_2 global, upvar
488 global varname [varname ...]
489 upvar varname localname [varname localname ...]
493 **global** accesses high level variables. Unlike C, global variables are not visible in procedures.
495 **upvar** gives a local name to a variable in the caller scope. This is useful when an argument is the name of a variable instead of a value. This is a call by reference and is the only way to use Draw variables as arguments.
497 **Note** that in the following examples the \$ character is always necessarily used to access the arguments.
500 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
501 # convert degree to radian
502 # pi is a global variable
503 proc deg2rad (degree} {
504 return [dval pi*$degree/2.]
506 # create line with a point and an angle
507 proc linang {linename x y angle} {
509 line l $x $y cos($angle) sin($angle)
511 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
513 @section occt_draw_3 Basic Commands
515 This chapter describes all the commands defined in the basic Draw package. Some are TCL commands, but most of them have been formulated in Draw. These commands are found in all Draw applications. The commands are grouped into four sections:
517 * General commands, which are used for Draw and TCL management.
518 * Variable commands, which are used to manage Draw variables such as storing and dumping.
519 * Graphic commands, which are used to manage the graphic system, and so pertain to views.
520 * Variable display commands, which are used to manage the display of objects within given views.
522 Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands
525 @subsection occt_draw_3_1 General commands
527 This section describes several useful commands:
529 * **help** to get information,
530 * **source** to eval a script from a file,
531 * **spy** to capture the commands in a file,
532 * **cpulimit** to limit the process cpu time,
533 * **wait** to waste some time,
534 * **chrono** to time commands.
536 @subsubsection occt_draw_3_1_1 help
541 help [command [helpstring group]]
544 Provides help or modifies the help information.
546 **help** without arguments lists all groups and the commands in each group.
548 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.
551 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
552 # Gives help on all commands starting with *a*
553 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
556 @subsubsection occt_draw_3_1_2 source
565 The **exit** command will terminate the file.
567 @subsubsection occt_draw_3_1_3 spy
575 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.
577 If a command returns an error it is saved with a comment mark.
579 The file created by **spy** can be executed with the **source** command.
582 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
583 # all commands will be saved in the file ;session;
585 # the file ;session; is closed and commands are not saved
587 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
591 @subsubsection occt_draw_3_1_4 cpulimit
599 **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.
602 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
603 #limit cpu to one hour
605 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
607 @subsubsection occt_draw_3_1_5 wait
613 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.
616 # You have ten seconds ...
620 @subsubsection occt_draw_3_1_6 chrono
625 chrono [ name start/stop/reset/show/restart/[counter text]]
628 Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed.
630 With arguments, **chrono** is used to manage activated chronometers. You can perform the following actions with a chronometer.
631 * run the chronometer (start).
632 * stop the chronometer (stop).
633 * reset the chronometer to 0 (reset).
634 * restart the chronometer (restart).
635 * display the current time (show).
636 * display the current time with specified text (output example - *COUNTER text: N*), command <i>testdiff</i> will compare such outputs between two test runs (counter).
639 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
641 ==Chronometers activated.
643 ==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds
644 ==CPU user time: 0.01 seconds
645 ==CPU system time: 0 seconds
646 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
648 @subsection occt_draw_3_2 Variable management commands
650 @subsubsection occt_draw_3_2_1 isdraw, directory
658 **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.
660 Use **directory** to return a list of all Draw global variables matching a pattern.
663 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
676 # to destroy all Draw objects with name containing curve
677 foreach var [directory *curve*] {unset $var}
678 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
681 @subsubsection occt_draw_3_2_2 whatis, dump
686 whatis varname [varname ...]
687 dump varname [varname ...]
690 **whatis** returns short information about a Draw variable. This is usually the type name.
692 **dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable.
695 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
702 ***** Dump of c *****
708 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
710 **Note** The behavior of *whatis* on other variables (not Draw) is not excellent.
713 @subsubsection occt_draw_3_2_3 renamevar, copy
717 renamevar varname tovarname [varname tovarname ...]
718 copy varname tovarname [varname tovarname ...]
721 * **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.
722 * **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.
725 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
729 # curves are copied, c2 will not be modified
731 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
733 @subsubsection occt_draw_3_2_4 datadir, save, restore
738 save variable [filename]
739 restore filename [variablename]
742 * **datadir** without arguments prints the path of the current data directory.
743 * **datadir** with an argument sets the data directory path. \
745 If the path starts with a dot (.) only the last directory name will be changed in the path.
747 * **save** writes a file in the data directory with the content of a variable. By default the name of the file is the name of the variable. To give a different name use a second argument.
748 * **restore** reads the content of a file in the data directory in a local variable. By default, the name of the variable is the name of the file. To give a different name, use a second argument.
750 The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent.
753 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
754 # note how TCL accesses shell environment variables
759 datadir $env(WBCONTAINER)/data/default
760 ==/adv_20/BAG/data/default
764 ==/adv_20/BAG/data/default/theBox
766 # when TCL does not find a command it tries a shell command
772 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
774 @subsection occt_draw_3_3 User defined commands
776 *DrawTrSurf* provides commands to create and display a Draw **geometric** variable from a *Geom_Geometry* object and also get a *Geom_Geometry* object from a Draw geometric variable name.
778 *DBRep* provides commands to create and display a Draw **topological** variable from a *TopoDS_Shape* object and also get a *TopoDS_Shape* object from a Draw topological variable name.
780 @subsubsection occt_draw_3_3_1 set
782 #### In *DrawTrSurf* package:
785 void Set(Standard_CString& Name,const gp_Pnt& G) ;
786 void Set(Standard_CString& Name,const gp_Pnt2d& G) ;
787 void Set(Standard_CString& Name,
788 const Handle(Geom_Geometry)& G) ;
789 void Set(Standard_CString& Name,
790 const Handle(Geom2d_Curve)& C) ;
791 void Set(Standard_CString& Name,
792 const Handle(Poly_Triangulation)& T) ;
793 void Set(Standard_CString& Name,
794 const Handle(Poly_Polygon3D)& P) ;
795 void Set(Standard_CString& Name,
796 const Handle(Poly_Polygon2D)& P) ;
799 #### In *DBRep* package:
802 void Set(const Standard_CString Name,
803 const TopoDS_Shape& S) ;
806 Example of *DrawTrSurf*
809 Handle(Geom2d_Circle) C1 = new Geom2d_Circle
810 (gce_MakeCirc2d (gp_Pnt2d(50,0,) 25));
811 DrawTrSurf::Set(char*, C1);
818 B = BRepPrimAPI_MakeBox (10,10,10);
822 @subsubsection occt_draw_3_3_2 get
824 #### In *DrawTrSurf* package:
827 Handle_Geom_Geometry Get(Standard_CString& Name) ;
830 #### In *DBRep* package:
833 TopoDS_Shape Get(Standard_CString& Name,
834 const TopAbs_ShapeEnum Typ = TopAbs_SHAPE,
835 const Standard_Boolean Complain
839 Example of *DrawTrSurf*
842 Standard_Integer MyCommand
843 (Draw_Interpretor& theCommands,
844 Standard_Integer argc, char** argv)
846 // Creation of a Geom_Geometry from a Draw geometric
848 Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]);
855 Standard_Integer MyCommand
856 (Draw_Interpretor& theCommands,
857 Standard_Integer argc, char** argv)
859 // Creation of a TopoDS_Shape from a Draw topological
861 TopoDS_Solid B = DBRep::Get(argv[1]);
865 @section occt_draw_4 Graphic Commands
867 Graphic commands are used to manage the Draw graphic system. Draw provides a 2d and a 3d viewer with up to 30 views. Views are numbered and the index of the view is displayed in the window’s title. Objects are displayed in all 2d views or in all 3d views, depending on their type. 2d objects can only be viewed in 2d views while 3d objects -- only in 3d views correspondingly.
869 @subsection occt_draw_4_1 Axonometric viewer
871 @subsubsection occt_draw_4_1_1 view, delete
875 view index type [X Y W H]
879 **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.
881 As a rule it is far simpler either to use the procedures **axo**, **top**, **left** or to click on the desired view type in the menu under *Views* in the task bar..
883 **delete** deletes a view. If no index is given, all the views are deleted.
885 Type selects from the following range:
887 * *AXON* : Axonometric view
888 * *PERS* : Perspective view
889 * <i>+X+Y</i> : View on both axes (i.e. a top view), other codes are <i>-X+Y</i>, <i>+Y-Z</i>, etc.
890 * <i>-2D-</i> : 2d view
892 The index, the type, the current zoom are displayed in the window title .
895 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
896 # this is the content of the mu4 procedure
899 view 1 +X+Z 320 20 400 400
900 view 2 +X+Y 320 450 400 400
901 view 3 +Y+Z 728 20 400 400
902 view 4 AXON 728 450 400 400
904 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
906 See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview**
908 @subsubsection occt_draw_4_1_2 axo, pers, top, ...
919 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.
921 * **axo** creates a large window axonometric view;
922 * **pers** creates a large window perspective view;
923 * **top**, **bottom**, **left**, **right**, **front**, **back** create a large window axis view;
924 * **mu4** creates four small window views: front, left, top and axo.
925 * **v2d** creates a large window 2d view.
926 * **av2d** creates two small window views, one 2d and one axo
927 * **smallview** creates a view at the bottom right of the screen of the given type.
929 See also: **view**, **delete**
931 @subsubsection occt_draw_4_1_3 mu, md, 2dmu, 2dmd, zoom, 2dzoom
942 * **mu** (magnify up) increases the zoom in one or several views by a factor of 10%.
943 * **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd**
944 perform the same on one or all 2d views.
945 * **zoom** and **2dzoom** set the zoom factor to a value specified by you. The current zoom factor is always displayed in the window’s title bar. Zoom 20 represents a full screen view in a large window; zoom 10, a full screen view in a small one.
946 * **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.
949 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
957 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
958 See also: **fit**, **2dfit**
961 @subsubsection occt_draw_4_14 pu, pd, pl, pr, 2dpu, 2dpd, 2dpl, 2dpr
970 The <i>p_</i> 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.
972 # you have selected one anonometric view
977 # you have selected an mu4 view; the object in the third view will pan up
980 See also: **fit**, **2dfit**
983 @subsubsection occt_draw_4_1_5 fit, 2dfit
992 **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.
994 When fitting all views a unique zoom is computed for all the views. All views are on the same scale.
997 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1002 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1003 See also: **zoom**, **mu**, **pu**
1006 @subsubsection occt_draw_4_1_6 u, d, l, r
1017 **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.
1020 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1021 # rotate the view up
1023 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1025 @subsubsection occt_draw_4_1_7 focal, fu, fd
1034 * **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.
1035 * **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object.
1038 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1041 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1043 **Note**: Do not use a negative or null focal value.
1047 @subsubsection occt_draw_4_1_8 color
1055 **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.
1057 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.
1060 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1061 # change the value of blue
1063 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1066 **Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc.
1068 @subsubsection occt_draw_4_1_9 dtext
1072 dtext [x y [z]] string
1075 **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.
1077 The coordinates are real space coordinates.
1080 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1084 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1086 @subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd
1091 hcolor index width gray
1092 xwd [index] filename
1095 * **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.
1096 * **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.
1097 * **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**.
1100 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1101 # all blue lines (color 3)
1102 # will be half-width and gray
1105 # make a postscript file and print it
1109 # make an xwd file and display it
1112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1114 **Note:** When more than one view is present, specify the index of the view.
1116 Only use a postscript printer to print postscript files.
1121 @subsubsection occt_draw_4_1_11 wclick, pick
1126 pick index X Y Z b [nowait]
1129 **wclick** defers an event until the mouse button is clicked. The message <code>just click</code> is displayed.
1131 Use the **pick** command to get graphic input. The arguments must be names for variables where the results are stored.
1132 * index: index of the view where the input was made.
1133 * X,Y,Z: 3d coordinates in real world.
1134 * b: b is the mouse button 1,2 or 3.
1136 When there is an extra argument, its value is not used and the command does not wait for a click; the value of b may then be 0 if there has not been a click.
1138 This option is useful for tracking the pointer.
1140 **Note** that the results are stored in Draw numeric variables.
1143 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1144 # make a circle at mouse location
1146 circle c x y z 0 0 1 1 0 0 0 30
1148 # make a dynamic circle at mouse location
1149 # stop when a button is clicked
1150 # (see the repaint command)
1153 while {[dval b] == 0} {
1154 pick index x y z b nowait
1155 circle c x y z 0 0 1 1 0 0 0 30
1158 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1159 See also: **repaint**
1162 Draw provides commands to manage the display of objects.
1163 * **display**, **donly** are used to display,
1164 * **erase**, **clear**, **2dclear** to erase.
1165 * **autodisplay** command is used to check whether variables are displayed when created.
1167 The variable name "." (dot) has a special status in Draw. Any Draw command expecting a Draw object as argument can be passed a dot. The meaning of the dot is the following.
1168 * If the dot is an input argument, a graphic selection will be made. Instead of getting the object from a variable, Draw will ask you to select an object in a view.
1169 * If the dot is an output argument, an unnamed object will be created. Of course this makes sense only for graphic objects: if you create an unnamed number you will not be able to access it. This feature is used when you want to create objects for display only.
1170 * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands.
1173 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1174 # OK use dot to dump an object on the screen
1179 #Not OK. display points on a curve c
1180 # with dot no variables are created
1181 for {set i 0} {$i <= 10} {incr i} {
1182 cvalue c $i/10 x y z
1187 # would have displayed only one point
1188 # because the precedent variable content is erased
1191 # is an other solution, creating variables
1194 # give a name to a graphic object
1196 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1199 @subsubsection occt_draw_4_1_12 autodisplay
1207 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.
1209 When **autodisplay** is off, using the dot return argument is ineffective.
1212 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1221 # c is erased, but not displayed
1223 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1225 @subsubsection occt_draw_4_1_13 display, donly
1229 display varname [varname ...]
1230 donly varname [varname ...]
1233 * **display** makes objects visible.
1234 * **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen.
1237 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1238 \# to see all objects
1239 foreach var [directory] {display $var}
1241 \# to select two objects and erase the other ones
1243 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1246 @subsubsection occt_draw_4_1_14 erase, clear, 2dclear
1251 erase [varname varname ...]
1256 **erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d.
1258 **clear** erases only 3d objects and **2dclear** only 2d objects. **erase** without arguments is similar to **clear; 2dclear**.
1262 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1263 # erase eveerything with a name starting with c_
1264 foreach var [directory c_*] {erase $var}
1268 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1270 @subsubsection occt_draw_4_1_14_1 disp, don, era
1272 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 enouth to run the command:
1277 @subsubsection occt_draw_4_1_15 repaint, dflush
1287 * **repaint** forces repainting of views.
1288 * **dflush** flushes the graphic buffers.
1290 These commands are useful within loops or in scripts.
1292 When an object is modified or erased, the whole view must be repainted. To avoid doing this too many times, Draw sets up a flag and delays the repaint to the end of the command in which the new prompt is issued. In a script, you may want to display the result of a change immediately. If the flag is raised, **repaint** will repaint the views and clear the flag.
1294 Graphic operations are buffered by Draw (and also by the X system). Usually the buffer is flushed at the end of a command and before graphic selection. If you want to flush the buffer from inside a script, use the **dflush** command.
1296 See also: @ref occt_draw_4_1_11 "pick" command.
1298 @subsection occt_draw_4_2 AIS viewer -- view commands
1300 @subsubsection occt_draw_4_2_1 vinit
1306 Creates a new View window with the specified *view_name*.
1307 By default the view is created in the viewer and in the graphic driver shared with the active view.
1310 name = {driverName/viewerName/viewName | viewerName/viewName | viewName}
1313 If *driverName* is not specified the driver will be shared with the active view.
1314 If *viewerName* is not specified the viewer will be shared with the active view.
1316 @subsubsection occt_draw_4_2_2 vhelp
1322 Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities.
1324 @subsubsection occt_draw_4_2_3 vtop
1331 Displays top view in the 3D viewer window. Orientation +X+Y.
1334 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1340 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1342 @subsubsection occt_draw_4_2_4 vaxo
1349 Displays axonometric view in the 3D viewer window. Orientation +X-Y+Z.
1352 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1358 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1360 @subsubsection occt_draw_4_2_5 vsetbg
1364 vsetbg imagefile [filltype]
1367 Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH.
1372 vsetbg myimage.brep CENTERED
1375 @subsubsection occt_draw_4_2_6 vclear
1381 Removes all objects from the viewer.
1383 @subsubsection occt_draw_4_2_7 vrepaint
1389 Forcibly redisplays the shape in the 3D viewer window.
1391 @subsubsection occt_draw_4_2_8 vfit
1397 Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface.
1399 @subsubsection occt_draw_4_2_9 vzfit
1406 Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space.
1408 @subsubsection occt_draw_4_2_10 vreadpixel
1412 vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]
1414 Read pixel value for active view.
1417 @subsubsection occt_draw_4_2_11 vselect
1421 vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [shift_selection = 0|1]
1424 Emulates different types of selection:
1426 * single mouse click selection
1427 * selection with a rectangle having the upper left and bottom right corners in <i>(x1,y1)</i> and <i>(x2,y2)</i> respectively
1428 * selection with a polygon having the corners in pixel positions <i>(x1,y1), (x2,y2),…, (xn,yn)</i>
1429 * <i> -allowoverlap </i> manages overlap and inclusion detection in rectangular selection. If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined rectangle will be detected, otherwise algorithm will chose only fully included sensitives. Default behavior is to detect only full inclusion.
1430 * any of these selections if shift_selection is set to 1.
1432 @subsubsection occt_draw_4_2_12 vmoveto
1439 Emulates cursor movement to pixel position (x,y).
1441 @subsubsection occt_draw_4_2_13 vviewparams
1445 vviewparams [-scale [s]] [-eye [x y z]] [-at [x y z]] [-up [x y z]] [-proj [x y z]] [-center x y] [-size sx]
1447 Gets or sets the current view parameters.
1448 * If called without arguments, all view parameters are printed.
1450 * -scale [s] : prints or sets the relative scale of viewport.
1451 * -eye [x y z] : prints or sets the eye location.
1452 * -at [x y z] : prints or sets the view center.
1453 * -up [x y z] : prints or sets the up vector direction.
1454 * -proj [x y z] : prints or sets the view direction.
1455 * -center x y : sets the screen center location in pixels.
1456 * -size [sx] : prints viewport projection width and height sizes or changes the size of its maximum dimension.
1458 @subsubsection occt_draw_4_2_14 vchangeselected
1462 vchangeselected shape
1464 Adds a shape to selection or removes one from it.
1466 @subsubsection occt_draw_4_2_15 vzclipping
1470 vzclipping [mode] [depth width]
1472 Gets or sets ZClipping mode, width and depth, where
1473 - *mode = OFF|BACK|FRONT|SLICE*
1474 - *depth* is a real value from segment [0,1]
1475 - *width* is a real value from segment [0,1]
1477 @subsubsection occt_draw_4_2_16 vnbselected
1483 Returns the number of selected objects in the interactive context.
1485 @subsubsection occt_draw_4_2_18 vpurgedisplay
1489 vpurgedisplay [CollectorToo = 0|1]
1491 Removes structures which do not belong to objects displayed in neutral point.
1493 @subsubsection occt_draw_4_2_19 vhlr
1497 vhlr is_enabled={on|off} [show_hidden={1|0}]
1499 Hidden line removal algorithm:
1500 * <i>is_enabled</i> applies HLR algorithm.
1501 * <i>show_hidden</i> if equals to 1, hidden lines are drawn as dotted ones.
1503 @subsubsection occt_draw_4_2_20 vhlrtype
1507 vhlrtype algo_type={algo|polyalgo} [shape_1 ... shape_n]
1510 Changes the type of HLR algorithm used for shapes.
1511 If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes.
1513 If no shape is specified through the command arguments, the given HLR algorithm_type is applied to all *AIS_Shape* isntances in the current context, and the command also changes the default HLR algorithm type.
1515 **Note** that this command works with instances of *AIS_Shape* or derived classes only, other interactive object types are ignored.
1517 @subsubsection occt_draw_4_2_21 vcamera
1521 vcamera [-ortho] [-projtype]
1523 [-fovy [Angle]] [-distance [Distance]]
1524 [-stereo] [-leftEye] [-rightEye]
1525 [-iod [Distance]] [-iodType [absolute|relative]]
1526 [-zfocus [Value]] [-zfocusType [absolute|relative]]
1529 Manages camera parameters.
1530 Prints the current value when the option is called without argument.
1532 Orthographic camera:
1533 * -ortho -- activates orthographic projection.
1536 * -persp -- activated perspective projection (mono);
1537 * -fovy -- field of view in y axis, in degrees;
1538 * -distance -- distance of eye from the camera center.
1540 Stereoscopic camera:
1541 * -stereo -- perspective projection (stereo);
1542 * -leftEye -- perspective projection (left eye);
1543 * -rightEye -- perspective projection (right eye);
1544 * -iod -- intraocular distance value;
1545 * -iodType -- distance type, absolute or relative;
1546 * -zfocus -- stereographic focus value;
1547 * -zfocusType -- focus type, absolute or relative.
1558 @subsubsection occt_draw_4_2_22 vstereo
1562 vstereo [0|1] [-mode Mode] [-reverse {0|1}] [-anaglyph Filter]
1565 Defines the stereo output mode. The following modes are available:
1566 * quadBuffer -- OpenGL QuadBuffer stereo, requires driver support. Should be called BEFORE *vinit*!
1567 * anaglyph -- Anaglyph glasses;
1568 * rowInterlaced -- row-interlaced display;
1569 * columnInterlaced -- column-interlaced display;
1570 * chessBoard -- chess-board output;
1571 * sideBySide -- horizontal pair;
1572 * overUnder -- vertical pair;
1573 Available Anaglyph filters for -anaglyph:
1574 * redCyan, redCyanSimple, yellowBlue, yellowBlueSimple, greenMagentaSimple.
1583 vcamera -stereo -iod 1
1588 @subsubsection occt_draw_4_2_23 vfrustumculling
1592 vfrustumculling [toEnable]
1595 Enables/disables objects clipping.
1598 @subsection occt_draw_4_3 AIS viewer -- display commands
1600 @subsubsection occt_draw_4_3_1 vdisplay
1604 vdisplay [-noupdate|-update] [-local] [-mutable] [-neutral]
1605 [-trsfPers {pan|zoom|rotate|trihedron|full|none}=none] [-trsfPersPos X Y [Z]] [-3d|-2d|-2dTopDown]
1606 [-dispMode mode] [-highMode mode]
1607 [-layer index] [-top|-topmost|-overlay|-underlay]
1609 name1 [name2] ... [name n]
1612 Displays named objects.
1613 Option <i>-local</i> enables display of objects in the local selection context.
1614 Local selection context will be opened if there is not any.
1616 * *noupdate* suppresses viewer redraw call.
1617 * *mutable* enables optimization for mutable objects.
1618 * *neutral* draws objects in the main viewer.
1619 * *layer* sets z-layer for objects. It can use <i>-overlay|-underlay|-top|-topmost</i> instead of <i>-layer index</i> for the default z-layers.
1620 * *top* draws objects on top of main presentations but below the topmost level.
1621 * *topmost* draws in overlay for 3D presentations with independent Depth.
1622 * *overlay* draws objects in overlay for 2D presentations (On-Screen-Display).
1623 * *underlay* draws objects in underlay for 2D presentations (On-Screen-Display).
1624 * *selectable|-noselect* controls selection of objects.
1625 * *trsfPers* sets transform persistence flags. Flag *full* allows to pan, zoom and rotate.
1626 * *trsfPersPos* sets an anchor point for transform persistence.
1627 * *2d|-2dTopDown* displays object in screen coordinates.
1628 * *dispmode* sets display mode for objects.
1629 * *highmode* sets highlight mode for objects.
1630 * *redisplay* recomputes presentation of objects.
1635 box b 40 40 40 10 10 10
1641 @subsubsection occt_draw_4_3_2 vdonly
1645 vdonly [-noupdate|-update] [name1] ... [name n]
1648 Displays only selected or named objects. If there are no selected or named objects, nothing is done.
1653 box b 40 40 40 10 10 10
1659 @subsubsection occt_draw_4_3_3 vdisplayall
1663 vdisplayall [-local]
1666 Displays all erased interactive objects (see vdir and vstate).
1667 Option <i>-local</i> enables displaying objects in the local selection context.
1672 box b 40 40 40 10 10 10
1678 @subsubsection occt_draw_4_3_4 verase
1682 verase [name1] [name2] … [name n]
1685 Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
1690 box b1 40 40 40 10 10 10
1691 box b2 -40 -40 -40 10 10 10
1695 # erase only first box
1697 # erase second box and sphere
1701 @subsubsection occt_draw_4_3_5 veraseall
1708 Erases all objects displayed in the viewer.
1713 box b1 40 40 40 10 10 10
1714 box b2 -40 -40 -40 10 10 10
1718 # erase only first box
1720 # erase second box and sphere
1724 @subsubsection occt_draw_4_3_6 vsetdispmode
1728 vsetdispmode [name] mode(0,1,2,3)
1731 Sets display mode for all, selected or named objects.
1732 * *0* (*WireFrame*),
1734 * *2* (*Quick HideLineremoval*),
1735 * *3* (*Exact HideLineremoval*).
1746 @subsubsection occt_draw_4_3_7 vdisplaytype
1753 Displays all objects of a given type.
1754 The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
1756 @subsubsection occt_draw_4_3_8 verasetype
1763 Erases all objects of a given type.
1764 Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
1766 @subsubsection occt_draw_4_3_9 vtypes
1773 Makes a list of known types and signatures in AIS.
1775 @subsubsection occt_draw_4_3_10 vaspects
1779 vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]
1780 [-setVisibility 0|1]
1781 [-setColor ColorName] [-setcolor R G B] [-unsetColor]
1782 [-setMaterial MatName] [-unsetMaterial]
1783 [-setTransparency Transp] [-unsetTransparency]
1784 [-setWidth LineWidth] [-unsetWidth]
1785 [-setLineType {solid|dash|dot|dotDash}] [-unsetLineType]
1786 [-freeBoundary {off/on | 0/1}]
1787 [-setFreeBoundaryWidth Width] [-unsetFreeBoundaryWidth]
1788 [-setFreeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]
1789 [-subshapes subname1 [subname2 [...]]]
1790 [-isoontriangulation 0|1]
1791 [-setMaxParamValue {value}]
1795 Manages presentation properties of all, selected or named objects.
1796 * *-subshapes* -- assigns presentation properties to the specified sub-shapes.
1797 * *-defaults* -- assigns presentation properties to all objects that do not have their own specified properties and to all objects to be displayed in the future.
1798 If *-defaults* option is used there should not be any names of objects and *-subshapes* specifier.
1802 vsetcolor [-noupdate|-update] [name] ColorName
1807 Manages presentation properties (color, material, transparency) of all objects, selected or named.
1809 **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*.
1811 vaspects [name] [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]
1812 vsetcolor [name] ColorName
1816 **Transparency. The *Transp* may be between 0.0 (opaque) and 1.0 (fully transparent).
1817 **Warning**: at 1.0 the shape becomes invisible.
1819 vaspects [name] [-settransparency Transp] [-unsettransparency]
1820 vsettransparency [name] Transp
1821 vunsettransparency [name]
1824 **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*.
1826 vaspects [name] [-setmaterial MatName] [-unsetmaterial]
1827 vsetmaterial [name] MatName
1828 vunsetmaterial [name]
1831 **Line width**. Specifies width of the edges. The *LineWidth* may be between 0.0 and 10.0.
1833 vaspects [name] [-setwidth LineWidth] [-unsetwidth]
1834 vsetwidth [name] LineWidth
1846 vaspects -setcolor red -settransparency 0.2
1855 @subsubsection occt_draw_4_3_11 vsetshading
1859 vsetshading shapename [coefficient]
1862 Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
1874 @subsubsection occt_draw_4_3_12 vunsetshading
1878 vunsetshading [shapename]
1881 Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode.
1883 @subsubsection occt_draw_4_3_13 vsetam
1887 vsetam [shapename] mode
1890 Activates selection mode for all selected or named shapes:
1891 * *0* for *shape* itself,
1898 * *7* (*compounds*).
1909 @subsubsection occt_draw_4_3_14 vunsetam
1916 Deactivates all selection modes for all shapes.
1918 @subsubsection occt_draw_4_3_15 vdump
1922 vdump <filename>.{png|bmp|jpg|gif} [-width Width -height Height]
1923 [-buffer rgb|rgba|depth=rgb]
1924 [-stereo mono|left|right|blend|sideBySide|overUnder=mono]
1928 Extracts the contents of the viewer window to a image file.
1930 @subsubsection occt_draw_4_3_16 vdir
1937 Displays the list of displayed objects.
1939 @subsubsection occt_draw_4_3_17 vsub
1943 vsub 0/1(on/off)[shapename]
1946 Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
1959 @subsubsection occt_draw_4_3_20 vsensdis
1966 Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes).
1968 Standard entity types are those defined in Select3D package:
1975 * sensitive triangulation
1976 * sensitive triangle
1977 Custom (application-defined) sensitive entity types are not processed by this command.
1979 @subsubsection occt_draw_4_3_21 vsensera
1986 Erases active entities.
1988 @subsubsection occt_draw_4_3_23 vr
1995 Reads shape from BREP-format file and displays it in the viewer.
2003 @subsubsection occt_draw_4_3_24 vstate
2007 vstate [-entities] [-hasSelected] [name1] ... [nameN]
2010 Reports show/hidden state for selected or named objects:
2011 * *entities* -- prints low-level information about detected entities;
2012 * *hasSelected* -- prints 1 if the context has a selected shape and 0 otherwise.
2014 @subsubsection occt_draw_4_3_25 vraytrace
2021 Turns on/off ray tracing renderer.
2023 @subsubsection occt_draw_4_3_26 vrenderparams
2027 vrenderparams [-rayTrace|-raster] [-rayDepth 0..10] [-shadows {on|off}]
2028 [-reflections {on|off}] [-fsaa {on|off}] [-gleam {on|off}]
2029 [-gi {on|off}] [-brng {on|off}] [-env {on|off}]
2030 [-shadin {color|flat|gouraud|phong}]
2033 Manages rendering parameters:
2034 * rayTrace -- Enables GPU ray-tracing
2035 * raster -- Disables GPU ray-tracing
2036 * rayDepth -- Defines maximum ray-tracing depth
2037 * shadows -- Enables/disables shadows rendering
2038 * reflections -- Enables/disables specular reflections
2039 * fsaa -- Enables/disables adaptive anti-aliasing
2040 * gleam -- Enables/disables transparency shadow effects
2041 * gi -- Enables/disables global illumination effects
2042 * brng -- Enables/disables blocked RNG (fast coherent PT)
2043 * env -- Enables/disables environment map background
2044 * shadingModel -- Controls shading model from enumeration color, flat, gouraud, phong
2046 Unlike *vcaps*, these parameters dramatically change visual properties.
2047 The command is intended to control presentation quality depending on hardware capabilities and performance.
2056 vrenderparams -shadows 1 -reflections 1 -fsaa 1
2058 @subsubsection occt_draw_4_3_27 vshaderprog
2062 'vshaderprog [name] pathToVertexShader pathToFragmentShader'
2063 or 'vshaderprog [name] off' to disable GLSL program
2064 or 'vshaderprog [name] phong' to enable per-pixel lighting calculations
2067 Enables rendering using a shader program.
2069 @subsubsection occt_draw_4_3_28 vsetcolorbg
2076 Sets background color.
2081 vsetcolorbg 200 0 200
2084 @subsection occt_draw_4_4 AIS viewer -- object commands
2086 @subsubsection occt_draw_4_4_1 vtrihedron
2090 vtrihedron name [-dispMode {wf|sh|wireframe|shading}]
2092 [-zaxis u v w -xaxis u v w ]
2093 [-drawaxes {X|Y|Z|XY|YZ|XZ|XYZ}]
2094 [-hidelabels {on|off}]"
2095 [-label {XAxis|YAxis|ZAxis} value]"
2096 [-attribute {XAxisLength|YAxisLength|ZAxisLength
2097 |TubeRadiusPercent|ConeRadiusPercent"
2098 |ConeLengthPercent|OriginRadiusPercent"
2099 |ShadingNumberOfFacettes} value]"
2100 [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis"
2101 |XOZAxis|Whole} {r g b | colorName}]"
2102 [-textcolor {r g b | colorName}]"
2103 [-arrowscolor {r g b | colorName}]"
2104 [-priority {Origin|XAxis|YAxis|ZAxis|XArrow"
2105 |YArrow|ZArrow|XOYAxis|YOZAxis"
2106 |XOZAxis|Whole} value]
2110 Creates a new *AIS_Trihedron* object or changes existing trihedron. If no argument is set, the default trihedron (0XYZ) is created.
2117 vtrihedron t2 -dispmode shading -origin -200 -200 -300
2118 vtrihedron t2 -color XAxis Quantity_NOC_RED
2119 vtrihedron t2 -color YAxis Quantity_NOC_GREEN
2120 vtrihedron t2 -color ZAxis|Origin Quantity_NOC_BLUE1
2123 @subsubsection occt_draw_4_4_2 vplanetri
2130 Creates a plane from a trihedron selection. If no arguments are set, the default plane is created.
2133 @subsubsection occt_draw_4_4_3 vsize
2140 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.
2146 vtrihedron tr2 0 0 0 1 0 0 1 0 0
2150 @subsubsection occt_draw_4_4_4 vaxis
2154 vaxis name [Xa Ya Za Xb Yb Zb]
2157 Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
2163 vaxis axe1 0 0 0 1 0 0
2166 @subsubsection occt_draw_4_4_5 vaxispara
2173 Creates an axis by interactive selection of an edge and a vertex.
2175 @subsubsection occt_draw_4_4_6 vaxisortho
2182 Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
2184 @subsubsection occt_draw_4_4_7 vpoint
2188 vpoint name [Xa Ya Za]
2191 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).
2199 @subsubsection occt_draw_4_4_8 vplane
2203 vplane name [AxisName] [PointName]
2204 vplane name [PointName] [PointName] [PointName]
2205 vplane name [PlaneName] [PointName]
2208 Creates a plane from named or interactively selected entities.
2217 vaxis axe1 0 0 0 0 0 1
2219 vplane plane1 axe1 p1
2222 @subsubsection occt_draw_4_4_9 vplanepara
2229 Creates a plane from interactively selected vertex and face.
2231 @subsubsection occt_draw_4_4_10 vplaneortho
2238 Creates a plane from interactive selected face and coplanar edge.
2240 @subsubsection occt_draw_4_4_11 vline
2244 vline name [PointName] [PointName]
2245 vline name [Xa Ya Za Xb Yb Zb]
2248 Creates a line from coordinates, named or interactively selected vertices.
2257 vline line2 0 0 0 50 0 1
2260 @subsubsection occt_draw_4_4_12 vcircle
2264 vcircle name [PointName PointName PointName IsFilled]
2265 vcircle name [PlaneName PointName Radius IsFilled]
2268 Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
2277 vcircle circle1 p1 p2 p3 1
2280 @subsubsection occt_draw_4_4_13 vtri2d
2287 Creates a plane with a 2D trihedron from an interactively selected face.
2289 @subsubsection occt_draw_4_4_14 vselmode
2293 vselmode [object] mode_number is_turned_on=(1|0)
2296 Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
2297 *Mode_number* is a non-negative integer encoding different interactive object classes.
2298 For shapes the following *mode_number* values are allowed:
2309 * 1 if mode is to be switched on
2310 * 0 if mode is to be switched off
2318 vtriangle triangle1 p1 p2 p3
2321 @subsubsection occt_draw_4_4_15 vconnect
2325 vconnect vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
2328 Creates *AIS_ConnectedInteractive* object from the input object and location and displays it.
2335 vsegment segment p1 p2
2336 restore CrankArm.brep obj
2338 vconnect new obj 100100100 1 0 0 0 0 1
2341 @subsubsection occt_draw_4_4_16 vtriangle
2345 vtriangle name PointName PointName PointName
2348 Creates and displays a filled triangle from named points.
2356 vtriangle triangle1 p1 p2 p3
2359 @subsubsection occt_draw_4_4_17 vsegment
2363 vsegment name PointName PointName
2366 Creates and displays a segment from named points.
2373 vsegment segment p1 p2
2376 @subsubsection occt_draw_4_4_18 vpointcloud
2380 vpointcloud name shape [-randColor] [-normals] [-noNormals]
2383 Creates an interactive object for an arbitrary set of points from the triangulated shape.
2385 * *randColor* -- generates a random color per point;
2386 * *normals* -- generates a normal per point (default);
2387 * *noNormals* -- does not generate a normal per point.
2390 vpointcloud name x y z r npts {surface|volume} [-randColor] [-normals] [-noNormals]
2392 Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r).
2394 * *randColor* -- generates a random color per point;
2395 * *normals* -- generates a normal per point (default);
2396 * *noNormals* -- does not generate a normal per point.
2401 vpointcloud pc 0 0 0 100 100000 surface -randColor
2405 @subsubsection occt_draw_4_4_19 vclipplane
2409 vclipplane maxplanes <view_name> -- gets plane limit for the view.
2410 vclipplane create <plane_name> -- creates a new plane.
2411 vclipplane delete <plane_name> -- deletes a plane.
2412 vclipplane clone <source_plane> <plane_name> -- clones the plane definition.
2413 vclipplane set/unset <plane_name> object <object list> -- sets/unsets the plane for an IO.
2414 vclipplane set/unset <plane_name> view <view list> -- sets/unsets plane for a view.
2415 vclipplane change <plane_name> on/off -- turns clipping on/off.
2416 vclipplane change <plane_name> equation <a> <b> <c> <d> -- changes plane equation.
2417 vclipplane change <plane_name> capping on/off -- turns capping on/off.
2418 vclipplane change <plane_name> capping color <r> <g> <b> -- sets color.
2419 vclipplane change <plane name> capping texname <texture> -- sets texture.
2420 vclipplane change <plane_name> capping texscale <sx> <sy> -- sets texture scale.
2421 vclipplane change <plane_name> capping texorigin <tx> <ty> -- sets texture origin.
2422 vclipplane change <plane_name> capping texrotate <angle> -- sets texture rotation.
2423 vclipplane change <plane_name> capping hatch on/off/<id> -- sets hatching mask.
2426 Manages clipping planes
2431 vclipplane create pln1
2432 vclipplane change pln1 equation 1 0 0 -0.1
2433 vclipplane set pln1 view Driver1/Viewer1/View1
2442 @subsubsection occt_draw_4_4_20 vdimension
2446 vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]
2447 [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2448 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2449 [-arrow external|internal|fit] [{-arrowlength|-arlen} RealArrowLength]
2450 [{-arrowangle|-arangle} ArrowAngle(degrees)] [-plane xoy|yoz|zox]
2451 [-flyout FloatValue -extension FloatValue]
2452 [-autovalue] [-value CustomRealValue] [-textvalue CustomTextValue]
2453 [-dispunits DisplayUnitsString]
2454 [-modelunits ModelUnitsString] [-showunits | -hideunits]
2457 Builds angle, length, radius or diameter dimension interactive object **name**.
2459 **Attension:** length dimension can't be built without working plane.
2466 vdimension dim1 -length -plane xoy -shapes p1 p2
2469 vdimension dim2 -angle -shapes p1 p2 p3
2471 vcircle circle p1 p2 p3 0
2472 vdimension dim3 -radius -shapes circle
2476 @subsubsection occt_draw_4_4_21 vdimparam
2480 vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2481 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2482 [-arrow external|internal|fit]
2483 [{-arrowlength|-arlen} RealArrowLength]
2484 [{-arrowangle|-arangle} ArrowAngle(degrees)]
2485 [-plane xoy|yoz|zox]
2486 [-flyout FloatValue -extension FloatValue]
2488 [-value CustomRealValue]
2489 [-textvalue CustomTextValue]
2490 [-dispunits DisplayUnitsString]
2491 [-modelunits ModelUnitsString]
2492 [-showunits | -hideunits]
2495 Sets parameters for angle, length, radius and diameter dimension **name**.
2502 vdimension dim1 -length -plane xoy -shapes p1 p2
2503 vdimparam dim1 -flyout -15 -arrowlength 4 -showunits -value 10
2505 vdimparam dim1 -textvalue "w_1"
2506 vdimparam dim1 -autovalue
2509 @subsubsection occt_draw_4_4_22 vangleparam
2513 vangleparam name [-type interior|exterior]
2514 [-showarrow first|second|both|none]
2517 Sets parameters for angle dimension **name**.
2525 vdimension dim1 -angle -plane xoy -shapes p1 p2 p3
2527 vangleparam dim1 -type exterior -showarrow first
2530 @subsubsection occt_draw_4_4_23 vlengthparam
2534 vlengthparam name [-type interior|exterior]
2535 [-showarrow first|second|both|none]
2538 Sets parameters for length dimension **name**.
2545 vdimension dim1 -length -plane xoy -shapes p1 p2
2549 vlengthparam dim1 -direction ox
2552 @subsubsection occt_draw_4_4_24 vmovedim
2556 vmovedim [name] [x y z]
2559 Moves picked or named (if **name** parameter is defined) dimension
2560 to picked mouse position or input point with coordinates **x**,**y**,**z**.
2561 Text label of dimension **name** is moved to position, another parts of dimension
2569 vdimension dim1 -length -plane xoy -shapes p1 p2
2570 vmovedim dim1 -10 30 0
2574 @subsection occt_draw_4_5 AIS viewer -- Mesh Visualization Service
2576 **MeshVS** (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
2578 @subsubsection occt_draw_4_5_1 meshfromstl
2582 meshfromstl meshname file
2585 Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately.
2589 meshfromstl mesh myfile.stl
2592 @subsubsection occt_draw_4_5_2 meshdispmode
2596 meshdispmode meshname displaymode
2599 Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
2600 * *1* for *wireframe*,
2601 * *2* for *shading* mode, or
2602 * *3* for *shrink* mode.
2607 meshfromstl mesh myfile.stl
2611 @subsubsection occt_draw_4_5_3 meshselmode
2615 meshselmode meshname selectionmode
2618 Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
2619 * *1* -- node selection;
2620 * *2* -- 0D elements (not supported in STL);
2621 * *4* -- links (not supported in STL);
2627 meshfromstl mesh myfile.stl
2631 @subsubsection occt_draw_4_5_4 meshshadcolor
2635 meshshadcolor meshname red green blue
2638 Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2643 meshfromstl mesh myfile.stl
2644 meshshadcolormode mesh 0.5 0.5 0.5
2647 @subsubsection occt_draw_4_5_5 meshlinkcolor
2651 meshlinkcolor meshname red green blue
2654 Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2659 meshfromstl mesh myfile.stl
2660 meshlinkcolormode mesh 0.5 0.5 0.5
2663 @subsubsection occt_draw_4_5_6 meshmat
2667 meshmat meshname material
2670 Changes the material of object **meshname**.
2672 *material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
2683 * *10 -- SHINY_PLASTIC,*
2685 * *12 -- METALIZED,*
2688 * *15 -- ALUMINIUM,*
2693 * *20 -- UserDefined*
2698 meshfromstl mesh myfile.stl
2702 @subsubsection occt_draw_4_5_7 meshshrcoef
2706 meshshrcoef meshname shrinkcoefficient
2709 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.
2714 meshfromstl mesh myfile.stl
2715 meshshrcoef mesh 0.05
2718 @subsubsection occt_draw_4_5_8 meshshow
2725 Displays **meshname** in the viewer (if it is erased).
2730 meshfromstl mesh myfile.stl
2734 @subsubsection occt_draw_4_5_9 meshhide
2741 Hides **meshname** in the viewer.
2746 meshfromstl mesh myfile.stl
2750 @subsubsection occt_draw_4_5_10 meshhidesel
2754 meshhidesel meshname
2757 Hides only selected entities. The other part of **meshname** remains visible.
2759 @subsubsection occt_draw_4_5_11 meshshowsel
2763 meshshowsel meshname
2766 Shows only selected entities. The other part of **meshname** becomes invisible.
2768 @subsubsection occt_draw_4_5_12 meshshowall
2772 meshshowall meshname
2775 Changes the state of all entities to visible for **meshname**.
2777 @subsubsection occt_draw_4_5_13 meshdelete
2784 Deletes MeshVS_Mesh object **meshname**.
2789 meshfromstl mesh myfile.stl
2793 @subsection occt_draw_4_6 VIS Viewer commands
2795 A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness:
2801 @subsubsection occt_draw_4_6_1 ivtkinit
2808 Creates a window for VTK viewer.
2810 @figure{/user_guides/draw_test_harness/images/draw_image001.png,"",225}
2812 @subsubsection occt_draw_4_6_2 ivtkdisplay
2816 ivtkdisplay name1 [name2] …[name n]
2819 Displays named objects.
2829 @figure{/user_guides/draw_test_harness/images/draw_image002.png,"",261}
2832 @subsubsection occt_draw_4_6_3 ivtkerase
2836 ivtkerase [name1] [name2] … [name n]
2839 Erases named objects. If no arguments are passed, erases all displayed objects.
2852 # erase only the cylinder
2854 # erase the sphere and the cone
2858 @subsubsection occt_draw_4_6_4 ivtkfit
2865 Automatic zoom/panning.
2867 @subsubsection occt_draw_4_6_5 ivtkdispmode
2871 ivtksetdispmode [name] {0|1}
2874 Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects
2875 The possible modes are: 0 (WireFrame) and 1 (Shading).
2884 # set shading mode for the cone
2888 @figure{/user_guides/draw_test_harness/images/draw_image003.png,"",262}
2890 @subsubsection occt_draw_4_6_6 ivtksetselmode
2894 ivtksetselmode [name] mode {0|1}
2897 Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects.
2902 # load a shape from file
2903 restore CrankArm.brep a
2904 # display the loaded shape
2906 # set the face selection mode
2907 ivtksetselmode a 4 1
2910 @figure{/user_guides/draw_test_harness/images/draw_image004.png,"",291}
2912 @subsubsection occt_draw_4_6_7 ivtkmoveto
2919 Imitates mouse cursor moving to point with the given display coordinates **x**,**y**.
2929 @subsubsection occt_draw_4_6_8 ivtkselect
2936 Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
2946 @subsubsection occt_draw_4_6_9 ivtkdump
2950 ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}]
2953 Dumps the contents of VTK viewer to image. It supports:
2954 * dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM.
2955 * dumping of different buffers: RGB, RGBA or depth buffer.
2956 * defining of image sizes (width and height in pixels).
2957 * dumping of stereo projections (left or right).
2964 ivtkdump D:/ConeSnapshot.png rgb 768 768
2967 @subsubsection occt_draw_4_6_10 ivtkbgcolor
2972 ivtkbgcolor r g b [r2 g2 b2]
2975 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].
2980 ivtkbgcolor 200 220 250
2983 @figure{/user_guides/draw_test_harness/images/draw_image005.png,"",196}
2986 ivtkbgcolor 10 30 80 255 255 255
2989 @figure{/user_guides/draw_test_harness/images/draw_image006.png,"",190}
2991 @section occt_draw_5 OCAF commands
2993 This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
2996 @subsection occt_draw_5_1 Application commands
2999 @subsubsection occt_draw_5_1_1 NewDocument
3003 NewDocument docname [format]
3006 Creates a new **docname** document with MDTV-Standard or described format.
3010 # Create new document with default (MDTV-Standard) format
3013 # Create new document with BinOcaf format
3014 NewDocument D2 BinOcaf
3017 @subsubsection occt_draw_5_1_2 IsInSession
3024 Returns *0*, if **path** document is managed by the application session, *1* -- otherwise.
3028 IsInSession /myPath/myFile.std
3031 @subsubsection occt_draw_5_1_3 ListDocuments
3038 Makes a list of documents handled during the session of the application.
3041 @subsubsection occt_draw_5_1_4 Open
3045 Open path docname [-stream]
3048 Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session.
3050 option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
3054 Open /myPath/myFile.std D
3057 @subsubsection occt_draw_5_1_5 Close
3064 Closes **docname** document. The document is no longer handled by the applicative session.
3071 @subsubsection occt_draw_5_1_6 Save
3078 Saves **docname** active document.
3085 @subsubsection occt_draw_5_1_7 SaveAs
3089 SaveAs docname path [-stream]
3092 Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists.
3094 option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
3098 SaveAs D /myPath/myFile.std
3101 @subsection occt_draw_5_2 Basic commands
3103 @subsubsection occt_draw_5_2_1 Label
3111 Creates the label expressed by <i>\<entry\></i> if it does not exist.
3118 @subsubsection occt_draw_5_2_2 NewChild
3123 NewChild docname [taggerlabel = Root label]
3125 Finds (or creates) a *TagSource* attribute located at father label of <i>\<taggerlabel\></i> and makes a new child label.
3129 # Create new child of root label
3132 # Create new child of existing label
3137 @subsubsection occt_draw_5_2_3 Children
3141 Children docname label
3143 Returns the list of attributes of label.
3150 @subsubsection occt_draw_5_2_4 ForgetAll
3154 ForgetAll docname label
3156 Forgets all attributes of the label.
3164 @subsubsection occt_draw_5_3 Application commands
3166 @subsubsection occt_draw_5_3_1 Main
3173 Returns the main label of the framework.
3180 @subsubsection occt_draw_5_3_2 UndoLimit
3184 UndoLimit docname [value=0]
3188 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
3195 @subsubsection occt_draw_5_3_3 Undo
3199 Undo docname [value=1]
3202 Undoes **value** steps.
3209 @subsubsection occt_draw_5_3_4 Redo
3213 Redo docname [value=1]
3216 Redoes **value** steps.
3223 @subsubsection occt_draw_5_3_5 OpenCommand
3230 Opens a new command transaction.
3237 @subsubsection occt_draw_5_3_6 CommitCommand
3241 CommitCommand docname
3244 Commits the Command transaction.
3251 @subsubsection occt_draw_5_3_7 NewCommand
3258 This is a shortcut for Commit and Open transaction.
3265 @subsubsection occt_draw_5_3_8 AbortCommand
3269 AbortCommand docname
3272 Aborts the Command transaction.
3279 @subsubsection occt_draw_5_3_9 Copy
3283 Copy docname entry Xdocname Xentry
3286 Copies the contents of *entry* to *Xentry*. No links are registered.
3293 @subsubsection occt_draw_5_3_10 UpdateLink
3297 UpdateLink docname [entry]
3300 Updates external reference set at *entry*.
3307 @subsubsection occt_draw_5_3_11 CopyWithLink
3311 CopyWithLink docname entry Xdocname Xentry
3314 Aborts the Command transaction.
3315 Copies the content of *entry* to *Xentry*. The link is registered with an *Xlink* attribute at *Xentry* label.
3319 CopyWithLink D1 0:2 D2 0:4
3322 @subsubsection occt_draw_5_3_12 UpdateXLinks
3326 UpdateXLinks docname entry
3329 Sets modifications on labels impacted by external references to the *entry*. The *document* becomes invalid and must be recomputed
3336 @subsubsection occt_draw_5_3_13 DumpDocument
3340 DumpDocument docname
3343 Displays parameters of *docname* document.
3351 @subsection occt_draw_5_4 Data Framework commands
3354 @subsubsection occt_draw_5_4_1 MakeDF
3361 Creates a new data framework.
3368 @subsubsection occt_draw_5_4_2 ClearDF
3375 Clears a data framework.
3382 @subsubsection occt_draw_5_4_3 CopyDF
3386 CopyDF dfname1 entry1 [dfname2] entry2
3389 Copies a data framework.
3396 @subsubsection occt_draw_5_4_4 CopyLabel
3400 CopyLabel dfname fromlabel tolablel
3407 CopyLabel D1 0:2 0:4
3410 @subsubsection occt_draw_5_4_5 MiniDumpDF
3417 Makes a mini-dump of a data framework.
3424 @subsubsection occt_draw_5_4_6 XDumpDF
3431 Makes an extended dump of a data framework.
3438 @subsection occt_draw_5_5 General attributes commands
3441 @subsubsection occt_draw_5_5_1 SetInteger
3445 SetInteger dfname entry value
3448 Finds or creates an Integer attribute at *entry* label and sets *value*.
3452 SetInteger D 0:2 100
3455 @subsubsection occt_draw_5_5_2 GetInteger
3459 GetInteger dfname entry [drawname]
3462 Gets a value of an Integer attribute at *entry* label and sets it to *drawname* variable, if it is defined.
3466 GetInteger D 0:2 Int1
3469 @subsubsection occt_draw_5_5_3 SetReal
3473 SetReal dfname entry value
3476 Finds or creates a Real attribute at *entry* label and sets *value*.
3483 @subsubsection occt_draw_5_5_4 GetReal
3487 GetReal dfname entry [drawname]
3490 Gets a value of a Real attribute at *entry* label and sets it to *drawname* variable, if it is defined.
3497 @subsubsection occt_draw_5_5_5 SetIntArray
3501 SetIntArray dfname entry lower upper value1 value2 …
3504 Finds or creates an IntegerArray attribute at *entry* label with lower and upper bounds and sets **value1*, *value2*...
3508 SetIntArray D 0:2 1 4 100 200 300 400
3511 @subsubsection occt_draw_5_5_6 GetIntArray
3515 GetIntArray dfname entry
3518 Gets a value of an *IntegerArray* attribute at *entry* label.
3525 @subsubsection occt_draw_5_5_7 SetRealArray
3529 SetRealArray dfname entry lower upper value1 value2 …
3532 Finds or creates a RealArray attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
3536 GetRealArray D 0:2 1 4 100. 200. 300. 400.
3539 @subsubsection occt_draw_5_5_8 GetRealArray
3543 GetRealArray dfname entry
3546 Gets a value of a RealArray attribute at *entry* label.
3553 @subsubsection occt_draw_5_5_9 SetComment
3557 SetComment dfname entry value
3560 Finds or creates a Comment attribute at *entry* label and sets *value*.
3564 SetComment D 0:2 "My comment"
3567 @subsubsection occt_draw_5_5_10 GetComment
3571 GetComment dfname entry
3574 Gets a value of a Comment attribute at *entry* label.
3581 @subsubsection occt_draw_5_5_11 SetExtStringArray
3585 SetExtStringArray dfname entry lower upper value1 value2 …
3588 Finds or creates an *ExtStringArray* attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
3592 SetExtStringArray D 0:2 1 3 *string1* *string2* *string3*
3595 @subsubsection occt_draw_5_5_12 GetExtStringArray
3599 GetExtStringArray dfname entry
3602 Gets a value of an ExtStringArray attribute at *entry* label.
3606 GetExtStringArray D 0:2
3609 @subsubsection occt_draw_5_5_13 SetName
3613 SetName dfname entry value
3616 Finds or creates a Name attribute at *entry* label and sets *value*.
3620 SetName D 0:2 *My name*
3623 @subsubsection occt_draw_5_5_14 GetName
3627 GetName dfname entry
3630 Gets a value of a Name attribute at *entry* label.
3637 @subsubsection occt_draw_5_5_15 SetReference
3641 SetReference dfname entry reference
3644 Creates a Reference attribute at *entry* label and sets *reference*.
3648 SetReference D 0:2 0:4
3651 @subsubsection occt_draw_5_5_16 GetReference
3655 GetReference dfname entry
3658 Gets a value of a Reference attribute at *entry* label.
3665 @subsubsection occt_draw_5_5_17 SetUAttribute
3669 SetUAttribute dfname entry localGUID
3672 Creates a UAttribute attribute at *entry* label with *localGUID*.
3676 set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
3677 SetUAttribute D 0:2 ${localGUID}
3680 @subsubsection occt_draw_5_5_18 GetUAttribute
3684 GetUAttribute dfname entry loacalGUID
3687 Finds a *UAttribute* at *entry* label with *localGUID*.
3691 set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
3692 GetUAttribute D 0:2 ${localGUID}
3695 @subsubsection occt_draw_5_5_19 SetFunction
3699 SetFunction dfname entry ID failure
3702 Finds or creates a *Function* attribute at *entry* label with driver ID and *failure* index.
3706 set ID "c73bd076-22ee-11d2-acde-080009dc4422"
3707 SetFunction D 0:2 ${ID} 1
3710 @subsubsection occt_draw_5_5_20 GetFunction
3714 GetFunction dfname entry ID failure
3717 Finds a Function attribute at *entry* label and sets driver ID to *ID* variable and failure index to *failure* variable.
3721 GetFunction D 0:2 ID failure
3724 @subsubsection occt_draw_5_5_21 NewShape
3728 NewShape dfname entry [shape]
3731 Finds or creates a Shape attribute at *entry* label. Creates or updates the associated *NamedShape* attribute by *shape* if *shape* is defined.
3739 @subsubsection occt_draw_5_5_22 SetShape
3743 SetShape dfname entry shape
3746 Creates or updates a *NamedShape* attribute at *entry* label by *shape*.
3754 @subsubsection occt_draw_5_5_23 GetShape
3758 GetShape2 dfname entry shape
3761 Sets a shape from NamedShape attribute associated with *entry* label to *shape* draw variable.
3768 @subsection occt_draw_5_6 Geometric attributes commands
3771 @subsubsection occt_draw_5_6_1 SetPoint
3775 SetPoint dfname entry point
3778 Finds or creates a Point attribute at *entry* label and sets *point* as generated in the associated *NamedShape* attribute.
3786 @subsubsection occt_draw_5_6_2 GetPoint
3790 GetPoint dfname entry [drawname]
3793 Gets a vertex from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
3800 @subsubsection occt_draw_5_6_3 SetAxis
3804 SetAxis dfname entry axis
3807 Finds or creates an Axis attribute at *entry* label and sets *axis* as generated in the associated *NamedShape* attribute.
3811 line l 10 20 30 100 200 300
3815 @subsubsection occt_draw_5_6_4 GetAxis
3819 GetAxis dfname entry [drawname]
3822 Gets a line from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
3829 @subsubsection occt_draw_5_6_5 SetPlane
3833 SetPlane dfname entry plane
3836 Finds or creates a Plane attribute at *entry* label and sets *plane* as generated in the associated *NamedShape* attribute.
3840 plane pl 10 20 30 -1 0 0
3844 @subsubsection occt_draw_5_6_6 GetPlane
3848 GetPlane dfname entry [drawname]
3851 Gets a plane from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
3858 @subsubsection occt_draw_5_6_7 SetGeometry
3862 SetGeometry dfname entry [type] [shape]
3865 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*.
3870 SetGeometry D 0:2 pnt p
3873 @subsubsection occt_draw_5_6_8 GetGeometryType
3877 GetGeometryType dfname entry
3880 Gets a geometry type from Geometry attribute at *entry* label.
3884 GetGeometryType D 0:2
3887 @subsubsection occt_draw_5_6_9 SetConstraint
3891 SetConstraint dfname entry keyword geometrie [geometrie …]
3892 SetConstraint dfname entry "plane" geometrie
3893 SetConstraint dfname entry "value" value
3896 1. Creates a Constraint attribute at *entry* label and sets *keyword* constraint between geometry(ies).
3897 *keyword* must be one of the following:
3898 *rad, dia, minr, majr, tan, par, perp, concentric, equal, dist, angle, eqrad, symm, midp, eqdist, fix, rigid,* or *from, axis, mate, alignf, aligna, axesa, facesa, round, offset*
3899 2. Sets plane for the existing constraint.
3900 3. Sets value for the existing constraint.
3904 SetConstraint D 0:2 "value" 5
3907 @subsubsection occt_draw_5_6_10 GetConstraint
3911 GetConstraint dfname entry
3914 Dumps a Constraint attribute at *entry* label
3921 @subsubsection occt_draw_5_6_11 SetVariable
3925 SetVariable dfname entry isconstant(0/1) units
3928 Creates a Variable attribute at *entry* label and sets *isconstant* flag and *units* as a string.
3932 SetVariable D 0:2 1 "mm"
3935 @subsubsection occt_draw_5_6_12 GetVariable
3939 GetVariable dfname entry isconstant units
3942 Gets an *isconstant* flag and units of a Variable attribute at *entry* label.
3946 GetVariable D 0:2 isconstant units
3947 puts "IsConstant=${isconstant}"
3948 puts "Units=${units}"
3951 @subsection occt_draw_5_7 Tree attributes commands
3954 @subsubsection occt_draw_5_7_1 RootNode
3958 RootNode dfname treenodeentry [ID]
3961 Returns the ultimate father of *TreeNode* attribute identified by its *treenodeentry* and its *ID* (or default ID, if *ID* is not defined).
3964 @subsubsection occt_draw_5_7_2 SetNode
3968 SetNode dfname treenodeentry [ID]
3971 Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* (or assigns a default ID, if the *ID* is not defined).
3974 @subsubsection occt_draw_5_7_3 AppendNode
3978 AppendNode dfname fatherentry childentry [fatherID]
3982 Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as last child of *fatherentry*.
3987 @subsubsection occt_draw_5_7_4 PrependNode
3991 PrependNode dfname fatherentry childentry [fatherID]
3995 Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as first child of *fatherentry*.
3998 @subsubsection occt_draw_5_7_5 InsertNodeBefore
4002 InsertNodeBefore dfname treenodeentry beforetreenode [ID]
4005 Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *beforetreenode* before *treenodeentry*.
4008 @subsubsection occt_draw_5_7_6 InsertNodeAfter
4012 InsertNodeAfter dfname treenodeentry aftertreenode [ID]
4015 Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *aftertreenode* after *treenodeentry*.
4018 @subsubsection occt_draw_5_7_7 DetachNode
4022 DetachNode dfname treenodeentry [ID]
4025 Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) from *treenodeentry*.
4028 @subsubsection occt_draw_5_7_8 ChildNodeIterate
4032 ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID]
4036 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.
4052 AppendNode D 0:2 0:4
4053 AppendNode D 0:2 0:5
4054 PrependNode D 0:4 0:3
4055 PrependNode D 0:4 0:8
4056 PrependNode D 0:4 0:9
4058 InsertNodeBefore D 0:5 0:6
4059 InsertNodeAfter D 0:4 0:7
4065 ChildNodeIterate D 0:2 1
4075 # List only first levels
4076 ChildNodeIterate D 0:2 1
4084 @subsubsection occt_draw_5_7_9 InitChildNodeIterator
4088 InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID]
4092 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.
4096 InitChildNodeIterate D 0:5 1
4098 for {set i 1} {$i < 100} {incr i} {
4099 if {[ChildNodeMore] == *TRUE*} {
4100 puts *Tree node = [ChildNodeValue]*
4105 puts "aChildNumber=$aChildNumber"
4108 @subsubsection occt_draw_5_7_10 ChildNodeMore
4115 Returns TRUE if there is a current item in the iteration.
4118 @subsubsection occt_draw_5_7_11 ChildNodeNext
4125 Moves to the next Item.
4128 @subsubsection occt_draw_5_7_12 ChildNodeValue
4135 Returns the current treenode of *ChildNodeIterator*.
4138 @subsubsection occt_draw_5_7_13 ChildNodeNextBrother
4142 ChildNodeNextBrother
4145 Moves to the next *Brother*. If there is none, goes up. This method is interesting only with *allLevels* behavior.
4148 @subsection occt_draw_5_8 Standard presentation commands
4151 @subsubsection occt_draw_5_8_1 AISInitViewer
4155 AISInitViewer docname
4158 Creates and sets *AISViewer* attribute at root label, creates AIS viewer window.
4165 @subsubsection occt_draw_5_8_2 AISRepaint
4172 Updates the AIS viewer window.
4179 @subsubsection occt_draw_5_8_3 AISDisplay
4183 AISDisplay docname entry [not_update]
4186 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.
4193 @subsubsection occt_draw_5_8_4 AISUpdate
4197 AISUpdate docname entry
4200 Recomputes a presentation of *AISobject* from *entry* label and applies the visualization setting in AIS viewer.
4207 @subsubsection occt_draw_5_8_5 AISErase
4211 AISErase docname entry
4214 Erases *AISobject* of *entry* label in AIS viewer.
4221 @subsubsection occt_draw_5_8_6 AISRemove
4225 AISRemove docname entry
4228 Erases *AISobject* of *entry* label in AIS viewer, then *AISobject* is removed from *AIS_InteractiveContext*.
4235 @subsubsection occt_draw_5_8_7 AISSet
4239 AISSet docname entry ID
4242 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*).
4249 @subsubsection occt_draw_5_8_8 AISDriver
4253 AISDriver docname entry [ID]
4256 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*).
4264 @subsubsection occt_draw_5_8_9 AISUnset
4268 AISUnset docname entry
4271 Deletes *AISPresentation* attribute (if it exists) of an *entry* label.
4278 @subsubsection occt_draw_5_8_10 AISTransparency
4282 AISTransparency docname entry [transparency]
4285 Sets (if *transparency* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label.
4289 AISTransparency D 0:5 0.5
4292 @subsubsection occt_draw_5_8_11 AISHasOwnTransparency
4296 AISHasOwnTransparency docname entry
4299 Tests *AISPresentation* attribute of an *entry* label by own transparency.
4303 AISHasOwnTransparency D 0:5
4306 @subsubsection occt_draw_5_8_12 AISMaterial
4310 AISMaterial docname entry [material]
4313 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).
4320 @subsubsection occt_draw_5_8_13 AISHasOwnMaterial
4324 AISHasOwnMaterial docname entry
4327 Tests *AISPresentation* attribute of an *entry* label by own material.
4331 AISHasOwnMaterial D 0:5
4334 @subsubsection occt_draw_5_8_14 AISColor
4338 AISColor docname entry [color]
4341 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*).
4348 @subsubsection occt_draw_5_8_15 AISHasOwnColor
4352 AISHasOwnColor docname entry
4355 Tests *AISPresentation* attribute of an *entry* label by own color.
4359 AISHasOwnColor D 0:5
4362 @section occt_draw_6 Geometry commands
4364 @subsection occt_draw_6_1 Overview
4366 Draw provides a set of commands to test geometry libraries. These commands are found in the TGEOMETRY executable, or in any Draw executable which includes *GeometryTest* commands.
4368 In the context of Geometry, Draw includes the following types of variable:
4371 * The 2d curve, which corresponds to *Curve* in *Geom2d*.
4372 * The 3d curve and surface, which correspond to *Curve* and *Surface* in <a href="user_guides__modeling_data.html#occt_modat_1">Geom package</a>.
4374 Draw geometric variables never share data; the *copy* command will always make a complete copy of the content of the variable.
4376 The following topics are covered in the nine sections of this chapter:
4378 * **Curve creation** deals with the various types of curves and how to create them.
4379 * **Surface creation** deals with the different types of surfaces and how to create them.
4380 * **Curve and surface modification** deals with the commands used to modify the definition of curves and surfaces, most of which concern modifications to bezier and bspline curves.
4381 * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
4382 * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
4383 * **Intersections** presents intersections of surfaces and curves.
4384 * **Approximations** deals with creating curves and surfaces from a set of points.
4385 * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
4386 * **Display** describes commands to control the display of curves and surfaces.
4388 Where possible, the commands have been made broad in application, i.e. they apply to 2d curves, 3d curves and surfaces. For instance, the *circle* command may create a 2d or a 3d circle depending on the number of arguments given.
4390 Likewise, the *translate* command will process points, curves or surfaces, depending on argument type. You may not always find the specific command you are looking for in the section where you expect it to be. In that case, look in another section. The *trim* command, for example, is described in the surface section. It can, nonetheless, be used with curves as well.
4392 @subsection occt_draw_6_2 Curve creation
4394 This section deals with both points and curves. Types of curves are:
4396 * Analytical curves such as lines, circles, ellipses, parabolas, and hyperbolas.
4397 * Polar curves such as bezier curves and bspline curves.
4398 * Trimmed curves and offset curves made from other curves with the *trim* and *offset* commands. Because they are used on both curves and surfaces, the *trim* and *offset* commands are described in the *surface creation* section.
4399 * NURBS can be created from other curves using *convert* in the *Surface Creation* section.
4400 * Curves can be created from the isoparametric lines of surfaces by the *uiso* and *viso* commands.
4401 * 3d curves can be created from 2d curves and vice versa using the *to3d* and *to2d* commands. The *project* command computes a 2d curve on a 3d surface.
4403 Curves are displayed with an arrow showing the last parameter.
4406 @subsubsection occt_draw_6_2_1 point
4413 Creates a 2d or 3d point, depending on the number of arguments.
4424 @subsubsection occt_draw_6_2_2 line
4428 line name x y [z] dx dy [dz]
4432 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.
4434 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.
4438 # a 2d line at 45 degrees of the X axis
4441 # a 3d line through the point 10 0 0 and parallel to Z
4445 @subsubsection occt_draw_6_2_3 circle
4449 circle name x y [z [dx dy dz]] [ux uy [uz]] radius
4452 Creates a 2d or a 3d circle.
4454 In 2d, *x, y* are the coordinates of the center and *ux, uy* define the vector towards the point of origin of the parameters. By default, this direction is (1,0). The X Axis of the local coordinate system defines the origin of the parameters of the circle. Use another vector than the x axis to change the origin of parameters.
4456 In 3d, *x, y, z* are the coordinates of the center; *dx, dy, dz* give the vector normal to the plane of the circle. By default, this vector is (0,0,1) i.e. the Z axis (it must not be null). *ux, uy, uz* is the direction of the origin; if not given, a default direction will be computed. This vector must neither be null nor parallel to *dx, dy, dz*.
4458 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.
4462 # A 2d circle of radius 5 centered at 10,-2
4465 # another 2d circle with a user defined origin
4466 # the point of parameter 0 on this circle will be
4467 # 1+sqrt(2),1+sqrt(2)
4470 # a 3d circle, center 10 20 -5, axis Z, radius 17
4471 circle c3 10 20 -5 17
4473 # same 3d circle with axis Y
4474 circle c4 10 20 -5 0 1 0 17
4476 # full 3d circle, axis X, origin on Z
4477 circle c5 10 20 -5 1 0 0 0 0 1 17
4480 @subsubsection occt_draw_6_2_4 ellipse
4484 ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4487 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:
4490 P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir
4494 * P is the point of parameter *u*,
4495 * *O, Xdir* and *Ydir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system.
4499 # default 2d ellipse
4500 ellipse e1 10 5 20 10
4502 # 2d ellipse at angle 60 degree
4503 ellipse e2 0 0 1 2 30 5
4505 # 3d ellipse, in the XY plane
4506 ellipse e3 0 0 0 25 5
4508 # 3d ellipse in the X,Z plane with axis 1, 0 ,1
4509 ellipse e4 0 0 0 0 1 0 1 0 1 25 5
4512 @subsubsection occt_draw_6_2_5 hyperbola
4516 hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4519 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.
4521 The Draw hyperbola is parameterized as follows:
4523 P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir
4527 * *P* is the point of parameter *U*,
4528 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *YDirection* of its local coordinate system.
4532 # default 2d hyperbola, with asymptotes 1,1 -1,1
4533 hyperbola h1 0 0 30 30
4535 # 2d hyperbola at angle 60 degrees
4536 hyperbola h2 0 0 1 2 20 20
4538 # 3d hyperbola, in the XY plane
4539 hyperbola h3 0 0 0 50 50
4542 @subsubsection occt_draw_6_2_6 parabola
4546 parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength
4549 Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola.
4551 The *Geom_Parabola* is parameterized as follows:
4554 P(u) = O + u*u/(4.*F)*XDir + u*YDir
4558 * *P* is the point of parameter *u*,
4559 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system,
4560 * *F* is the focal length of the parabola.
4567 # 2d parabola with convexity +Y
4568 parabola p2 0 0 0 1 50
4570 # 3d parabola in the Y-Z plane, convexity +Z
4571 parabola p3 0 0 0 1 0 0 0 0 1 50
4574 @subsubsection occt_draw_6_2_7 beziercurve, 2dbeziercurve
4578 beziercurve name nbpole pole, [weight]
4579 2dbeziercurve name nbpole pole, [weight]
4582 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.
4586 # a rational 2d bezier curve (arc of circle)
4587 2dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1
4589 # a 3d bezier curve, not rational
4590 beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
4593 @subsubsection occt_draw_6_2_8 bsplinecurve, 2dbsplinecurve, pbsplinecurve, 2dpbsplinecurve
4597 bsplinecurve name degree nbknots knot, umult pole, weight
4598 2dbsplinecurve name degree nbknots knot, umult pole, weight
4600 pbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
4601 2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
4604 Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves.
4606 A bspline curve is defined by its degree, its periodic or non-periodic nature, a table of knots and a table of poles (i.e. control points). Consequently, specify the degree, the number of knots, and for each knot, the multiplicity, for each pole, the weight. In the syntax above, the commas link the adjacent arguments which they fall between: knot and multiplicities, pole and weight.
4608 The table of knots is an increasing sequence of reals without repetition.
4609 Multiplicities must be lower or equal to the degree of the curve. For non-periodic curves, the first and last multiplicities can be equal to degree+1. For a periodic curve, the first and last multiplicities must be equal.
4611 The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be:
4613 * For a non periodic curve: Sum of multiplicities - degree + 1
4614 * For a periodic curve: Sum of multiplicities - last multiplicity
4618 # a bspline curve with 4 poles and 3 knots
4619 bsplinecurve bc 2 3 0 3 1 1 2 3 \
4620 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
4621 # a 2d periodic circle (parameter from 0 to 2*pi !!)
4623 2dpbsplinecurve c 2 \
4624 4 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \
4634 **Note** that you can create the **NURBS** subset of bspline curves and surfaces by trimming analytical curves and surfaces and executing the command *convert*.
4637 @subsubsection occt_draw_6_2_9 uiso, viso
4645 Creates a U or V isoparametric curve from a surface.
4649 # create a cylinder and extract iso curves
4656 **Note** that this cannot be done from offset surfaces.
4659 @subsubsection occt_draw_6_2_10 to3d, to2d
4663 to3d name curve2d [plane]
4664 to2d name curve3d [plane]
4667 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.
4671 # the following commands
4673 plane p -2 1 0 1 2 3
4676 # will create the same circle as
4677 circle c -2 1 0 1 2 3 5
4680 See also: **project**
4683 @subsubsection occt_draw_6_2_11 project
4687 project name curve3d surface
4690 Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces.
4692 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.
4701 @subsection occt_draw_6_3 Surface creation
4703 The following types of surfaces exist:
4704 * Analytical surfaces: plane, cylinder, cone, sphere, torus;
4705 * Polar surfaces: bezier surfaces, bspline surfaces;
4706 * Trimmed and Offset surfaces;
4707 * Surfaces produced by Revolution and Extrusion, created from curves with the *revsurf* and *extsurf*;
4710 Surfaces are displayed with isoparametric lines. To show the parameterization, a small parametric line with a length 1/10 of V is displayed at 1/10 of U.
4712 @subsubsection occt_draw_6_3_1 plane
4716 plane name [x y z [dx dy dz [ux uy uz]]]
4719 Creates an infinite plane.
4721 A plane is the same as a 3d coordinate system, *x,y,z* is the origin, *dx, dy, dz* is the Z direction and *ux, uy, uz* is the X direction.
4723 The plane is perpendicular to Z and X is the U parameter. *dx,dy,dz* and *ux,uy,uz* must not be null or collinear. *ux,uy,uz* will be modified to be orthogonal to *dx,dy,dz*.
4725 There are default values for the coordinate system. If no arguments are given, the global system (0,0,0), (0,0,1), (1,0,0). If only the origin is given, the axes are those given by default(0,0,1), (1,0,0). If the origin and the Z axis are given, the X axis is generated perpendicular to the Z axis.
4727 Note that this definition will be used for all analytical surfaces.
4731 # a plane through the point 10,0,0 perpendicular to X
4732 # with U direction on Y
4733 plane p1 10 0 0 1 0 0 0 1 0
4735 # an horixontal plane with origin 10, -20, -5
4739 @subsubsection occt_draw_6_3_2 cylinder
4743 cylinder name [x y z [dx dy dz [ux uy uz]]] radius
4746 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.
4750 # a cylinder on the default Z axis, radius 10
4753 # a cylinder, also along the Z axis but with origin 5,
4755 cylinder c2 5 10 -3 10
4757 # a cylinder through the origin and on a diagonal
4758 # with longitude pi/3 and latitude pi/4 (euler angles)
4759 dset lo pi/3. la pi/4.
4760 cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo)
4764 @subsubsection occt_draw_6_3_3 cone
4768 cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius
4770 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.
4774 # a cone at 45 degrees at the origin on Z
4777 # a cone on axis Z with radius r1 at z1 and r2 at z2
4778 cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1
4781 @subsubsection occt_draw_6_3_4 sphere
4785 sphere name [x y z [dx dy dz [ux uy uz]]] radius
4788 Creates a sphere in the local coordinate system defined in the **plane** command. The sphere is centered at the origin.
4790 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.
4794 # a sphere at the origin
4796 # a sphere at 10 10 10, with poles on the axis 1,1,1
4797 sphere s2 10 10 10 1 1 1 10
4800 @subsubsection occt_draw_6_3_5 torus
4804 torus name [x y z [dx dy dz [ux uy uz]]] major minor
4807 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.
4809 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.
4813 # a torus at the origin
4816 # a torus in another coordinate system
4817 torus t2 10 5 -2 2 1 0 20 5
4821 @subsubsection occt_draw_6_3_6 beziersurf
4825 beziersurf name nbupoles nbvolpes pole, [weight]
4828 Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions.
4830 Then give the poles in the following order: *pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles)* and *pole(nbupoles, nbvpoles)*.
4832 Weights may be omitted, but if you give one weight you must give all of them.
4836 # a non-rational degree 2,3 surface
4838 0 0 0 10 0 5 20 0 0 \
4839 0 10 2 10 10 3 20 10 2 \
4840 0 20 10 10 20 20 20 20 10 \
4841 0 30 0 10 30 0 20 30 0
4844 @subsubsection occt_draw_6_3_7 bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf
4848 bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot
4849 vmult ... x y z w ...
4855 * **bsplinesurf** generates bspline surfaces;
4856 * **upbsplinesurf** creates a bspline surface periodic in u;
4857 * **vpbsplinesurf** creates one periodic in v;
4858 * **uvpbsplinesurf** creates one periodic in uv.
4860 The syntax is similar to the *bsplinecurve* command. First give the degree in u and the knots in u with their multiplicities, then do the same in v. The poles follow. The number of poles is the product of the number in u and the number in v.
4862 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.
4866 # create a bspline surface of degree 1 2
4867 # with two knots in U and three in V
4872 0 10 2 1 10 10 3 1 \
4873 0 20 10 1 10 20 20 1 \
4878 @subsubsection occt_draw_6_3_8 trim, trimu, trimv
4882 trim newname name [u1 u2 [v1 v2]]
4887 The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package.
4888 * *trim* creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface.
4889 * *trimu* creates a u-trimmed surface,
4890 * *trimv* creates a v-trimmed surface.
4892 After an initial trim, a second execution with no parameters given recreates the basis curve. The curves can be either 2d or 3d. If the trimming parameters decrease and if the curve or surface is not periodic, the direction is reversed.
4894 **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.
4898 # create a 3d circle
4901 # trim it, use the same variable, the original is
4905 # the original can be recovered!
4911 # the original is not the trimmed curve but the basis
4914 # as the circle is periodic, the two following commands
4919 # trim an infinite cylinder
4924 @subsubsection occt_draw_6_3_9 offset
4928 offset name basename distance [dx dy dz]
4931 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.
4933 The curve can be a 2d or a 3d curve. To compute the offsets for a 3d curve, you must also give a vector *dx,dy,dz*. For a planar curve, this vector is usually the normal to the plane containing the curve.
4935 The offset curve or surface copies the basic geometry, which can be modified later.
4939 # graphic demonstration that the outline of a torus
4940 # is the offset of an ellipse
4943 torus t 0 0 0 0 cos(angle) sin(angle) 50 20
4945 ellipse e 0 0 0 50 50*sin(angle)
4946 # note that the distance can be negative
4947 offset l1 e 20 0 0 1
4950 @subsubsection occt_draw_6_3_10 revsurf
4954 revsurf name curvename x y z dx dy dz
4957 Creates a surface of revolution from a 3d curve.
4959 A surface of revolution or revolved surface is obtained by rotating a curve (called the *meridian*) through a complete revolution about an axis (referred to as the *axis of revolution*). The curve and the axis must be in the same plane (the *reference plane* of the surface). Give the point of origin x,y,z and the vector dx,dy,dz to define the axis of revolution.
4961 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.
4965 # another way of creating a torus like surface
4967 revsurf s c 0 0 0 0 1 0
4970 @subsubsection occt_draw_6_3_11 extsurf
4974 extsurf newname curvename dx dy dz
4977 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.
4979 In the syntax, *dx,dy,dz* gives the direction of extrusion.
4981 To parameterize a surface of extrusion: *u* is the parameter along the extruded curve; the *v* parameter is along the direction of extrusion.
4985 # an elliptic cylinder
4986 ellipse e 0 0 0 10 5
4992 @subsubsection occt_draw_6_3_12 convert
4996 convert newname name
4999 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.
5003 # turn a 2d arc of a circle into a 2d NURBS
5008 # an easy way to make a planar bspline surface
5014 **Note** that offset curves and surfaces are not processed by this command.
5016 @subsection occt_draw_6_4 Curve and surface modifications
5018 Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines.
5020 General modifications:
5022 * Reversing the parametrization: **reverse**, **ureverse**, **vreverse**
5024 Modifications for both bezier curves and bsplines:
5026 * Exchanging U and V on a surface: **exchuv**
5027 * Segmentation: **segment**, **segsur**
5028 * Increasing the degree: **incdeg**, **incudeg**, **incvdeg**
5029 * Moving poles: **cmovep**, **movep**, **movecolp**, **moverowp**
5031 Modifications for bezier curves:
5033 * Adding and removing poles: **insertpole**, **rempole**, **remcolpole**, **remrowpole**
5035 Modifications for bspline:
5037 * Inserting and removing knots: **insertknot**, **remknot**, **insertuknot**, **remuknot**, **insetvknot**, **remvknot**
5038 * Modifying periodic curves and surfaces: **setperiodic**, **setnotperiodic**, **setorigin**, **setuperiodic**, **setunotperiodic**, **setuorigin**, **setvperiodic**, **setvnotperiodic**, **setvorigin**
5042 @subsubsection occt_draw_6_4_1 reverse, ureverse, vreverse
5048 ureverse surfacename
5049 vreverse surfacename
5052 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.
5054 **ureverse** or **vreverse** reverse the u or v parameter of a surface. Note that the new parameters of the curve may change according to the type of curve. For instance, they will change sign on a line or stay 0,1 on a bezier.
5056 Reversing a parameter on an analytical surface may create an indirect coordinate system.
5060 # reverse a trimmed 2d circle
5065 # dumping c will show that it is now trimmed between
5066 # 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4
5069 @subsubsection occt_draw_6_4_2 exchuv
5076 For a bezier or bspline surface this command exchanges the u and v parameters.
5080 # exchanging u and v on a spline (made from a cylinder)
5087 @subsubsection occt_draw_6_4_3 segment, segsur
5091 segment curve Ufirst Ulast
5092 segsur surface Ufirst Ulast Vfirst Vlast
5095 **segment** and **segsur** segment a bezier curve and a bspline curve or surface respectively.
5097 These commands modify the curve to restrict it between the new parameters: *Ufirst*, the starting point of the modified curve, and *Ulast*, the end point. *Ufirst* is less than *Ulast*.
5099 This command must not be confused with **trim** which creates a new geometry.
5103 # segment a bezier curve in half
5104 beziercurve c 3 0 0 0 10 0 0 10 10 0
5105 segment c ufirst ulast
5108 @subsubsection occt_draw_6_4_4 iincudeg, incvdeg
5112 incudeg surfacename newdegree
5113 incvdeg surfacename newdegree
5116 **incudeg** and **incvdeg** increase the degree in the U or V parameter of a bezier or bspline surface.
5120 # make a planar bspline and increase the degree to 2 3
5128 **Note** that the geometry is modified.
5131 @subsubsection occt_draw_6_4_5 cmovep, movep, movecolp, moverowp
5135 cmovep curve index dx dy [dz]
5136 movep surface uindex vindex dx dy dz
5137 movecolp surface uindex dx dy dz
5138 moverowp surface vindex dx dy dz
5141 **move** methods translate poles of a bezier curve, a bspline curve or a bspline surface.
5142 * **cmovep** and **movep** translate one pole with a given index.
5143 * **movecolp** and **moverowp** translate a whole column (expressed by the *uindex*) or row (expressed by the *vindex*) of poles.
5147 # start with a plane
5148 # transform to bspline, raise degree and add relief
5150 trim p p -10 10 -10 10
5159 @subsubsection occt_draw_6_4_6 insertpole, rempole, remcolpole, remrowpole
5163 insertpole curvename index x y [z] [weight]
5164 rempole curvename index
5165 remcolpole surfacename index
5166 remrowpole surfacename index
5169 **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.
5171 **rempole** removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves.
5173 **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.
5177 # start with a segment, insert a pole at end
5178 # then remove the central pole
5179 beziercurve c 2 0 0 0 10 0 0
5180 insertpole c 2 10 10 0
5184 @subsubsection occt_draw_6_4_7 insertknot, insertuknot, insertvknot
5188 insertknot name knot [mult = 1] [knot mult ...]
5189 insertuknot surfacename knot mult
5190 insertvknot surfacename knot mult
5193 **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.
5195 **insertuknot** and **insertvknot** insert knots in a surface.
5199 # create a cylindrical surface and insert a knot
5201 trim c c 0 pi/2 0 10
5203 insertuknot c1 pi/4 1
5206 @subsubsection occt_draw_6_4_8 remknot, remuknot, remvknot
5210 remknot index [mult] [tol]
5211 remuknot index [mult] [tol]
5212 remvknot index [mult] [tol]
5215 **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.
5217 By default, if no tolerance is given, the knot will always be removed.
5221 # bspline circle, remove a knot
5228 **Note** that Curves or Surfaces may be modified.
5231 @subsubsection occt_draw_6_4_9 setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic
5236 setnotperiodic curve
5237 setuperiodic surface
5238 setunotperiodic surface
5239 setvperiodic surface
5240 setvnotperiodic surface
5243 **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.
5245 **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.
5249 # a circle deperiodicized
5255 @subsubsection occt_draw_6_4_10 setorigin, setuorigin, setvorigin
5259 setorigin curvename index
5260 setuorigin surfacename index
5261 setuorigin surfacename index
5264 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.
5268 # a torus with new U and V origins
5276 @subsection occt_draw_6_5 Transformations
5278 Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling.
5280 @subsubsection occt_draw_6_5_1 translate, dtranslate
5284 translate name [names ...] dx dy dz
5285 2dtranslate name [names ...] dx dy
5288 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.
5290 For 2d points or curves, use the **2dtranslate** command.
5297 torus t 10 20 30 5 2
5298 translate p c t 0 0 15
5302 *Objects are modified by this command.*
5304 @subsubsection occt_draw_6_5_2 rotate, 2drotate
5308 rotate name [name ...] x y z dx dy dz angle
5309 2drotate name [name ...] x y angle
5312 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.
5314 For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative.
5318 # make a helix of circles. create a script file with
5319 this code and execute it using **source**.
5321 for {set i 1} {$i <= 10} {incr i} {
5322 copy c[expr $i-1] c$i
5324 rotate c$i 0 0 0 0 0 1 36
5328 @subsubsection occt_draw_6_5_3 pmirror, lmirror, smirror, dpmirror, dlmirror
5332 pmirror name [names ...] x y z
5333 lmirror name [names ...] x y z dx dy dz
5334 smirror name [names ...] x y z dx dy dz
5335 2dpmirror name [names ...] x y
5336 2dlmirror name [names ...] x y dx dy
5339 The mirror commands perform a mirror transformation of 2d or 3d geometry.
5341 * **pmirror** is the point mirror, mirroring 3d curves and surfaces about a point of symmetry.
5342 * **lmirror** is the line mirror commamd, mirroring 3d curves and surfaces about an axis of symmetry.
5343 * **smirror** is the surface mirror, mirroring 3d curves and surfaces about a plane of symmetry. In the last case, the plane of symmetry is perpendicular to dx,dy,dz.
5344 * **2dpmirror** is the point mirror in 2D.
5345 * **2dlmirror** is the axis symmetry mirror in 2D.
5349 # build 3 images of a torus
5350 torus t 10 10 10 1 2 3 5 1
5354 lmirror t2 0 0 0 1 0 0
5356 smirror t3 0 0 0 1 0 0
5359 @subsubsection occt_draw_6_5_4 pscale, dpscale
5363 pscale name [name ...] x y z s
5364 2dpscale name [name ...] x y s
5367 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**.
5372 # double the size of a sphere
5377 @subsection occt_draw_6_6 Curve and surface analysis
5379 **Draw** provides methods to compute information about curves and surfaces:
5381 * **coord** to find the coordinates of a point.
5382 * **cvalue** and **2dcvalue** to compute points and derivatives on curves.
5383 * **svalue** to compute points and derivatives on a surface.
5384 * **localprop** and **minmaxcurandif** to compute the curvature on a curve.
5385 * **parameters** to compute (u,v) values for a point on a surface.
5386 * **proj** and **2dproj** to project a point on a curve or a surface.
5387 * **surface_radius** to compute the curvature on a surface.
5389 @subsubsection occt_draw_6_6_1 coord
5396 Sets the x, y (and optionally z) coordinates of the point P.
5408 @subsubsection occt_draw_6_6_2 cvalue, 2dcvalue
5412 cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]]
5413 2dcvalue curve U x y [d1x d1y [d2x d2y]]
5416 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*.
5420 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* :
5423 2dbeziercurve c 4 0 0 1 1 2 1 3 0
5424 2dcvalue c 0 x y d1x d1y d2x d2y
5426 # values of x y d1x d1y d2x d2y
5430 @subsubsection occt_draw_6_6_3 svalue
5434 svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]]
5437 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.
5441 # display points on a sphere
5443 for {dset t 0} {[dval t] <= 1} {dset t t+0.01} {
5444 svalue s t*2*pi t*pi-pi/2 x y z
5449 @subsubsection occt_draw_6_6_4 localprop, minmaxcurandinf
5453 localprop curvename U
5454 minmaxcurandinf curve
5457 **localprop** computes the curvature of a curve.
5458 **minmaxcurandinf** computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve.
5462 # show curvature at the center of a bezier curve
5463 beziercurve c 3 0 0 0 10 2 0 20 0 0
5468 @subsubsection occt_draw_6_6_5 parameters
5472 parameters surf/curve x y z U [V]
5475 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.
5479 # Compute parameters on a plane
5480 plane p 0 0 10 1 1 0
5481 parameters p 5 5 5 u v
5482 # the values of u and v are : 0 5
5485 @subsubsection occt_draw_6_6_6 proj, 2dproj
5493 Use **proj** to project a point on a 3d curve or a surface and **2dproj** for a 2d curve.
5495 The command will compute and display all points in the projection. The lines joining the point to the projections are created with the names *ext_1, ext_2, ... *
5499 Let us project a point on a torus
5504 == ext_1 ext_2 ext_3 ext_4
5507 @subsubsection occt_draw_6_6_7 surface_radius
5511 surface_radius surface u v [c1 c2]
5514 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*.
5518 Let us compute curvatures of a cylinder:
5522 surface_radius c pi 3 c1 c2
5523 == Min Radius of Curvature : -5
5524 == Min Radius of Curvature : infinite
5528 @subsection occt_draw_6_7 Intersections
5530 * **intersect** computes intersections of surfaces;
5531 * **2dintersect** computes intersections of 2d curves.
5532 * **intconcon** computes intersections of 2d conic curves.
5534 @subsubsection occt_draw_6_7_1 intersect
5538 intersect name surface1 surface2
5541 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*, ...
5547 plane p 0 0 40 0 1 5
5551 @subsubsection occt_draw_6_7_2 2dintersect
5555 2dintersect curve1 [curve2] [-tol tol] [-state]
5558 Displays the intersection points between 2d curves.
5560 -tol - allows changing the intersection tolerance (default value is 1.e-3);
5561 -state - allows printing the intersection state for each point.
5565 # intersect two 2d ellipses
5567 ellipse e2 0 0 0 1 5 2
5568 2dintersect e1 e2 -tol 1.e-10 -state
5571 @subsubsection occt_draw_6_7_3 intconcon
5575 intconcon curve1 curve2
5578 Displays the intersection points between two 2d curves.
5579 Curves must be only conic sections: 2d lines, circles, ellipses,
5580 hyperbolas, parabolas. Algorithm from IntAna2d_AnaIntersection is used.
5584 # intersect two 2d ellipses
5586 ellipse e2 0 0 0 1 5 2
5590 @subsection occt_draw_6_8 Approximations
5592 Draw provides command to create curves and surfaces by approximation.
5594 * **2dapprox** fits a curve through 2d points;
5595 * **appro** fits a curve through 3d points;
5596 * **surfapp** and **grilapp** fit a surface through 3d points;
5597 * **2dinterpolate** interpolates a curve.
5599 @subsubsection occt_draw_6_8_1 appro, dapprox
5603 appro result nbpoint [curve]
5604 2dapprox result nbpoint [curve / x1 y1 x2 y2]
5607 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.
5611 Let us pick points and they will be fitted
5617 @subsubsection occt_draw_6_8_2 surfapp, grilapp
5622 surfapp name nbupoints nbvpoints x y z ....
5623 grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ...
5626 * **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints.
5627 * **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.
5631 # a surface using the same data as in the beziersurf
5634 0 0 0 10 0 5 20 0 0 \
5635 0 10 2 10 10 3 20 10 2 \
5636 0 20 10 10 20 20 20 20 10 \
5637 0 30 0 10 30 0 20 30 0
5640 @subsection occt_draw_6_9 Projections
5642 Draw provides commands to project points/curves on curves/surfaces.
5644 * **proj** projects point on the curve/surface (see @ref occt_draw_6_6_6 "proj command description");
5645 * **project** projects 3D curve on the surface (see @ref occt_draw_6_2_11 "project command description");
5646 * **projponf** projects point on the face.
5648 @subsubsection occt_draw_6_9_1 projponf
5652 projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]
5655 **projponf** projects point *pnt* on the face *face*.
5656 You can change the Extrema options:
5657 * To change the Extrema search algorithm use the following options:<br>
5658 -g - for Grad algorithm;<br>
5659 -t - for Tree algorithm;
5660 * To change the Extrema search solutions use the following options:<br>
5661 -min - to look for Min solutions;<br>
5662 -max - to look for Max solutions;<br>
5663 -minmax - to look for MinMax solutions.
5677 @subsection occt_draw_6_10 Constraints
5679 * **cirtang** constructs 2d circles tangent to curves;
5680 * **lintan** constructs 2d lines tangent to curves.
5683 @subsubsection occt_draw_6_10_1 cirtang
5687 cirtang cname curve/point/radius curve/point/radius curve/point/radius
5690 Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc.
5694 # a point, a line and a radius. 2 solutions
5701 @subsubsection occt_draw_6_10_2 lintan
5705 lintan name curve curve [angle]
5708 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.
5712 # lines tangent to 2 circles, 4 solutions
5717 # lines at 15 degrees tangent to a circle and a line, 2
5718 solutions: l1_1 l1_2
5724 @subsection occt_draw_6_11 Display
5726 Draw provides commands to control the display of geometric objects. Some display parameters are used for all objects, others are valid for surfaces only, some for bezier and bspline only, and others for bspline only.
5728 On curves and surfaces, you can control the mode of representation with the **dmode** command. You can control the parameters for the mode with the **defle** command and the **discr** command, which control deflection and discretization respectively.
5730 On surfaces, you can control the number of isoparametric curves displayed on the surface with the **nbiso** command.
5732 On bezier and bspline curve and surface you can toggle the display of the control points with the **clpoles** and **shpoles** commands.
5734 On bspline curves and surfaces you can toggle the display of the knots with the **shknots** and **clknots** commands.
5737 @subsubsection occt_draw_6_11_1 dmod, discr, defle
5741 dmode name [name ...] u/d
5742 discr name [name ...] nbintervals
5743 defle name [name ...] deflection
5746 **dmod** command allows choosing the display mode for a curve or a surface.
5748 In mode *u*, or *uniform deflection*, the points are computed to keep the polygon at a distance lower than the deflection of the geometry. The deflection is set with the *defle* command. This mode involves intensive use of computational power.
5750 In *d*, or discretization mode, a fixed number of points is computed. This number is set with the *discr* command. This is the default mode. On a bspline, the fixed number of points is computed for each span of the curve. (A span is the interval between two knots).
5752 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.
5756 # increment the number of points on a big circle
5764 @subsubsection occt_draw_6_11_2 nbiso
5768 nbiso name [names...] nuiso nviso
5771 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.
5775 Let us display 35 meridians and 15 parallels on a sphere:
5781 @subsubsection occt_draw_6_11_3 clpoles, shpoles
5789 On bezier and bspline curves and surfaces, the control polygon is displayed by default: *clpoles* erases it and *shpoles* restores it.
5793 Let us make a bezier curve and erase the poles
5796 beziercurve c 3 0 0 0 10 0 0 10 10 0
5800 @subsubsection occt_draw_6_11_4 clknots, shknots
5808 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.
5812 # hide the knots on a bspline curve
5813 bsplinecurve bc 2 3 0 3 1 1 2 3 \
5814 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
5819 @section occt_draw_7 Topology commands
5821 Draw provides a set of commands to test OCCT Topology libraries. The Draw commands are found in the DRAWEXE executable or in any executable including the BRepTest commands.
5823 Topology defines the relationship between simple geometric entities, which can thus be linked together to represent complex shapes. The type of variable used by Topology in Draw is the shape variable.
5825 The <a href="user_guides__modeling_data.html#occt_modat_5">different topological shapes</a> include:
5827 * **COMPOUND**: A group of any type of topological object.
5828 * **COMPSOLID**: A set of solids connected by their faces. This expands the notions of WIRE and SHELL to solids.
5829 * **SOLID**: A part of space limited by shells. It is three dimensional.
5830 * **SHELL**: A set of faces connected by their edges. A shell can be open or closed.
5831 * **FACE**: In 2d, a plane; in 3d, part of a surface. Its geometry is constrained (trimmed) by contours. It is two dimensional.
5832 * **WIRE**: A set of edges connected by their vertices. It can be open or closed depending on whether the edges are linked or not.
5833 * **EDGE**: A topological element corresponding to a restrained curve. An edge is generally limited by vertices. It has one dimension.
5834 * **VERTEX**: A topological element corresponding to a point. It has a zero dimension.
5836 Shapes are usually shared. **copy** will create a new shape which shares its representation with the original. Nonetheless, two shapes sharing the same topology can be moved independently (see the section on **transformation**).
5838 The following topics are covered in the eight sections of this chapter:
5840 * Basic shape commands to handle the structure of shapes and control the display.
5841 * Curve and surface topology, or methods to create topology from geometry and vice versa.
5842 * Primitive construction commands: box, cylinder, wedge etc.
5843 * Sweeping of shapes.
5844 * Transformations of shapes: translation, copy, etc.
5845 * Topological operations, or booleans.
5846 * Drafting and blending.
5847 * Analysis of shapes.
5850 @subsection occt_draw_7_1 Basic topology
5852 The set of basic commands allows simple operations on shapes, or step-by-step construction of objects. These commands are useful for analysis of shape structure and include:
5854 * **isos** and **discretisation** to control display of shape faces by isoparametric curves .
5855 * **orientation**, **complement** and **invert** to modify topological attributes such as orientation.
5856 * **explode**, **exwire** and **nbshapes** to analyze the structure of a shape.
5857 * **emptycopy**, **add**, **compound** to create shapes by stepwise construction.
5859 In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges:
5861 * a red edge is an isolated edge, which belongs to no faces.
5862 * a green edge is a free boundary edge, which belongs to one face,
5863 * a yellow edge is a shared edge, which belongs to at least two faces.
5866 @subsubsection occt_draw_7_1_1 isos, discretisation
5870 isos [name ...][nbisos]
5871 discretisation nbpoints
5874 Determines or changes the number of isoparametric curves on shapes.
5876 The same number is used for the u and v directions. With no arguments, *isos* prints the current default value. To determine, the number of isos for a shape, give it name as the first argument.
5878 *discretisation* changes the default number of points used to display the curves. The default value is 30.
5882 # Display only the edges (the wireframe)
5886 **Warning**: don’t confuse *isos* and *discretisation* with the geometric commands *nbisos* and *discr*.
5889 @subsubsection occt_draw_7_1_2 orientation, complement, invert, normals, range
5893 orientation name [name ...] F/R/E/I
5894 complement name [name ...]
5896 normals s (length = 10), disp normals
5897 range name value value
5900 * **orientation** -- assigns the orientation of simple and complex shapes to one of the following four values: *FORWARD, REVERSED, INTERNAL, EXTERNAL*.
5901 * **complement** -- changes the current orientation of shapes to its complement: *FORWARD* to *REVERSED* and *INTERNAL* to *EXTERNAL*.
5902 * **invert** -- creates a copy of the original shape with a reversed orientation of all subshapes. For example, it may be useful to reverse the normals of a solid.
5903 * *normals** -- returns the assignment of colors to orientation values.
5904 * **range** -- defines the length of a selected edge by defining the values of a starting point and an end point.
5908 # to invert normals of a box
5914 # to assign a value to an edge
5916 # to define the box as edges
5918 b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12
5919 # to define as an edge
5921 # to define the length of the edge as starting from 0
5926 @subsubsection occt_draw_7_1_3 explode, exwire, nbshapes
5930 explode name [C/So/Sh/F/W/E/V]
5935 **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.
5937 With name only, **explode** will extract the first sublevel of shapes: the shells of a solid or the edges of a wire, for example. With one argument, **explode** will extract all subshapes of that type: *C* for compounds, *So* for solids, *Sh* for shells, *F* for faces, *W* for wires, *E* for edges, *V* for vertices.
5939 **exwire** is a special case of **explode** for wires, which extracts the edges in an ordered way, if possible. Each edge, for example, is connected to the following one by a vertex.
5941 **nbshapes** counts the number of shapes of each type in an entity.
5948 # whatis returns the type and various information
5950 = b is a shape SOLID FORWARD Free Modified
5955 = b_1 is a shape SHELL FORWARD Modified Orientable
5958 # extract the edges b_1, ... , b_12
5965 Number of shapes in b
5977 @subsubsection occt_draw_7_1_4 emptycopy, add, compound
5981 emptycopy [newname] name
5983 compound [name ...] compoundname
5986 **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.
5988 **add** inserts shape *C* into shape *S*. Verify that *C* and *S* reference compatible types of objects:
5989 * Any *Shape* can be added to a *Compound*.
5990 * Only a *Solid* can be added to a *CompSolid*.
5991 * Only a *Shell* can *Edge* or a *Vertex* can be added into a *Solid*.
5992 * Only a *Face* can be added to a *Shell*.
5993 * Only a *Wire* and *Vertex* can be added in a *Solid*.
5994 * Only an *Edge* can be added to a *Wire*.
5995 * Only a *Vertex* can be added to an *Edge*.
5996 * Nothing can be added to a *Vertex*.
5998 **emptycopy** and **add** should be used with care.
6000 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.
6004 # a compound with three boxes
6012 @subsubsection occt_draw_7_1_5 compare
6016 compare shape1 shape2
6019 **compare** compares the two shapes *shape1* and *shape2* using the methods *TopoDS_Shape::IsSame()* and *TopoDS_Shape::IsEqual()*.
6035 # shapes are not same
6038 @subsubsection occt_draw_7_1_6 issubshape
6042 issubshape subshape shape
6045 **issubshape** checks if the shape *subshape* is sub-shape of the shape *shape* and gets its index in the shape.
6052 # b_2 is sub-shape of b. Index in the shape: 2.
6056 @subsection occt_draw_7_2 Curve and surface topology
6058 This group of commands is used to create topology from shapes and to extract shapes from geometry.
6060 * To create vertices, use the **vertex** command.
6061 * To create edges use, the **edge**, **mkedge** commands.
6062 * To create wires, use the **wire**, **polyline**, **polyvertex** commands.
6063 * To create faces, use the **mkplane**, **mkface** commands.
6064 * To extract the geometry from edges or faces, use the **mkcurve** and **mkface** commands.
6065 * To extract the 2d curves from edges or faces, use the **pcurve** command.
6068 @subsubsection occt_draw_7_2_1 vertex
6072 vertex name [x y z / p edge]
6075 Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge.
6082 @subsubsection occt_draw_7_2_1a mkpoint
6089 Creates a point from the coordinates of a given vertex.
6096 @subsubsection occt_draw_7_2_2 edge, mkedge, uisoedge, visoedge
6100 edge name vertex1 vertex2
6101 mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]]
6102 uisoedge edge face u v1 v2
6103 visoedge edge face v u1 u2
6106 * **edge** creates a straight line edge between two vertices.
6107 * **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.
6111 # straight line edge
6116 # make a circular edge
6120 # A similar result may be achieved by trimming the curve
6121 # The trimming is removed by mkedge
6126 * **visoedge** and **uisoedge** are commands that generate a *uiso* parameter edge or a *viso* parameter edge.
6130 # to create an edge between v1 and v2 at point u
6131 # to create the example plane
6140 # to create the edge in the plane at the u axis point
6141 0.5, and between the v axis points v=0.2 and v =0.8
6142 uisoedge e p 0.5 0.20 0.8
6145 @subsubsection occt_draw_7_2_3 wire, polyline, polyvertex
6149 wire wirename e1/w1 [e2/w2 ...]
6150 polyline name x1 y1 z1 x2 y2 z2 ...
6151 polyvertex name v1 v2 ...
6154 **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.
6156 **polyline** creates a polygonal wire from point coordinates. To make a closed wire, you should give the first point again at the end of the argument list.
6158 **polyvertex** creates a polygonal wire from vertices.
6162 # create two polygonal wires
6163 # glue them and define as a single wire
6164 polyline w1 0 0 0 10 0 0 10 10 0
6165 polyline w2 10 10 0 0 10 0 0 0 0
6169 @subsubsection occt_draw_7_2_4 profile
6173 profile name [code values] [code values] ...
6177 **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.
6180 | **Code** | **Values ** | **Action** |
6181 | :------------ | :------------- | :---------------- |
6182 | O | X Y Z | Sets the origin of the plane |
6183 | P | DX DY DZ UX UY UZ | Sets the normal and X of the plane |
6184 | F | X Y | Sets the first point |
6185 | X | DX | Translates a point along X |
6186 | Y | DY | Translates a point along Y |
6187 | L | DL | Translates a point along direction |
6188 | XX | X | Sets point X coordinate |
6189 | YY | Y | Sets point Y coordinate |
6190 | T | DX DY | Translates a point |
6191 | TT | X Y | Sets a point |
6192 | R | Angle | Rotates direction |
6193 | RR | Angle | Sets direction |
6194 | D | DX DY | Sets direction |
6195 | IX | X | Intersects with vertical |
6196 | IY | Y | Intersects with horizontal |
6197 | C | Radius Angle | Arc of circle tangent to direction |
6200 Codes and values are used to define the next point or change the direction. When the profile changes from a straight line to a curve, a tangent is created. All angles are in degrees and can be negative.
6202 The point [code values] can be repeated any number of times and in any order to create the profile contour.
6206 | No suffix | Makes a closed face |
6207 | W | Make a closed wire |
6208 | WW | Make an open wire |
6210 The profile shape definition is the suffix; no suffix produces a face, *w* is a closed wire, *ww* is an open wire.
6212 Code letters are not case-sensitive.
6216 # to create a trianglular plane using a vertex at the
6217 origin, in the xy plane
6218 profile p O 0 0 0 X 1 Y 0 x 1 y 1
6223 # to create a contour using the different code
6226 # two vertices in the xy plane
6227 profile p F 1 0 x 2 y 1 ww
6229 # to view from a point normal to the plane
6232 # add a circular element of 45 degrees
6233 profile p F 1 0 x 2 y 1 c 1 45 ww
6235 # add a tangential segment with a length value 1
6236 profile p F 1 0 x 2 y 1 c 1 45 l 1 ww
6238 # add a vertex with xy values of 1.5 and 1.5
6239 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 ww
6241 # add a vertex with the x value 0.2, y value is constant
6242 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 ww
6244 # add a vertex with the y value 2 x value is constant
6245 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 yy 2 ww
6247 # add a circular element with a radius value of 1 and a circular value of 290 degrees
6248 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
6250 # wire continues at a tangent to the intersection x = 0
6251 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 ww
6253 # continue the wire at an angle of 90 degrees until it intersects the y axis at y= -o.3
6254 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 ww
6257 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 w
6259 # to create the plane with the same contour
6260 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
6263 @subsubsection occt_draw_7_2_5 bsplineprof
6267 bsplineprof name [S face] [W WW]
6270 * for an edge : \<digitizes\> ... <mouse button 2>
6271 * to end profile : <mouse button 3>
6273 Builds a profile in the XY plane from digitizes. By default the profile is closed and a face is built.
6275 **bsplineprof** creates a 2d profile from bspline curves using the mouse as the input. *MB1* creates the points, *MB2* finishes the current curve and starts the next curve, *MB3* closes the profile.
6277 The profile shape definition is the suffix; no suffix produces a face, **w** is a closed wire, **ww** is an open wire.
6281 #to view the xy plane
6283 #to create a 2d curve with the mouse
6285 # click mb1 to start the curve
6286 # click mb1 to create the second vertex
6287 # click mb1 to create a curve
6289 #click mb2 to finish the curve and start a new curve
6291 # click mb1 to create the second curve
6292 # click mb3 to create the face
6295 @subsubsection occt_draw_7_2_6 mkoffset
6297 **mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurrences is not limited.
6298 The offset distance defines the spacing and the positioning of the occurrences.
6302 mkoffset result shape nboffset stepoffset [jointype(a/i) [alt]]
6305 * *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* ...;
6306 * *shape* - input shape (face or compound of wires);
6307 * *nboffset* - the number of the parallel occurrences;
6308 * *stepoffset* - offset distance between occurrences;
6309 * *jointype(a/i)* - join type (a for *arc* (default) and i for *intersection*);
6310 * *alt* - altitude from the plane of the input face in relation to the normal to the face.
6315 # Create a box and select a face
6318 # Create three exterior parallel contours with an offset value of 2
6320 # wires r_1, r_2 and r_3 are created
6322 # Create three exterior parallel contours with an offset value of 2 without round corners
6323 mkoffset r b_1 3 2 i
6324 # wires r_1, r_2 and r_3 are created
6326 # Create one interior parallel contour with an offset value of 0.4
6327 mkoffset r b_1 1 -0.4
6330 **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.
6334 # to create the example contour
6335 profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w
6336 # creates an incoherent interior offset
6337 mkoffset r p 1 -0.50
6339 # creates two incoherent wires
6340 mkoffset r p 1 -0.55
6341 # r_1 is a compound of two wires
6344 @subsubsection occt_draw_7_2_7 mkplane, mkface
6349 mkface name surface [ufirst ulast vfirst vlast]
6352 **mkplane** generates a face from a planar wire. The planar surface will be constructed with an orientation which keeps the face inside the wire.
6354 **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.
6358 # make a polygonal face
6359 polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0
6362 # make a cylindrical face
6364 trim g g -pi/3 pi/2 0 15
6368 @subsubsection occt_draw_7_2_8 mkcurve, mksurface
6376 **mkcurve** creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries.
6378 **mksurface** creates a surface from a face. The surface will not be trimmed.
6388 @subsubsection occt_draw_7_2_9 pcurve
6393 pcurve [name edgename] facename
6396 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.
6400 # view the pcurves of a face
6409 @subsubsection occt_draw_7_2_10 chfi2d
6413 chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) ....
6417 Creates chamfers and fillets on 2D objects. Select two adjacent edges and:
6419 * two respective distance values
6420 * a distance value and an angle
6422 The radius value produces a fillet between the two faces.
6424 The distance is the length value from the edge between the two selected faces in a normal direction.
6428 Let us create a 2d fillet:
6432 profile p x 2 y 2 x -2
6433 chfi2d cfr p . . F 0.3
6440 Let us create a 2d chamfer using two distances:
6443 profile p x 2 y 2 x -2
6444 chfi2d cfr p . . CDD 0.3 0.6
6451 Let us create a 2d chamfer using a defined distance and angle
6455 profile p x 2 y 2 x -2
6456 chfi2d cfr p . . CDA 0.3 75
6463 @subsubsection occt_draw_7_2_11 nproject
6467 nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol
6468 [continuity [maxdeg [maxseg]]]
6471 Creates a shape projection which is normal to the target surface.
6475 # create a curved surface
6484 translate ll 2 -0.5 0
6490 #display in four views
6493 # create the example shape
6494 circle c 1.8 -0.5 1 0 1 0 1 0 0 0.4
6497 # create the normal projection of the shape(circle)
6502 @subsection occt_draw_7_3 Primitives
6504 Primitive commands make it possible to create simple shapes. They include:
6506 * **box** and **wedge** commands.
6507 * **pcylinder**, **pcone**, **psphere**, **ptorus** commands.
6508 * **halfspace** command
6511 @subsubsection occt_draw_7_3_1 box, wedge
6515 box name [x y z] dx dy dz
6516 wedge name dx dy dz ltx / xmin zmin xmax xmax
6519 **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.
6521 **wedge** creates a box with five faces called a wedge. One face is in the OXZ plane, and has dimensions *dx,dz* while the other face is in the plane *y = dy*. This face either has dimensions *ltx, dz* or is bounded by *xmin,zmin,xmax,zmax*.
6523 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.
6527 # a box at the origin
6531 box b2 30 30 40 10 20 30
6536 # a wedge with a sharp edge (5 faces)
6540 wedge w3 20 20 20 10 10 10 10
6543 @subsubsection occt_draw_7_3_2 pcylinder, pcone, psphere, ptorus
6547 pcylinder name [plane] radius height [angle]
6548 pcone name [plane] radius1 radius2 height [angle]
6549 pcone name [plane] radius1 radius2 height [angle]
6550 psphere name [plane] radius1 [angle1 angle2] [angle]
6551 ptorus name [plane] radius1 radius2 [angle1 angle2] [angle]
6554 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.
6556 **pcylinder** creates a cylindrical block with the given radius and height.
6558 **pcone** creates a truncated cone of the given height with radius1 in the plane z = 0 and radius2 in the plane z = height. Neither radius can be negative, but one of them can be null.
6560 **psphere** creates a solid sphere centered on the origin. If two angles, *angle1* and *angle2*, are given, the solid will be limited by two planes at latitude *angle1* and *angle2*. The angles must be increasing and in the range -90,90.
6562 **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.
6569 # a quarter of a truncated cone
6570 pcone co 15 10 10 90
6572 # three-quarters of sphere
6579 @subsubsection occt_draw_7_3_3 halfspace
6583 halfspace result face/shell x y z
6586 **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.
6592 ==b_1 b_2 b_3 b_4 b_5 b_6
6593 halfspace hr b_3 0.5 0.5 0.5
6597 @subsection occt_draw_7_4 Sweeping
6599 Sweeping creates shapes by sweeping out a shape along a defined path:
6601 * **prism** -- sweeps along a direction.
6602 * **revol** -- sweeps around an axis.
6603 * **pipe** -- sweeps along a wire.
6604 * **mksweep** and **buildsweep** -- to create sweeps by defining the arguments and algorithms.
6605 * **thrusections** -- creates a sweep from wire in different planes.
6608 @subsubsection occt_draw_7_4_1 prism
6612 prism result base dx dy dz [Copy | Inf | SemiInf]
6615 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.
6617 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.
6621 # sweep a planar face to make a solid
6622 polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0
6626 @subsubsection occt_draw_7_4_2 revol
6630 revol result base x y z dx dy dz angle [Copy]
6633 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.
6637 # shell by wire rotation
6638 polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0
6639 revol s w 20 0 0 0 1 0 90
6643 @subsubsection occt_draw_7_4_3 pipe
6647 pipe name wire_spine Profile
6650 Creates a new shape by sweeping a shape known as the profile along a wire known as the spine.
6654 # sweep a circle along a bezier curve to make a solid
6657 beziercurve spine 4 0 0 0 10 0 0 10 10 0 20 10 0
6660 circle profile 0 0 0 1 0 0 2
6661 mkedge profile profile
6662 wire profile profile
6663 mkplane profile profile
6664 pipe p spine profile
6667 @subsubsection occt_draw_7_4_4 mksweep, addsweep, setsweep, deletesweep, buildsweep, simulsweep
6672 addsweep wire[vertex][-M][-C] [auxiilaryshape]
6674 setsweep options [arg1 [arg2 [...]]]
6675 simulsweep r [n] [option]
6676 buildsweep [r] [option] [Tol]
6680 * *-FR* : Tangent and Normal are defined by a Frenet trihedron
6681 * *-CF* : Tangent is given by Frenet, the Normal is computed to minimize the torsion
6682 * *-DX Surf* : Tangent and Normal are given by Darboux trihedron, surf must be a shell or a face
6683 * *-CN dx dy dz* : BiNormal is given by *dx dy dz*
6684 * *-FX Tx Ty TZ [Nx Ny Nz]* : Tangent and Normal are fixed
6687 These commands are used to create a shape from wires. One wire is designated as the contour that defines the direction; it is called the spine. At least one other wire is used to define the the sweep profile.
6688 * **mksweep** -- initializes the sweep creation and defines the wire to be used as the spine.
6689 * **addsweep** -- defines the wire to be used as the profile.
6690 * **deletesweep** -- cancels the choice of profile wire, without leaving the mksweep mode. You can re-select a profile wire.
6691 * **setsweep** -- commands the algorithms used for the construction of the sweep.
6692 * **simulsweep** -- can be used to create a preview of the shape. [n] is the number of sections that are used to simulate the sweep.
6693 * **buildsweep** -- creates the sweep using the arguments defined by all the commands.
6697 #create a sweep based on a semi-circular wire using the
6699 #create a circular figure
6700 circle c2 0 0 0 1 0 0 10
6701 trim c2 c2 -pi/2 pi/2
6707 # to display all the options for a sweep
6709 #to create a sweep using the Frenet algorithm where the
6710 #normal is computed to minimise the torsion
6713 # to simulate the sweep with a visual approximation
6717 @subsubsection occt_draw_7_4_5 thrusections
6721 thrusections [-N] result issolid isruled wire1 wire2 [..wire..]
6724 **thrusections** creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices.
6725 A bezier curve is generated between the vertices of each wire. The option *[-N]* means that no check is made on wires for direction.
6729 #create three wires in three planes
6730 polyline w1 0 0 0 5 0 0 5 5 0 2 3 0
6731 polyline w2 0 1 3 4 1 3 4 4 3 1 3 3
6732 polyline w3 0 0 5 5 0 5 5 5 5 2 3 5
6734 thrusections th issolid isruled w1 w2 w3
6735 ==thrusections th issolid isruled w1 w2 w3
6736 Tolerances obtenues -- 3d : 0
6741 @subsection occt_draw_7_5 Topological transformation
6743 Transformations are applications of matrices. When the transformation is nondeforming, such as translation or rotation, the object is not copied. The topology localcoordinate system feature is used. The copy can be enforced with the **tcopy** command.
6745 * **tcopy** -- makes a copy of the structure of a shape.
6746 * **ttranslate**, **trotate**, **tmove** and **reset** -- move a shape.
6747 * **tmirror** and **tscale** -- always modify the shape.
6750 @subsubsection occt_draw_7_5_1 tcopy
6754 tcopy name toname [name toname ...]
6757 Copies the structure of one shape, including the geometry, into another, newer shape.
6761 # create an edge from a curve and copy it
6762 beziercurve c 3 0 0 0 10 0 0 20 10 0
6767 # now modify the curve, only e1 and e2 will be modified
6770 @subsubsection occt_draw_7_5_2 tmove, treset
6774 tmove name [name ...] shape
6775 reset name [name ...]
6778 **tmove** and **reset** modify the location, or the local coordinate system of a shape.
6780 **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).
6786 box b2 20 0 0 10 10 10
6787 # translate the first box
6788 ttranslate b1 0 10 0
6789 # and apply the same location to b2
6791 # return to original positions
6795 @subsubsection occt_draw_7_5_3 ttranslate, trotate
6799 ttranslate [name ...] dx dy dz
6800 trotate [name ...] x y z dx dy dz angle
6803 **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.
6804 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.)
6806 Locations are very economic in the data structure because multiple occurences of an object share the topological description.
6810 # make rotated copies of a sphere in between two cylinders
6811 # create a file source toto.tcl
6813 for {set i 0} {$i < 360} {incr i 20} {
6815 trotate s$i 0 0 0 0 0 1 $i
6818 # create two cylinders
6821 ttranslate c2 0 0 20
6825 ttranslate s 25 0 12.5
6827 # call the source file for multiple copies
6831 @subsubsection occt_draw_7_5_4 tmirror, tscale
6835 tmirror name x y z dx dy dz
6836 tscale name x y z scale
6839 * **tmirror** makes a mirror copy of a shape about a plane x,y,z dx,dy,dz.
6841 * **Tscale** applies a central homotopic mapping to a shape.
6845 # mirror a portion of cylinder about the YZ plane
6846 pcylinder c1 10 10 270
6848 tmirror c2 15 0 0 1 0 0
6854 @subsection occt_draw_7_6 Old Topological operations
6856 * **fuse**, **cut**, **common** are boolean operations.
6857 * **section**, **psection** compute sections.
6858 * **sewing** joins two or more shapes.
6861 @subsubsection occt_draw_7_6_1 fuse, cut, common
6865 fuse name shape1 shape2
6866 cut name shape1 shape2
6867 common name shape1 shape2
6870 **fuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
6872 **cut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes.
6874 **common** creates a new shape which contains only what is in common between the two original shapes in their intersection.
6878 # all four boolean operations on a box and a cylinder
6880 box b 0 -10 5 20 20 10
6884 ttranslate s1 40 0 0
6887 ttranslate s2 -40 0 0
6890 ttranslate s3 0 40 0
6893 ttranslate s4 0 -40 0
6897 @subsubsection occt_draw_7_6_2 section, psection
6901 section result shape1 shape2
6902 psection name shape plane
6905 **section** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
6907 **psection** creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane.
6911 # section line between a cylinder and a box
6913 box b 0 0 5 15 15 15
6914 trotate b 0 0 0 1 1 1 20
6917 # planar section of a cone
6919 plane p 0 0 15 1 1 2
6923 @subsubsection occt_draw_7_6_3 sewing
6927 sewing result [tolerance] shape1 shape2 ...
6930 **Sewing** joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value.
6934 # create two adjacent boxes
6939 sr is a shape COMPOUND FORWARD Free Modified
6942 @subsection occt_draw_7_7 New Topological operations
6945 The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm.
6948 @subsubsection occt_draw_7_7_1 bparallelmode
6950 * **bparallelmode** enable or disable parallel mode for boolean operations. Sequential computing is used by default.
6958 Without arguments, bparallelmode shows current state of parallel mode for boolean operations.
6960 * *0* Disable parallel mode,
6961 * *1* Enable parallel mode
6965 # Enable parallel mode for boolean operations.
6968 # Show state of parallel mode for boolean operations.
6972 @subsubsection occt_draw_7_7_2 bop, bopfuse, bopcut, boptuc, bopcommon
6974 * **bop** defines *shape1* and *shape2* subject to ulterior Boolean operations
6975 * **bopfuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
6976 * **bopcut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes.
6977 * **boptuc** is a reverced **bopcut**.
6978 * **bopcommon** creates a new shape which contains only whatever is in common between the two original shapes in their intersection.
6989 These commands have short variants:
6992 bcommon result shape1 shape2
6993 bfuse result shape1 shape2
6994 bcut result shape1 shape2
6998 **bop** fills data structure (DS) of boolean operation for *shape1* and *shape2*.
6999 **bopcommon, bopfuse, bopcut, boptuc** commands are used after **bop** command. After one **bop** command it is possible to call several commands from the list above. For example:
7009 Let us produce all four boolean operations on a box and a cylinder:
7012 box b 0 -10 5 20 20 10
7015 # fills data structure
7019 ttranslate s1 40 0 0
7022 ttranslate s2 -40 0 0
7025 ttranslate s3 0 40 0
7028 ttranslate s4 0 -40 0
7031 Now use short variants of the commands:
7035 ttranslate s11 40 0 100
7038 ttranslate s12 -40 0 100
7041 ttranslate s14 0 -40 100
7044 @subsubsection occt_draw_7_7_3 bopsection
7052 * **bopsection** -- creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
7053 * **bop** -- fills data structure (DS) of boolean operation for *shape1* and *shape2*.
7054 * **bopsection** -- is used after **bop** command.
7056 Short variant syntax:
7058 bsection result shape1 shape2 [-2d/-2d1/-2s2] [-a]
7061 * <i>-2d</i> -- PCurves are computed on both parts.
7062 * <i>-2d1</i> -- PCurves are computed on first part.
7063 * <i>-2d2</i> -- PCurves are computed on second part.
7064 * <i>-a</i> -- built geometries are approximated.
7068 Let us build a section line between a cylinder and a box
7071 box b 0 0 5 15 15 15
7072 trotate b 0 0 0 1 1 1 20
7079 @subsubsection occt_draw_7_7_4 bopcheck, bopargshape
7084 bopargcheck shape1 [[shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF]
7087 **bopcheck** checks a shape for self-interference.
7089 **bopargcheck** checks the validity of argument(s) for boolean operations.
7091 * Boolean Operation -- (by default a section is made) :
7098 * Test Options -- (by default all options are enabled) :
7099 * **R** (disable small edges (shrink range) test)
7100 * **F** (disable faces verification test)
7101 * **T** (disable tangent faces searching test)
7102 * **V** (disable test possibility to merge vertices)
7103 * **E** (disable test possibility to merge edges)
7104 * **I** (disable self-interference test)
7105 * **P** (disable shape type test)
7106 * Additional Test Options :
7107 * **B** (stop test on first faulty found) -- by default it is off;
7108 * **F** (full output for faulty shapes) -- by default the output is made in a short format.
7110 **Note** that Boolean Operation and Test Options are used only for a couple of argument shapes, except for <b>I</b> and <b>P</b> options that are always used to test a couple of shapes as well as a single shape.
7114 # checks a shape on self-interference
7118 # checks the validity of argument for boolean cut operations
7119 box b2 0 0 0 10 10 10
7120 bopargcheck b1 b2 -C
7123 @subsection occt_draw_7_8 Drafting and blending
7125 Drafting is creation of a new shape by tilting faces through an angle.
7127 Blending is the creation of a new shape by rounding edges to create a fillet.
7129 * Use the **depouille** command for drafting.
7130 * Use the **chamf** command to add a chamfer to an edge
7131 * Use the **blend** command for simple blending.
7132 * Use **bfuseblend** for a fusion + blending operation.
7133 * Use **bcutblend** for a cut + blending operation.
7134 * Use **buildevol**, **mkevol**, **updatevol** to realize varying radius blending.
7137 @subsubsection occt_draw_7_8_1 depouille
7141 dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...]
7144 Creates a new shape by drafting one or more faces of a shape.
7146 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.
7150 # draft a face of a box
7153 == b_1 b_2 b_3 b_4 b_5 b_6
7155 dep a b 0 0 1 b_2 10 0 10 0 1 0 5
7158 @subsubsection occt_draw_7_8_2 chamf
7162 chamf newname shape edge face S dist
7163 chamf newname shape edge face dist1 dist2
7164 chamf newname shape edge face A dist angle
7167 Creates a chamfer along the edge between faces using:
7169 * a equal distances from the edge
7170 * the edge, a face and distance, a second distance
7171 * the edge, a reference face and an angle
7173 Use the dot syntax to select the faces and edges.
7177 Let us create a chamfer based on equal distances from the edge (45 degree angle):
7181 chamf ch b . . S 0.5
7185 # select an adjacent face
7188 Let us create a chamfer based on different distances from the selected edge:
7191 chamf ch b . . 0.3 0.4
7195 # select an adjacent face
7198 Let us create a chamfer based on a distance from the edge and an angle:
7202 chamf ch b . . A 0.4 30
7206 # select an adjacent face
7209 @subsubsection occt_draw_7_8_3 blend
7213 blend result object rad1 ed1 rad2 ed2 ... [R/Q/P]
7216 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.
7220 # blend a box, click on an edge
7223 ==tolerance ang : 0.01
7224 ==tolerance 3d : 0.0001
7225 ==tolerance 2d : 1e-05
7227 ==tolblend 0.01 0.0001 1e-05 0.001
7229 # click on the edge you want ot fillet
7231 ==COMPUTE: temps total 0.1s dont :
7232 ==- Init + ExtentAnalyse 0s
7233 ==- PerformSetOfSurf 0.02s
7234 ==- PerformFilletOnVertex 0.02s
7236 ==- Reconstruction 0.06s
7240 @subsubsection occt_draw_7_8_4 bfuseblend
7244 bfuseblend name shape1 shape2 radius [-d]
7247 Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius.
7248 Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
7252 # fuse-blend two boxes
7255 ttranslate b2 -10 10 3
7256 bfuseblend a b1 b2 1
7259 @subsubsection occt_draw_7_8_4a bcutblend
7263 bcutblend name shape1 shape2 radius [-d]
7266 Creates a boolean cut of two shapes and then blends (fillets) the intersection edges using the given radius.
7267 Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
7271 # cut-blend two boxes
7274 ttranslate b2 -10 10 3
7278 @subsubsection occt_draw_7_8_5 mkevol, updatevol, buildevol
7282 mkevol result object (then use updatevol) [R/Q/P]
7283 updatevol edge u1 radius1 [u2 radius2 ...]
7287 These three commands work together to create fillets with evolving radii.
7289 * **mkevol** allows specifying the shape and the name of the result. It returns the tolerances of the fillet.
7290 * **updatevol** allows describing the filleted edges you want to create. For each edge, you give a set of coordinates: parameter and radius and the command prompts you to pick the edge of the shape which you want to modify. The parameters will be calculated along the edges and the radius function applied to the whole edge.
7291 * **buildevol** produces the result described previously in **mkevol** and **updatevol**.
7295 # makes an evolved radius on a box
7298 ==tolerance ang : 0.01
7299 ==tolerance 3d : 0.0001
7300 ==tolerance 2d : 1e-05
7302 ==tolblend 0.01 0.0001 1e-05 0.001
7305 updatevol . 0 1 1 3 2 2
7309 ==Dump of SweepApproximation
7310 ==Error 3d = 1.28548881203818e-14
7311 ==Error 2d = 1.3468326936926e-14 ,
7312 ==1.20292299999388e-14
7313 ==2 Segment(s) of degree 3
7315 ==COMPUTE: temps total 0.91s dont :
7316 ==- Init + ExtentAnalyse 0s
7317 ==- PerformSetOfSurf 0.33s
7318 ==- PerformFilletOnVertex 0.53s
7320 ==- Reconstruction 0.04s
7325 @subsection occt_draw_7_9 Analysis of topology and geometry
7327 Analysis of shapes includes commands to compute length, area, volumes and inertial properties, as well as to compute some aspects impacting shape validity.
7329 * Use **lprops**, **sprops**, **vprops** to compute integral properties.
7330 * Use **bounding** to compute and to display the bounding box of a shape.
7331 * Use **distmini** to calculate the minimum distance between two shapes.
7332 * Use **isbbinterf** to check if the two shapes are interfered by their bounding boxes.
7333 * Use **xdistef**, **xdistcs**, **xdistcc**, **xdistc2dc2dss**, **xdistcc2ds** to check the distance between two objects on even grid.
7334 * Use **checkshape** to check validity of the shape.
7335 * Use **tolsphere** to see the tolerance spheres of all vertices in the shape.
7336 * Use **validrange** to check range of an edge not covered by vertices.
7339 @subsubsection occt_draw_7_9_1 lprops, sprops, vprops
7348 * **lprops** computes the mass properties of all edges in the shape with a linear density of 1;
7349 * **sprops** of all faces with a surface density of 1;
7350 * **vprops** of all solids with a density of 1.
7352 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.
7356 # volume of a cylinder
7360 Mass : 6283.18529981086
7363 X = 4.1004749224903e-06
7364 Y = -2.03392858349861e-16
7368 366519.141445068 5.71451850691484e-12
7370 5.71451850691484e-12 366519.141444962
7371 2.26823064169991e-10 0.257640437382627
7372 2.26823064169991e-10 314159.265358863
7375 IX = 366519.141446336
7376 IY = 366519.141444962
7377 I.Z = 314159.265357595
7381 @subsubsection occt_draw_7_9_2 bounding
7385 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]
7388 Computes and displays the bounding box (BndBox) of a shape. The bounding box is a cuboid circumscribes the source shape.
7389 Generaly, bounding boxes can be divided on two main types:
7390 - axis-aligned BndBox (AABB). I.e. the box whose edges are parallel to the some axis of World Coordinate System (WCS);
7391 - oriented BndBox (OBB). I.e. not AABB.
7393 Detailed information about this command is availabe in DRAW help-system (enter "help bounding" in DRAW-application).
7395 **Example 1: Creation of AABB with given corners**
7397 bounding -c 50 100 30 180 200 100 -shape result
7404 **Example 2: Compare AABB and OBB**
7406 # Create a torus and rotate it
7408 trotate t 5 10 15 1 1 1 28
7410 # Create AABB from the torus
7411 bounding -s t -shape ra -dump -save x1 y1 z1 x2 y2 z2
7412 ==Axes-aligned bounding box
7413 ==X-range: -26.888704600189307 23.007685197265488
7414 ==Y-range: -22.237699567214314 27.658690230240481
7415 ==Z-range: -13.813966507560762 12.273995247458407
7417 # Obtain the boundaries
7418 dump x1 y1 z1 x2 y2 z2
7419 ==*********** Dump of x1 *************
7422 ==*********** Dump of y1 *************
7425 ==*********** Dump of z1 *************
7428 ==*********** Dump of x2 *************
7431 ==*********** Dump of y2 *************
7434 ==*********** Dump of z2 *************
7437 # Compute the volume of AABB
7441 # Let us check this value
7442 dval (x2-x1)*(y2-y1)*(z2-z1)
7443 ==64949.886543606823
7446 The same result is obtained.
7449 # Create OBB from the torus
7450 bounding -s t -shape ro -dump -obb
7451 ==Oriented bounding box
7452 ==Center: -1.9405097014619073 2.7104953315130857 -0.76998563005117782
7453 ==X-axis: 0.31006700219833244 -0.23203206410428409 0.9219650619059514
7454 ==Y-axis: 0.098302309139513336 -0.95673739537318336 -0.27384340837854165
7455 ==Z-axis: 0.94561890324040099 0.17554109923901748 -0.27384340837854493
7456 ==Half X: 5.0000002000000077
7457 ==Half Y: 26.783728747002169
7458 ==Half Z: 26.783728747002165
7460 # Compute the volume of OBB
7465 As we can see, the volume of OBB is significantly less than the volume of AABB.
7467 @subsubsection occt_draw_7_9_2a isbbinterf
7471 isbbinterf shape1 shape2 [-o]
7474 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, axes-aligned boxes will be checked.
7476 **Example 1: Not interfered AABB**
7478 box b1 100 60 140 20 10 80
7479 box b2 210 200 80 120 60 90
7481 ==The shapes are NOT interfered by AABB.
7484 **Example 2: Interfered AABB**
7487 box b2 100 100 100 50 50 50
7489 ==The shapes are interfered by AABB.
7492 **Example 3: Not interfered OBB**
7496 trotate b1 -150 -150 -150 1 2 3 -40
7497 trotate b2 -150 -150 -150 1 5 2 60
7499 # Check of interference
7501 ==The shapes are NOT interfered by OBB.
7504 **Example 4: Interfered OBB**
7508 trotate b1 -50 -50 -50 1 1 1 -40
7509 trotate b2 -50 -50 -50 1 1 1 60
7511 # Check of interference
7513 ==The shapes are interfered by OBB.
7516 @subsubsection occt_draw_7_9_3 distmini
7520 distmini name Shape1 Shape2
7523 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(red) and the results are listed in the shell window. The *distmini* lines are considered as shapes which have a value v.
7527 box b 0 0 0 10 20 30
7528 box b2 30 30 0 10 20 30
7530 ==the distance value is : 22.3606797749979
7531 ==the number of solutions is :2
7534 ==the type of the solution on the first shape is 0
7535 ==the type of the solution on the second shape is 0
7536 ==the coordinates of the point on the first shape are:
7538 ==the coordinates of the point on the second shape
7542 ==solution number 2:
7543 ==the type of the solution on the first shape is 0
7544 ==the type of the solution on the second shape is 0
7545 ==the coordinates of the point on the first shape are:
7547 ==the coordinates of the point on the second shape
7554 @subsubsection occt_draw_7_9_4 xdistef, xdistcs, xdistcc, xdistc2dc2dss, xdistcc2ds
7559 xdistcs curve surface firstParam lastParam [NumberOfSamplePoints]
7560 xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints]
7561 xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints]
7562 xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints]
7565 It is assumed that curves have the same parametrization range and *startParam* is less than *finishParam*.
7567 Commands with prefix *xdist* allow checking the distance between two objects on even grid:
7568 * **xdistef** -- distance between edge and face;
7569 * **xdistcs** -- distance between curve and surface. This means that the projection of each sample point to the surface is computed;
7570 * **xdistcc** -- distance between two 3D curves;
7571 * **xdistcc2ds** -- distance between 3d curve and 2d curve on surface;
7572 * **xdistc2dc2dss** -- distance between two 2d curves on surface.
7579 xdistcs c_1 s1 0 1 100
7580 xdistcc2ds c_1 c2d2_1 s2 0 1
7581 xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
7584 @subsubsection occt_draw_7_9_5 checkshape
7588 checkshape [-top] shape [result] [-short]
7592 * *top* -- optional parameter, which allows checking only topological validity of a shape.
7593 * *shape* -- the only required parameter which represents the name of the shape to check.
7594 * *result* -- optional parameter which is the prefix of the output shape names.
7595 * *short* -- a short description of the check.
7597 **checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape.
7601 # checkshape returns a comment valid or invalid
7604 # returns the comment
7605 this shape seems to be valid
7608 @subsubsection occt_draw_7_9_6 tolsphere
7616 * *shape* -- the name of the shape to process.
7618 **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.
7622 # tolsphere returns all names of created spheres.
7624 settolerance b1 0.05
7626 # creates spheres and returns the names
7627 b1_v1 b1_v2 b1_v3 b1_v4 b1_v5 b1_v6 b1_v7 b1_v8
7630 @subsubsection occt_draw_7_9_7 validrange
7634 validrange edge [(out) u1 u2]
7638 * *edge* -- the name of the edge to analyze.
7639 * *u1*, *u2* -- optional names of variables to put the range into.
7641 **validrange** computes valid range of the edge. If *u1* and *u2* are not given it returns first and last parameters. Otherwise, it sets the variables u1 and u2.
7650 1.9884375000000002e-008 3.1415926337054181
7653 1.9884375000000002e-008
7659 @subsection occt_draw_7_10 Surface creation
7661 Surface creation commands include surfaces created from boundaries and from spaces between shapes.
7662 * **gplate** creates a surface from a boundary definition.
7663 * **filling** creates a surface from a group of surfaces.
7665 @subsubsection occt_draw_7_10_1 gplate,
7669 gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ...
7672 Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces.
7680 beziercurve c1 3 0 0 0 1 0 1 2 0 0
7686 trotate e3 0 0 0 0 0 1 90
7689 # create the surface
7690 gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0
7692 ======== Results ===========
7693 DistMax=8.50014503228635e-16
7695 Calculation time: 0.33
7697 Approximation results
7698 Approximation error : 2.06274907619957e-13
7699 Criterium error : 4.97600631215754e-14
7701 #to create a surface defined by edges and passing through a point
7702 # to define the border edges and the point
7707 beziercurve c1 3 0 0 0 1 0 1 2 0 0
7713 trotate e3 0 0 0 0 0 1 90
7718 # to create the surface
7719 gplate r2 4 1 p e1 0 e2 0 e3 0 e4 0 pp
7721 ======== Results ===========
7722 DistMax=3.65622157610934e-06
7724 Calculculation time: 0.27
7726 Approximation results
7727 Approximation error : 0.000422195884750181
7728 Criterium error : 3.43709808053967e-05
7731 @subsubsection occt_draw_7_10_2 filling, fillingparam
7735 filling result nbB nbC nbP [SurfInit] [edge][face]order...
7736 edge[face]order... point/u v face order...
7739 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.
7741 To define the surface border:
7743 * enter the number of edges, constraints, and points
7744 * enumerate the edges, constraints and points
7746 The surface can pass through other points. These are defined after the border definition.
7748 You can use the *fillingparam* command to access the filling parameters.
7752 * <i>-l</i> : to list current values
7753 * <i>-i</i> : to set default values
7754 * <i>-rdeg nbPonC nbIt anis </i> : to set filling options
7755 * <i>-c t2d t3d tang tcur </i> : to set tolerances
7756 * <i>-a maxdeg maxseg </i> : Approximation option
7760 # to create four curved survaces and a point
7765 beziercurve c1 3 0 0 0 1 0 1 2 0 0
7771 trotate e3 0 0 0 0 0 1 90
7782 # to create a tangential surface
7783 filling r1 4 0 0 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1
7784 # to create a tangential surface passing through point pp
7785 filling r2 4 0 1 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 pp#
7786 # to visualise the surface in detail
7788 # to display the current filling parameters
7805 @subsection occt_draw_7_11 Complex Topology
7807 Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling.
7810 @subsubsection occt_draw_7_11_1 offsetshape, offsetcompshape
7814 offsetshape r shape offset [tol] [face ...]
7815 offsetcompshape r shape offset [face ...]
7818 **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.
7820 The resulting shape is based on a calculation of intersections. In case of simple shapes such as a box, only the adjacent intersections are required and you can use the **offsetshape** command.
7822 In case of complex shapes, where intersections can occur from non-adjacent edges and faces, use the **offsetcompshape** command. **comp** indicates complete and requires more time to calculate the result.
7824 The opening between the object interior and exterior is defined by the argument face or faces.
7830 == b1_1 b1_2 b1_3 b1_4 b1_5 b1_6
7831 offsetcompshape r b1 -1 b1_3
7834 @subsubsection occt_draw_7_11_2 featprism, featdprism, featrevol, featlf, featrf
7838 featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)
7839 featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)
7840 featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)
7841 featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)
7842 featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)
7843 featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]
7844 featperformval prism/revol/dprism/lf result value
7847 **featprism** loads the arguments for a prism with contiguous sides normal to the face.
7849 **featdprism** loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle.
7851 **featrevol** loads the arguments for a prism with a circular evolution.
7853 **featlf** loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline.
7855 **featrf** loads the arguments for a rib or slot with a curved surface. This feature uses a circular face and a wire as a guideline.
7857 **featperform** loads the arguments to create the feature.
7859 **featperformval** uses the defined arguments to create a feature with a limiting value.
7861 All the features are created from a set of arguments which are defined when you initialize the feature context. Negative values can be used to create depressions.
7865 Let us create a feature prism with a draft angle and a normal direction :
7868 # create a box with a wire contour on the upper face
7870 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7872 # loads the feature arguments defining the draft angle
7873 featdprism b f b_6 5 1 0
7874 # create the feature
7875 featperformval dprism r 1
7876 ==BRepFeat_MakeDPrism::Perform(Height)
7877 BRepFeat_Form::GlobalPerform ()
7883 Let us create a feature prism with circular direction :
7886 # create a box with a wire contour on the upper face
7888 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7890 # loads the feature arguments defining a rotation axis
7891 featrevol b f b_6 1 0 1 0 1 0 1 0
7892 featperformval revol r 45
7893 ==BRepFeat_MakeRevol::Perform(Angle)
7894 BRepFeat_Form::GlobalPerform ()
7901 Let us create a slot using the linear feature :
7904 #create the base model using the multi viewer
7906 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
7908 # create the contour for the linear feature
7909 vertex v1 -0.2 4 0.3
7911 vertex v3 0.2 0.2 0.3
7913 vertex v5 4 -0.2 0.3
7920 plane pl 0.2 0.2 0.3 0 0 1
7921 # loads the linear feature arguments
7922 featlf pr w pl 0 0 0.3 0 0 0 0 1
7923 featperform lf result
7926 Let us create a rib using the revolution feature :
7929 #create the base model using the multi viewer
7932 # create the contour for the revolution feature
7933 profile w c 1 190 WW
7934 trotate w 0 0 0 1 0 0 90
7936 trotate w -3 0 1.5 0 0 1 180
7937 plane pl -3 0 1.5 0 1 0
7938 # loads the revolution feature arguments
7939 featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1
7940 featperform rf result
7943 @subsubsection occt_draw_7_11_3 draft
7947 draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal]
7950 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.
7952 * The draft angle is measured in radians.
7953 * The draft direction is determined by the argument -INTERNAL
7954 * The argument Ri/Ro deftermines wether the corner edges of the draft surfaces are angular or rounded.
7955 * Arguments that can be used to define the surface distance are:
7956 * length, a defined distance
7957 * shape, until the surface contacts a shape
7958 * surface, until the surface contacts a surface.
7960 **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.
7964 # to create a simple profile
7965 profile p F 0 0 x 2 y 4 tt 0 4 w
7966 # creates a draft with rounded angles
7967 draft res p 0 0 1 3 1 -Ro
7968 # to create a profile with an internal angle
7969 profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w
7970 # creates a draft with rounded external angles
7971 draft res p 0 0 1 3 1 -Ro
7974 @subsubsection occt_draw_7_11_4 deform
7978 deform newname name CoeffX CoeffY CoeffZ
7981 Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions.
7987 # the conversion to bspline is followed by the
7992 @subsubsection occt_draw_7_11_5 nurbsconvert
7997 nurbsconvert result name [result name]
8000 Changes the NURBS curve definition of a shape to a Bspline curve definition. This conversion is required for assymetric deformation and prepares the arguments for other commands such as **deform**. The conversion can be necessary when transferring shape data to other applications.
8003 @subsubsection occt_draw_7_11_6 edgestofaces
8005 **edgestofaces** - The command allows building planar faces from the planar edges randomly located in 3D space.
8007 It has the following syntax:
8009 edgestofaces r_faces edges [-a AngTol -s Shared(0/1)]
8012 * -a AngTol - angular tolerance used for distinguishing the planar faces;
8013 * -s Shared(0/1) - boolean flag which defines whether the input edges are already shared or have to be intersected.
8016 @subsection occt_draw_7_12 Texture Mapping to a Shape
8018 Texture mapping allows you to map textures on a shape. Textures are texture image files and several are predefined. You can control the number of occurrences of the texture on a face, the position of a texture and the scale factor of the texture.
8020 @subsubsection occt_draw_7_12_1 vtexture
8024 vtexture NameOfShape TextureFile
8025 vtexture NameOfShape
8026 vtexture NameOfShape ?
8027 vtexture NameOfShape IdOfTexture
8030 **TextureFile** identifies the file containing the texture you want. The same syntax without **TextureFile** disables texture mapping. The question-mark <b>?</b> lists available textures. **IdOfTexture** allows applying predefined textures.
8032 @subsubsection occt_draw_7_12_2 vtexscale
8036 vtexscale NameOfShape ScaleU ScaleV
8037 vtexscale NameOfShape ScaleUV
8038 vtexscale NameOfShape
8041 *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.
8043 The syntax without *ScaleU*, *ScaleV* or *ScaleUV* disables texture scaling.
8045 @subsubsection occt_draw_7_12_3 vtexorigin
8049 vtexorigin NameOfShape UOrigin VOrigin
8050 vtexorigin NameOfShape UVOrigin
8051 vtexorigin NameOfShape
8054 *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.
8056 The syntax without *UOrigin*, *VOrigin* or *UVOrigin* disables origin positioning.
8058 @subsubsection occt_draw_7_12_4 vtexrepeat
8062 vtexrepeat NameOfShape URepeat VRepeat
8063 vtexrepeat NameOfShape UVRepeat
8064 vtexrepeat NameOfShape
8067 *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.
8069 The same syntax without *URepeat*, *VRepeat* or *UVRepeat* disables texture repetition.
8071 @subsubsection occt_draw_7_12_5 vtexdefault
8075 vtexdefault NameOfShape
8078 *Vtexdefault* sets or resets the texture mapping default parameters.
8082 * *URepeat = VRepeat = 1* no repetition
8083 * *UOrigin = VOrigin = 1* origin set at (0,0)
8084 * *UScale = VScale = 1* texture covers 100% of the face
8087 @section occt_draw_20 General Fuse Algorithm commands
8089 This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for debugging of General Fuse Algorithm (GFA). It is also applicable for all General Fuse based algorithms such as Boolean Operations Algorithm (BOA), Splitter Algorithm (SPA), Cells Builder Algorithm etc.
8091 See @ref occt_user_guides__boolean_operations "Boolean operations" user's guide for the description of these algorithms.
8093 @subsection occt_draw_20_1 Definitions
8095 The following terms and definitions are used in this document:
8096 * **Objects** -- list of shapes that are arguments of the algorithm.
8097 * **Tools** -- list of shapes that are arguments of the algorithm. Difference between Objects and Tools is defined by specific requirements of the operations (Boolean Operations, Splitting Operation).
8098 * **DS** -- internal data structure used by the algorithm (*BOPDS_DS* object).
8099 * **PaveFiller** -- intersection part of the algorithm (*BOPAlgo_PaveFiller* object).
8100 * **Builder** -- builder part of the algorithm (*BOPAlgo_Builder* object).
8101 * **IDS Index** -- the index of the vector *myLines*.
8103 @subsection occt_draw_20_2 General commands
8105 * **bclearobjects** -- clears the list of Objects;
8106 * **bcleartools** -- clears the list of Tools;
8107 * **baddobjects** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Objects;
8108 * **baddtools** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Tools;
8109 * **bfillds** -- performs the Intersection Part of the Algorithm;
8110 * **bbuild** *r* -- performs the Building Part of the Algorithm (General Fuse operation); *r* is the resulting shape;
8111 * **bsplit** *r* -- performs the Splitting operation; *r* is the resulting shape;
8112 * **bbop** *r* *iOp* -- performs the Boolean operation; *r* is the resulting shape; *iOp* - type of the operation (0 - COMMON; 1 - FUSE; 2 - CUT; 3 - CUT21; 4 - SECTION);
8113 * **bcbuild** *rx* -- performs initialization of the *Cells Builder* algorithm (see @ref occt_algorithms_10c_Cells_1 "Usage of the Cells Builder algorithm" for more details).
8115 @subsection occt_draw_20_3 Commands for Intersection Part
8117 All commands listed below are available when the Intersection Part of the algorithm is done (i.e. after the command *bfillds*).
8119 @subsubsection occt_draw_20_3_1 bopds
8127 * all BRep shapes of arguments that are in the DS [default];
8128 * <i>-v</i> : only vertices of arguments that are in the DS;
8129 * <i>-e</i> : only edges of arguments that are in the DS;
8130 * <i>-f</i> : only faces of arguments that are in the DS.
8132 @subsubsection occt_draw_20_3_2 bopdsdump
8134 Prints contents of the DS.
8141 Ranges:2 number of ranges
8142 range: 0 33 indices for range 1
8143 range: 34 67 indices for range 2
8144 Shapes:68 total number of source shapes
8146 1 : SHELL { 2 12 22 26 30 32 }
8147 2 : FACE { 4 5 6 7 8 9 10 11 }
8148 3 : WIRE { 4 7 9 11 }
8156 @code 0 : SOLID { 1 } @endcode has the following meaning:
8157 * *0* -- index in the DS;
8158 * *SOLID* -- type of the shape;
8159 * <i>{ 1 }</i> -- a DS index of the successors.
8161 @subsubsection occt_draw_20_3_3 bopindex
8167 Prints DS index of shape *S*.
8169 @subsubsection occt_draw_20_3_4 bopiterator
8176 Prints pairs of DS indices of source shapes that are intersected in terms of bounding boxes.
8178 <i>[t1 t2]</i> are types of the shapes:
8185 Draw[104]> bopiterator 6 4
8194 * *bopiterator 6 4* prints pairs of indices for types: edge/face;
8195 * *z58 z12* -- DS indices of intersecting edge and face.
8198 @subsubsection occt_draw_20_3_5 bopinterf
8205 Prints contents of *myInterfTB* for the type of interference *t*:
8206 * *t=0* : vertex/vertex;
8207 * *t=1* : vertex/edge;
8208 * *t=2* : edge/edge;
8209 * *t=3* : vertex/face;
8210 * *t=4* : edge/face.
8214 Draw[108]> bopinterf 4
8215 EF: (58, 12, 68), (17, 56, 69), (19, 64, 70), (45, 26, 71), (29, 36, 72), (38, 32, 73), 6 EF found.
8218 Here, record <i>(58, 12, 68)</i> means:
8219 * *58* -- a DS index of the edge;
8220 * *12* -- a DS index of the face;
8221 * *68* -- a DS index of the new vertex.
8223 @subsubsection occt_draw_20_3_6 bopsp
8225 Displays split edges.
8230 edge 58 : z58_74 z58_75
8231 edge 17 : z17_76 z17_77
8232 edge 19 : z19_78 z19_79
8233 edge 45 : z45_80 z45_81
8234 edge 29 : z29_82 z29_83
8235 edge 38 : z38_84 z38_85
8238 * *edge 58* -- 58 is a DS index of the original edge.
8239 * *z58_74 z58_75* -- split edges, where 74, 75 are DS indices of the split edges.
8241 @subsubsection occt_draw_20_3_7 bopcb
8248 Prints Common Blocks for:
8249 * all source edges (by default);
8250 * the source edge with the specified index *nE*.
8256 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
8260 This command dumps common blocks for the source edge with index 17.
8261 * *PB* -- information about the Pave Block;
8262 * *71* -- a DS index of the split edge
8263 * *17* -- a DS index of the original edge
8264 * <i>Pave1 : { 68 3.000 }</i> -- information about the Pave:
8265 * *68* -- a DS index of the vertex of the pave
8266 * *3.000* -- a parameter of vertex 68 on edge 17
8267 * *Faces: 36* -- 36 is a DS index of the face the common block belongs to.
8270 @subsubsection occt_draw_20_3_8 bopfin
8277 Prints Face Info about IN-parts for the face with DS index *nF*.
8283 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
8284 PB:{ E:75 orE:19 Pave1: { 69 3.000 } Pave2: { 18 10.000 } }
8290 * <i>PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }</i> -- information about the Pave Block;
8291 * <i>vrts In ... 18 </i> -- a DS index of the vertex IN the face.
8293 @subsubsection occt_draw_20_3_9 bopfon
8299 Print Face Info about ON-parts for the face with DS index *nF*.
8305 PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }
8306 PB:{ E:76 orE:45 Pave1: { 69 0.000 } Pave2: { 71 10.000 } }
8307 PB:{ E:78 orE:43 Pave1: { 71 0.000 } Pave2: { 70 10.000 } }
8308 PB:{ E:74 orE:41 Pave1: { 68 0.000 } Pave2: { 70 10.000 } }
8313 * <i>PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }</i> -- information about the Pave Block;
8314 * <i>vrts On: ... 68 69 70 71</i> -- DS indices of the vertices ON the face.
8316 @subsubsection occt_draw_20_3_10 bopwho
8323 Prints the information about the shape with DS index *nF*.
8331 * *rank: 0* -- means that shape 5 results from the Argument with index 0.
8335 Draw[118]> bopwho 68
8338 FF curves: (12, 56),
8339 FF curves: (12, 64),
8342 This means that shape 68 is a result of the following interferences:
8343 * *EF: (58, 12)* -- edge 58 / face 12
8344 * *FF curves: (12, 56)* -- edge from the intersection curve between faces 12 and 56
8345 * *FF curves: (12, 64)* -- edge from the intersection curve between faces 12 and 64
8347 @subsubsection occt_draw_20_3_11 bopnews
8354 * <i>-v</i> -- displays all new vertices produced during the operation;
8355 * <i>-e</i> -- displays all new edges produced during the operation.
8357 @subsection occt_draw_20_4 Commands for the Building Part
8359 The commands listed below are available when the Building Part of the algorithm is done (i.e. after the command *bbuild*).
8361 @subsubsection occt_draw_20_4_1 bopim
8368 Shows the compound of shapes that are images of shape *S* from the argument.
8371 @section occt_draw_8 Data Exchange commands
8373 This chapter presents some general information about Data Exchange (DE) operations.
8375 DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.)
8377 This files include a number of entities. Each entity has its own number in the file which we call label and denote as # for a STEP file and D for an IGES file. Each file has entities called roots (one or more). A full description of such entities is contained in the Users' Guides
8378 * for <a href="user_guides__step.html#occt_step_1">STEP format</a> and
8379 * for <a href="user_guides__iges.html#occt_iges_1">IGES format</a>.
8381 Each Draw session has an interface model, which is a structure for keeping various information.
8383 The first step of translation is loading information from a file into a model.
8384 The second step is creation of an OpenCASCADE shape from this model.
8386 Each entity from a file has its own number in the model (num). During the translation a map of correspondences between labels(from file) and numbers (from model) is created.
8388 The model and the map are used for working with most of DE commands.
8390 @subsection occt_draw_8_1 IGES commands
8392 @subsubsection occt_draw_8_1_1 igesread
8396 igesread <file_name> <result_shape_name> [<selection>]
8399 Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted.
8402 | N | Mode | Description |
8403 | :-- | :-- | :---------- |
8404 | 0 | End | finish conversion and exit igesbrep |
8405 | 1 | Visible roots | convert only visible roots |
8406 | 2 | All roots | convert all roots |
8407 | 3 | One entity | convert entity with number provided by the user |
8408 | 4 | Selection | convert only entities contained in selection |
8411 After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes (e.g., one shape per root or one shape for all the entities). It is also possible to save loaded shapes in files, and to cancel loading.
8413 The second parameter of this command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was *s*, they will be *s_1, ... s_N*.
8415 <i>\<selection\></i> specifies the scope of selected entities in the model, by default it is *xst-transferrable-roots*. If we use symbol <i>*</i> as <i>\<selection\></i> all roots will be translated.
8417 See also the detailed description of <a href="user_guides__iges.html#occt_iges_2_3_4">Selecting IGES entities</a>.
8421 # translation all roots from file
8422 igesread /disk01/files/model.igs a *
8425 @subsubsection occt_draw_8_1_2 tplosttrim
8429 tplosttrim [<IGES_type>]
8432 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.
8433 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.
8434 Optional parameter <i>\<IGES_type\></i> can be *0TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces.
8438 tplosttrim TrimmedSurface
8441 @subsubsection occt_draw_8_1_3 brepiges
8445 brepiges <shape_name> <filename.igs>
8448 Writes an OCCT shape to an IGES file.
8452 # write shape with name aa to IGES file
8453 brepiges aa /disk1/tmp/aaa.igs
8454 == unit (write) : MM
8455 == mode write : Faces
8456 == To modifiy : command param
8457 == 1 Shapes written, giving 345 Entities
8458 == Now, to write a file, command : writeall filename
8459 == Output on file : /disk1/tmp/aaa.igs
8463 @subsection occt_draw_8_2 STEP commands
8465 These commands are used during the translation of STEP models.
8468 @subsubsection occt_draw_8_2_1 stepread
8472 stepread file_name result_shape_name [selection]
8475 Read a STEP file to an OCCT shape.
8476 This command will interactively ask the user to select a set of entities to be converted:
8478 | N | Mode | Description |
8479 | :---- | :---- | :---- |
8480 | 0 | End | Finish transfer and exit stepread |
8481 | 1 | root with rank 1 | Transfer first root |
8482 | 2 | root by its rank | Transfer root specified by its rank |
8483 | 3 | One entity | Transfer entity with a number provided by the user |
8484 | 4 | Selection | Transfer only entities contained in selection |
8486 After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes.
8487 The second parameter of this command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was *s*, they will be *s_1, ... s_N*.
8488 <i>\<selection\></i> specifies the scope of selected entities in the model. If we use symbol <i>*</i> as <i>\<selection\></i> all roots will be translated.
8490 See also the detailed description of <a href="user_guides__step.html#occt_step_2_3_6">Selecting STEP entities</a>.
8494 # translation all roots from file
8495 stepread /disk01/files/model.stp a *
8498 @subsubsection occt_draw_8_2_2 stepwrite
8502 stepwrite mode shape_name file_name
8505 Writes an OCCT shape to a STEP file.
8507 The following modes are available :
8508 * *a* -- as is -- the mode is selected automatically depending on the type & geometry of the shape;
8509 * *m* -- *manifold_solid_brep* or *brep_with_voids*
8510 * *f* -- *faceted_brep*
8511 * *w* -- *geometric_curve_set*
8512 * *s* -- *shell_based_surface_model*
8514 For further information see <a href="#user_guides__step.html#occt_step_6_5">Writing a STEP file</a>.
8518 Let us write shape *a* to a STEP file in mode *0*.
8521 stepwrite 0 a /disk1/tmp/aaa.igs
8525 @subsection occt_draw_8_3 General commands
8527 These are auxilary commands used for the analysis of result of translation of IGES and STEP files.
8529 @subsubsection occt_draw_8_3_1 count
8533 count <counter> [<selection>]
8536 Calculates statistics on the entities in the model and outputs a count of entities.
8538 The optional selection argument, if specified, defines a subset of entities, which are to be taken into account. The first argument should be one of the currently defined counters.
8540 | Counter | Operation |
8541 | :-------- | :-------- |
8542 | xst-types | Calculates how many entities of each OCCT type exist |
8543 | step214-types | Calculates how many entities of each STEP type exist |
8550 @subsubsection occt_draw_8_3_2 data
8557 Obtains general statistics on the loaded data.
8558 The information printed by this command depends on the symbol specified.
8562 # print full information about warnings and fails
8567 | :------ | :------ |
8568 | g | Prints the information contained in the header of the file |
8569 | c or f | Prints messages generated during the loading of the STEP file (when the procedure of the integrity of the loaded data check is performed) and the resulting statistics (f works only with fail messages while c with both fail and warning messages) |
8570 | t | The same as c or f, with a list of failed or warned entities |
8571 | m or l | The same as t but also prints a status for each entity |
8572 | e | Lists all entities of the model with their numbers, types, validity status etc. |
8573 | R | The same as e but lists only root entities |
8577 @subsubsection occt_draw_8_3_3 elabel
8584 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.
8591 @subsubsection occt_draw_8_3_4 entity
8595 entity <#(D)>_or_<num> <level_of_information>
8598 The content of an IGES or STEP entity can be obtained by using this command.
8599 Entity can be determined by its number or label.
8600 <i>\<level_of_information\></i> has range [0-6]. You can get more information about this level using this command without parameters.
8604 # full information for STEP entity with label 84
8608 @subsubsection occt_draw_8_3_5 enum
8615 Prints a number for the entity with a given label.
8619 # give a number for IGES entity with label 21
8623 @subsubsection occt_draw_8_3_6 estatus
8627 estatus <#(D)>_or_<num>
8630 The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command.
8637 @subsubsection occt_draw_8_3_7 fromshape
8641 fromshape <shape_name>
8644 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.
8651 @subsubsection occt_draw_8_3_8 givecount
8655 givecount <selection_name> [<selection_name>]
8659 Prints a number of loaded entities defined by the selection argument.
8660 Possible values of \<selection_name\> you can find in the “IGES FORMAT Users’s Guide”.
8664 givecount xst-model-roots
8667 @subsubsection occt_draw_8_3_9 givelist
8671 givelist <selection_name>
8674 Prints a list of a subset of loaded entities defined by the selection argument:
8675 | Selection | Description |
8676 | :-------- | :----------- |
8677 | xst-model-all | all entities of the model |
8678 | xst-model-roots | all roots |
8679 | xst-pointed | (Interactively) pointed entities (not used in DRAW) |
8680 | xst-transferrable-all | all transferable (recognized) entities |
8681 | xst-transferrable-roots | Transferable roots |
8686 # give a list of all entities of the model
8687 givelist xst-model-all
8690 @subsubsection occt_draw_8_3_10 listcount
8692 Syntax: listcount \<counter\> [\<selection\> ...]
8694 Prints a list of entities per each type matching the criteria defined by arguments.
8695 Optional <i>\<selection\></i> argument, if specified, defines a subset of entities, which are to be taken into account. Argument <i>\<counter\></i> should be one of the currently defined counters:
8697 | Counter | Operation |
8698 | :----- | :------ |
8699 | xst-types | Calculates how many entities of each OCCT type exist |
8700 | iges-types | Calculates how many entities of each IGES type and form exist |
8701 | iges-levels | Calculates how many entities lie in different IGES levels |
8708 @subsubsection occt_draw_8_3_11 listitems
8715 This command prints a list of objects (counters, selections etc.) defined in the current session.
8718 @subsubsection occt_draw_8_3_12 listtypes
8722 listtypes [<selection_name> ...]
8725 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.
8728 @subsubsection occt_draw_8_3_13 newmodel
8735 Clears the current model.
8738 @subsubsection occt_draw_8_3_14 param
8742 param [<parameter>] [<value>]
8745 This command is used to manage translation parameters.
8746 Command without arguments gives a full list of parameters with current values.
8747 Command with <i>\<parameter\></i> (without <i><value></i>) gives us the current value of this parameter and all possible values for it. Command with <i><value></i> sets this new value to <i>\<parameter\></i>.
8751 Let us get the information about possible schemes for writing STEP file :
8754 param write.step.schema
8757 @subsubsection occt_draw_8_3_15 sumcount
8761 sumcount <counter> [<selection> ...]
8764 Prints only a number of entities per each type matching the criteria defined by arguments.
8771 @subsubsection occt_draw_8_3_16 tpclear
8778 Clears the map of correspondences between IGES or STEP entities and OCCT shapes.
8782 @subsubsection occt_draw_8_3_17 tpdraw
8786 tpdraw <#(D)>_or_<num>
8794 @subsubsection occt_draw_8_3_18 tpent
8798 tpent <#(D)>_or_<num>
8801 Get information about the result of translation of the given IGES or STEP entity.
8808 @subsubsection occt_draw_8_3_19 tpstat
8812 tpstat [*|?]<symbol> [<selection>]
8816 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 <i>\<symbol\></i> defines what information will be printed:
8818 * *g* -- General statistics (a list of results and messages)
8819 * *c* -- Count of all warning and fail messages
8820 * *C* -- List of all warning and fail messages
8821 * *f* -- Count of all fail messages
8822 * *F* -- List of all fail messages
8823 * *n* -- List of all transferred roots
8824 * *s* -- The same, with types of source entity and the type of result
8825 * *b* -- The same, with messages
8826 * *t* -- Count of roots for geometrical types
8827 * *r* -- Count of roots for topological types
8828 * *l* -- The same, with the type of the source entity
8830 The sign \* before parameters *n, s, b, t, r* makes it work on all entities (not only on roots).
8832 The sign ? before *n, s, b, t* limits the scope of information to invalid entities.
8834 Optional argument \<selection\> can limit the action of the command to the selection, not to all entities.
8836 To get help, run this command without arguments.
8840 # translation ratio on IGES faces
8841 tpstat *l iges-faces
8844 @subsubsection occt_draw_8_3_20 xload
8851 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.
8855 xload /disk1/tmp/aaa.stp
8859 @subsection occt_draw_8_4 Overview of XDE commands
8861 These commands are used for translation of IGES and STEP files into an XCAF document (special document is inherited from CAF document and is intended for Extended Data Exchange (XDE) ) and working with it. XDE translation allows reading and writing of shapes with additional attributes -- colors, layers etc. All commands can be divided into the following groups:
8862 * XDE translation commands
8863 * XDE general commands
8864 * XDE shape’s commands
8865 * XDE color’s commands
8866 * XDE layer’s commands
8867 * XDE property’s commands
8869 Reminding: All operations of translation are performed with parameters managed by command @ref occt_draw_8_3_14 "param".
8871 @subsubsection occt_draw_8_4_1 ReadIges
8875 ReadIges document file_name
8878 Reads information from an IGES file to an XCAF document.
8882 ReadIges D /disk1/tmp/aaa.igs
8883 ==> Document saved with name D
8886 @subsubsection occt_draw_8_4_2 ReadStep
8890 ReadStep <document> <file_name>
8893 Reads information from a STEP file to an XCAF document.
8897 ReadStep D /disk1/tmp/aaa.stp
8898 == Document saved with name D
8901 @subsubsection occt_draw_8_4_3 WriteIges
8905 WriteIges <document> <file_name>
8910 WriteIges D /disk1/tmp/aaa.igs
8913 @subsubsection occt_draw_8_4_4 WriteStep
8917 WriteStep <document> <file_name>
8920 Writes information from an XCAF document to a STEP file.
8924 WriteStep D /disk1/tmp/aaa.stp
8927 @subsubsection occt_draw_8_4_5 XFileCur
8934 Returns the name of file which is set as the current one in the Draw session.
8942 @subsubsection occt_draw_8_4_6 XFileList
8949 Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file.
8954 ==> *as1-ct-Bolt.stp*
8955 ==> *as1-ct-L-Bracktet.stp*
8956 ==> *as1-ct-LBA.stp*
8957 ==> *as1-ct-NBA.stp*
8961 @subsubsection occt_draw_8_4_7 XFileSet
8968 Sets the current file taking it from the components list of the assemble file.
8972 XFileSet as1-ct-NBA.stp
8975 @subsubsection occt_draw_8_4_8 XFromShape
8982 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.
8987 ==> Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp
8990 @subsection occt_draw_8_5 XDE general commands
8992 @subsubsection occt_draw_8_5_1 XNewDoc
8999 Creates a new XCAF document.
9006 @subsubsection occt_draw_8_5_2 XShow
9010 XShow <document> [ <label1> … ]
9013 Shows a shape from a given label in the 3D viewer. If the label is not given -- shows all shapes from the document.
9017 # show shape from label 0:1:1:4 from document D
9021 @subsubsection occt_draw_8_5_3 XStat
9028 Prints common information from an XCAF document.
9033 ==>Statistis of shapes in the document:
9037 ==>Total number of labels for shapes in the document = 32
9038 ==>Number of labels with name = 27
9039 ==>Number of labels with color link = 3
9040 ==Number of labels with layer link = 0
9041 ==>Statistis of Props in the document:
9042 ==>Number of Centroid Props = 5
9043 ==>Number of Volume Props = 5
9044 ==>Number of Area Props = 5
9045 ==>Number of colors = 4
9046 ==>BLUE1 RED YELLOW BLUE2
9047 ==>Number of layers = 0
9050 @subsubsection occt_draw_8_5_4 XWdump
9054 XWdump <document> <filename>
9057 Saves the contents of the viewer window as an image (XWD, png or BMP file).
9058 <i>\<filename\></i> must have a corresponding extention.
9062 XWdump D /disk1/tmp/image.png
9065 @subsubsection occt_draw_8_5_5 Xdump
9069 Xdump <document> [int deep {0|1}]
9072 Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes.
9077 ==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
9078 ==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
9079 ==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
9080 ==> ASSEMBLY 0:1:1:4 PLATE(0xe8387780)
9081 ==> ASSEMBLY 0:1:1:5 ROD(0xe8475418)
9082 ==> ASSEMBLY 0:1:1:6 AS1(0xe8476968)
9083 ==> ASSEMBLY 0:1:1:7 L-BRACKET-ASSEMBLY(0xe8476230)
9084 ==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
9085 ==> ASSEMBLY 0:1:1:8 NUT-BOLT-ASSEMBLY(0xe8475ec0)
9086 ==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
9087 ==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
9091 @subsection occt_draw_8_6 XDE shape commands
9093 @subsubsection occt_draw_8_6_1 XAddComponent
9097 XAddComponent <document> <label> <shape>
9100 Adds a component shape to assembly.
9104 Let us add shape b as component shape to assembly shape from label *0:1:1:1*
9107 XAddComponent D 0:1:1:1 b
9110 @subsubsection occt_draw_8_6_2 XAddShape
9114 XAddShape <document> <shape> [makeassembly=1]
9117 Adds a shape (or an assembly) to a document. If this shape already exists in the document, then prints the label which points to it. By default, a new shape is added as an assembly (i.e. last parameter 1), otherwise it is necessary to pass 0 as the last parameter.
9121 # add shape b to document D
9124 # if pointed shape is compound and last parameter in
9125 # XAddShape command is used by default (1), then for
9126 # each subshapes new label is created
9129 @subsubsection occt_draw_8_6_3 XFindComponent
9133 XFindComponent <document> <shape>
9136 Prints a sequence of labels of the assembly path.
9143 @subsubsection occt_draw_8_6_4 XFindShape
9147 XFindShape <document> <shape>
9150 Finds and prints a label with an indicated top-level shape.
9157 @subsubsection occt_draw_8_6_5 XGetFreeShapes
9161 XGetFreeShapes <document> [shape_prefix]
9164 Print labels or create DRAW shapes for all free shapes in the document.
9165 If *shape_prefix* is absent -- prints labels, else -- creates DRAW shapes with names
9166 <i>shape_prefix</i>_num (i.e. for example: there are 3 free shapes and *shape_prefix* = a therefore shapes will be created with names a_1, a_2 and a_3).
9168 **Note**: a free shape is a shape to which no other shape refers to.
9173 == 0:1:1:6 0:1:1:10 0:1:1:12 0:1:1:13
9176 == sh_1 sh_2 sh_3 sh_4
9179 @subsubsection occt_draw_8_6_6 XGetOneShape
9183 XGetOneShape <shape> <document>
9186 Creates one DRAW shape for all free shapes from a document.
9193 @subsubsection occt_draw_8_6_7 XGetReferredShape
9197 XGetReferredShape <document> <label>
9200 Prints a label that contains a top-level shape that corresponds to a shape at a given label.
9204 XGetReferredShape D 0:1:1:1:1
9207 @subsubsection occt_draw_8_6_8 XGetShape
9211 XGetShape <result> <document> <label>
9214 Puts a shape from the indicated label in document to result.
9218 XGetShape b D 0:1:1:3
9221 @subsubsection occt_draw_8_6_9 XGetTopLevelShapes
9225 XGetTopLevelShapes <document>
9228 Prints labels that contain top-level shapes.
9232 XGetTopLevelShapes D
9233 == 0:1:1:1 0:1:1:2 0:1:1:3 0:1:1:4 0:1:1:5 0:1:1:6 0:1:1:7
9237 @subsubsection occt_draw_8_6_10 XLabelInfo
9241 XLabelInfo <document> <label>
9244 Prints information about a shape, stored at an indicated label.
9248 XLabelInfo D 0:1:1:6
9249 ==> There are TopLevel shapes. There is an Assembly. This Shape is not used.
9252 @subsubsection occt_draw_8_6_11 XNewShape
9256 XNewShape <document>
9259 Creates a new empty top-level shape.
9266 @subsubsection occt_draw_8_6_12 XRemoveComponent
9270 XRemoveComponent <document> <label>
9273 Removes a component from the components label.
9277 XRemoveComponent D 0:1:1:1:1
9280 @subsubsection occt_draw_8_6_13 XRemoveShape
9284 XRemoveShape <document> <label>
9287 Removes a shape from a document (by it’s label).
9291 XRemoveShape D 0:1:1:2
9294 @subsubsection occt_draw_8_6_14 XSetShape
9298 XSetShape <document> <label> <shape>
9301 Sets a shape at the indicated label.
9305 XSetShape D 0:1:1:3 b
9308 @subsubsection occt_draw_8_6_15 XUpdateAssemblies
9312 XUpdateAssemblies <document>
9315 Updates all assembly compounds in the XDE document.
9322 @subsection occt_draw_8_7_ XDE color commands
9324 @subsubsection occt_draw_8_7_1 XAddColor
9328 XAddColor <document> <R> <G> <B>
9331 Adds color in document to the color table. Parameters R,G,B are real.
9335 XAddColor D 0.5 0.25 0.25
9338 @subsubsection occt_draw_8_7_2 XFindColor
9342 XFindColor <document> <R> <G> <B>
9345 Finds a label where the indicated color is situated.
9349 XFindColor D 0.25 0.25 0.5
9353 @subsubsection occt_draw_8_7_3 XGetAllColors
9357 XGetAllColors <document>
9360 Prints all colors that are defined in the document.
9365 ==> RED DARKORANGE BLUE1 GREEN YELLOW3
9368 @subsubsection occt_draw_8_7_4 XGetColor
9372 XGetColor <document> <label>
9375 Returns a color defined at the indicated label from the color table.
9383 @subsubsection occt_draw_8_7_5 XGetObjVisibility
9387 XGetObjVisibility <document> {<label>|<shape>}
9390 Returns the visibility of a shape.
9394 XGetObjVisibility D 0:1:1:4
9397 @subsubsection occt_draw_8_7_6 XGetShapeColor
9401 XGetShapeColor <document> <label> <colortype(s|c)>
9404 Returns the color defined by label. If <i>colortype</i>=’s’ -- returns surface color, else -- returns curve color.
9408 XGetShapeColor D 0:1:1:4 c
9411 @subsubsection occt_draw_8_7_7 XRemoveColor
9415 XRemoveColor <document> <label>
9418 Removes a color from the color table in a document.
9422 XRemoveColor D 0:1:2:1
9425 @subsubsection occt_draw_8_7_8 XSetColor
9429 XSetColor <document> {<label>|<shape>} <R> <G> <B>
9432 Sets an RGB color to a shape given by label.
9436 XsetColor D 0:1:1:4 0.5 0.5 0.
9439 @subsubsection occt_draw_8_7_9 XSetObjVisibility
9443 XSetObjVisibility <document> {<label>|<shape>} {0|1}
9446 Sets the visibility of a shape.
9450 # set shape from label 0:1:1:4 as invisible
9451 XSetObjVisibility D 0:1:1:4 0
9454 @subsubsection occt_draw_8_7_10 XUnsetColor
9458 XUnsetColor <document> {<label>|<shape>} <colortype>
9461 Unset a color given type (‘s’ or ‘c’) for the indicated shape.
9465 XUnsetColor D 0:1:1:4 s
9469 @subsection occt_draw_8_8_ XDE layer commands
9471 @subsubsection occt_draw_8_8_1 XAddLayer
9475 XAddLayer <document> <layer>
9478 Adds a new layer in an XCAF document.
9485 @subsubsection occt_draw_8_8_2 XFindLayer
9489 XFindLayer <document> <layer>
9492 Prints a label where a layer is situated.
9500 @subsubsection occt_draw_8_8_3 XGetAllLayers
9504 XGetAllLayers <document>
9507 Prints all layers in an XCAF document.
9512 == *0:1:1:3* *Bolt* *0:1:1:9*
9515 @subsubsection occt_draw_8_8_4 XGetLayers
9519 XGetLayers <document> {<shape>|<label>}
9522 Returns names of layers, which are pointed to by links of an indicated shape.
9526 XGetLayers D 0:1:1:3
9530 @subsubsection occt_draw_8_8_5 XGetOneLayer
9534 XGetOneLayer <document> <label>
9537 Prints the name of a layer at a given label.
9541 XGetOneLayer D 0:1:3:2
9544 @subsubsection occt_draw_8_8_6 XIsVisible
9548 XIsVisible <document> {<label>|<layer>}
9551 Returns 1 if the indicated layer is visible, else returns 0.
9555 XIsVisible D 0:1:3:1
9558 @subsubsection occt_draw_8_8_7 XRemoveAllLayers
9562 XRemoveAllLayers <document>
9565 Removes all layers from an XCAF document.
9572 @subsubsection occt_draw_8_8_8 XRemoveLayer
9576 XRemoveLayer <document> {<label>|<layer>}
9579 Removes the indicated layer from an XCAF document.
9583 XRemoveLayer D layer2
9586 @subsubsection occt_draw_8_8_9 XSetLayer
9590 XSetLayer XSetLayer <document> {<shape>|<label>} <layer> [shape_in_one_layer {0|1}]
9594 Sets a reference between a shape and a layer (adds a layer if it is necessary).
9595 Parameter <i>\<shape_in_one_layer\></i> shows whether a shape could be in a number of layers or only in one (0 by default).
9599 XSetLayer D 0:1:1:2 layer2
9602 @subsubsection occt_draw_8_8_10 XSetVisibility
9606 XSetVisibility <document> {<label>|<layer>} <isvisible {0|1}>
9609 Sets the visibility of a layer.
9613 # set layer at label 0:1:3:2 as invisible
9614 XSetVisibility D 0:1:3:2 0
9617 @subsubsection occt_draw_8_8_11 XUnSetAllLayers
9621 XUnSetAllLayers <document> {<label>|<shape>}
9624 Unsets a shape from all layers.
9628 XUnSetAllLayers D 0:1:1:2
9631 @subsubsection occt_draw_8_8_12 XUnSetLayer
9635 XUnSetLayer <document> {<label>|<shape>} <layer>
9638 Unsets a shape from the indicated layer.
9642 XUnSetLayer D 0:1:1:2 layer1
9645 @subsection occt_draw_8_9 XDE property commands
9647 @subsubsection occt_draw_8_9_1 XCheckProps
9651 XCheckProps <document> [ {0|deflection} [<shape>|<label>] ]
9654 Gets properties for a given shape (*volume*, *area* and <i>centroid</i>) and compares them with the results after internal calculations. If the second parameter is 0, the standard OCCT tool is used for the computation of properties. If the second parameter is not 0, it is processed as a deflection. If the deflection is positive the computation is done by triangulations, if it is negative -- meshing is forced.
9658 # check properties for shapes at label 0:1:1:1 from
9659 # document using standard Open CASCADE Technology tools
9660 XCheckProps D 0 0:1:1:1
9661 == Label 0:1:1:1 ;L-BRACKET*
9662 == Area defect: -0.0 ( 0%)
9663 == Volume defect: 0.0 ( 0%)
9664 == CG defect: dX=-0.000, dY=0.000, dZ=0.000
9667 @subsubsection occt_draw_8_9_2 XGetArea
9671 XGetArea <document> {<shape>|<label>}
9674 Returns the area of a given shape.
9679 == 24628.31815094999
9682 @subsubsection occt_draw_8_9_3 XGetCentroid
9686 XGetCentroid <document> {<shape>|<label>}
9689 Returns the center of gravity coordinates of a given shape.
9693 XGetCentroid D 0:1:1:1
9696 @subsubsection occt_draw_8_9_4 XGetVolume
9700 XGetVolume <document> {<shape>|<label>}
9703 Returns the volume of a given shape.
9707 XGetVolume D 0:1:1:1
9710 @subsubsection occt_draw_8_9_5 XSetArea
9714 XSetArea <document> {<shape>|<label>} <area>
9717 Sets new area to attribute list ??? given shape.
9721 XSetArea D 0:1:1:1 2233.99
9724 @subsubsection occt_draw_8_9_6 XSetCentroid
9728 XSetCentroid <document> {<shape>|<label>} <x> <y> <z>
9731 Sets new center of gravity to the attribute list given shape.
9735 XSetCentroid D 0:1:1:1 0. 0. 100.
9738 @subsubsection occt_draw_8_9_7 XSetMaterial
9742 XSetMaterial <document> {<shape>|<label>} <name> <density(g/cu sm)>
9745 Adds a new label with material into the material table in a document, and adds a link to this material to the attribute list of a given shape or a given label. The last parameter sets the density of a pointed material.
9749 XSetMaterial D 0:1:1:1 Titanium 8899.77
9752 @subsubsection occt_draw_8_9_8 XSetVolume
9756 XSetVolume <document> {<shape>|<label>} <volume>
9759 Sets new volume to the attribute list ??? given shape.
9763 XSetVolume D 0:1:1:1 444555.33
9766 @subsubsection occt_draw_8_9_9 XShapeMassProps
9770 XShapeMassProps <document> [ <deflection> [{<shape>|<label>}] ]
9773 Computes and returns real mass and real center of gravity for a given shape or for all shapes in a document. The second parameter is used for calculation of the volume and CG(center of gravity). If it is 0, then the standard CASCADE tool (geometry) is used for computation, otherwise -- by triangulations with a given deflection.
9778 == Shape from label : 0:1:1:1
9779 == Mass = 193.71681469282299
9780 == CenterOfGravity X = 14.594564763807696,Y =
9781 20.20271885211281,Z = 49.999999385313245
9782 == Shape from label : 0:1:1:2 not have a mass
9786 @subsubsection occt_draw_8_9_10 XShapeVolume
9790 XShapeVolume <shape> <deflection>
9793 Calculates the real volume of a pointed shape with a given deflection.
9800 @section occt_draw_9 Shape Healing commands
9804 @subsection occt_draw_9_1 General commands
9806 @subsubsection occt_draw_9_1_1 bsplres
9810 bsplres <result> <shape> <tol3d> <tol2d< <reqdegree> <reqnbsegments> <continuity3d> <continuity2d> <PriorDeg> <RationalConvert>
9813 Performs approximations of a given shape (BSpline curves and surfaces or other surfaces) to BSpline with given required parameters. The specified continuity can be reduced if the approximation with a specified continuity was not done successfully. Results are put into the shape, which is given as a parameter result. For a more detailed description see the ShapeHealing User’s Guide (operator: **BSplineRestriction**).
9815 @subsubsection occt_draw_9_1_2 checkfclass2d
9819 checkfclass2d <face> <ucoord> <vcoord>
9822 Shows where a point which is given by coordinates is located in relation to a given face -- outbound, inside or at the bounds.
9826 checkfclass2d f 10.5 1.1
9830 @subsubsection occt_draw_9_1_3 checkoverlapedges
9834 checkoverlapedges <edge1> <edge2> [<toler> <domaindist>]
9837 Checks the overlapping of two given edges. If the distance between two edges is less than the given value of tolerance then edges are overlapped. Parameter \<domaindist\> sets length of part of edges on which edges are overlapped.
9841 checkoverlapedges e1 e2
9844 @subsubsection occt_draw_9_1_4 comtol
9848 comptol <shape> [nbpoints] [prefix]
9851 Compares the real value of tolerance on curves with the value calculated by standard (using 23 points). The maximal value of deviation of 3d curve from pcurve at given simple points is taken as a real value (371 is by default). Command returns the maximal, minimal and average value of tolerance for all edges and difference between real values and set values. Edges with the maximal value of tolerance and relation will be saved if the ‘prefix’ parameter is given.
9857 ==> Edges tolerance computed by 871 points:
9858 ==> MAX=8.0001130696523449e-008 AVG=6.349346868091096e-009 MIN=0
9859 ==> Relation real tolerance / tolerance set in edge
9860 ==> MAX=0.80001130696523448 AVG=0.06349345591805905 MIN=0
9861 ==> Edge with max tolerance saved to t_edge_tol
9862 ==> Concerned faces saved to shapes t_1, t_2
9865 @subsubsection occt_draw_9_1_5 convtorevol
9869 convtorevol <result> <shape>
9872 Converts all elementary surfaces of a given shape into surfaces of revolution.
9873 Results are put into the shape, which is given as the <i>\<result\></i> parameter.
9880 @subsubsection occt_draw_9_1_6 directfaces
9884 directfaces <result> <shape>
9887 Converts indirect surfaces and returns the results into the shape, which is given as the result parameter.
9894 @subsubsection occt_draw_9_1_7 expshape
9898 expshape <shape> <maxdegree> <maxseg>
9901 Gives statistics for a given shape. This test command is working with Bezier and BSpline entities.
9906 ==> Number of Rational Bspline curves 128
9907 ==> Number of Rational Bspline pcurves 48
9910 @subsubsection occt_draw_9_1_8 fixsmall
9914 fixsmall <result> <shape> [<toler>=1.]
9917 Fixes small edges in given shape by merging adjacent edges with agiven tolerance. Results are put into the shape, which is given as the result parameter.
9924 @subsubsection occt_draw_9_1_9 fixsmalledges
9928 fixsmalledges <result> <shape> [<toler> <mode> <maxangle>]
9931 Searches at least one small edge at a given shape. If such edges have been found, then small edges are merged with a given tolerance. If parameter <i>\<mode\></i> is equal to *Standard_True* (can be given any values, except 2), then small edges, which can not be merged, are removed, otherwise they are to be kept (*Standard_False* is used by default). Parameter <i>\<maxangle\></i> sets a maximum possible angle for merging two adjacent edges, by default no limit angle is applied (-1). Results are put into the shape, which is given as parameter result.
9935 fixsmalledges r a 0.1 1
9938 @subsubsection occt_draw_9_1_10 fixshape
9942 fixshape <result> <shape> [<preci> [<maxpreci>]] [{switches}]
9945 Performs fixes of all sub-shapes (such as *Solids*, *Shells*, *Faces*, *Wires* and *Edges*) of a given shape. Parameter <i>\<preci\></i> sets a basic precision value, <i>\<maxpreci\></i> sets the maximal allowed tolerance. Results are put into the shape, which is given as parameter result. <b>{switches}</b> allows to tune parameters of ShapeFix
9947 The following syntax is used:
9948 * <i>\<symbol\></i> may be
9949 * "-" to set parameter off,
9951 * "*" to set default
9952 * <i>\<parameter\></i> is identified by letters:
9953 * l -- FixLackingMode
9954 * o -- FixOrientationMode
9955 * h -- FixShiftedMode
9956 * m -- FixMissingSeamMode
9957 * d -- FixDegeneratedMode
9959 * i -- FixSelfIntersectionMode
9960 * n -- FixNotchedEdgesMode
9961 For enhanced message output, use switch '+?'
9968 @subsubsection occt_draw_9_1_11 fixwgaps
9972 fixwgaps <result> <shape> [<toler>=0]
9975 Fixes gaps between ends of curves of adjacent edges (both 3d and pcurves) in wires in a given shape with a given tolerance. Results are put into the shape, which is given as parameter result.
9982 @subsubsection occt_draw_9_1_12 offsetcurve, offset2dcurve
9986 offsetcurve <result> <curve> <offset> <direction(as point)>
9987 offset2dcurve <result> <curve> <offset>
9990 **offsetcurve** works with the curve in 3d space, **offset2dcurve** in 2d space.
9992 Both commands are intended to create a new offset curve by copying the given curve to distance, given by parameter <i>\<offset\></i>. Parameter <i>\<direction\></i> defines direction of the offset curve. It is created as a point. For correct work of these commands the direction of normal of the offset curve must be perpendicular to the plane, the basis curve is located there. Results are put into the curve, which is given as parameter <i>\<result\></i>.
9997 offsetcurve r c 20 pp
10000 @subsubsection occt_draw_9_1_13 projcurve
10004 projcurve <edge>|<curve3d>|<curve3d first last> <X> <Y> <Z>
10007 **projcurve** returns the projection of a given point on a given curve. The curve may be defined by three ways: by giving the edge name, giving the 3D curve and by giving the unlimited curve and limiting it by pointing its start and finish values.
10011 projcurve k_1 0 1 5
10012 ==Edge k_1 Params from 0 to 1.3
10013 ==Precision (BRepBuilderAPI) : 9.9999999999999995e-008 ==Projection : 0 1 5
10014 ==Result : 0 1.1000000000000001 0
10015 ==Param = -0.20000000000000001 Gap = 5.0009999000199947
10018 @subsubsection occt_draw_9_1_14 projpcurve
10022 projpcurve <edge> <face> <Tol> <X> <Y> <Z> [<start_param>]
10025 **projpcurve** returns the projection of a given point on a given curve on surface. The curve on surface is defined by giving the edge and face names. Edge must have curve 2D repesentation on the face. Optional parameter <i>\<start_param\></i> is any parameter of pcurve, which is used by algoritm as start point for searching projection of given point with help of local Extrema algorithm. If this parameter is not set, algorithm uses whole parametric interval of pcurve for searching projection.
10030 # Using global searching
10031 projpcurve f_1 f 1.e-7 0.877 0 0.479
10032 ==Point: 0.87762772831890712 0 0.47934285275342808
10033 ==Param: 0.49990578239977856
10034 ==Dist: 0.0007152557954264938
10038 # Using starting parameter on edge
10039 projpcurve f_1 f 1.e-7 0.877 0 0.479 .6
10040 ==Point: 0.87762772831890712 0 0.47934285275342808
10041 ==Param: 0.49990578239977856
10042 ==Dist: 0.0007152557954264938
10045 @subsubsection occt_draw_9_1_15 projface
10049 projface <face> <X> <Y> [<Z>]
10052 Returns the projection of a given point to a given face in 2d or 3d space. If two coordinates (2d space) are given then returns coordinates projection of this point in 3d space and vice versa.
10056 projface a_1 10.0 0.0
10057 == Point UV U = 10 V = 0
10058 == = proj X = -116 Y = -45 Z = 0
10061 @subsubsection occt_draw_9_1_16 scaleshape
10065 scaleshape <result> <shape> <scale>
10068 Returns a new shape, which is the result of scaling of a given shape with a coefficient equal to the parameter <i>\<scale\></i>. Tolerance is calculated for the new shape as well.
10072 scaleshape r a_1 0.8
10075 @subsubsection occt_draw_9_1_17 settolerance
10079 settolerance <shape> [<mode>=v-e-w-f-a] <val>(fix value) or
10083 Sets new values of tolerance for a given shape. If the second parameter <i>mode</i> is given, then the tolerance value is set only for these sub shapes.
10087 settolerance a 0.001
10090 @subsubsection occt_draw_9_1_18 splitface
10094 splitface <result> <face> [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]
10097 Splits a given face in parametric space and puts the result into the given parameter <i>\<result\></i>.
10098 Returns the status of split face.
10102 # split face f by parameter u = 5
10104 ==> Splitting by U: ,5
10108 @subsubsection occt_draw_9_1_19 statshape
10112 statshape <shape> [particul]
10115 Returns the number of sub-shapes, which compose the given shape. For example, the number of solids, number of faces etc. It also returns the number of geometrical objects or sub-shapes with a specified type, example, number of free faces, number of C0
10116 surfaces. The last parameter becomes out of date.
10123 ==> 402 Edge (oriented)
10124 ==> 402 Edge (Shared)
10127 ==> 804 Vertex (Oriented)
10128 ==> 402 Vertex (Shared)
10130 ==> 4 Face with more than one wire
10131 ==> 34 bspsur: BSplineSurface
10134 @subsubsection occt_draw_9_1_20 tolerance
10138 tolerance <shape> [<mode>:D v e f c] [<tolmin> <tolmax>:real]
10141 Returns tolerance (maximal, avg and minimal values) of all given shapes and tolerance of their *Faces*, *Edges* and *Vertices*. If parameter <i>\<tolmin\></i> or <i>\<tolmax\></i> or both of them are given, then sub-shapes are returned as a result of analys of this shape, which satisfy the given tolerances. If a particular value of entity ((**D**)all shapes (**v**) *vertices* (**e**) *edges* (**f**) *faces* (**c**) *combined* (*faces*)) is given as the second parameter then only this group will be analyzed for tolerance.
10146 ==> Tolerance MAX=0.31512672416608001 AVG=0.14901359484722074 MIN=9.9999999999999995e-08
10147 ==> FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
10148 ==> EDGE : MAX=0.31512672416608001 AVG=0.098691334511810405 MIN=9.9999999999999995e-08
10149 ==> VERTEX : MAX=0.31512672416608001 AVG=0.189076074499648 MIN=9.9999999999999995e-08
10151 tolerance a v 0.1 0.001
10152 ==> Analysing Vertices gives 6 Shapes between tol1=0.10000000000000001 and tol2=0.001 , named tol_1 to tol_6
10156 @subsection occt_draw_9_2 Conversion commands
10158 @subsubsection occt_draw_9_2_1 DT_ClosedSplit
10162 DT_ClosedSplit <result> <shape>
10165 Divides all closed faces in the shape (for example cone) and returns result of given shape into shape, which is given as parameter result. Number of faces in resulting shapes will be increased.
10166 Note: A closed face is a face with one or more seam.
10173 @subsubsection occt_draw_9_2_2 DT_ShapeConvert, DT_ShapeConvertRev
10177 DT_ShapeConvert <result> <shape> <convert2d> <convert3d>
10178 DT_ShapeConvertRev <result> <shape> <convert2d> <convert3d>
10181 Both commands are intended for the conversion of 3D, 2D curves to Bezier curves and surfaces to Bezier based surfaces. Parameters convert2d and convert3d take on a value 0 or 1. If the given value is 1, then the conversion will be performed, otherwise it will not be performed. The results are put into the shape, which is given as parameter Result. Command *DT_ShapeConvertRev* differs from *DT_ShapeConvert* by converting all elementary surfaces into surfaces of revolution first.
10185 DT_ShapeConvert r a 1 1
10189 @subsubsection occt_draw_9_2_3 DT_ShapeDivide
10193 DT_ShapeDivide <result> <shape> <tol>
10196 Divides the shape with C1 criterion and returns the result of geometry conversion of a given shape into the shape, which is given as parameter result. This command illustrates how class *ShapeUpgrade_ShapeDivideContinuity* works. This class allows to convert geometry with a continuity less than the specified continuity to geometry with target continuity. If conversion is not possible then the geometrical object is split into several ones, which satisfy the given tolerance. It also returns the status shape splitting:
10197 * OK : no splitting was done
10198 * Done1 : Some edges were split
10199 * Done2 : Surface was split
10200 * Fail1 : Some errors occurred
10204 DT_ShapeDivide r a 0.001
10208 @subsubsection occt_draw_9_2_4 DT_SplitAngle
10212 DT_SplitAngle <result> <shape> [MaxAngle=95]
10215 Works with all revolved surfaces, like cylinders, surfaces of revolution, etc. This command divides given revolved surfaces into segments so that each resulting segment covers not more than the given *MaxAngle* degrees and puts the result of splitting into the shape, which is given as parameter result. Values of returned status are given above.
10216 This command illustrates how class *ShapeUpgrade_ShapeDivideAngle* works.
10224 @subsubsection occt_draw_9_2_5 DT_SplitCurve
10228 DT_SplitCurve <curve> <tol> <split(0|1)>
10231 Divides the 3d curve with C1 criterion and returns the result of splitting of the given curve into a new curve. If the curve had been divided by segments, then each segment is put to an individual result. This command can correct a given curve at a knot with the given tolerance, if it is impossible, then the given surface is split at that knot. If the last parameter is 1, then 5 knots are added at the given curve, and its surface is split by segments, but this will be performed not for all parametric spaces.
10238 @subsubsection occt_draw_9_2_6 DT_SplitCurve2d
10242 DT_SplitCurve2d Curve Tol Split(0/1)
10245 Works just as **DT_SplitCurve** (see above), only with 2d curve.
10249 DT_SplitCurve2d r c
10252 @subsubsection occt_draw_9_2_7 DT_SplitSurface
10256 DT_SplitSurface <result> <Surface|GridSurf> <tol> <split(0|1)>
10259 Divides surface with C1 criterion and returns the result of splitting of a given surface into surface, which is given as parameter result. If the surface has been divided into segments, then each segment is put to an individual result. This command can correct a given C0 surface at a knot with a given tolerance, if it is impossible, then the given surface is split at that knot. If the last parameter is 1, then 5 knots are added to the given surface, and its surface is split by segments, but this will be performed not for all parametric spaces.
10265 # split surface with name "su"
10266 DT_SplitSurface res su 0.1 1
10268 ==> appel a SplitSurface::Init
10269 ==> appel a SplitSurface::Build
10270 ==> appel a SplitSurface::GlobalU/VKnots
10271 ==> nb GlobalU;nb GlobalV=7 2 0 1 2 3 4 5 6.2831853072 0 1
10272 ==> appel a Surfaces
10273 ==> transfert resultat
10274 ==> res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1
10278 @subsubsection occt_draw_9_2_8 DT_ToBspl
10282 DT_ToBspl <result> <shape>
10285 Converts a surface of linear extrusion, revolution and offset surfaces into BSpline surfaces. Returns the result into the shape, which is given as parameter result.
10290 == error = 5.20375663162094e-08 spans = 10
10291 == Surface is aproximated with continuity 2
10294 @section occt_draw_10 Performance evaluation commands
10297 @subsection occt_draw_10_1 VDrawSphere
10301 vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToEnableVBO=1] [NumberOfViewerUpdate=1] [ToShowEdges=0]
10304 Calculates and displays in a given number of steps a sphere with given coordinates, radius and fineness. Returns the information about the properties of the sphere, the time and the amount of memory required to build it.
10306 This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter.
10310 vdrawsphere s 200 1 1 1 500 1
10311 == Compute Triangulation...
10312 == NumberOfPoints: 39602
10313 == NumberOfTriangles: 79200
10314 == Amount of memory required for PolyTriangulation without Normals: 2 Mb
10315 == Amount of memory for colors: 0 Mb
10316 == Amount of memory for PolyConnect: 1 Mb
10317 == Amount of graphic card memory required: 2 Mb
10318 == Number of scene redrawings: 1
10319 == CPU user time: 15.6000999999998950 msec
10320 == CPU system time: 0.0000000000000000 msec
10321 == CPU average time of scene redrawing: 15.6000999999998950 msec
10325 @section occt_draw_12 Simple vector algebra and measurements
10327 This section contains description of auxiliary commands that can be useful for simple calculations and manipulations needed when analyzing complex models.
10329 @subsection occt_draw_12_1 Vector algebra commands
10331 This section describes commands providing simple calculations with 2D and 3D vectors. The vector is represented by a TCL list of double values (coordinates). The commands get input vector coordinates from the command line as distinct values. So, if you have a vector stored in a variable you need to use *eval* command as a prefix, for example, to compute the magnitude of cross products of two vectors given by 3 points the following commands can be used:
10333 Draw[10]> set vec1 [vec 12 28 99 12 58 99]
10335 Draw[13]> set vec2 [vec 12 28 99 16 21 89]
10337 Draw[14]> set cross [eval cross $vec1 $vec2]
10339 Draw[15]> eval module $cross
10343 @subsubsection occt_draw_12_1_1 vec
10347 vec <x1> <y1> <z1> <x2> <y2> <z2>
10350 Returns coordinates of vector between two 3D points.
10357 @subsubsection occt_draw_12_1_2 2dvec
10361 2dvec <x1> <y1> <x2> <y2>
10364 Returns coordinates of vector between two 2D points.
10371 @subsubsection occt_draw_12_1_3 pln
10375 pln <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
10378 Returns plane built on three points. A plane is represented by 6 double values: coordinates of the origin point and the normal directoin.
10382 pln 1 2 3 6 5 4 9 8 7
10385 @subsubsection occt_draw_12_1_4 module
10392 Returns module of a vector.
10399 @subsubsection occt_draw_12_1_5 2dmodule
10406 Returns module of a 2D vector.
10413 @subsubsection occt_draw_12_1_6 norm
10420 Returns unified vector from a given 3D vector.
10427 @subsubsection occt_draw_12_1_7 2dnorm
10434 Returns unified vector from a given 2D vector.
10441 @subsubsection occt_draw_12_1_8 inverse
10445 inverse <x> <y> <z>
10448 Returns inversed 3D vector.
10455 @subsubsection occt_draw_12_1_9 2dinverse
10462 Returns inversed 2D vector.
10469 @subsubsection occt_draw_12_1_10 2dort
10476 Returns 2D vector rotated on 90 degrees.
10483 @subsubsection occt_draw_12_1_11 distpp
10487 distpp <x1> <y1> <z1> <x2> <y2> <z2>
10490 Returns distance between two 3D points.
10497 @subsubsection occt_draw_12_1_12 2ddistpp
10501 2ddistpp <x1> <y1> <x2> <y2>
10504 Returns distance between two 2D points.
10511 @subsubsection occt_draw_12_1_13 distplp
10515 distplp <x0> <y0> <z0> <nx> <ny> <nz> <xp> <yp> <zp>
10518 Returns distance between plane defined by point and normal direction and another point.
10522 distplp 0 0 0 0 0 1 5 6 7
10525 @subsubsection occt_draw_12_1_14 distlp
10529 distlp <x0> <y0> <z0> <dx> <dy> <dz> <xp> <yp> <zp>
10532 Returns distance between 3D line defined by point and direction and another point.
10536 distlp 0 0 0 1 0 0 5 6 7
10539 @subsubsection occt_draw_12_1_15 2ddistlp
10543 2ddistlp <x0> <y0> <dx> <dy> <xp> <yp>
10546 Returns distance between 2D line defined by point and direction and another point.
10550 2ddistlp 0 0 1 0 5 6
10553 @subsubsection occt_draw_12_1_16 distppp
10557 distppp <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
10560 Returns deviation of point (x2,y2,z2) from segment defined by points (x1,y1,z1) and (x3,y3,z3).
10564 distppp 0 0 0 1 1 0 2 0 0
10567 @subsubsection occt_draw_12_1_17 2ddistppp
10571 2ddistppp <x1> <y1> <x2> <y2> <x3> <y3>
10574 Returns deviation of point (x2,y2) from segment defined by points (x1,y1) and (x3,y3). The result is a signed value. It is positive if the point (x2,y2) is on the left side of the segment, and negative otherwise.
10578 2ddistppp 0 0 1 -1 2 0
10581 @subsubsection occt_draw_12_1_18 barycen
10585 barycen <x1> <y1> <z1> <x2> <y2> <z2> <par>
10588 Returns point of a given parameter between two 3D points.
10592 barycen 0 0 0 1 1 1 0.3
10595 @subsubsection occt_draw_12_1_19 2dbarycen
10599 2dbarycen <x1> <y1> <x2> <y2> <par>
10602 Returns point of a given parameter between two 2D points.
10606 2dbarycen 0 0 1 1 0.3
10609 @subsubsection occt_draw_12_1_20 cross
10613 cross <x1> <y1> <z1> <x2> <y2> <z2>
10616 Returns cross product of two 3D vectors.
10623 @subsubsection occt_draw_12_1_21 2dcross
10627 2dcross <x1> <y1> <x2> <y2>
10630 Returns cross product of two 2D vectors.
10637 @subsubsection occt_draw_12_1_22 dot
10641 dot <x1> <y1> <z1> <x2> <y2> <z2>
10644 Returns scalar product of two 3D vectors.
10651 @subsubsection occt_draw_12_1_23 2ddot
10655 2ddot <x1> <y1> <x2> <y2>
10658 Returns scalar product of two 2D vectors.
10665 @subsubsection occt_draw_12_1_24 scale
10669 scale <x> <y> <z> <factor>
10672 Returns 3D vector multiplied by scalar.
10679 @subsubsection occt_draw_12_1_25 2dscale
10683 2dscale <x> <y> <factor>
10686 Returns 2D vector multiplied by scalar.
10693 @subsection occt_draw_12_2 Measurements commands
10695 This section describes commands that make possible to provide measurements on a model.
10697 @subsubsection occt_draw_12_2_1 pnt
10704 Returns coordinates of point in the given Draw variable. Object can be of type point or vertex. Actually this command is built up from the commands @ref occt_draw_7_2_1a "mkpoint" and @ref occt_draw_6_6_1 "coord".
10712 @subsubsection occt_draw_12_2_2 pntc
10719 Returns coordinates of point on 3D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "cvalue".
10727 @subsubsection occt_draw_12_2_3 2dpntc
10731 2dpntc <curv2d> <par>
10734 Returns coordinates of point on 2D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "2dcvalue".
10739 2dpntc c [dval pi/2]
10742 @subsubsection occt_draw_12_2_4 pntsu
10746 pntsu <surf> <u> <v>
10749 Returns coordinates of point on surface with given parameters. Actually this command is based on the command @ref occt_draw_6_6_3 "svalue".
10754 pntsu s [dval pi/2] 5
10757 @subsubsection occt_draw_12_2_5 pntcons
10761 pntcons <curv2d> <surf> <par>
10764 Returns coordinates of point on surface defined by point on 2D curve with given parameter. Actually this command is based on the commands @ref occt_draw_6_6_2 "2dcvalue" and @ref occt_draw_6_6_3 "svalue".
10770 pntcons c s [dval pi/2]
10773 @subsubsection occt_draw_12_2_6 drseg
10777 drseg <name> <x1> <y1> <z1> <x2> <y2> <z2>
10780 Creates a linear segment between two 3D points. The new object is given the *name*. The object is drawn in the axonometric view.
10784 drseg s 0 0 0 1 0 0
10787 @subsubsection occt_draw_12_2_7 2ddrseg
10791 2ddrseg <name> <x1> <y1> <x2> <y2>
10794 Creates a linear segment between two 2D points. The new object is given the *name*. The object is drawn in the 2D view.
10801 @subsubsection occt_draw_12_2_8 mpick
10808 Prints in the console the coordinates of a point clicked by mouse in a view (axonometric or 2D). This command will wait for mouse click event in a view.
10815 @subsubsection occt_draw_12_2_9 mdist
10822 Prints in the console the distance between two points clicked by mouse in a view (axonometric or 2D). This command will wait for two mouse click events in a view.
10829 @section occt_draw_13 Inspector commands
10832 This section describes commands that make possible to use Inspector.
10834 @subsection occt_draw_13_1 tinspector
10838 tinspector [-plugins {name1 ... [nameN] | all}]
10840 [-shape object [name1] ... [nameN]]
10841 [-open file_name [name1] ... [nameN]]
10843 [-select {object | name1 ... [nameN]}]
10846 Starts tool of inspection.
10848 * *plugins* enters plugins that should be added in the inspector.
10849 Available names are: dfbrowser, vinspector and shapeview.
10850 Plugins order will be the same as defined in arguments.
10851 'all' adds all available plugins in the order:
10852 DFBrowser, VInspector and ShapeView.
10853 If at the first call this option is not used, 'all' option is applyed;
10854 * *activate* activates the plugin in the tool view.
10855 If at the first call this option is not used, the first plugin is activated;
10856 * *shape* initializes plugin/s by the shape object. If 'name' is empty, initializes all plugins;
10857 * *open* gives the file to the plugin/s. If the plugin is active, after open, update content will be done;
10858 * *update* updates content of the active plugin;
10859 * *select* sets the parameter that should be selected in an active tool view.
10860 Depending on active tool the parameter is:
10861 ShapeView: 'object' is an instance of TopoDS_Shape TShape,
10862 DFBrowser: 'name' is an entry of TDF_Label and name2(optionaly) for TDF_Attribute type name,
10863 VInspector: 'object' is an instance of AIS_InteractiveObject;
10864 * *show* sets Inspector view visible or hidden. The first call of this command will show it.
10868 pload DCAF INSPECTOR
10870 NewDocument Doc BinOcaf
10874 SetInteger Doc ${aLabel} ${aSetAttr1}
10876 tinspector -plugins dfbrowser -select 0:2 TDataStd_Integer
10881 pload ALL INSPECTOR
10884 box b2 100 200 220 100 120 100
10886 tinspector -plugins shapeview -shape b1 -shape b2 -select b1
10891 pload ALL INSPECTOR
10893 tinspector -plugins vinspector
10896 box box_1 100 100 100
10899 box box_2 180 120 200 150 150 150
10906 tinspector -update -select box_1
10910 @section occt_draw_11 Extending Test Harness with custom commands
10913 The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism.
10916 @subsection occt_draw_11_1 Custom command implementation
10918 Custom command implementation has not undergone any changes since the introduction of the plug-in mechanism. The syntax of every command should still be like in the following example.
10922 static Standard_Integer myadvcurve(Draw_Interpretor& di, Standard_Integer n, char** a)
10928 For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx).
10931 @subsection occt_draw_11_2 Registration of commands in Test Harness
10933 To become available in the Test Harness the custom command must be registered in it. This should be done as follows.
10937 void MyPack::CurveCommands(Draw_Interpretor& theCommands)
10940 char* g = "Advanced curves creation";
10942 theCommands.Add ( "myadvcurve", "myadvcurve name p1 p2 p3 - Creates my advanced curve from points",
10943 __FILE__, myadvcurve, g );
10948 @subsection occt_draw_11_3 Creating a toolkit (library) as a plug-in
10950 All custom commands are compiled and linked into a dynamic library (.dll on Windows, or .so on Unix/Linux). To make Test Harness recognize it as a plug-in it must respect certain conventions. Namely, it must export function *PLUGINFACTORY()* accepting the Test Harness interpreter object (*Draw_Interpretor*). This function will be called when the library is dynamically loaded during the Test Harness session.
10952 This exported function *PLUGINFACTORY()* must be implemented only once per library.
10954 For convenience the *DPLUGIN* macro (defined in the *Draw_PluginMacro.hxx* file) has been provided. It implements the *PLUGINFACTORY()* function as a call to the *Package::Factory()* method and accepts *Package* as an argument. Respectively, this *Package::Factory()* method must be implemented in the library and activate all implemented commands.
10958 #include <Draw_PluginMacro.hxx>
10960 void MyPack::Factory(Draw_Interpretor& theDI)
10964 MyPack::CurveCommands(theDI);
10968 // Declare entry point PLUGINFACTORY
10972 @subsection occt_draw_11_4 Creation of the plug-in resource file
10974 As mentioned above, the plug-in resource file must be compliant with Open CASCADE Technology requirements (see *Resource_Manager.hxx* file for details). In particular, it should contain keys separated from their values by a colon (;:;).
10975 For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name.
10976 Thus, the resource file must contain a line mapping this name (key) to the library name. The latter should be without file extension (.dll on Windows, .so on Unix/Linux) and without the ;lib; prefix on Unix/Linux.
10977 For several plug-ins one resource file can be created. In such case, keys denoting plug-ins can be combined into groups, these groups -- into their groups and so on (thereby creating some hierarchy). Any new parent key must have its value as a sequence of child keys separated by spaces, tabs or commas. Keys should form a tree without cyclic dependencies.
10979 **Examples** (file MyDrawPlugin):
10981 ! Hierarchy of plug-ins
10982 ALL : ADVMODELING, MESHING
10984 ADVMODELING : ADVSURF, ADVCURV
10986 ! Mapping from naming to toolkits (libraries)
10987 ADVSURF : TKMyAdvSurf
10988 ADVCURV : TKMyAdvCurv
10992 For other examples of the plug-in resource file refer to the @ref occt_draw_1_3_2 "Plug-in resource file" chapter above or to the <i>$CASROOT/src/DrawPlugin</i> file shipped with Open CASCADE Technology.
10995 @subsection occt_draw_11_5 Dynamic loading and activation
10997 Loading a plug-in and activating its commands is described in the @ref occt_draw_1_3_3 "Activation of the commands implemented in the plug-in" chapter.
10999 The procedure consists in defining the system variables and using the *pload* commands in the Test Harness session.
11003 Draw[]> set env(CSF_MyDrawPluginDefaults) /users/test
11004 Draw[]> pload -MyDrawPlugin ALL