1 Draw Test Harness {#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**). It provides basic documentation on using Draw. For advanced information on Draw and its applications, see our offerings on our web site at <a href="http://www.opencascade.org/support/training">http://www.opencascade.org/support/training</a>
10 Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
13 @subsection occt_draw_1_1 Overview
15 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.
17 Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
19 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.
23 * A command interpreter based on the TCL command language.
24 * A 3d graphic viewer based on the X system.
25 * A basic set of commands covering scripts, variables and graphics.
26 * 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.
27 * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
30 There is also a set of commands for each delivery unit in the modeling libraries:
39 @subsection occt_draw_1_2 Contents of this documentation
41 This documentation describes:
43 * The command language.
44 * The basic set of commands.
45 * The graphical commands.
46 * The Geometry set of commands.
47 * The Topology set of commands.
49 This document does not describe other sets of commands and does not explain how to extend Draw using C++.
51 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.
57 Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file.
62 # this is a very short example
67 @subsection occt_draw_1_3 Getting started
69 Install Draw and launch Emacs. Get a command line in Emacs using *Esc x *and key in *woksh*.
71 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.
73 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.
75 @subsubsection occt_draw_1_3_1 Launching DRAW Test Harness
77 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 set-up (usually this is done automatically after the installation process on Windows or after launching specific scripts on Linux).
80 @subsubsection occt_draw_1_3_2 Plug-in resource file
82 Open CASCADE Technology is shipped with the DrawPlugin resource file located in the <i>$CASROOT/src/DrawResources</i> directory.
84 The format of the file is compliant with standard Open CASCADE Technology resource files (see the *Resource_Manager.cdl* file for details).
86 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.
88 **Example:** (excerpt from DrawPlugin):
89 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
90 OCAF : VISUALIZATION, OCAFKERNEL
96 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 @subsubsection occt_draw_1_3_3 Activation of commands implemented in the plug-in
100 To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness:
103 pload [-PluginFileName] [[Key1] [Key2]...]
108 * *-PluginFileName* - defines the name of a plug-in resource file (prefix "-" is mandatory) described above.
109 If this parameter is omitted then the default name DrawPlugin is used.
110 * *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).
112 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.
115 Draw[] pload -DrawPlugin OCAF
117 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.
120 Draw[] pload (equivalent to pload -DrawPlugin DEFAULT).
122 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.
125 @section occt_draw_2 The Command Language
127 @subsection occt_draw_2_1 Overview
129 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.
131 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:
133 * Syntax of the TCL language.
134 * Accessing variables in TCL and Draw.
135 * Control structures.
138 @subsection occt_draw_2_2 Syntax of TCL
140 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.
142 The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons.
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
148 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150 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.
152 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.
154 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.
156 The following substitutions are performed by TCL:
158 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.
161 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
162 # set a variable value
163 set file documentation
164 puts $file #to display file contents on the screen
166 # a simple substitution, set psfile to documentation.ps
170 # another substitution, set pfile to documentationPS
174 # delete files NEWdocumentation and OLDdocumentation
175 foreach prefix {NEW OLD} {rm $prefix$file}
176 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178 Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted.
180 Compare command construction in csh.
183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
186 # expr is a command evaluating a numeric expression
187 set radian [expr $pi*$degree/180]
188 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190 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.
192 TCL uses two forms of *quoting* to prevent substitution and word breaking.
194 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 " ".
197 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
198 # set msg to ;the price is 12.00;
200 set msg ;the price is $price;
201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
203 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.
206 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
208 # this will loop for ever
209 # because while argument is ;0 3;
210 while ;$x 3; {set x [expr $x+1]}
211 # this will terminate as expected because
212 # while argument is {$x 3}
213 while {$x 3} {set x [expr $x+1]}
214 # this can be written also
218 # the following cannot be written
219 # because while requires two arguments
224 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
226 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.
229 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
231 set a 1 # this is not a comment
232 set b 1; # this is a comment
233 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235 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.
239 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240 # I want to delete two files
244 # this will fail because rm will receive only one argument
245 # and complain that ;foo bar; does not exit
249 # a second evaluation will do it
250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
252 @subsection occt_draw_2_3 Accessing variables in TCL and Draw
254 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.
256 TCL provides a mechanism to link user data to variables. Using this functionality, Draw defines its variables as TCL variables with associated data.
258 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 *$* does not change the result of a command. The content of a Draw variable is accessed using appropriate commands.
260 There are many kinds of Draw variables, and new ones may be added with C++. Geometric and topological variables are described below.
262 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.
265 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
266 # dset is used for numeric variables
267 # pi is a predefined Draw variable
268 dset angle pi/3 radius 10
269 point p radius*cos(angle) radius*sin(angle) 0
270 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271 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.
273 @subsubsection occt_draw_2_3_1 set, unset
279 unset varname [varname varname ...]
282 **set** assigns a string value to a variable. If the variable does not already exist, it is created.
284 Without a value, **set** returns the content of the variable.
286 **unset** deletes variables. It is is also used to delete Draw variables.
289 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
296 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298 **Note**, that the *set* command can set only one variable, unlike the *dset* command.
301 @subsubsection occt_draw_2_3_2 dset, dval
306 dset var1 value1 vr2 value2 ...
310 *dset* assigns values to Draw numeric variables. The argument can be any numeric expression including Draw numeric variables. Since all Draw commands expect a numeric expression, there is no need to use $ or *expr*. The *dset* command can assign several variables. If there is an odd number of arguments, the last variable will be assigned a value of 0. If the variable does not exist, it will be created.
312 *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.
316 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
321 # no $ required for Draw commands
324 # *puts* prints a string
325 puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)];
326 == x = 10, cos(x/pi) = -0.99913874099467914
327 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 **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.*
332 @subsection occt_draw_2_4 lists
334 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.
336 This allows you to insert lists within lists.
339 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
340 # a list of 3 strings
343 # a list of two strings the first is a list of 2
345 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347 Many TCL commands return lists and **foreach** is a useful way to create loops on list elements.
349 @subsubsection occt_draw_2_5 Control Structures
351 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:
353 * You use braces instead of parentheses to enclose conditions.
354 * You do not start the script on the next line of your command.
357 @subsubsection occt_draw_2_5_1 if
362 if condition script [elseif script .... else script]
365 **If** evaluates the condition and the script to see whether the condition is true.
370 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
378 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
380 @subsubsection occt_draw_2_5_2 while, for, foreach
386 while condition script
387 for init condition reinit script
388 foreach varname list script
391 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. \
394 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
397 while {[dval x] 100} {
402 # incr var d, increments a variable of d (default 1)
403 for {set i 0} {$i 10} {incr i} {
405 point p$i cos(angle0 sin(angle) 0
408 foreach object {crapo tomson lucas} {display $object}
409 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
411 @subsubsection occt_draw_2_5_3 break, continue
420 Within loops, the **break** and **continue** commands have the same effect as in C.
422 **break** interrupts the innermost loop and **continue** jumps to the next iteration.
425 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
426 # search the index for which t$i has value ;secret;
427 for {set i 1} {$i = 100} {incr i} {
428 if {[set t$i] == ;secret;} break;
430 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
432 @subsection occt_draw_2_6 Procedures
434 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.
436 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.
438 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.
440 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.
443 @subsubsection occt_draw_2_6_1 proc
448 proc argumentlist script
451 **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.
453 **return** gives a return value to the procedure.
456 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
461 # procedure with arguments and default values
462 proc distance {x1 y1 {x2 0} {y2 0}} {
463 set d [expr (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)]
464 return [expr sqrt(d)]
467 if {$n == 0} {return 1} else {
468 return [expr n*[fact [expr n -1]]]
471 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
474 @subsubsection occt_draw_2_6_2 global, upvar
479 global varname [varname ...]
480 upvar varname localname [varname localname ...]
484 **global** accesses high level variables. Unlike C, global variables are not visible in procedures.
486 **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.
488 **Note** that in the following examples the \$ character is always necessarily used to access the arguments.
491 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
492 # convert degree to radian
493 # pi is a global variable
494 proc deg2rad (degree} {
495 return [dval pi*$degree/2.]
497 # create line with a point and an angle
498 proc linang {linename x y angle} {
500 line l $x $y cos($angle) sin($angle)
502 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
504 @section occt_draw_3 Basic Commands
506 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:
508 * General commands, which are used for Draw and TCL management.
509 * Variable commands, which are used to manage Draw variables such as storing and dumping.
510 * Graphic commands, which are used to manage the graphic system, and so pertain to views.
511 * Variable display commands, which are used to manage the display of objects within given views.
513 Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands
516 @subsection occt_draw_3_1 General commands
518 This section describes several useful commands:
520 * **help** to get information,
521 * **source** to eval a script from a file,
522 * **spy** to capture the commands in a file,
523 * **cpulimit** to limit the process cpu time,
524 * **wait** to waste some time,
525 * **chrono** to time commands.
527 @subsubsection occt_draw_3_1_1 help
532 help [command [helpstring group]]
535 Provides help or modifies the help information.
537 **help** without arguments lists all groups and the commands in each group.
539 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.
542 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
543 # Gives help on all commands starting with *a*
544 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
547 @subsubsection occt_draw_3_1_2 source
556 The **exit** command will terminate the file.
558 @subsubsection occt_draw_3_1_3 spy
566 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.
568 If a command returns an error it is saved with a comment mark.
570 The file created by **spy** can be executed with the **source** command.
573 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
574 # all commands will be saved in the file ;session;
576 # the file ;session; is closed and commands are not saved
578 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
582 @subsubsection occt_draw_3_1_4 cpulimit
590 **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.
593 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
594 #limit cpu to one hour
596 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
598 @subsubsection occt_draw_3_1_5 wait
604 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.
607 # You have ten seconds ...
611 @subsubsection occt_draw_3_1_6 chrono
616 chrono [ name start/stop/reset/show]
619 Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed.
621 With arguments, **chrono** is used to manage activated chronometers. You can perform the following actions with a chronometer.
622 * run the chronometer (start).
623 * stop the chronometer (stop).
624 * reset the chronometer to 0 (reset).
625 * display the current time (show).
628 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
630 ==Chronometers activated.
632 ==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds
633 ==CPU user time: 0.01 seconds
634 ==CPU system time: 0 seconds
635 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
637 @subsection occt_draw_3_2 Variable management commands
639 @subsubsection occt_draw_3_2_1 isdraw, directory
647 **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.
649 Use **directory** to return a list of all Draw global variables matching a pattern.
652 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
665 # to destroy all Draw objects with name containing curve
666 foreach var [directory *curve*] {unset $var}
667 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
670 @subsubsection occt_draw_3_2_2 whatis, dump
675 whatis varname [varname ...]
676 dump varname [varname ...]
679 **whatis** returns short information about a Draw variable. This is usually the type name.
681 **dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable.
684 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
691 ***** Dump of c *****
697 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
699 **Note** The behavior of *whatis* on other variables (not Draw) is not excellent.
702 @subsubsection occt_draw_3_2_3 rename, copy
706 rename varname tovarname [varname tovarname ...]
707 copy varname tovarname [varname tovarname ...]
710 * **rename** 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.
711 * **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.
714 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
718 # curves are copied, c2 will not be modified
720 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
722 @subsubsection occt_draw_3_2_4 datadir, save, restore
727 save variable [filename]
728 restore filename [variablename]
731 * **datadir** without arguments prints the path of the current data directory.
732 * **datadir** with an argument sets the data directory path. \
734 If the path starts with a dot (.) only the last directory name will be changed in the path.
736 * **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.
737 * **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.
739 The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent.
742 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
743 # note how TCL accesses shell environment variables
748 datadir $env(WBCONTAINER)/data/default
749 ==/adv_20/BAG/data/default
753 ==/adv_20/BAG/data/default/theBox
755 # when TCL does not find a command it tries a shell command
761 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
763 @subsection occt_draw_3_3 User defined commands
765 *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.
767 *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.
769 @subsubsection occt_draw_3_3_1 set
771 #### In *DrawTrSurf* package:
774 void Set(Standard_CString& Name,const gp_Pnt& G) ;
775 void Set(Standard_CString& Name,const gp_Pnt2d& G) ;
776 void Set(Standard_CString& Name,
777 const Handle(Geom_Geometry)& G) ;
778 void Set(Standard_CString& Name,
779 const Handle(Geom2d_Curve)& C) ;
780 void Set(Standard_CString& Name,
781 const Handle(Poly_Triangulation)& T) ;
782 void Set(Standard_CString& Name,
783 const Handle(Poly_Polygon3D)& P) ;
784 void Set(Standard_CString& Name,
785 const Handle(Poly_Polygon2D)& P) ;
788 #### In *DBRep* package:
791 void Set(const Standard_CString Name,
792 const TopoDS_Shape& S) ;
795 Example of *DrawTrSurf*
798 Handle(Geom2d_Circle) C1 = new Geom2d_Circle
799 (gce_MakeCirc2d (gp_Pnt2d(50,0,) 25));
800 DrawTrSurf::Set(char*, C1);
807 B = BRepPrimAPI_MakeBox (10,10,10);
811 @subsubsection occt_draw_3_3_2 get
813 #### In *DrawTrSurf* package:
816 Handle_Geom_Geometry Get(Standard_CString& Name) ;
819 #### In *DBRep* package:
822 TopoDS_Shape Get(Standard_CString& Name,
823 const TopAbs_ShapeEnum Typ = TopAbs_SHAPE,
824 const Standard_Boolean Complain
828 Example of *DrawTrSurf*
831 Standard_Integer MyCommand
832 (Draw_Interpretor& theCommands,
833 Standard_Integer argc, char** argv)
835 // Creation of a Geom_Geometry from a Draw geometric
837 Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]);
844 Standard_Integer MyCommand
845 (Draw_Interpretor& theCommands,
846 Standard_Integer argc, char** argv)
848 // Creation of a TopoDS_Shape from a Draw topological
850 TopoDS_Solid B = DBRep::Get(argv[1]);
854 @section occt_draw_4 Graphic Commands
856 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.
858 @subsection occt_draw_4_1 Axonometric viewer
860 @subsubsection occt_draw_4_1_1 view, delete
864 view index type [X Y W H]
868 **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.
870 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..
872 **delete** deletes a view. If no index is given, all the views are deleted.
874 Type selects from the following range:
876 * *AXON* : Axonometric view
877 * *PERS* : Perspective view
878 * *+X+Y* : View on both axes (i.e. a top view), other codes are *-X+Y, +Y-Z*, etc.
881 The index, the type, the current zoom are displayed in the window title .
884 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
885 # this is the content of the mu4 procedure
888 view 1 +X+Z 320 20 400 400
889 view 2 +X+Y 320 450 400 400
890 view 3 +Y+Z 728 20 400 400
891 view 4 AXON 728 450 400 400
893 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
895 See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview**
897 @subsubsection occt_draw_4_1_2 axo, pers, top, ...
908 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.
910 * **axo** creates a large window axonometric view;
911 * **pers** creates a large window perspective view;
912 * **top**, **bottom**, **left**, **right**, **front**, **back** create a large window axis view;
913 * **mu4** creates four small window views: front, left, top and axo.
914 * **v2d** creates a large window 2d view.
915 * **av2d** creates two small window views, one 2d and one axo
916 * **smallview** creates a view at the bottom right of the screen of the given type.
918 See also: **view**, **delete**
920 @subsubsection occt_draw_4_1_3 mu, md, 2dmu, 2dmd, zoom, 2dzoom
931 * **mu** (magnify up) increases the zoom in one or several views by a factor of 10%.
932 * **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd**
933 perform the same on one or all 2d views.
934 * **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.
935 * **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.
938 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
946 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
947 See also: **fit**, **2dfit**
950 @subsubsection occt_draw_4_14 pu, pd, pl, pr, 2dpu, 2dpd, 2dpl, 2dpr
955 The **p_ **commands are used to pan. **pu **and **pd **pan up and down respectively;**pl **and **pr **pan left and right respectively. Each time the view is displaced by 40 pixels.When no index is given, all views will pan in the direction specified.
958 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
959 # you have selected one anonometric view
964 # you have selected an mu4 view; the object in the third
967 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
968 See also: **fit**, **2dfit**
971 @subsubsection occt_draw_4_1_5 fit, 2dfit
980 **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.
982 When fitting all views a unique zoom is computed for all the views. All views are on the same scale.
985 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
990 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
991 See also: **zoom**, **mu**, **pu**
994 @subsubsection occt_draw_4_1_6 u, d, l, r
1005 **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.
1008 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1009 # rotate the view up
1011 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1013 @subsubsection occt_draw_4_1_7 focal, fu, fd
1022 * **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.
1023 * **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object.
1026 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1029 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1031 **Note**: Do not use a negative or null focal value.
1035 @subsubsection occt_draw_4_1_8 color
1043 **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.
1045 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.
1048 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1049 # change the value of blue
1051 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1054 **Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc.
1056 @subsubsection occt_draw_4_1_9 dtext
1060 dtext [x y [z]] string
1063 **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.
1065 The coordinates are real space coordinates.
1068 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1072 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1074 @subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd
1079 hcolor index width gray
1080 xwd [index] filename
1083 * **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.
1084 * **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.
1085 * **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**.
1088 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1089 # all blue lines (color 3)
1090 # will be half-width and gray
1093 # make a postscript file and print it
1097 # make an xwd file and display it
1100 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1102 **Note:** When more than one view is present, specify the index of the view.
1104 Only use a postscript printer to print postscript files.
1109 @subsubsection occt_draw_4_1_11 wclick, pick
1114 pick index X Y Z b [nowait]
1117 **wclick** defers an event until the mouse button is clicked. The message <code>just click</code> is displayed.
1119 Use the **pick** command to get graphic input. The arguments must be names for variables where the results are stored.
1120 * index: index of the view where the input was made.
1121 * X,Y,Z: 3d coordinates in real world.
1122 * b: b is the mouse button 1,2 or 3.
1124 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.
1126 This option is useful for tracking the pointer.
1128 **Note** that the results are stored in Draw numeric variables.
1131 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1132 # make a circle at mouse location
1134 circle c x y z 0 0 1 1 0 0 0 30
1136 # make a dynamic circle at mouse location
1137 # stop when a button is clicked
1138 # (see the repaint command)
1141 while {[dval b] == 0} {
1142 pick index x y z b nowait
1143 circle c x y z 0 0 1 1 0 0 0 30
1146 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1147 See also: **repaint**
1150 Draw provides commands to manage the display of objects.
1151 * **display**, **donly** are used to display,
1152 * **erase**, **clear**, **2dclear** to erase.
1153 * **autodisplay** command is used to check whether variables are displayed when created.
1155 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.
1156 * 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.
1157 * 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.
1158 * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands.
1161 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1162 # OK use dot to dump an object on the screen
1167 #Not OK. display points on a curve c
1168 # with dot no variables are created
1169 for {set i 0} {$i = 10} {incr i} {
1170 cvalue c $i/10 x y z
1175 # would have displayed only one point
1176 # because the precedent variable content is erased
1179 # is an other solution, creating variables
1182 # give a name to a graphic object
1184 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1187 @subsubsection occt_draw_4_1_12 autodisplay
1195 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.
1197 When **autodisplay** is off, using the dot return argument is ineffective.
1200 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1209 # c is erased, but not displayed
1211 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1213 @subsubsection occt_draw_4_1_13 display, donly
1217 display varname [varname ...]
1218 donly varname [varname ...]
1221 * **display** makes objects visible.
1222 * **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen.
1225 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1226 \# to see all objects
1227 foreach var [directory] {display $var}
1229 \# to select two objects and erase the other ones
1231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1234 @subsubsection occt_draw_4_1_14 erase, clear, 2dclear
1239 erase [varname varname ...]
1244 **erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d.
1246 **clear** erases only 3d objects and **2dclear** only 2d objects. **erase** without arguments is similar to **clear; 2dclear**.
1250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1251 # erase eveerything with a name starting with c_
1252 foreach var [directory c_*] {erase $var}
1256 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1258 @subsubsection occt_draw_4_1_15 repaint, dflush
1268 * **repaint** forces repainting of views.
1269 * **dflush** flushes the graphic buffers.
1271 These commands are useful within loops or in scripts.
1273 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.
1275 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.
1278 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1279 # See the example with the pick command
1280 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1283 @subsection occt_draw_4_2 AIS viewer – view commands
1286 @subsubsection occt_draw_4_2_1 vinit
1292 Creates the 3D viewer window
1294 @subsubsection occt_draw_4_2_2 vhelp
1300 Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities.
1302 @subsubsection occt_draw_4_2_3 vtop
1309 Displays top view in the 3D viewer window.
1312 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1318 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1320 @subsubsection occt_draw_4_2_4 vaxo
1327 Displays axonometric view in the 3D viewer window.
1330 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1336 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1338 @subsubsection occt_draw_4_2_5 vsetbg
1342 vsetbg imagefile [filltype]
1345 Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH.
1350 vsetbg myimage.brep CENTERED
1353 @subsubsection occt_draw_4_2_6 vclear
1359 Removes all objects from the viewer.
1361 @subsubsection occt_draw_4_2_7 vrepaint
1367 Forcedly redisplays the shape in the 3D viewer window.
1369 @subsubsection occt_draw_4_2_8 vfit
1375 Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface.
1377 @subsubsection occt_draw_4_2_9 vzfit
1384 Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space.
1386 @subsubsection occt_draw_4_2_10 vreadpixel
1390 vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]
1392 Read pixel value for active view.
1395 @subsubsection occt_draw_4_2_11 vselect
1399 vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [shift_selection = 0|1]
1402 Emulates different types of selection:
1404 * single mouse click selection
1405 * selection with a rectangle having the upper left and bottom right corners in *(x1,y1)* and *(x2,y2)* respectively
1406 * selection with a polygon having the corners in pixel positions *(x1,y1), (x2,y2),…, (xn,yn)*
1407 * any of these selections if shift_selection is set to 1.
1409 @subsubsection occt_draw_4_2_12 vmoveto
1416 Emulates cursor movement to pixel position (x,y).
1418 @subsubsection occt_draw_4_2_13 vviewparams
1422 vviewparams [scale center_X center_Y proj_X proj_Y proj_Z up_X up_Y up_Z at_X at_Y at_Z]
1424 Gets or sets the current view characteristics.
1426 @subsubsection occt_draw_4_2_14 vchangeselected
1430 vchangeselected shape
1432 Adds a shape to selection or removes one from it.
1434 @subsubsection occt_draw_4_2_15 vzclipping
1438 vzclipping [mode] [depth width]
1440 Gets or sets ZClipping mode, width and depth, where
1441 - *mode = OFF|BACK|FRONT|SLICE*
1442 - *depth* is a real value from segment [0,1]
1443 - *width* is a real value from segment [0,1]
1445 @subsubsection occt_draw_4_2_16 vnbselected
1451 Returns the number of selected objects in the interactive context.
1453 @subsubsection occt_draw_4_2_17 vantialiasing
1459 Sets antialiasing if the command is called with 1 or unsets otherwise.
1461 @subsubsection occt_draw_4_2_18 vpurgedisplay
1465 vpurgedisplay [CollectorToo = 0|1]
1467 Removes structures which do not belong to objects displayed in neutral point.
1469 @subsubsection occt_draw_4_2_19 vhlr
1473 vhlr is_enabled={on|off}
1475 Switches hidden line removal (computed) mode on/off.
1477 @subsubsection occt_draw_4_2_20 vhlrtype
1481 vhlrtype algo_type={algo|polyalgo} [shape_1 ... shape_n]
1484 Changes the type of HLR algorithm used for shapes.
1485 If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes.
1487 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.
1489 **Note** that this command works with instances of *AIS_Shape* or derived classes only, other interactive object types are ignored.
1492 @subsection occt_draw_4_3 AIS viewer – display commands
1494 @subsubsection occt_draw_4_3_1 vdisplay
1497 vdisplay name1 [name2] … [name n]
1499 Displays named objects.
1503 box b 40 40 40 10 10 10
1509 @subsubsection occt_draw_4_32 vdonly
1511 Syntax: vdonly [name1] … [name n]
1513 Displays only selected or named objects. If there are no selected or named objects, nothing is done.
1517 box b 40 40 40 10 10 10
1521 @subsubsection occt_draw_4_33 vdisplayall
1525 Displays all created objects.
1529 box b 40 40 40 10 10 10
1533 @subsubsection occt_draw_4_34 verase
1535 Syntax: verase [name1] [name2] … [name n]
1537 Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
1541 box b1 40 40 40 10 10 10
1542 box b2 -40 -40 -40 10 10 10
1546 # erase only first box
1548 # erase second box and sphere
1550 @subsubsection occt_draw_4_35 veraseall
1554 Erases all objects displayed in the viewer.
1557 box b1 40 40 40 10 10 10
1558 box b2 -40 -40 -40 10 10 10
1562 # erase only first box
1564 # erase second box and sphere
1567 @subsubsection occt_draw_4_36 vsetdispmode
1569 Syntax: vsetdispmode [name] mode(0,1,2,3)
1571 Sets display mode for all, selected or named objects.
1572 **mode** is **0** (**WireFrame**), **1** (**Shading**), **2** (**Quick HideLineremoval**), **3** (**Exact HideLineremoval**).
1580 @subsubsection occt_draw_4_37 vdisplaytype
1582 Syntax: vdisplaytype type
1584 Displays all objects of a given type.
1585 Possible **type**s are **;Point;, ;Axis;, ;Trihedron;, ;PlaneTrihedron;, ;Line;, ;Circle;, ;Plane;, ;Shape;, ;ConnectedShape;, ;MultiConn.Shape;, ;ConnectedInter.;, ;MultiConn.;, ;Constraint; **and** ;Dimension; **(see **vtypes**).
1587 @subsubsection occt_draw_4_38 verasetype
1589 Syntax: verasetype type
1591 Erases all objects of a given type.
1592 Possible** type**s are **;Point;, ;Axis;, ;Trihedron;, ;PlaneTrihedron;, ;Line;, ;Circle;, ;Plane;, ;Shape;, ;ConnectedShape;, ;MultiConn.Shape;, ;ConnectedInter.;, ;MultiConn.;, ;Constraint; **and **;Dimension; **(see **vtypes**).
1594 @subsubsection occt_draw_4_39 vtypes
1598 Makes a list of known types and signatures in AIS.
1600 @subsubsection occt_draw_4_310 vsetcolor
1602 Syntax: vsetcolor [shapename] colorname
1604 Sets color for all, selected or named shapes.
1605 Possible **colorname**s are: ;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;**.
1609 @subsubsection occt_draw_4_311 vunsetcolor
1611 Syntax: vunsetcolor [shapename]
1613 Sets default color for all, selected or named shapes.
1615 @subsubsection occt_draw_4_312 vsettransparency
1617 Syntax: vsettransparency [shapename] coeficient
1619 Sets transparency for all selected or named shapes. The **Coefficient** may be between 0.0 (opaque) and 1.0 (fully transparent). Warning: at 1.0 the shape becomes invisible.
1628 vsettransparency b 0.5
1630 @subsubsection occt_draw_4_313 vunsettransparency
1632 Syntax: vunsettransparency [shapename]
1634 Sets default transparency (0.0) for all selected or named shapes.
1636 @subsubsection occt_draw_4_314 vsetmaterial
1638 Syntax: vsetmaterial [shapename] materialname
1640 Sets material for all selected or named shapes.
1641 **materialname** is ***BRASS*, *BRONZE*, *COPPER*, *GOLD*, *PEWTER*, *PLASTER*, *PLASTIC*, *SILVER*, *STEEL*, *STONE*, *SHINY_PLASTIC*, *SATIN*, *METALIZED*, *NEON_GNC*, *CHROME*, *ALUMINIUM*, *OBSIDIAN*, *NEON_PHC*, *JADE*.**
1651 @subsubsection occt_draw_4_315 vunsetmaterial
1653 Syntax: vunsetmaterial [shapename]
1655 Sets default material for all selected or named shapes.
1657 @subsubsection occt_draw_4_316 vsetwidth
1659 Syntax: vsetwidth [shapename] coeficient
1661 Sets width of the edges for all selected or named shapes.
1662 The **Coefficient** may be between 0.0 and 10.0.
1671 @subsubsection occt_draw_4_317 vunsetwidth
1673 Syntax: vunsetwidth [shapename]
1675 Sets default width of edges (0.0) for all selected or named shapes.
1677 @subsubsection occt_draw_4_318 vsetshading
1679 Syntax: vsetshading shapename [coefficient]
1681 Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
1690 @subsubsection occt_draw_4_319 vunsetshading
1692 Syntax: vunsetshading [shapename]
1694 Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
1696 @subsubsection occt_draw_4_320 vsetam
1698 Syntax: vsetam [shapename] mode
1700 Activates selection mode for all selected or named shapes.
1701 **mode** is **0** for **shape** itself, **1** for **vertices**, **2** for **edges**, **3** for **wires**, **4** for **faces**, **5** for **shells**, **6** for **solids**, **7** for **compounds**.
1709 @subsubsection occt_draw_4_321 vunsetam
1713 Deactivates all selection modes for all shapes.
1715 @subsubsection occt_draw_4_322 vdump
1717 Syntax: vdump filename.{png|xwd|bmp}
1719 Extracts the contents of the viewer window to a png, XWD or BMP file.
1721 @subsubsection occt_draw_4_323 vdir
1725 Displays the list of displayed objects.
1727 @subsubsection occt_draw_4_324 vsub
1729 Syntax: vsub 0/1(on/off)[shapename]
1731 Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
1742 @subsubsection occt_draw_4_325 vardis
1746 Displays active areas (for each activated sensitive entity, one or several 2D bounding boxes are displayed, depending on the implementation of a particular entity).
1748 @subsubsection occt_draw_4_326 varera
1752 Erases active areas.
1754 @subsubsection occt_draw_4_327 vsensdis
1758 Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes).
1760 Standard entity types are those defined in Select3D package:
1767 * sensitive triangulation
1768 * sensitive triangle
1769 Custom (application-defined) sensitive entity types are not processed by this command.
1771 @subsubsection occt_draw_4_328 vsensera
1775 Erases active entities.
1777 @subsubsection occt_draw_4_329 vperf
1779 Syntax: vperf shapename 1/0 (Transformation/Loacation) 1/0 (Primitives sensibles ON/OFF)
1781 Tests the animation of an object along a predefined trajectory.
1791 @subsubsection occt_draw_4_330 vr
1795 Reads shape from BREP-format file and displays it in the viewer.
1800 @subsubsection occt_draw_4_330331 vstate
1802 Syntax: vstate [name1] … [name n]
1804 Makes a list of the status (**Displayed** or **Not Displayed**) of some selected or named objects.
1808 @subsection occt_draw_4_3304 AIS viewer – object commands
1810 @subsubsection occt_draw_4_33041 vtrihedron
1812 Syntax: vtrihedron name [X0] [Y0] [Z0] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
1814 Creates a new AIS_Trihedron object. If no argument is set, the default trihedron (0XYZ) is created.
1820 @subsubsection occt_draw_4_33042 vplanetri
1822 Syntax: vplanetri name
1824 Creates a plane from a trihedron selection.
1827 @subsubsection occt_draw_4_33043 vsize
1829 Syntax: vsize [name] [size]
1831 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.
1836 vtrihedron tr2 0 0 0 1 0 0 1 0 0
1839 @subsubsection occt_draw_4_33044 vaxis
1841 Syntax: vaxis name [Xa Ya Za Xb Yb Zb]
1843 Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
1848 vaxis axe1 0 0 0 1 0 0
1850 @subsubsection occt_draw_4_33045 vaxispara
1852 Syntax: vaxispara nom
1854 Creates an axis by interactive selection of an edge and a vertex.
1856 @subsubsection occt_draw_4_33046 vaxisortho
1858 Syntax: vaxisotrho name
1860 Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
1862 @subsubsection occt_draw_4_33047 vpoint
1864 Syntax: vpoint name [Xa Ya Za]
1866 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).
1872 @subsubsection occt_draw_4_33048 vplane
1874 Syntax: vplane name [AxisName] [PointName]
1875 vplane name [PointName] [PointName] [PointName]
1876 vplane name [PlaneName] [PointName]
1878 Creates a plane from named or interactively selected entities.
1883 vaxis axe1 0 0 0 0 0 1
1885 vplane plane1 axe1 p1
1887 @subsubsection occt_draw_4_33049 vplanepara
1889 Syntax: vplanepara name
1891 Creates a plane from interactively selected vertex and face.
1893 @subsubsection occt_draw_4_330410 vplaneortho
1895 Syntax: vplaneortho name
1897 Creates a plane from interactive selected face and coplanar edge.
1899 @subsubsection occt_draw_4_330411 vline
1901 Syntax: vline name [PointName] [PointName]
1902 vline name [Xa Ya Za Xb Yb Zb]
1904 Creates a line from coordinates, named or interactively selected vertices.
1912 vline line2 0 0 0 50 0 1
1914 @subsubsection occt_draw_4_330412 vcircle
1916 Syntax: vcircle name [PointName PointName PointName IsFilled]
1917 vcircle name [PlaneName PointName Radius IsFilled]
1919 Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
1927 vcircle circle1 p1 p2 p3 1
1930 @subsubsection occt_draw_4_330413 vtri2d
1934 Creates a plane with a 2D trihedron from an interactively selected face.
1936 @subsubsection occt_draw_4_330414 vselmode
1938 Syntax: vselmode [object] mode On/Off
1940 Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
1941 Value On is defined as 1 and Off – as 0.
1948 vtriangle triangle1 p1 p2 p3
1949 @subsubsection occt_draw_4_330415 vconnect, vconnectsh
1951 Syntax: vconnect name object Xo Yo Zo Xu Xv Xw Zu Zv Zw
1952 vconnectsh name shape Xo Yo Zo Xu Xv Xw Zu Zv Zw
1954 Creates and displays an object with input location connected to a named entity.
1955 The difference between these two commands is that the object created by vconnect does not support the selection modes differrent from 0.
1961 vsegment segment p1 p2
1962 restore CrankArm.brep obj
1964 vconnectsh new obj 100100100 1 0 0 0 0 1
1968 @subsubsection occt_draw_4_330416 vtriangle
1970 Syntax: vtriangle name PointName PointName PointName
1972 Creates and displays a filled triangle from named points.
1979 vtriangle triangle1 p1 p2 p3
1981 @subsubsection occt_draw_4_330417 vsegment
1983 Syntax: vsegment name PointName PointName
1985 Creates and displays a segment from named points.
1991 vsegment segment p1 p2
1994 **MeshVS **(Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
1998 @subsection occt_draw_4_3305 AIS viewer – Mesh Visualization Service
2000 @subsubsection occt_draw_4_33051 meshfromstl
2002 Syntax: meshfromstl meshname file
2004 Creates a MeshVS_Mesh object based on STL file data. The object will be displayed immediately.
2007 meshfromstl mesh myfile.stl
2009 @subsubsection occt_draw_4_33052 meshdispmode
2011 Syntax: meshdispmode meshname displaymode
2013 Changes the display mode of object **meshname**. The **displaymode** is integer, which can be **1** (for wireframe), **2** (for shading mode) or **3** (for shrink mode).
2017 meshfromstl mesh myfile.stl
2020 @subsubsection occt_draw_4_33053 meshselmode
2022 Syntax: meshselmode meshname selectionmode
2024 Changes the selection mode of object **meshname**. The **selectionmode** is integer OR-combination of mode flags. The basic flags are the following:
2025 **1** – node selection,
2026 **2** – 0D elements (not suppored in STL)
2027 **4** – links (not supported in STL)
2032 meshfromstl mesh myfile.stl
2035 @subsubsection occt_draw_4_33054 meshshadcolor
2037 Syntax: meshshadcolor meshname red green blue
2039 Changes the face interior color of object **meshname**. The **red**, **green** and **blue** are real values between **0** and **1**.
2043 meshfromstl mesh myfile.stl
2044 meshshadcolormode mesh 0.5 0.5 0.5
2046 @subsubsection occt_draw_4_33055 meshlinkcolor
2048 Syntax: meshlinkcolor meshname red green blue
2050 Changes the color of face borders for object **meshname**. The **red**, **green** and **blue** are real values between **0** and **1**.
2054 meshfromstl mesh myfile.stl
2055 meshlinkcolormode mesh 0.5 0.5 0.5
2057 @subsubsection occt_draw_4_33056 meshmat
2059 Syntax: meshmat meshname material
2061 Changes the material of object **meshname**. **material** is represented with an integer value as follows (equivalent to enumeration Graphic3d_NameOfMaterial):
2072 **10 - SHINY_PLASTIC,**
2082 **20 - UserDefined**
2086 meshfromstl mesh myfile.stl
2089 @subsubsection occt_draw_4_33057 meshshrcoef
2091 Syntax: meshshrcoef meshname shrinkcoefficient
2093 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.
2097 meshfromstl mesh myfile.stl
2098 meshshrcoef mesh 0.05
2100 @subsubsection occt_draw_4_33058 meshshow
2102 Syntax: meshshow meshname
2104 Displays **meshname** in the viewer (if it is erased).
2108 meshfromstl mesh myfile.stl
2111 @subsubsection occt_draw_4_33059 meshhide
2113 Syntax: meshhide meshname
2115 Hides **meshname** in the viewer.
2119 meshfromstl mesh myfile.stl
2122 @subsubsection occt_draw_4_330510 meshhidesel
2124 Syntax: meshhidesel meshname
2126 Hides only selected entities. The other part of **meshname** remains visible.
2128 @subsubsection occt_draw_4_330511 meshshowsel
2130 Syntax: meshshowsel meshname
2132 Shows only selected entities. The other part of **meshname** becomes invisible.
2134 @subsubsection occt_draw_4_330512 meshshowall
2136 Syntax: meshshowall meshname
2138 Changes the state of all entities to visible for **meshname**.
2140 @subsubsection occt_draw_4_330513 meshdelete
2142 Syntax: meshdelete meshname
2144 Deletes MeshVS_Mesh object **meshname**.
2148 meshfromstl mesh myfile.stl
2154 @subsection occt_draw_4_3306 AIS viewer – 2D viewer – view commands
2156 @subsubsection occt_draw_4_33061 v2dinit
2160 **v2dinit **creates the 2D viewer window.
2162 @subsubsection occt_draw_4_33062 v2dsetbg
2164 Syntax: v2dsetbg imagefile [filletype]
2166 **v2dsetbg** loads **imagefile** as background. **filletype** is **NONE**, **CENTERED**, **TILED**, **STRETCH**.
2170 v2dsetbg myimage.brep CENTERED
2172 @subsubsection occt_draw_4_33063 v2dfit
2176 Fits all shapes to the size of the window.
2178 @subsubsection occt_draw_4_33064 v2drepaint
2182 Forcedly repaints all shapes.
2184 @subsubsection occt_draw_4_33065 v2dclear
2188 Clears the 2D viewer window
2190 @subsubsection occt_draw_4_33066 v2dtext
2192 Syntax: v2dtext text x y [angle scale fontindex]
2194 Creates a new object with the name **text_i** (i – integer value) and displays **text** at the position** x**, **y.** The text can be displayed at a certain **angle**, on a certain **scale** and with a certain **fontindex**.
2195 Default values are: **angle=0.0, scale=1.0, fontindex=0**.
2199 v2dtext *My text* 10 10
2200 @subsubsection occt_draw_4_33067 v2dsettextcolor
2202 Syntax: v2dsettextcolor text_name colorindex
2204 Changes the color of **text_name** object (**name** must be an integer value).
2208 v2dtext *My text* 10 10
2209 # Change color to red
2210 v2dsettextcolor text_0 3
2211 @subsubsection occt_draw_4_33068 v2dpick
2215 Displays mouse coordinates and color after clicking the mouse button in the 2D viewer window.
2218 @subsubsection occt_draw_4_33069 v2dgrid
2220 Syntax: v2dgrid [type x y xstep ystep angle [drawmode]]
2221 v2dgrid [type x y radiusstep division angle [drawmode]]
2223 Loads a grid in the 2D viewer window.
2224 **type** is **Rect** or **Circ**.
2225 **drawmode** is **Lines**, **Points** or **None**.
2229 v2dgrid Circ 0 0 250 12 0 Lines
2231 v2dgrid Rect 0 0 200 200 0 Lines
2232 @subsubsection occt_draw_4_330610 v2rmgrid
2236 Unloads a grid from the window.
2238 @subsubsection occt_draw_4_330611 v2dpickgrid
2240 Syntax: v2dpickgrid [mouse_x mouse_y [grid_x grid_y]]
2242 Gets coordinates of a grid point near the mouse button click in the 2D viewer window and sets it to **grid_x**, **grid_y** variables.
2244 @subsubsection occt_draw_4_330612 v2dpsout
2246 Syntax: v2dpsout imagefile [scale colorspace]
2247 [width height [xcenter ycenter]]
2249 Exports **imagefile**. You can set its the scale, width, height and colorspace.
2250 **colorspace** can be **RGB, BlackAndWhite, GreyScale**.
2252 @subsubsection occt_draw_4_330612613 v2ddir
2256 Makes aLlist of the displayed objects.
2259 @subsection occt_draw_4_3306127 Ais viewer – 2D viewer – display commands
2261 @subsubsection occt_draw_4_33061271 v2ddisplay
2263 Syntax: v2ddisplay name [projection]
2265 Projection: origin_x origin_y origin_z normal_x normal_y normal_z dx_x dx_y dx_z.
2267 Displays named objects.
2276 @subsubsection occt_draw_4_33061272 v2ddonly
2278 Syntax: v2ddonly [name1] … [name n]
2280 Displays only selected or named objects. If there are no selected or named objects, nothing is done.
2290 @subsubsection occt_draw_4_33061273 v2ddisplayall
2292 Syntax: v2ddisplayall
2294 Displays all created objects.
2305 @subsubsection occt_draw_4_33061274 v2derase
2307 Syntax: v2derase name1 [name2] … [name n]
2309 Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
2319 @subsubsection occt_draw_4_33061275 v2deraseall
2323 Erases all objects displayed in the viewer.
2333 @subsubsection occt_draw_4_33061276 v2dsetcolor
2335 Syntax: v2dsetcolor [shapename] colorname
2337 Sets color for all, selected or named shapes.
2338 Values of **colorname** see **vsetcolor**.
2347 @subsubsection occt_draw_4_33061277 v2dunsetcolor
2349 Syntax: v2dunsetcolor [shapename]
2351 Sets default color for all, selected or named shapes.
2361 @subsubsection occt_draw_4_33061278 v2dsetbgcolor
2363 Syntax: v2dsetbgcolor colorname
2365 Sets background color.
2366 See **vsetcolor** for the values of **colorname.**.
2375 @subsubsection occt_draw_4_33061279 v2dsetwidth
2377 Syntax: v2dsetwidth [shapename] widthenum
2379 Set width of the edges for all, selected or named shapes.
2380 **widthenum** may be one of: **THIN, MEDIUM, THICK, VERYTHICK**.
2389 @subsubsection occt_draw_4_330612710 v2dunsetwidth
2391 Syntax: vunsetwidth [shapename]
2393 Sets default width of the edges for all, selected or named shapes.
2404 @section occt_2142243456_930384826 OCAF commands
2407 This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
2410 @subsection occt_2142243456_9303848261 Application commands
2413 @subsubsection occt_2142243456_93038482611 NewDocument
2415 Syntax: NewDocument docname [format]
2417 Creates a new **docname** document with MDTV-Standard or described format.
2420 # Create new document with default (MDTV-Standard) format
2423 # Create new document with BinOcaf format
2424 NewDocument D2 BinOcaf
2426 @subsubsection occt_2142243456_93038482612 IsInSession
2428 Syntax: IsInSession path
2430 **I**Returns **0**, if **path** document is managed by the application session, **1** – otherwise.
2433 IsInSession /myPath/myFile.std
2435 @subsubsection occt_2142243456_93038482613 ListDocuments
2437 Syntax: ListDocuments
2439 Makes a list of documents handled during the session of the application.
2442 @subsubsection occt_2142243456_93038482614 Open
2444 Syntax: Open path docname
2446 Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session.
2449 Open /myPath/myFile.std D
2451 @subsubsection occt_2142243456_93038482615 Close
2453 Syntax: Close docname
2455 Closes **docname** document. The document is no longer handled by the applicative session.
2460 @subsubsection occt_2142243456_93038482616 Save
2462 Syntax: Save docname
2464 Saves **docname** active document.
2469 @subsubsection occt_2142243456_93038482617 SaveAs
2471 Syntax: SaveAs docname path
2473 Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists.
2476 SaveAs D /myPath/myFile.std
2478 @subsection occt_2142243456_9303848262 Basic commands
2481 @subsubsection occt_2142243456_930384826521 Label
2483 Syntax: Label docname entry
2485 Creates the label expressed by **entry** if it does not exist.
2490 @subsubsection occt_2142243456_930384826522 NewChild
2492 Syntax: NewChild docname [taggerlabel = Root label]
2494 Finds (or creates) a TagSource attribute located at father label of **taggerlabel** and makes a new child label.
2497 # Create new child of root label
2500 # Create new child of existing label
2504 @subsubsection occt_2142243456_930384826523 Children
2506 Syntax: Children docname label
2508 Returns the list of attributes of **label**.
2513 @subsubsection occt_2142243456_930384826524 ForgetAll
2515 Syntax: ForgetAll docname label
2517 Forgets all attributes of the label.
2522 @subsection occt_2142243456_93038482653 Application commands
2525 @subsubsection occt_2142243456_930384826531 Main
2527 Syntax: Main docname
2529 Returns the main label of the framework.
2534 @subsubsection occt_2142243456_930384826532 UndoLimit
2536 Syntax: UndoLimit docname [value=0]
2539 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
2544 @subsubsection occt_2142243456_930384826533 Undo
2546 Syntax: Undo docname [value=1]
2548 Undoes **value** steps.
2553 @subsubsection occt_2142243456_930384826534 Redo
2555 Syntax: Redo docname [value=1]
2557 Redoes **value** steps.
2562 @subsubsection occt_2142243456_930384826535 OpenCommand
2564 Syntax: OpenCommand docname
2566 Opens a new command transaction.
2571 @subsubsection occt_2142243456_930384826536 CommitCommand
2573 Syntax: CommitCommand docname
2575 Commits the Command transaction.
2580 @subsubsection occt_2142243456_930384826537 NewCommand
2582 Syntax: NewCommand docname
2584 This is a short-cut for Commit and Open transaction.
2589 @subsubsection occt_2142243456_930384826538 AbortCommand
2591 Syntax: AbortCommand docname
2593 Aborts the Command transaction.
2598 @subsubsection occt_2142243456_930384826539 Copy
2600 Syntax: Copy docname entry Xdocname Xentry
2602 Copies the contents of **entry** to **Xentry**. No links are registred.
2607 @subsubsection occt_2142243456_9303848265310 UpdateLink
2609 Syntax: UpdateLink docname [entry]
2611 Updates external reference set at **entry**.
2616 @subsubsection occt_2142243456_9303848265311 CopyWithLink
2618 Syntax: CopyWithLink docname entry Xdocname Xentry
2620 Aborts the Command transaction.
2621 Copies the content of **entry** to **Xentry**. The link is registred with an Xlink attribute at ** Xentry** label.
2624 CopyWithLink D1 0:2 D2 0:4
2626 @subsubsection occt_2142243456_9303848265312 UpdateXLinks
2628 Syntax: UpdateXLinks docname entry
2630 Sets modifications on labels impacted by external references to the **entry**. The **document** becomes invalid and must be recomputed
2635 @subsubsection occt_2142243456_9303848265313 DumpDocument
2637 Syntax: DumpDocument docname
2639 Displays parameters of **docname** document.
2644 @subsection occt_2142243456_93038482654 Data Framework commands
2647 @subsubsection occt_2142243456_930384826541 MakeDF
2649 Syntax: MakeDF dfname
2651 Creates a new data framework.
2656 @subsubsection occt_2142243456_930384826542 ClearDF
2658 Syntax: ClearDF dfname
2660 Clears a data framework.
2665 @subsubsection occt_2142243456_930384826543 CopyDF
2667 Syntax: CopyDF dfname1 entry1 [dfname2] entry2
2669 Copies a data framework.
2674 @subsubsection occt_2142243456_930384826544 CopyLabel
2676 Syntax: CopyLabel dfname fromlabel tolablel
2681 CopyLabel D1 0:2 0:4
2683 @subsubsection occt_2142243456_930384826545 MiniDumpDF
2685 Syntax: MiniDumpDF dfname
2687 Makes a mini-dump of a data framework.
2692 @subsubsection occt_2142243456_930384826546 XDumpDF
2694 Syntax: XDumpDF dfname
2696 Makes an extended dump of a data framework.
2701 @subsection occt_2142243456_93038482655 General attributes commands
2704 @subsubsection occt_2142243456_930384826551 SetInteger
2706 Syntax: SetInteger dfname entry value
2708 Finds or creates an Integer attribute at **entry** label and sets **value**.
2711 SetInteger D 0:2 100
2713 @subsubsection occt_2142243456_930384826552 GetInteger
2715 Syntax: GetInteger dfname entry [drawname]
2717 Gets a value of an Integer attribute at **entry** label and sets it to **drawname** variable, if it is defined.
2720 GetInteger D 0:2 Int1
2722 @subsubsection occt_2142243456_930384826553 SetReal
2724 Syntax: SetReal dfname entry value
2726 Finds or creates a Real attribute at **entry** label and sets **value**.
2731 @subsubsection occt_2142243456_930384826554 GetReal
2733 Syntax: GetReal dfname entry [drawname]
2735 Gets a value of a Real attribute at **entry** label and sets it to **drawname** variable, if it is defined.
2740 @subsubsection occt_2142243456_930384826555 SetIntArray
2742 Syntax: SetIntArray dfname entry lower upper value1 value2 …
2744 Finds or creates an IntegerArray attribute at **entry** label with lower and upper bounds and sets **value1, **.** value2…**
2747 SetIntArray D 0:2 1 4 100 200 300 400
2749 @subsubsection occt_2142243456_930384826556 GetIntArray
2751 Syntax: GetIntArray dfname entry
2753 Gets a value of an IntegerArray attribute at **entry** label.
2758 @subsubsection occt_2142243456_930384826557 SetRealArray
2760 Syntax: SetRealArray dfname entry lower upper value1 value2 …
2762 Finds or creates a RealArray attribute at **entry** label with lower and upper bounds and sets **value1, **.** value2…**
2765 GetRealArray D 0:2 1 4 100. 200. 300. 400.
2767 @subsubsection occt_2142243456_930384826558 GetRealArray
2769 Syntax: GetRealArray dfname entry
2771 Gets a value of a RealArray attribute at **entry** label.
2776 @subsubsection occt_2142243456_930384826559 SetComment
2778 Syntax: SetComment dfname entry value
2780 Finds or creates a Comment attribute at **entry** label and sets **value**.
2783 SetComment D 0:2 *My comment*
2785 @subsubsection occt_2142243456_9303848265510 GetComment
2787 Syntax: GetComment dfname entry
2789 Gets a value of a Comment attribute at **entry** label.
2794 @subsubsection occt_2142243456_9303848265511 SetExtStringArray
2796 Syntax: SetExtStringArray dfname entry lower upper value1 value2 …
2798 Finds or creates an ExtStringArray attribute at **entry** label with lower and upper bounds and sets **value1, **.** value2…**
2801 SetExtStringArray D 0:2 1 3 *string1* *string2* *string3*
2803 @subsubsection occt_2142243456_9303848265512 GetExtStringArray
2805 Syntax: GetExtStringArray dfname entry
2807 Gets a value of an ExtStringArray attribute at **entry** label.
2810 GetExtStringArray D 0:2
2812 @subsubsection occt_2142243456_9303848265513 SetName
2814 Syntax: SetName dfname entry value
2816 Finds or creates a Name attribute at **entry** label and set **value**.
2819 SetName D 0:2 *My name*
2821 @subsubsection occt_2142243456_9303848265514 GetName
2823 Syntax: GetName dfname entry
2825 Gets a value of a Name attribute at **entry** label.
2830 @subsubsection occt_2142243456_9303848265515 SetReference
2832 Syntax: SetReference dfname entry reference
2834 Creates a Reference attribute at **entry** label and sets **reference**.
2837 SetReference D 0:2 0:4
2839 @subsubsection occt_2142243456_9303848265516 GetReference
2841 Syntax: GetReference dfname entry
2843 Gets a value of a Reference attribute at **entry** label.
2848 @subsubsection occt_2142243456_9303848265517 SetUAttribute
2850 Syntax: SetUAttribute dfname entry localGUID
2852 Creates a UAttribute attribute at **entry** label with **localGUID**.
2855 set localGUID *c73bd076-22ee-11d2-acde-080009dc4422*
2856 SetUAttribute D 0:2 ${localGUID}
2858 @subsubsection occt_2142243456_9303848265518 GetUAttribute
2860 Syntax: GetUAttribute dfname entry loacalGUID
2862 Finds a UAttribute at **entry** label with **localGUID**.
2865 set localGUID *c73bd076-22ee-11d2-acde-080009dc4422*
2866 GetUAttribute D 0:2 ${localGUID}
2868 @subsubsection occt_2142243456_9303848265519 SetFunction
2870 Syntax: SetFunction dfname entry ID failure
2872 Finds or creates a Function attribute at **entry** label with driver ID and **failure** index.
2875 set ID *c73bd076-22ee-11d2-acde-080009dc4422*
2876 SetFunction D 0:2 ${ID} 1
2878 @subsubsection occt_2142243456_9303848265520 GetFunction
2880 Syntax: GetFunction dfname entry ID failure
2882 Finds a Function attribute at **entry** label and sets driver ID to **ID** variable and failure index to **failure** variable.
2885 GetFunction D 0:2 ID failure
2887 @subsubsection occt_2142243456_9303848265521 NewShape
2889 Syntax: NewShape dfname entry [shape]
2892 Finds or creates a Shape attribute at **entry** label. Creates or updates the associated NamedShape attribute by **shape** if **shape** is defined.
2898 @subsubsection occt_2142243456_9303848265522 SetShape
2900 Syntax: SetShape dfname entry shape
2902 Creates or updates a NamedShape attribute at **entry** label by **shape**.
2908 @subsubsection occt_2142243456_9303848265523 GetShape
2910 Syntax: GetShape2 dfname entry shape
2912 Sets a shape from NamedShape attribute associated with **entry** label to **shape** draw variable.
2917 @subsection occt_2142243456_93038482656 Geometric attributes commands
2920 @subsubsection occt_2142243456_930384826561 SetPoint
2922 Syntax: SetPoint dfname entry point
2924 Finds or creates a Point attribute at **entry** label and sets **point** as generated in the associated NamedShape attribute.
2930 @subsubsection occt_2142243456_930384826562 GetPoint
2932 Syntax: GetPoint dfname entry [drawname]
2934 Gets a vertex from NamedShape attribute at **entry** label and sets it to **drawname** variable, if it is defined.
2939 @subsubsection occt_2142243456_930384826563 SetAxis
2941 Syntax: SetAxis dfname entry axis
2943 Finds or creates an Axis attribute at **entry** label and sets **axis** as generated in the associated NamedShape attribute.
2946 line l 10 20 30 100 200 300
2949 @subsubsection occt_2142243456_930384826564 GetAxis
2951 Syntax: GetAxis dfname entry [drawname]
2953 Gets a line from NamedShape attribute at **entry** label and sets it to **drawname** variable, if it is defined.
2958 @subsubsection occt_2142243456_930384826565 SetPlane
2960 Syntax: SetPlane dfname entry plane
2962 Finds or creates a Plane attribute at **entry** label and sets **plane** as generated in the associated NamedShape attribute.
2965 plane pl 10 20 30 –1 0 0
2968 @subsubsection occt_2142243456_930384826566 GetPlane
2970 Syntax: GetPlane dfname entry [drawname]
2972 Gets a plane from NamedShape attribute at **entry** label and sets it to **drawname** variable, if it is defined.
2977 @subsubsection occt_2142243456_930384826567 SetGeometry
2979 Syntax: SetGeometry dfname entry [type] [shape]
2982 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**.
2986 SetGeometry D 0:2 pnt p
2988 @subsubsection occt_2142243456_930384826568 GetGeometryType
2990 Syntax: GetGeometryType dfname entry
2992 Gets a geometry type from Geometry attribute at **entry** label.
2995 GetGeometryType D 0:2
2997 @subsubsection occt_2142243456_930384826569 SetConstraint
2999 Syntax: SetConstraint dfname entry keyword geometrie [geometrie …]
3000 SetConstraint dfname entry *plane* geometrie
3001 SetConstraint dfname entry *value* value
3003 1. Creates a Constraint attribute at **entry** label and sets **keyword** constraint between geometry(ies).
3004 **keyword** must be one of the following:
3005 **rad/dia/minr/majr/tan/par/perp/concentric/equal/dist/angle/eqrad/symm/midp/ eqdist/fix/rigid**
3007 **from/axis/mate/alignf/aligna/axesa/facesa/round/offset**
3009 2. Sets plane for the existing constraint.
3011 3. Sets value for the existing constraint.
3014 SetConstraint D 0:2 *value* 5
3016 @subsubsection occt_2142243456_9303848265610 GetConstraint
3018 Syntax: GetConstraint dfname entry
3020 Dumps a Constraint attribute at **entry** label
3025 @subsubsection occt_2142243456_9303848265611 SetVariable
3027 Syntax: SetVariable dfname entry isconstant(0/1) units
3029 Creates a Variable attribute at **entry** label and sets **isconstant** flag and **units** as a string.
3032 SetVariable D 0:2 1 *mm*
3034 @subsubsection occt_2142243456_9303848265612 GetVariable
3036 Syntax: GetVariable dfname entry isconstant units
3038 Gets an **isconstant** flag and **units** of a Variable attribute at **entry** label.
3041 GetVariable D 0:2 isconstant units
3042 puts *IsConstant=${isconstant}*
3043 puts *Units=${units}*
3046 @subsection occt_2142243456_93038482657 Tree attributes commands
3049 @subsubsection occt_2142243456_930384826571 RootNode
3051 Syntax: RootNode dfname treenodeentry [ID]
3053 Returns ultimate father of TreeNode attribute identified by its **treenodeentry** and its **ID** (or default ID, if **ID** is not defined).
3056 @subsubsection occt_2142243456_930384826572 SetNode
3058 Syntax: SetNode dfname treenodeentry [ID]
3060 Creates a TreeNode attribute on the **treenodeentry** label with its tree **ID** (or assigns a default ID, if the **ID** is not defined).
3063 @subsubsection occt_2142243456_930384826573 AppendNode
3065 Syntax: AppendNode dfname fatherentry childentry [fatherID]
3068 Inserts a TreeNode attribute with its tree **fatherID** (or default ID, if **fatherID** is not defined) on **childentry** as last child of **fatherentry**.
3073 @subsubsection occt_2142243456_930384826574 PrependNode
3075 Syntax: PrependNode dfname fatherentry childentry [fatherID]
3078 Inserts a TreeNode attribute with its tree **fatherID** (or default ID, if **fatherID** is not defined) on **childentry** as first child of **fatherentry**.
3081 @subsubsection occt_2142243456_930384826575 InsertNodeBefore
3083 Syntax: InsertNodeBefore dfname treenodeentry beforetreenode [ID]
3085 Inserts a TreeNode attribute with tree **ID** (or default ID, if **ID** is not defined) **beforetreenode** before **treenodeentry**.
3088 @subsubsection occt_2142243456_930384826576 InsertNodeAfter
3090 Syntax: InsertNodeAfter dfname treenodeentry aftertreenode [ID]
3092 Inserts a TreeNode attribute with tree **ID** (or default ID, if **ID** is not defined) **aftertreenode** after **treenodeentry**.
3095 @subsubsection occt_2142243456_930384826577 DetachNode
3097 Syntax: DetachNode dfname treenodeentry [ID]
3099 Removes a TreeNode attribute with tree **ID** (or default ID, if **ID** is not defined) from **treenodeentry**.
3102 @subsubsection occt_2142243456_930384826578 ChildNodeIterate
3104 Syntax: ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID]
3107 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.
3122 AppendNode D 0:2 0:4
3123 AppendNode D 0:2 0:5
3124 PrependNode D 0:4 0:3
3125 PrependNode D 0:4 0:8
3126 PrependNode D 0:4 0:9
3128 InsertNodeBefore D 0:5 0:6
3129 InsertNodeAfter D 0:4 0:7
3135 ChildNodeIterate D 0:2 1
3145 # List only first levels
3146 ChildNodeIterate D 0:2 1
3153 @subsubsection occt_2142243456_930384826579 InitChildNodeIterator
3155 Syntax: InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID]
3158 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.
3161 InitChildNodeIterate D 0:5 1
3163 for {set i 1} {$i 100} {incr i} {
3164 if {[ChildNodeMore] == *TRUE*} {
3165 puts *Tree node = [ChildNodeValue]*
3170 puts *aChildNumber=$aChildNumber*
3172 @subsubsection occt_2142243456_9303848265710 ChildNodeMore
3174 Syntax: ChildNodeMore
3176 Returns TRUE if there is a current item in the iteration.
3179 @subsubsection occt_2142243456_9303848265711 ChildNodeNext
3181 Syntax: ChildNodeNext
3183 Moves to the next Item.
3186 @subsubsection occt_2142243456_9303848265712 ChildNodeValue
3188 Syntax: ChildNodeValue
3190 Returns the current treenode of ChildNodeIterator.
3193 @subsubsection occt_2142243456_9303848265713 ChildNodeNextBrother
3195 Syntax: ChildNodeNextBrother
3197 Moves to the next Brother. If there is none, goes up. This method is interesting only with ;allLevels; behavior.
3200 @subsection occt_2142243456_93038482658 Standard presentation commands
3203 @subsubsection occt_2142243456_930384826581 AISInitViewer
3205 Syntax: AISInitViewer docname
3207 Creates and sets AISViewer attribute at root label, creates AIS viewer window.
3212 @subsubsection occt_2142243456_930384826582 AISRepaint
3214 Syntax: AISRepaint docname
3216 Updates the AIS viewer window.
3221 @subsubsection occt_2142243456_930384826583 AISDisplay
3223 Syntax: AISDisplay docname entry [not_update]
3226 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.
3231 @subsubsection occt_2142243456_930384826584 AISUpdate
3233 Syntax: AISUpdate docname entry
3235 Recomputes a presantation of AISobject from **entry** label and applies the visualization setting in AIS viewer.
3240 @subsubsection occt_2142243456_930384826585 AISErase
3242 Syntax: AISErase docname entry
3244 Erases AISobject of **entry** label in AIS viewer.
3249 @subsubsection occt_2142243456_930384826586 AISRemove
3251 Syntax: AISRemove docname entry
3253 Erases AISobject of **entry** label in AIS viewer, then AISobject is removed from AIS_InteractiveContext.
3258 @subsubsection occt_2142243456_930384826587 AISSet
3260 Syntax: AISSet docname entry ID
3263 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).
3268 @subsubsection occt_2142243456_930384826588 AISDriver
3270 Syntax: AISDriver docname entry [ID]
3273 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).
3279 @subsubsection occt_2142243456_930384826589 AISUnset
3281 Syntax: AISUnset docname entry
3283 Deletes AISPresentation attribute (if it exists) of an **entry** label.
3288 @subsubsection occt_2142243456_9303848265810 AISTransparency
3290 Syntax: AISTransparency docname entry [transparency]
3292 Sets (if **transparency** is defined) or gets the value of transparency for AISPresentation attribute of an **entry** label.
3295 AISTransparency D 0:5 0.5
3297 @subsubsection occt_2142243456_9303848265811 AISHasOwnTransparency
3299 Syntax: AISHasOwnTransparency docname entry
3301 Tests AISPresentation attribute of an **entry** label by own transparency.
3304 AISHasOwnTransparency D 0:5
3306 @subsubsection occt_2142243456_9303848265812 AISMaterial
3308 Syntax: AISMaterial docname entry [material]
3311 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 **meshmat**).
3316 @subsubsection occt_2142243456_9303848265813 AISHasOwnMaterial
3318 Syntax: AISHasOwnMaterial docname entry
3320 Tests AISPresentation attribute of an **entry** label by own material.
3323 AISHasOwnMaterial D 0:5
3325 @subsubsection occt_2142243456_9303848265814 AISColor
3327 Syntax: AISColor docname entry [color]
3329 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**).
3334 @subsubsection occt_2142243456_9303848265815 AISHasOwnColor
3336 Syntax: AISHasOwnColor docname entry
3338 Tests AISPresentation attribute of an **entry** label by own color.
3341 AISHasOwnColor D 0:5
3344 @section occt_2142243456_1101404852 Geometry commands
3346 @subsection occt_2142243456_110140485261 Overview
3348 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.
3350 In the context of Geometry, Draw includes the following types of variable:
3353 * The 2d curve, which corresponds to *Curve *in *Geom2d*.
3354 * The 3d curve and surface, which correspond to *Curve *and *Surface *in *Geom *<a href="#_ftn2">[2]</a>.
3356 Draw geometric variables never share data; the **copy **command will always make a complete copy of the content of the variable.
3358 The following topics are covered in the nine sections of this chapter:
3360 * **Curve creation** deals with the various types of curves and how to create them.
3361 * **Surface creation** deals with the different types of surfaces and how to create them.
3362 * **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.
3363 * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
3364 * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
3365 * **Intersections** presents intersections of surfaces and curves.
3366 * **Approximations** deals with creating curves and surfaces from a set of points.
3367 * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
3368 * **Display** describes commands to control the display of curves and surfaces.
3370 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.
3372 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.
3374 @subsection occt_2142243456_110140485262 Curve creation
3376 This section deals with both points and curves. Types of curves are:
3378 * Analytical curves such as lines, circles, ellipses, parabolas, and hyperbolas.
3379 * Polar curves such as bezier curves and bspline curves.
3380 * 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.
3381 * NURBS can be created from other curves using **convert **in the *Surface Creation *section.
3382 * Curves can be created from the isoparametric lines of surfaces by the **uiso **and **viso **commands.
3383 * 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.
3385 Curves are displayed with an arrow showing the last parameter.
3388 @subsubsection occt_2142243456_1101404852621 point
3391 Syntax: point name x y [z]
3394 **point** creates a 2d or 3d point, depending on the number of arguments. **Example:**
3404 @subsubsection occt_2142243456_1101404852622 line
3407 Syntax: line name x y [z] dx dy [dz]
3410 **line** 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.
3412 A 2d line will be represented asl x y dx dy, and a 3d line asl x y z dx dy dz. A line is parameterized along its length starting from the point of origin along the direction vector. The direction vector is normalized and must not be null. Lines are infinite, even though their representation is not. **Example:**
3415 # a 2d line at 45 degrees of the X axis
3418 # a 3d line through the point 10 0 0 and parallel to Z
3422 @subsubsection occt_2142243456_1101404852623 circle
3424 Syntax: circle name x y [z [dx dy dz]] [ux uy [uz]] radius
3426 **circle **creates a 2d or a 3d circle.
3428 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.
3430 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.
3432 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.
3436 # A 2d circle of radius 5 centered at 10,-2
3439 # another 2d circle with a user defined origin
3440 # the point of parameter 0 on this circle will be
3441 # 1+sqrt(2),1+sqrt(2)
3444 # a 3d circle, center 10 20 -5, axis Z, radius 17
3445 circle c3 10 20 -5 17
3447 # same 3d circle with axis Y
3448 circle c4 10 20 -5 0 1 0 17
3450 # full 3d circle, axis X, origin on Z
3451 circle c5 10 20 -5 1 0 0 0 0 1 17
3454 @subsubsection occt_2142243456_1101404852624 ellipse
3456 Syntax: ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius **ellipse **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:
3458 P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir
3462 * P is the point of parameter u,
3463 * O, Xdir and Ydir are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system.
3466 # default 2d ellipse
3467 ellipse e1 10 5 20 10
3469 # 2d ellipse at angle 60 degree
3470 ellipse e2 0 0 1 2 30 5
3472 # 3d ellipse, in the XY plane
3473 ellipse e3 0 0 0 25 5
3475 # 3d ellipse in the X,Z plane with axis 1, 0 ,1
3476 ellipse e4 0 0 0 0 1 0 1 0 1 25 5
3478 See also: **circle**
3479 @subsubsection occt_2142243456_1101404852625 hyperbola
3481 Syntax: hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
3483 **hyperbola **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.
3485 The Draw hyperbola is parameterized as follows:
3487 P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir
3491 * P is the point of parameter U,
3492 * O, XDir and YDir are respectively the origin, *X Direction* and *Y
3494 Direction* of its local coordinate system.
3497 # default 2d hyperbola, with asymptotes 1,1 -1,1
3498 hyperbola h1 0 0 30 30
3500 # 2d hyperbola at angle 60 degrees
3501 hyperbola h2 0 0 1 2 20 20
3503 # 3d hyperbola, in the XY plane
3504 hyperbola h3 0 0 0 50 50
3506 See also: **circle**
3509 @subsubsection occt_2142243456_1101404852626 parabola
3511 Syntax: parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength
3513 **parabola **creates a 2d or 3d parabola. in the axis system defined by the first arguments.The origin is the apex of the parabola.
3515 The Geom_Parabola parabola is parameterized as follows:
3517 P(u) = O + u*u/(4.*F)*XDir + u*YDir
3520 * P is the point of parameter u,
3521 * O, XDir and YDir are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system,
3522 * F is the focal length of the parabola.
3528 # 2d parabola with convexity +Y
3529 parabola p2 0 0 0 1 50
3531 # 3d parabola in the Y-Z plane, convexity +Z
3532 parabola p3 0 0 0 1 0 0 0 0 1 50
3534 See also: **circle**
3537 @subsubsection occt_2142243456_1101404852627 beziercurve, dbeziercurve
3539 Syntax: beziercurve name nbpole pole, [weight]
3540 2dbeziercurve name nbpole pole, [weight]
3542 **beziercurve **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.
3545 # a rational 2d bezier curve (arc of circle)
3546 2dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1
3548 # a 3d bezier curve, not rational
3549 beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
3552 @subsubsection occt_2142243456_1101404852628 bsplinecurve, dbsplinecurve, pbsplinecurve, dpbsplinecurve
3554 Syntax: bsplinecurve name degree nbknots knot, umult pole, weight 2dbsplinecurve name degree nbknots knot, umult pole, weight pbsplinecurve name degree nbknots knot, umult pole, weight(periodic)
3555 2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
3557 **bsplinecurve **creates 2d or 3d bspline curves; the **pbsplinecurve **and **2dpbsplinecurve **commands create periodic bspline curves.
3559 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.
3561 The table of knots is an increasing sequence of reals without repetition.
3562 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.
3564 The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be:
3566 * For a non periodic curve: Sum of multiplicities - degree + 1
3567 * For a periodic curve: Sum of multiplicities - last multiplicity
3570 # a bspline curve with 4 poles and 3 knots
3571 bsplinecurve bc 2 3 0 3 1 1 2 3 \
3572 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
3573 # a 2d periodic circle (parameter from 0 to 2*pi !!)
3575 2dpbsplinecurve c 2 \
3576 4 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \
3586 *You can create the **NURBS **subset of bspline curves and*
3587 *surfaces by trimming analytical curves and surfaces and*
3588 *executing the command *convert*; see below.*
3591 @subsubsection occt_2142243456_1101404852629 uiso, viso
3593 Syntax: uiso name surface u
3596 Use these commands to create a U or V isoparametric curve from a surface.
3599 # create a cylinder and extract iso curves
3606 *Cannot be done from offset surfaces.*
3609 @subsubsection occt_2142243456_11014048526210 tod, tod
3611 Syntax: to3d name curve2d [plane]
3612 to2d name curve3d [plane]
3614 The **to3d **and **to2d **commands are used to 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.
3617 # the following commands
3619 plane p -2 1 0 1 2 3
3622 # will create the same circle as
3623 circle c -2 1 0 1 2 3 5
3625 See also: **project**
3628 @subsubsection occt_2142243456_11014048526211 project
3630 Syntax: project name curve3d surface
3632 **project **computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces.
3635 # intersect a cylinder and a plane
3636 # and project the resulting ellipse on the cylinder
3637 # this will create a 2d sinusoid-like bspline
3643 @subsection occt_2142243456_110140485263 Surface creation
3645 Types of surfaces are:
3647 * Analytical surfaces: plane, cylinder, cone, sphere, torus.
3648 * Polar surfaces: bezier surfaces, bspline surfaces
3649 * Trimmed and Offset surfaces; see **trim**, **trimu**, **trimv**, **offset**.
3650 * Surfaces produced by Revolution and Extrusion, created from curves with the **revsurf **and **extsurf**.
3653 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.
3656 @subsubsection occt_2142243456_1101404852631 plane
3658 Syntax: plane name [x y z [dx dy dz [ux uy uz]]]
3660 Uses this command to create an infinite plane. 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. The plane is perpendicular to Z and X is the U parameter. dx,dy,dz and ux,uy,uz must not be null and not colinear. ux,uy,uz will be modified to be orthogonal to dx,dy,dz. 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. Note that this definition will be used for all analytical surfaces.
3663 # a plane through the point 10,0,0 perpendicular to X
3664 # with U direction on Y
3665 plane p1 10 0 0 1 0 0 0 1 0
3667 # an horixontal plane with origin 10, -20, -5
3671 @subsubsection occt_2142243456_1101404852632 cylinder
3673 Syntax: cylinder name [x y z [dx dy dz [ux uy uz]]] radius
3675 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.
3679 # a cylinder on the default Z axis, radius 10
3682 # a cylinder, also along the Z axis but with origin 5,
3684 cylinder c2 5 10 -3 10
3686 # a cylinder through the origin and on a diagonal
3687 # with longitude pi/3 and latitude pi/4 (euler angles)
3688 dset lo pi/3. la pi/4.
3689 cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo)
3693 @subsubsection occt_2142243456_1101404852633 cone
3695 Syntax: cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius
3697 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.
3701 # a cone at 45 degrees at the origin on Z
3704 # a cone on axis Z with radius r1 at z1 and r2 at z2
3705 cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1
3707 @subsubsection occt_2142243456_1101404852634 sphere
3709 Syntax: sphere name [x y z [dx dy dz [ux uy uz]]] radius
3711 Creates a sphere in the local coordinate system defined in the **plane **command. The sphere is centered at the origin. To parameterize the sphere, u is the angle from X to Y, between o 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.
3713 # a sphere at the origin
3715 # a sphere at 10 10 10, with poles on the axis 1,1,1
3716 sphere s2 10 10 10 1 1 1 10
3721 @subsubsection occt_2142243456_1101404852635 torus
3723 Syntax: torus name [x y z [dx dy dz [ux uy uz]]] major minor
3725 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.
3727 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.
3730 # a torus at the origin
3733 # a torus in another coordinate system
3734 torus t2 10 5 -2 2 1 0 20 5
3739 @subsubsection occt_2142243456_1101404852636 beziersurf
3741 Syntax: beziersurf name nbupoles nbvolpes pole, [weight]
3743 Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions.
3745 Then give the poles in the following order: pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles) and pole(nbupoles, nbvpoles).
3747 Weights may be omitted, but if you give one weight you must give all of them.
3750 # a non-rational degree 2,3 surface
3752 0 0 0 10 0 5 20 0 0 \
3753 0 10 2 10 10 3 20 10 2 \
3754 0 20 10 10 20 20 20 20 10 \
3755 0 30 0 10 30 0 20 30 0
3757 See also: **beziercurve**
3759 @subsubsection occt_2142243456_1101404852637 bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf
3761 Syntax: bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot
3762 vmult ... x y z w ...
3767 **bsplinesurf **generates bspline surfaces. **upbsplinesurf **creates a bspline surface periodic in u; **vpbsplinesurf **creates one periodic in v; and **uvpbsplinesurf **creates one periodic in uv.
3769 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. 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.
3772 # create a bspline surface of degree 1 2
3773 # with two knots in U and three in V
3778 0 10 2 1 10 10 3 1 \
3779 0 20 10 1 10 20 20 1 \
3782 See also: **bsplinecurve**, **beziersurf**, **convert**
3785 @subsubsection occt_2142243456_1101404852638 trim, trimu, trimv
3787 Syntax: trim newname name [u1 u2 [v1 v2]]
3791 The **trim **commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom *package. The **trim **command creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface. **trimu **creates a u-trimmed surface, and **trimv **a v-trimmed surface. 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.
3793 *Note that a trimmed curve or surface contains a copy of the*
3794 *basis geometry: modifying that will not modify the trimmed*
3795 *geometry. Trimming trimmed geometry will not create*
3796 *multiple levels of trimming. The basis geometry will be used.*
3799 # create a 3d circle
3802 # trim it, use the same variable, the original is
3806 # the original can be recovered!
3812 # the original is not the trimmed curve but the basis
3815 # as the circle is periodic, the two following commands
3820 # trim an infinite cylinder
3824 See also: **reverse**
3827 @subsubsection occt_2142243456_1101404852639 offset
3829 Syntax: offset name basename distance [dx dy dz]
3831 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.
3833 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.
3835 The offset curve or surface copies the basic geometry, which can be modified later.
3838 # graphic demonstration that the outline of a torus
3839 # is the offset of an ellipse
3842 torus t 0 0 0 0 cos(angle) sin(angle) 50 20
3844 ellipse e 0 0 0 50 50*sin(angle)
3845 # note that the distance can be negative
3846 offset l1 e 20 0 0 1
3847 @subsubsection occt_2142243456_11014048526310 revsurf
3849 Syntax: revsurf name curvename x y z dx dy dz
3851 Creates a surface of revolution from a 3d curve. 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. 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.
3854 # another way of creating a torus like surface
3856 revsurf s c 0 0 0 0 1 0
3859 @subsubsection occt_2142243456_11014048526311 extsurf
3861 Syntax: extsurf newname curvename dx dy dz
3863 Use the **extsurf **command to create 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. In the syntax, dx,dy,dz gives the direction of extrusion. To parameterize a surface of extrusion: u is the parameter along the extruded curve; the v parameter is along the direction of extrusion.
3866 # an elliptic cylinder
3867 ellipse e 0 0 0 10 5
3873 @subsubsection occt_2142243456_11014048526312 convert
3875 Syntax: convert newname name
3877 **convert **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.
3880 # turn a 2d arc of a circle into a 2d NURBS
3885 # an easy way to make a planar bspline surface
3891 *Offset curves and surfaces are not treated by this command.*
3895 @subsection occt_2142243456_110140485264 Curve and surface modifications
3897 Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines.
3899 General modifications:
3901 * Reversing the parametrization: **reverse**, **ureverse**, **vreverse**
3903 Modifications for both bezier curves and bsplines:
3905 * Exchanging U and V on a surface: **exchuv**
3906 * Segmentation: **segment**, **segsur**
3907 * Increasing the degree: **incdeg**, **incudeg**, **incvdeg**
3908 * Moving poles: **cmovep**, **movep**, **movecolp**, **moverowp**
3910 Modifications for bezier curves:
3912 * Adding and removing poles: **insertpole**, **rempole**, **remcolpole**, **remrowpole**
3914 Modifications for bspline:
3916 * Inserting and removing knots: **insertknot**, **remknot**, **insertuknot**, **remuknot**, **insetvknot**, **remvknot**
3917 * Modifying periodic curves and surfaces: **setperiodic**, **setnotperiodic**, **setorigin**, **setuperiodic**, **setunotperiodic**, **setuorigin**, **setvperiodic**, **setvnotperiodic**, **setvorigin**
3923 @subsubsection occt_2142243456_1101404852641 reverse, ureverse, vreverse
3926 Syntax: reverse curvename
3927 ureverse surfacename
3928 vreverse surfacename
3930 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.
3932 **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.
3934 Reversing a parameter on an analytical surface may create an indirect coordinate system.
3937 # reverse a trimmed 2d circle
3942 # dumping c will show that it is now trimmed between
3943 # 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4
3946 @subsubsection occt_2142243456_1101404852642 exchuv
3948 Syntax: exchuv surfacename
3950 For a bezier or bspline surface this command exchanges the u and v parameters.
3953 # exchanging u and v on a spline (made from a cylinder)
3960 @subsubsection occt_2142243456_1101404852643 segment, segsur
3962 Syntax: segment curve Ufirst Ulast
3963 segsur surface Ufirst Ulast Vfirst Vlast
3965 **segment **and **segsur **segment a bezier curve and a bspline curve or surface respectively. These commands modify the curve to restrict it between the new parameters: the starting point of the modified curve, Ufirst, and the end point, Ulast. Ufirst is less than Ulast.
3967 This command must not be confused with **trim **which creates new geometry.
3971 # segment a bezier curve in half
3972 beziercurve c 3 0 0 0 10 0 0 10 10 0
3973 segment c ufirst ulast
3976 @subsubsection occt_2142243456_1101404852644 iincudeg, incvdeg
3978 Syntax: incudeg surfacename newdegree
3979 incvdeg surfacename newdegree
3981 **incudeg **and **incvdeg **increase the degree in the U or V parameter of a bezier or bspline surface.
3984 # make a planar bspline and increase the degree to 2 3
3992 *The geometry is modified.*
3995 @subsubsection occt_2142243456_1101404852645 cmovep, movep, movecolp, moverowp
3997 Syntax: cmovep curve index dx dy [dz]
3998 movep surface uindex vindex dx dy dz
3999 movecolp surface uindex dx dy dz
4000 moverowp surface vindex dx dy dz
4002 **move **methods translate poles of a bezier curve, a bspline curve or a bspline surface. **cmovep **and **movep **translate one pole with a given index.
4004 **movecolp **and **moverowp **translate a whole column (expressed by the uindex) or row (expressed by the vindex) of poles.
4007 # start with a plane
4008 # transform to bspline, raise degree and add relief
4010 trim p p -10 10 -10 10
4019 @subsubsection occt_2142243456_1101404852646 insertpole, rempole, remcolpole, remrowpole
4021 Syntax: insertpole curvename index x y [z] [weight]
4022 rempole curvename index
4023 remcolpole surfacename index
4024 remrowpole surfacename index
4026 **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.
4028 **rempole **removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves.
4030 **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.
4033 # start with a segment, insert a pole at end
4034 # then remove the central pole
4035 beziercurve c 2 0 0 0 10 0 0
4036 insertpole c 2 10 10 0
4040 @subsubsection occt_2142243456_1101404852647 insertknot, insertuknot, insertvknot
4042 Syntax: insertknot name knot [mult = 1] [knot mult ...]
4043 insertuknot surfacename knot mult
4044 insertvknot surfacename knot mult
4046 **insertknot **inserts knots in the knot sequence of a bspline curve. You must give a knot value and a target multiplicity. The default multiplicity is 1. If there is already a knot with the given value and a multiplicity lower than the target one, its multiplicity will be raised. **insertuknot **and **insertvknot **insert knots in a surface.
4053 # create a cylindrical surface and insert a knot
4055 trim c c 0 pi/2 0 10
4057 insertuknot c1 pi/4 1
4059 @subsubsection occt_2142243456_1101404852648 remknot, remuknot, remvknot
4061 Syntax: remknot index [mult] [tol]
4062 remuknot index [mult] [tol]
4063 remvknot index [mult] [tol]
4065 **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.
4067 By default, if no tolerance is given, the knot will always be removed.
4070 # bspline circle, remove a knot
4077 *Curves or Surfaces may be modified.*
4080 @subsubsection occt_2142243456_1101404852649 setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic
4082 Syntax: setperiodic curve
4083 setnotperiodic curve
4084 setuperiodic surface
4085 setunotperiodic surface
4086 setvperiodic surface
4087 setvnotperiodic surface
4089 **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.
4091 **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.
4094 # a circle deperiodicized
4098 @subsubsection occt_2142243456_11014048526410 setorigin, setuorigin, setvorigin
4100 Syntax: setorigin curvename index
4101 setuorigin surfacename index
4102 setuorigin surfacename index
4104 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.
4107 # a torus with new U and V origins
4114 @subsection occt_2142243456_110140485265 Transformations
4116 Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling.
4118 @subsubsection occt_2142243456_1101404852651 translate, dtranslate
4120 Syntax: translate name [names ...] dx dy dz
4121 2dtranslate name [names ...] dx dy
4123 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.
4125 For 2d points or curves, use the **2dtranslate **command.
4131 torus t 10 20 30 5 2
4132 translate p c t 0 0 15
4134 *Objects are modified by this command.*
4136 @subsubsection occt_2142243456_1101404852652 rotate, drotate
4138 Syntax: rotate name [name ...] x y z dx dy dz angle
4139 2drotate name [name ...] x y angle
4140 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.
4142 For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative.
4145 # make a helix of circles. create a scripte file with
4146 this code and execute it using **source**.
4148 for {set i 1} {$i = 10} {incr i} {
4149 copy c[expr $i-1] c$i
4151 rotate c$i 0 0 0 0 0 1 36
4154 @subsubsection occt_2142243456_1101404852653 pmirror, lmirror, smirror, dpmirror, dlmirror
4156 Syntax: pmirror name [names ...] x y z
4157 lmirror name [names ...] x y z dx dy dz
4158 smirror name [names ...] x y z dx dy dz
4159 2dpmirror name [names ...] x y
4160 2dlmirror name [names ...] x y dx dy
4162 The mirror commands perform a mirror transformation of 2d or 3d geometry.
4164 **pmirror **is the point mirror, mirroring 3d curves and surfaces about a point of symmetry. **lmirror **is the line mirror commamd, mirroring 3d curves and surfaces about an axis of symmetry. **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.
4166 In 2d, only **2dpmirror**, point symmetry mirroring, and **2dlmirror**, axis symmetry mirroring, are available.
4169 # build 3 images of a torus
4170 torus t 10 10 10 1 2 3 5 1
4174 lmirror t2 0 0 0 1 0 0
4176 smirror t3 0 0 0 1 0 0
4178 @subsubsection occt_2142243456_1101404852654 pscale, dpscale
4180 Syntax: pscale name [name ...] x y z s
4181 2dpscale name [name ...] x y s
4182 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**.
4185 # double the size of a sphere
4189 @subsection occt_2142243456_110140485266 Curve and surface analysis
4191 **Draw **provides methods to compute information about curves and surfaces:
4193 * **coord **to find the coordinates of a point.
4194 * **cvalue **and **2dcvalue **to compute points and derivatives on curves.
4195 * **svalue **to compute points and derivatives on a surface.
4196 * **localprop **and **minmaxcurandif **to compute the curvature on a curve.
4197 * **parameters **to compute (u,v) values for a point on a surface.
4198 * **proj **and **2dproj **to project a point on a curve or a surface.
4199 * **surface_radius **to compute the curvature on a surface.
4201 @subsubsection occt_2142243456_1101404852661 coord
4203 Syntax: coord P x y [z]
4205 The **coord **command will set the coordinates of the point P. x, y (and optionally z)
4214 @subsubsection occt_2142243456_1101404852662 cvalue, dcvalue
4216 Syntax: cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]]
4217 2dcvalue curve U x y [d1x d1y [d2x d2y]]
4219 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.
4222 # on a bezier curve at parameter 0
4223 # the point is the first pole
4224 # the derivative is the vector first to second pole
4225 # multiplied by the degree
4226 # the second derivative is the difference
4227 # first to second pole, second to third pole
4228 # multipied by degree * degree-1
4229 2dbeziercurve c 4 0 0 1 1 2 1 3 0
4230 2dcvalue c 0 x y d1x d1y d2x d2y
4232 # values of x y d1x d1y d2x d2y
4236 @subsubsection occt_2142243456_1101404852663 svalue
4238 Syntax: svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]]
4240 **svalue **computes points and derivatives on a surface for a pair of parameter values. The result depends on the number of arguments. You can compute first and second derivatives.
4243 # display points on a sphere
4245 for {dset t 0} {[dval t] = 1} {dset t t+0.01} {
4246 svalue s t*2*pi t*pi-pi/2 x y z
4251 @subsubsection occt_2142243456_1101404852664 localprop, minmaxcurandinf
4253 Syntax: localprop curvename U
4254 minmaxcurandinf curve
4256 The **localprop **command computes the curvature of a curve.
4257 **minmaxcurandinf **computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve.
4260 # show curvature at the center of a bezier curve
4261 beziercurve c 3 0 0 0 10 2 0 20 0 0
4265 See also: **surface_radius**
4268 @subsubsection occt_2142243456_1101404852665 parameters
4270 Syntax: parameters surf/curve x y z U [V]
4272 The **parameters **command 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.
4275 # Compute parameters on a plane
4276 plane p 0 0 10 1 1 0
4277 parameters p 5 5 5 u v
4278 # the values of u and v are : 0 5
4281 @subsubsection occt_2142243456_1101404852666 proj, dproj
4283 Syntax: proj name x y z
4286 Use **proj **to project a point on a 3d curve or a surface and **2dproj **for a 2d curve.
4288 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, ...
4291 # project point on a torus
4294 == ext_1 ext_2 ext_3 ext_4
4297 @subsubsection occt_2142243456_1101404852667 surface_radius
4299 Syntax: surface_radius surface u v [c1 c2]
4301 The **surface_radius **command 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.
4304 # computes curvatures of a cylinder
4306 surface_radius c pi 3 c1 c2
4307 == Min Radius of Curvature : -5
4308 == Min Radius of Curvature : infinite
4312 @subsection occt_2142243456_110140485267 Intersections
4314 The **intersect **command computes intersections of surfaces; the **2dintersect **command, intersections of 2d curves.
4317 @subsubsection occt_2142243456_1101404852671 intersect
4319 Syntax: intersect name surface1 surface2
4321 The **intersect **command 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;, ...
4326 plane p 0 0 40 0 1 5
4330 @subsubsection occt_2142243456_1101404852672 dintersect
4332 Syntax: 2dintersect curve1 curve2
4334 **2dintersect **displays the intersection points between two 2d curves.
4337 # intersect two 2d ellipses
4339 ellipse e2 0 0 0 1 5 2
4341 @subsection occt_2142243456_110140485268 Approximations
4343 Draw provides command to create curves and surfaces by approximation.
4345 **2dapprox **fits a curve through 2d points, **appro **fits a curve through 3d points, **surfapp **and **grilapp **fits a surface through 3d points, **2dinterpolate **may be used to interpolate a curve.
4347 @subsubsection occt_2142243456_1101404852681 appro, dapprox
4349 Syntax: appro result nbpoint [curve]
4350 2dapprox result nbpoint [curve / x1 y1 x2 y2]
4352 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.
4355 # pick points and they will be fitted
4359 @subsubsection occt_2142243456_1101404852682 surfapp, grilapp
4362 Syntax: surfapp name nbupoints nbvpoints x y z ....
4363 grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ...
4365 **surfapp **fits a surface through an array of u and v points, nbupoints*nbvpoints.
4367 **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.
4370 # a surface using the same data as in the beziersurf
4373 0 0 0 10 0 5 20 0 0 \
4374 0 10 2 10 10 3 20 10 2 \
4375 0 20 10 10 20 20 20 20 10 \
4376 0 30 0 10 30 0 20 30 0
4382 @subsection occt_2142243456_110140485269 Constraints
4384 The **cirtang **command is used to construct 2d circles tangent to curves and **lintan **to construct 2d lines tangent to curves.
4387 @subsubsection occt_2142243456_1101404852691 cirtang
4389 Syntax: cirtang cname curve/point/radius curve/point/radius curve/point/radius
4391 The **cirtang **command will build 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.
4394 # a point, a line and a radius. 2 solutions
4401 @subsubsection occt_2142243456_1101404852692 lintan
4403 Syntax: lintan name curve curve [angle]
4405 The **lintan **command will build all 2d lines tangent to two curves. If a 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.
4408 # lines tangent to 2 circles, 4 solutions
4413 # lines at 15 degrees tangent to a circle and a line, 2
4414 solutions: l1_1 l1_2
4422 @subsection occt_2142243456_1101404852610 Display
4424 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.
4426 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.
4428 On surfaces, you can control the number of isoparametric curves displayed on the surface with the **nbiso **commands.
4430 On bezier and bspline curve and surface you can toggle the display of the control points with the **clpoles **and **shpoles **commands.
4432 On bspline curves and surfaces you can toggle the display of the knots with the **shknots **and **clknots **commands.
4435 @subsubsection occt_2142243456_11014048526101 dmod, discr, defle
4437 Syntax: dmode name [name ...] u/d
4438 discr name [name ...] nbintervals
4439 defle name [name ...] deflection
4441 **dmode **allows you to choose the display mode for a curve or a surface.
4443 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.
4445 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).
4447 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.
4450 # increment the number of points on a big circle
4458 @subsubsection occt_2142243456_11014048526102 nbiso
4460 Syntax: nbiso name [names...] nuiso nviso
4462 **nbiso **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.
4465 # display 35 meridians and 15 parallels on a spere
4470 @subsubsection occt_2142243456_11014048526103 clpoles, shpoles
4472 Syntax: clpoles name
4475 On bezier and bspline curves and surfaces, the control polygon is displayed by default: **clpoles **erases it and **shpoles **restores it.
4478 # make a bezier curve and erase the poles
4479 beziercurve c 3 0 0 0 10 0 0 10 10 0
4483 @subsubsection occt_2142243456_11014048526104 clknots, shknots
4485 Syntax: clknots name
4488 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.
4491 # hide the knots on a bspline curve
4492 bsplinecurve bc 2 3 0 3 1 1 2 3 \
4493 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
4495 @section occt_2142243456_1869436669 Topology commands
4503 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.
4505 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.
4507 The different topological shapes<a href="#_ftn3">[3]</a> include:
4509 * COMPOUND: A group of any type of topological object.
4510 * COMPSOLID: A set of solids connected by their faces. This expands the notions of WIRE and SHELL to solids.
4511 * SOLID: A part of space limited by shells. It is three dimensional.
4512 * SHELL: A set of faces connected by their edges. A shell can be open or closed.
4513 * FACE: In 2d, a plane; in 3d, part of a surface. Its geometry is constrained (trimmed) by contours. It is two dimensional.
4514 * WIRE: A set of edges connected by their vertices. It can be open or closed depending on whether the edges are linked or not.
4515 * EDGE: A topological element corresponding to a restrained curve. An edge is generally limited by vertices. It has one dimension.
4516 * VERTEX: A topological element corresponding to a point. It has a zero dimension.
4518 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**).
4520 The following topics are covered in the eight sections of this chapter:
4522 * Basic shape commands to handle the structure of shapes and control the display.
4523 * Curve and surface topology, or methods to create topology from geometry and vice versa.
4524 * Primitive construction commands: box, cylinder, wedge etc.
4525 * Sweeping of shapes.
4526 * Transformations of shapes: translation, copy, etc.
4527 * Topological operations, or booleans.
4528 * Drafting and blending.
4529 * Analysis of shapes.
4533 @subsection occt_2142243456_186943666971 Basic topology
4535 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:
4537 * **isos **and **discretisation **to control display of shape faces by isoparametric curves .
4538 * **orientation**, **complement **and **invert **to modify topological attributes such as orientation.
4539 * **explode**, **exwire **and **nbshapes **to analyze the structure of a shape.
4540 * **emptycopy**, **add**, **compound **to create shapes by stepwise construction.
4542 In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges:
4544 * a red edge is an isolated edge, which belongs to no faces.
4545 * a green edge is a free boundary edge, which belongs to one face,
4546 * a yellow edge is a shared edge, which belongs to at least two faces.
4549 @subsubsection occt_2142243456_1869436669711 isos, discretisation
4551 Syntax: isos [name ...][nbisos]
4552 discretisation nbpoints
4553 **isos **determines or changes the number of isoparametric curves on shapes.
4555 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.
4557 **discretisation **changes the default number of points used to display the curves. The default value is 30.
4560 # Display only the edges (the wireframe)
4564 Don’t confuse *isos* and *discretisation* with the geometric
4565 *commands *nbisos* and *discr*.*
4568 @subsubsection occt_2142243456_1869436669712 orientation, complement, invert, normals, range
4570 Syntax: orientation name [name ...] F/R/E/I
4571 complement name [name ...]
4573 normals s (length = 10), disp normals
4574 range name value value
4576 **orientation **assigns the orientation of shapes - simple and complex - to one of the following four values: FORWARD, REVERSED, INTERNAL, EXTERNAL.
4578 **complement **changes the current orientation of shapes to its complement, FORWARD - REVERSED, INTERNAL - EXTERNAL.
4580 **invert **creates a new shape which is a copy of the original with the orientation all subshapes reversed. For example, it may be useful to reverse the normals of a solid.
4582 **normals **returns the assignment of colors to orientation values.
4584 **range **defines the length of a selected edge by defining the values of a starting point and an end point.
4587 # invert normals of a box
4593 # to assign a value to an edge
4595 # to define the box as edges
4597 b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12
4598 # to define as an edge
4600 # to define the length of the edge as starting from 0
4605 @subsubsection occt_2142243456_1869436669713 explode, exwire, nbshapes
4607 Syntax: explode name [C/So/Sh/F/W/E/V]
4611 **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.
4613 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.
4615 **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.
4617 **nbshapes **counts the number of shapes of each type in an entity.
4623 # whatis returns the type and various information
4625 = b is a shape SOLID FORWARD Free Modified
4630 = b_1 is a shape SHELL FORWARD Modified Orientable
4633 # extract the edges b_1, ... , b_12
4640 Number of shapes in b
4652 @subsubsection occt_2142243456_1869436669714 emptycopy, add, compound
4654 Syntax: emptycopy [newname] name
4656 compound [name ...] compoundname
4658 **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.
4660 **add **inserts shape C into shape S. Verify that C and S reference compatible types of objects:
4662 * Any *Shape *can be added to a *Compound*.
4663 * Only a *Solid *can be added to a *CompSolid*.
4664 * Only a *Shell*, an *Edge *or a *Vertex *can be added into a *Solid*.
4665 * Only a *Face *can be added to a *Shell*.
4666 * Only a *Wire *and *Vertex *can be added in a *Solid*.
4667 * Only an *Edge *can be added to a *Wire*.
4668 * Only a *Vertex *can be added to an *Edge*.
4669 * Nothing can be added to a *Vertex*.
4671 Care should be taken using **emptycopy **and **add**.
4673 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.
4676 # a compound with three boxes
4683 @subsubsection occt_2142243456_1869436669715 checkshape
4685 Syntax: checkshape [-top] shape [result] [-short]
4688 *-top* – check only topological validity of a shape.
4689 *shape *– the only required parameter which represents the name of the shape to check.
4690 *result* – optional parameter which is the prefix of the output shape names.
4691 *-short* – short description of check.
4694 **checkshape **examines the selected object for topological and geometric coherence. The object should be a three dimensional shape.
4697 # checkshape returns a comment valid or invalid
4700 # returns the comment
4701 this shape seems to be valid
4704 *This test is performed using the tolerance set in the algorithm.*
4710 @subsection occt_2142243456_186943666972 Curve and surface topology
4712 This group of commands is used to create topology from shapes and to extract shapes from geometry.
4714 * To create vertices, use the **vertex **command.
4715 * To create edges use, the **edge**, **mkedge **commands.
4716 * To create wires, use the **wire**, **polyline**, **polyvertex **commands.
4717 * To create faces, use the **mkplane**, **mkface **commands.
4718 * To extract the geometry from edges or faces, use the **mkcurve **and **mkface **commands.
4719 * To extract the 2d curves from edges or faces, use the **pcurve **command.
4722 @subsubsection occt_2142243456_1869436669721 vertex
4724 Syntax: vertex name [x y z / p edge]
4726 Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge.
4732 @subsubsection occt_2142243456_1869436669722 edge, mkedge, uisoedge, visoedge
4734 Syntax: edge name vertex1 vertex2
4735 mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]]
4736 uisoedge edge face u v1 v2
4737 visoedge edge face v u1 u2
4739 **edge **creates a straight line edge between two vertices.
4741 **mkedge **generates edges from curves<a href="#_ftn4">[4]</a>.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 you to block 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.
4744 # straight line edge
4749 # make a circular edge
4753 # A similar result may be achieved by trimming the curve
4754 # The trimming is removed by mkedge
4758 **visoedge **and **uisoedge **are commands that generate a uiso parameter edge
4759 or a viso parameter edge.
4763 # to create an edge between v1 and v2 at point u
4764 # to create the example plane
4773 # to create the edge in the plane at the u axis point
4774 0.5, and between the v axis points v=0.2 and v =0.8
4775 uisoedge e p 0.5 0.20 0.8
4778 @subsubsection occt_2142243456_1869436669723 wire, polyline, polyvertex
4780 Syntax: wire wirename e1/w1 [e2/w2 ...]
4781 polyline name x1 y1 z1 x2 y2 z2 ...
4782 polyvertex name v1 v2 ...
4784 **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.
4786 **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.
4788 **polyvertex **creates a polygonal wire from vertices.
4791 # create two polygonal wires
4792 # glue them and define as a single wire
4793 polyline w1 0 0 0 10 0 0 10 10 0
4794 polyline w2 10 10 0 0 10 0 0 0 0
4798 @subsubsection occt_2142243456_1869436669724 profile
4800 Syntax profile name [code values] [code values] ...
4802 **Code** **Values ** **Action**
4803 O X Y Z Sets the origin of the plane
4804 P DX DY DZ UX UY UZ Sets the normal and X of the plane
4805 F X Y Sets the first point
4806 X DX Translates a point along X
4807 Y DY Translates a point along Y
4808 L DL Translates a point along direction
4809 XX X Sets point X coordinate
4810 YY Y Sets point Y coordinate
4811 T DX DY Translates a point
4813 R Angle Rotates direction
4814 RR Angle Sets direction
4815 D DX DY Sets direction
4816 IX X Intersects with vertical
4817 IY Y Intersects with horizontal
4818 C Radius Angle Arc of circle tangent to direction
4821 No suffix Makes a closed face
4822 W Make a closed wire
4823 WW Make an open wire
4826 **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.
4828 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.
4830 The point [code values] can be repeated any number of times and in any order to create the profile contour.
4832 The profile shape definition is the suffix; no suffix produces a face, **w **is a closed wire, **ww **is an open wire.
4834 Code letters are not case-sensitive.
4837 # to create a trianglular plane using a vertex at the
4838 origin, in the xy plane
4839 profile p O 0 0 0 X 1 Y 0 x 1 y 1
4842 # to create a contour using the different code
4845 # two vertices in the xy plane
4846 profile p F 1 0 x 2 y 1 ww
4848 # to view from a point normal to the plane
4851 # add a circular element of 45 degrees
4852 profile p F 1 0 x 2 y 1 c 1 45 ww
4854 # add a tangential segment with a length value 1
4855 profile p F 1 0 x 2 y 1 c 1 45 l 1 ww
4857 # add a vertex with xy values of 1.5 and 1.5
4858 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 ww
4860 # add a vertex with the x value 0.2, y value is constant
4861 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 ww
4863 # add a vertex with the y value 2 x value is constant
4864 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 yy 2 ww
4866 # add a circular element with a radius value of 1 and a circular value of 290 degrees
4867 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
4869 # wire continues at a tangent to the intersection x = 0
4870 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
4872 # continue the wire at an angle of 90 degrees until it intersects the y axis at y= -o.3
4873 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
4876 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
4878 # to create the plane with the same contour
4879 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
4882 @subsubsection occt_2142243456_1869436669725 bsplineprof
4884 Syntax: bsplineprof name [S face] [W WW]
4886 for an edge : digitizes ... mouse button 2
4887 to end profile : mouse button 3
4889 Build a profile in the XY plane from digitizes
4890 By default the profile is closed and a face is built.
4892 W Make a closed wire
4893 WW Make an open wires
4895 **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.
4897 The profile shape definition is the suffix; no suffix produces a face, **w **is a closed wire, **ww **is an open wire.
4900 #to view the xy plane
4902 #to create a 2d curve with the mouse
4904 # click mb1 to start the curve
4905 # click mb1 to create the second vertex
4906 # click mb1 to create a curve
4908 #click mb2 to finish the curve and start a new curve
4910 # click mb1 to create the second curve
4911 # click mb3 to create the face
4914 @subsubsection occt_2142243456_1869436669726 mkoffset
4916 Syntax: mkoffset result face/compound of wires nboffset stepoffset
4918 **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 occurences is not limited.
4920 The offset distance defines the spacing and the positionning of the occurences.
4923 #Create a box and select a face
4926 #Create three exterior parallel contours with an offset
4929 Create one interior parallel contour with an offset
4932 mkoffset r b_1 1 -0.4
4935 *The mkoffset command must be used with prudence, angular contours produce offset contours with fillets. Interior parallel contours can produce more than one wire, normally these are refused. In the following example, any increase in the offset value is refused*
4938 # to create the example contour
4939 profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w
4940 # to create an incoherent interior offset
4941 mkoffset r p 1 -0.50
4942 ==p is not a FACE but a WIRE
4943 BRepFill_TrimEdgeTool: incoherent intersection
4944 # to create two incoherent wires
4945 mkoffset r p 1 -0.50
4948 @subsubsection occt_2142243456_1869436669727 mkplane, mkface
4950 Syntax: mkplane name wire
4951 mkface name surface [ufirst ulast vfirst vlast]
4953 **mkplane **generates a face from a planar wire. The planar surface will be constructed with an orientation which keeps the face inside the wire.
4955 **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.
4958 # make a polygonal face
4959 polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0
4962 # make a cylindrical face
4964 trim g g -pi/3 pi/2 0 15
4968 @subsubsection occt_2142243456_1869436669728 mkcurve, mksurface
4970 Syntax: mkcurve curve edge
4973 **mkcurve **creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries.
4975 **mksurface **creates a surface from a face. The surface will not be trimmed.
4984 @subsubsection occt_2142243456_1869436669729 pcurve
4986 Syntax: pcurve [name edgename] facename
4988 **pcurve **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 counterclockwise. To make curves visible, use a fitted 2d view.
4991 # view the pcurves of a face
5000 @subsubsection occt_2142243456_18694366697210 chfid
5002 Syntax: chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) ....
5004 chfi2d creates chamfers and fillets on 2D objects. Select t:wo adjacent edges and:
5007 * two respective distance values
5008 * a distance value and an angle
5010 The radius value produces a fillet between the two faces.
5012 The distance is the length value from the edge between the two selected faces in a normal direction.
5016 # to create a 2d fillet
5018 profile p x 2 y 2 x -2
5019 chfi2d cfr p . . F 0.3
5026 # to create a 2d chamfer using two distances
5027 profile p x 2 y 2 x -2
5028 chfi2d cfr p . . CDD 0.3 0.6
5035 # to create a 2d chamfer using a defined distance and
5038 profile p x 2 y 2 x -2
5039 chfi2d cfr p . . CDA 0.3 75
5046 @subsubsection occt_2142243456_18694366697211 nproject
5048 Syntax: nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol
5049 [continuity [maxdeg [maxseg]]]
5051 **nproject **creates a shape projection which is normal to the target surface.
5054 # create a curved surface
5063 translate ll 2 -0.5 0
5069 #display in four views
5072 # create the example shape
5073 circle c 1.8 -0.5 1 0 1 0 1 0 0 0.4
5076 # create the normal projection of the shape(circle)
5081 @subsection occt_2142243456_186943666973 Primitives
5083 Primitive commands make it possible to create simple shapes. They include:
5085 * **box **and **wedge **commands.
5086 * **pcylinder**, **pcone**, **psphere**, **ptorus **commands.
5087 * **halfspace **command
5090 @subsubsection occt_2142243456_1869436669731 box, wedge
5092 Syntax: box name [x y z] dx dy dz
5093 wedge name dx dy dz ltx / xmin zmin xmax xmax
5095 **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.
5097 **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.
5099 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.
5102 # a box at the origin
5106 box b2 30 30 40 10 20 30
5111 # a wedge with a sharp edge (5 faces)
5115 wedge w3 20 20 20 10 10 10 10
5118 @subsubsection occt_2142243456_1869436669732 pcylinder, pcone, psphere, ptorus
5120 Syntax: pcylinder name [plane] radius height [angle]
5121 pcone name [plane] radius1 radius2 height [angle]
5122 pcone name [plane] radius1 radius2 height [angle]
5123 psphere name [plane] radius1 [angle1 angle2] [angle]
5124 ptorus name [plane] radius1 radius2 [angle1 angle2] [angle]
5126 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 expreesed in degrees and located on the Z axis, starting from the X axis. The default angle is 360.
5128 **pcylinder **creates a cylindrical block with the given radius and height.
5130 **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.
5132 **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.
5134 **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.
5140 # a quarter of a truncated cone
5141 pcone co 15 10 10 90
5143 # three-quarters of sphere
5148 @subsubsection occt_2142243456_1869436669733 halfspace
5150 Syntax: halfspace result face/shell x y z
5152 **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.
5157 ==b_1 b_2 b_3 b_4 b_5 b_6
5158 halfspace hr b_3 0.5 0.5 0.5
5162 @subsection occt_2142243456_186943666974 Sweeping
5164 Sweeping creates shapes by sweeping out a shape along a defined path:
5166 * **prism **sweeps along a direction.
5167 * **revol **sweeps around an axis.
5168 * **pipe **sweeps along a wire.
5169 * **mksweep **and **buildsweep **are commands to create sweeps by defining the arguments and algorithms.
5170 * **thrusections **creates a sweep from wire in different planes.
5173 @subsubsection occt_2142243456_1869436669741 prism
5175 Syntax: prism result base dx dy dz [Copy | Inf | SemiInf]
5177 **prism **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.
5179 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.
5182 # sweep a planar face to make a solid
5183 polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0
5187 @subsubsection occt_2142243456_1869436669742 revol
5189 Syntax: revol result base x y z dx dy dz angle [Copy]
5191 **revol **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.
5194 # shell by wire rotation
5195 polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0
5196 revol s w 20 0 0 0 1 0 90
5200 @subsubsection occt_2142243456_1869436669743 pipe
5202 Syntax: pipe name wire_spine Profile
5204 **pipe **creates a new shape by sweeping a shape known as the profile along a wire known as the spine.
5207 # sweep a circle along a bezier curve to make a solid
5210 beziercurve spine 4 0 0 0 10 0 0 10 10 0 20 10 0
5213 circle profile 0 0 0 1 0 0 2
5214 mkedge profile profile
5215 wire profile profile
5216 mkplane profile profile
5217 pipe p spine profile
5220 @subsubsection occt_2142243456_1869436669744 mksweep, deletesweep, buildsweep, simulsweep
5222 Syntax: mksweep wire
5223 addsweep wire[vertex][-M][-C] [auxiilaryshapedeletesweep wire
5224 setsweep options [arg1 [arg2 [...]]]
5228 -FR : Tangent and Normal are defined by a Frenet trihedron
5229 -CF : Tangent is given by Frenet,
5230 the Normal is computed to minimize the torsion
5231 -DX Surf : Tangent and Normal are given by Darboux trihedron,
5232 Surf must be a shell or a face
5233 -CN dx dy dz : BiNormal is given by dx dy dz
5234 -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed
5236 simulsweep r [n] [option]
5237 buildsweep [r] [option] [Tol]
5239 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.
5241 **mksweep **initializes the sweep creation and defines the wire to be used as the spine.
5243 **addsweep **defines the wire to be used as the profile.
5245 **deletesweep **cancels the choice of profile wire, without leaving the mksweep mode. You can re-select a profile wire.
5247 **setsweep **commands the algorithms used for the construction of the sweep.
5249 **simulsweep **can be used to create a preview of the shape. [n] is the number of sections that are used to simulate the sweep.
5251 **buildsweep **creates the sweep using the arguments defined by all the commands.
5254 #create a sweep based on a semi-circular wire using the
5256 #create a circular figure
5257 circle c2 0 0 0 1 0 0 10
5258 trim c2 c2 -pi/2 pi/2
5264 # to display all the options for a sweep
5266 #to create a sweep using the Frenet algorithm where the
5267 #normal is computed to minimise the torsion
5270 # to simulate the sweep with a visual approximation
5274 @subsubsection occt_2142243456_1869436669745 thrusections
5276 Syntax: thrusections [-N] result issolid isruled wire1 wire2 [..wire..]
5278 **thrusections **creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices.
5279 A bezier curve is generated between the vertices of each wire. The option [-N] means no check is made on wires for direction.
5282 #create three wires in three planes
5283 polyline w1 0 0 0 5 0 0 5 5 0 2 3 0
5284 polyline w2 0 1 3 4 1 3 4 4 3 1 3 3
5285 polyline w3 0 0 5 5 0 5 5 5 5 2 3 5
5287 thrusections th issolid isruled w1 w2 w3
5288 ==thrusections th issolid isruled w1 w2 w3
5289 Tolerances obtenues -- 3d : 0
5296 @subsection occt_2142243456_186943666975 Topological transformation
5298 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.
5300 * **tcopy **makes a copy of the structure of a shape.
5301 * **ttranslate**, **trotate**, **tmove**, **reset **move a shape.
5302 * **tmirror**, **tscale **always modify the shape.
5305 @subsubsection occt_2142243456_1869436669751 tcopy
5307 Syntax: tcopy name toname [name toname ...]
5309 Copies the structure of one shape, including the geometry, into another, newer shape.
5312 # create an edge from a curve and copy it
5313 beziercurve c 3 0 0 0 10 0 0 20 10 0
5318 # now modify the curve, only e1 and e2 will be modified
5320 @subsubsection occt_2142243456_1869436669752 tmove, treset
5322 Syntax: tmove name [name ...] shape
5323 reset name [name ...]
5325 **tmove **and **reset **modify the location, or the local coordinate system of a shape.
5327 **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).
5332 box b2 20 0 0 10 10 10
5333 # translate the first box
5334 ttranslate b1 0 10 0
5335 # and apply the same location to b2
5337 # return to original positions
5341 @subsubsection occt_2142243456_1869436669753 ttranslate, trotate
5343 Syntax: ttranslate [name ...] dx dy dz
5344 trotate [name ...] x y z dx dy dz angle
5346 **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.
5347 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.)
5349 Locations are very economic in the data structure because multiple occurences of an object share the topological description.
5351 # make rotated copies of a sphere in between two cylinders
5352 # create a file source toto.tcl
5354 for {set i 0} {$i 360} {incr i 20} {
5356 trotate s$i 0 0 0 0 0 1 $i
5359 # create two cylinders
5362 ttranslate c2 0 0 20
5366 ttranslate s 25 0 12.5
5368 # call the source file for multiple copies
5372 @subsubsection occt_2142243456_1869436669754 tmirror, tscale
5374 Syntax: tmirror name x y z dx dy dz
5375 tscale name x y z scale
5377 **tmirror **makes a mirror copy of a shape about a plane x,y,z dx,dy,dz. **Tscale **applies a central homotopic mapping to a shape.
5380 # mirror a portion of cylinder about the YZ plane
5381 pcylinder c1 10 10 270
5383 tmirror c2 15 0 0 1 0 0
5389 @subsection occt_2142243456_186943666976 Old Topological operations
5393 * **fuse**, **cut**, **common **are boolean operations.
5394 * **section**, **psection **compute sections.
5395 * **sewing **joins two or more shapes.
5398 @subsubsection occt_2142243456_1869436669761 fuse, cut, common
5400 Syntax: fuse name shape1 shape2
5401 cut name shape1 shape2
5402 common name shape1 shape2
5404 **fuse **creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
5406 **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.
5408 **common **creates a new shape which contains only what is in common between the two original shapes in their intersection.
5411 # all four boolean operations on a box and a cylinder
5413 box b 0 -10 5 20 20 10
5417 ttranslate s1 40 0 0
5420 ttranslate s2 -40 0 0
5423 ttranslate s3 0 40 0
5426 ttranslate s4 0 -40 0
5430 @subsubsection occt_2142243456_1869436669762 section, psection
5432 Syntax: section result shape1 shape2
5433 psection name shape plane
5435 **section **creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
5437 **psection **creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane.
5440 # section line between a cylinder and a box
5442 box b 0 0 5 15 15 15
5443 trotate b 0 0 0 1 1 1 20
5446 # planar section of a cone
5448 plane p 0 0 15 1 1 2
5452 @subsubsection occt_2142243456_1869436669763 sewing
5454 Syntax: sewing result [tolerance] shape1 shape2 ...
5456 **Sewing **joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value.
5460 # create two adjacent boxes
5465 sr is a shape COMPOUND FORWARD Free Modified
5468 @subsection occt_2142243456_186943666977 New Topological operations
5471 The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm.
5474 @subsubsection occt_2142243456_1869436669771 bop, bopfuse, bopcut, boptuc, bopcommon,
5476 **bop** defines **shape1** and **shape2** subject to ulterior Boolean operations
5478 **bopfuse **creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
5480 **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.
5482 **boptuc **is a reverced** bopcut**.
5484 **bopcommon **creates a new shape which contains only whatever is in common between the two original shapes in their intersection.
5487 Syntax: bop shape1 shape2
5493 These commands have short variants:
5495 bcommon result shape1 shape2
5496 bfuse result shape1 shape2
5497 bcut result shape1 shape2
5500 **bop** fills data structure (DS) of boolean operation for **shape1** and **shape2**.
5501 **bopcommon, bopfuse, bopcut, boptuc **commands used after **bop** command. After one **bop** command it is possible to call several commands from the list above. For example: **bop** S1 S2; **bopfuse** R.
5505 # all four boolean operations on a box and a cylinder
5507 box b 0 -10 5 20 20 10
5510 # fills data structure
5514 ttranslate s1 40 0 0
5517 ttranslate s2 -40 0 0
5520 ttranslate s3 0 40 0
5523 ttranslate s4 0 -40 0
5526 Short variants of commands:
5529 ttranslate s11 40 0 100
5532 ttranslate s12 -40 0 100
5535 ttranslate s14 0 -40 100
5537 @subsubsection occt_2142243456_1869436669772 bopsection
5539 **bopsection **creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
5542 Syntax: bop shape1 shape2
5549 bsection result shape1 shape2 [-2d/-2d1/-2s2] [-a]
5552 **bop** fills data structure (DS) of boolean operation for **shape1** and **shape2**.
5553 **bopsection** command used after **bop** command.
5555 **-2d** - PCurves are computed on both parts.
5556 **-2d1** - PCurves are computed on first part.
5557 **-2d2 **- PCurves are computed on second part.
5558 **-a** - geometries built are approximated.
5563 # section line between a cylinder and a box
5565 box b 0 0 5 15 15 15
5566 trotate b 0 0 0 1 1 1 20
5573 @subsubsection occt_2142243456_1869436669773 bopcheck, bopargshape
5575 Syntax: bopcheck shape
5576 bopargcheck shape1 [[shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF]
5579 **bopcheck** checks a shape for self-interference.
5581 **bopargcheck** checks the validity of argument(s) for boolean operations.
5590 By default a section is made.
5593 **R** (disable small edges (shrank range) test)
5594 **F** (disable faces verification test)
5595 **T** (disable tangent faces searching test)
5596 **V** (disable test possibility to merge vertices)
5597 **E** (disable test possibility to merge edges)
5598 **I** (disable self-interference test)
5599 **P** (disable shape type test)
5600 By default all options are enabled.
5602 #Additional Test Options
5603 **B** (stop test on first faulty found); default OFF
5604 **F** (full output for faulty shapes);
5605 **By **default the output is made in a short format.
5607 NOTE: Boolean Operation and Test Options are used only for a couple of argument shapes, except for **I** and **P** options that are always used to test a couple of shapes as well as a single shape.
5611 # checks a shape on self-interference
5615 # checks the validity of argument for boolean cut operations
5616 box b2 0 0 0 10 10 10
5617 bopargcheck b1 b2 -C
5620 @subsection occt_2142243456_186943666978 Drafting and blending
5622 Drafting is creation of a new shape by tilting faces through an angle.
5624 Blending is the creation of a new shape by rounding edges to create a fillet.
5626 * Use the **depouille **command for drafting.
5627 * Use the **chamf **command to add a chamfer to an edge
5628 * Use the **blend **command for simple blending.
5629 * Use **fubl **for a fusion + blending operation.
5630 * Use **buildevol**, **mkevol**, **updatevol **to realize varying radius blending.
5633 @subsubsection occt_2142243456_1869436669781 depouille
5635 Syntax: dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...]
5637 **depouille **creates a new shape by drafting one or more faces of a shape.
5639 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.
5641 # draft a face of a box
5644 == b_1 b_2 b_3 b_4 b_5 b_6
5646 dep a b 0 0 1 b_2 10 0 10 0 1 0 5
5649 @subsubsection occt_2142243456_1869436669782 chamf
5651 Syntax: chamf newname shape edge face S dist
5652 chamf newname shape edge face dist1 dist2
5653 chamf newname shape edge face A dist angle
5655 **chamf **creates a chamfer along the edge between faces using:
5657 * a equal distances from the edge
5658 * the edge, a face and distance, a second distance
5659 * the edge, a reference face and an angle
5661 Use the dot syntax to select the faces and edges.
5664 # to create a chamfer based on equal distances from the
5665 edge (45 degree angle)
5668 chamf ch b . . S 0.5
5672 # select an adjacent face
5675 # to create a chamfer based on different distances from
5678 chamf ch b . . 0.3 0.4
5682 # select an adjacent face
5685 # to create a chamfer based on a distance from the edge
5688 chamf ch b . . A 0.4 30
5692 # select an adjacent face
5695 @subsubsection occt_2142243456_1869436669783 blend
5697 Syntax: blend result object rad1 ed1 rad2 ed2 ... [R/Q/P]
5699 **blend **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.
5702 # blend a box, click on an edge
5705 ==tolerance ang : 0.01
5706 ==tolerance 3d : 0.0001
5707 ==tolerance 2d : 1e-05
5709 ==tolblend 0.01 0.0001 1e-05 0.001
5711 # click on the edge you want ot fillet
5713 ==COMPUTE: temps total 0.1s dont :
5714 ==- Init + ExtentAnalyse 0s
5715 ==- PerformSetOfSurf 0.02s
5716 ==- PerformFilletOnVertex 0.02s
5718 ==- Reconstruction 0.06s
5722 @subsubsection occt_2142243456_1869436669784 fubl
5724 Syntax: fubl name shape1 shape2 radius
5726 **fubl **creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius.
5729 # fuse-blend two boxes
5732 ttranslate b2 -10 10 3
5734 See also: **fuse**, **blend**
5737 @subsubsection occt_2142243456_1869436669785 mkevol, updatevol, buildevol
5739 Syntax: mkevol result object (then use updatevol) [R/Q/P]
5740 updatevol edge u1 radius1 [u2 radius2 ...]
5743 These three commands work together to create fillets with evolving radii.
5745 **mkevol **allows you to specify the shape and the name of the result. It returns the tolerances of the fillet.
5747 **updatevol **allows you to describe 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.
5749 **buildevol **produces the result described previously in **mkevol **and **updatevol**.
5752 # makes an evolved radius on a box
5755 ==tolerance ang : 0.01
5756 ==tolerance 3d : 0.0001
5757 ==tolerance 2d : 1e-05
5759 ==tolblend 0.01 0.0001 1e-05 0.001
5762 updatevol . 0 1 1 3 2 2
5766 ==Dump of SweepApproximation
5767 ==Error 3d = 1.28548881203818e-14
5768 ==Error 2d = 1.3468326936926e-14 ,
5769 ==1.20292299999388e-14
5770 ==2 Segment(s) of degree 3
5772 ==COMPUTE: temps total 0.91s dont :
5773 ==- Init + ExtentAnalyse 0s
5774 ==- PerformSetOfSurf 0.33s
5775 ==- PerformFilletOnVertex 0.53s
5777 ==- Reconstruction 0.04s
5782 @subsection occt_2142243456_186943666979 Topological analysis
5784 Analysis of shapes includes commands to compute length, area, volumes and inertial properties.
5786 * Use **lprops**, **sprops**, **vprops **to compute integral properties.
5787 * Use **bounding **to display the bounding box of a shape.
5788 * Use **distmini **to calculate the minimum distance between two shapes.
5793 @subsubsection occt_2142243456_1869436669791 lprops, sprops, vprops
5795 Syntax: lprops shape
5799 **lprops **computes the mass properties of all edges in the shape with a linear density of 1, **sprops **of all faces with a surface density of 1 and **vprops **of all solids with a density of 1.
5801 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.
5804 # volume of a cylinder
5808 Mass : 6283.18529981086
5811 X = 4.1004749224903e-06
5812 Y = -2.03392858349861e-16
5816 366519.141445068 5.71451850691484e-12
5818 5.71451850691484e-12 366519.141444962
5819 2.26823064169991e-10 0.257640437382627
5820 2.26823064169991e-10 314159.265358863
5823 IX = 366519.141446336
5824 IY = 366519.141444962
5825 I.Z = 314159.265357595
5829 @subsubsection occt_2142243456_1869436669792 bounding
5831 Syntax: bounding shape
5833 Displays the bounding box of a shape. The bounding box is a cuboid created with faces parallel to the x, y, and z planes. The command returns the dimension values of the the box, *xmin ymin zmin xmax ymax zmax.*
5836 # bounding box of a torus
5839 ==-27.059805107309852 -27.059805107309852 -
5841 ==27.059805107309852 27.059805107309852
5845 @subsubsection occt_2142243456_1869436669793 distmini
5847 Syntax: distmini name Shape1 Shape2
5849 **distmini **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.
5852 box b 0 0 0 10 20 30
5853 box b2 30 30 0 10 20 30
5855 ==the distance value is : 22.3606797749979
5856 ==the number of solutions is :2
5859 ==the type of the solution on the first shape is 0
5860 ==the type of the solution on the second shape is 0
5861 ==the coordinates of the point on the first shape are:
5863 ==the coordinates of the point on the second shape
5867 ==solution number 2:
5868 ==the type of the solution on the first shape is 0
5869 ==the type of the solution on the second shape is 0
5870 ==the coordinates of the point on the first shape are:
5872 ==the coordinates of the point on the second shape
5881 @subsection occt_2142243456_1869436669710 Surface creation
5883 Surface creation commands include surfaces created from boundaries and from spaces between shapes.
5885 * gplate creates a surface from a boundary definition.
5886 * filling creates a surface from a group of surfaces.
5889 @subsubsection occt_2142243456_18694366697101 gplate,
5891 Syntax: gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ...
5893 **gplate **creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces.
5900 beziercurve c1 3 0 0 0 1 0 1 2 0 0
5906 trotate e3 0 0 0 0 0 1 90
5909 # create the surface
5910 gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0
5912 ======== Results ===========
5913 DistMax=8.50014503228635e-16
5915 Calculation time: 0.33
5917 Approximation results
5918 Approximation error : 2.06274907619957e-13
5919 Criterium error : 4.97600631215754e-14
5921 #to create a surface defined by edges and passing through a point
5922 # to define the border edges and the point
5927 beziercurve c1 3 0 0 0 1 0 1 2 0 0
5933 trotate e3 0 0 0 0 0 1 90
5938 # to create the surface
5939 gplate r2 4 1 p e1 0 e2 0 e3 0 e4 0 pp
5941 ======== Results ===========
5942 DistMax=3.65622157610934e-06
5944 Calculculation time: 0.27
5946 Approximation results
5947 Approximation error : 0.000422195884750181
5948 Criterium error : 3.43709808053967e-05
5950 @subsubsection occt_2142243456_18694366697102 filling, fillingparam
5952 Syntax: filling result nbB nbC nbP [SurfInit] [edge][face]order...
5953 edge[face]order... point/u v face order...
5955 **filling **creates a surface between borders. It 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.
5957 To define the surface border:
5959 * enter the number of edges, constraints, and points
5960 * enumerate the edges, constraints and points
5962 The surface can pass through other points. These are defined after the border definition.
5964 You can use the **fillingparam **command to access the filling parameters.
5968 -l : to list current values
5970 -i : to set default values
5972 -r deg nbPonC nbIt anis : to set filling options
5974 -c t2d t3d tang tcur : to set tolerances
5976 -a maxdeg maxseg : Approximation option
5979 # to create four curved survaces and a point
5984 beziercurve c1 3 0 0 0 1 0 1 2 0 0
5990 trotate e3 0 0 0 0 0 1 90
6001 # to create a tangential surface
6002 filling r1 4 0 0 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1
6003 # to create a tangential surface passing through point pp
6004 filling r2 4 0 1 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 pp#
6005 # to visualise the surface in detail
6007 # to display the current filling parameters
6025 @subsection occt_2142243456_1869436669711 Complex Topology
6027 Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling.
6030 @subsubsection occt_2142243456_18694366697111 offsetshape, offsetcompshape
6032 Syntax: offsetshape r shape offset [tol] [face ...]
6033 offsetcompshape r shape offset [face ...]
6035 **offsetshape **and **offsetcompshape **assigns 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.
6037 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.
6039 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.
6042 The opening between the object interior and exterior is defined by the argument face or faces.
6047 == b1_1 b1_2 b1_3 b1_4 b1_5 b1_6
6048 offsetcompshape r b1 -1 b1_3
6050 Syntax: offsetparameter tolerance intersection(c/p) join(a/i)
6051 offsetload shape offset [face1 face2 …]
6052 offsetonface face1 offset1 face2 offset2 …
6053 offsetperform result
6055 **offsetparameter** sets the values of parameters and options for the following command **offsetload**:
6056 * *tolerance* defines the coincidence tolerance criterion for generated shapes;
6057 * *intersection* defines the mode of intersection: *c* means complete intersection, *p* means partial intersection;
6058 * *join* defines the mode of connecting new adjacent faces: *a* means GeomAbs_Arc, *i* means GeomAbs_Intersection.
6060 **offsetload** loads shape, offset value and, if necessary, a set of faces to remove from the shape. These data are later used by command **offsetperform**.
6061 **offsetonface** indicates the faces of shape (loaded earlier by command **offsetload**) that should be shifted with special offset value. This command is optional. **Warning:** this command should be called only after **offsetload** and it takes effect only if parameter join = GeomAbs_Intersection.
6063 **offsetperform** performs the result of 3d-offset algorithm using the data loaded by previous commands.
6068 == b1_1 b1_2 b1_3 b1_4 b1_5 b1_6
6069 offsetparameter 1e-7 p i
6070 offsetload b1 2 b1_1 b1_2
6072 offsetperform result
6076 @subsubsection occt_2142243456_18694366697112 featprism, featdprism, featrevol, featlf, featrf
6078 Syntax: featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)
6079 featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)
6080 featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)
6081 featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)
6082 featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)
6083 featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]
6084 featperformval prism/revol/dprism/lf result value
6086 **featprism **loads the arguments for a prism with contiguous sides normal to the face.
6088 **featdprism **loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle.
6090 **featrevol **loads the arguments for a prism with a circular evolution.
6092 **featlf **loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline.
6094 **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.
6096 **featperform **loads the arguments to create the feature.
6098 **featperformval **uses the defined arguments to create a feature with a limiting value.
6100 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.
6103 # to create a feature prism with a draft angle and a
6105 # create a box with a wire contour on the upper face
6107 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
6109 # loads the feature arguments defining the draft angle
6110 featdprism b f b_6 5 1 0
6111 # create the feature
6112 featperformval dprism r 1
6113 ==BRepFeat_MakeDPrism::Perform(Height)
6114 BRepFeat_Form::GlobalPerform ()
6119 # to create a feature prism with circular direction
6120 # create a box with a wire contour on the upper face
6122 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
6124 # loads the feature arguments defining a rotation axis
6125 featrevol b f b_6 1 0 1 0 1 0 1 0
6126 featperformval revol r 45
6127 ==BRepFeat_MakeRevol::Perform(Angle)
6128 BRepFeat_Form::GlobalPerform ()
6133 # to create a slot using the linear feature
6134 #create the base model using the multi viewer
6136 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
6138 # create the contour for the linear feature
6139 vertex v1 -0.2 4 0.3
6141 vertex v3 0.2 0.2 0.3
6143 vertex v5 4 -0.2 0.3
6150 plane pl 0.2 0.2 0.3 0 0 1
6151 # loads the linear feature arguments
6152 featlf pr w pl 0 0 0.3 0 0 0 0 1
6153 featperform lf result
6155 # to create a rib using the revolution feature
6156 #create the base model using the multi viewer
6159 # create the contour for the revolution feature
6160 profile w c 1 190 WW
6161 trotate w 0 0 0 1 0 0 90
6163 trotate w -3 0 1.5 0 0 1 180
6164 plane pl -3 0 1.5 0 1 0
6165 # loads the revolution feature arguments
6166 featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1
6167 featperform rf result
6170 @subsubsection occt_2142243456_18694366697113 draft
6172 Syntax: draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal]
6174 **draft **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.
6176 * The draft angle is measured in radians.
6177 * The draft direction is determined by the argument -INTERNAL
6178 * The argument Ri/Ro deftermines wether the corner edges of the
6180 draft surface are angular or rounded.
6182 * Arguments that can be used to define the surface distance are:
6183 * length, a defined distance
6184 * shape, until the surface contacts a shape
6185 * surface, until the surface contacts a surface.
6188 *The original aim of adding a draft angle to a shape is to*
6189 *produce a shape which can be removed easily from a mould.*
6190 *The Examples below use larger angles than are used normally*
6191 *and the calculation results returned are not indicated.*
6195 # to create a simple profile
6196 profile p F 0 0 x 2 y 4 tt 0 4 w
6197 # creates a draft with rounded angles
6198 draft res p 0 0 1 3 1 -Ro
6199 # to create a profile with an internal angle
6200 profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w
6201 # creates a draft with rounded external angles
6202 draft res p 0 0 1 3 1 -Ro
6205 @subsubsection occt_2142243456_18694366697114 deform, nurbsconvert
6207 Syntax: deform newname name CoeffX CoeffY CoeffZ
6209 **deform **modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions.
6211 Syntax nurbsconvert result name [result name]
6213 **nurbsconvert **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.
6218 # the conversion to bspline is followed by the
6223 @subsection occt_2142243456_1869436669712 Texture Mapping to a Shape
6225 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.
6227 @subsubsection occt_2142243456_18694366697121 vtexture
6229 Syntax vtexture NameOfShape TextureFile
6230 vtexture NameOfShape
6231 vtexture NameOfShape ?
6232 vtexture NameOfShape IdOfTexture
6234 **TextureFile **identifies the file containing the texture you want. The same syntax without **TextureFile **disables texture mapping. The question-mark ***?* **lists available textures. **IdOfTexture **allows you to apply predefined textures.
6236 @subsubsection occt_2142243456_18694366697122 vtexscale
6238 Syntax: vtexscale NameOfShape ScaleU ScaleV
6239 vtexscale NameOfShape ScaleUV
6240 vtexscale NameOfShape
6242 **ScaleU **and **Scale V **allow you to scale the texture according to the U and V parameters individually, while **ScaleUV **applies the same scale to both parameters. The same syntax without **ScaleU**, **ScaleV **or **ScaleUV **disables texture scaling.
6244 @subsubsection occt_2142243456_18694366697123 vtexorigin
6246 Syntax vtexorigin NameOfShape UOrigin VOrigin
6247 vtexorigin NameOfShape UVOrigin
6248 vtexorigin NameOfShape
6250 **UOrigin **and **VOrigin **allow you to place the texture according to the U and V parameters individually while **UVOrigin **applies the same position value to both parameters. The same syntax without **UOrigin**, **VOrigin **or **UVOrigin **disables origin positioning.
6252 @subsubsection occt_2142243456_18694366697124 vtexrepeat
6254 Syntax vtexrepeat NameOfShape URepeat VRepeat
6255 vtexrepeat NameOfShape UVRepeat
6256 vtexrepeat NameOfShape
6258 **URepeat **and **VRepeat **allow you to repeat the texture along the U and V parameters individually while **UVRepeat **applies the same number of repetitions for both parameters. The same syntax without **URepeat**, **VRepeat **or **UVRepeat **disables texture repetition.
6260 @subsubsection occt_2142243456_18694366697125 vtexdefault
6262 Syntax vtexdefault NameOfShape
6264 **Vtexdefault **sets or resets the texture mapping default parameters.
6268 URepeat = VRepeat = 1 = no repetition
6269 UOrigin = VOrigin = 1 = origin set at (0,0)
6270 UScale = VScale = 1 = texture covers 100% of the face
6271 @section occt_2142243456_1866931135 Data Exchange commands
6274 @subsection occt_2142243456_186693113581 General
6276 This paragraph presents some general information about Data Exchange (DE) operations.
6278 DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.)
6280 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’s Guide for a corresponding format.
6282 Each Draw session has an interface model – some structure for keeping various information.
6283 First step of translation – loading information from a file into a model.
6284 Second step – creation of an OpenCASCADE shape from this model.
6285 Each entity from file has its own number in the model (num).
6286 During the translation a map of correspondences between labels(from file) and numbers (from model) is created.
6287 The model and the mentioned map are used for working with most of DE commands.
6289 @subsection occt_2142243456_186693113582 IGES commands
6291 These commands are used during the translation of IGES models.
6294 @subsubsection occt_2142243456_1866931135821 igesread
6296 Syntax: igesread file_name result_shape_name [selection]
6298 Read an IGES file to an OCCT shape.
6299 This command will interactively ask the user to select a set of entities to be converted:
6302 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.
6303 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.
6304 selection specifies the scope of selected entities in the model, it is xst-transferrable-roots by default. More about selection see in the *IGES FORMAT User’s Guide*.
6305 If we use symbol * as selection all roots will be translated.
6308 # translation all roots from file
6309 igesread /disk01/files/model.igs a *
6311 @subsubsection occt_2142243456_1866931135822 tplosttrim
6313 Syntax: tplosttrim [IGES_type]
6315 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.
6316 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.
6317 Optional parameter IGES_type can be TrimmedSurface, BoundedSurface or Face to specify the only type of IGES faces.
6320 tplosttrim TrimmedSurface
6322 @subsubsection occt_2142243456_1866931135823 brepiges
6324 Syntax: brepiges shape_name filename.igs
6326 Writes an OCCT shape to an IGES file.
6329 # write shape with name aa to IGES file
6330 brepiges aa /disk1/tmp/aaa.igs
6331 == unit (write) : MM
6332 == mode write : Faces
6333 == To modifiy : command param
6334 == 1 Shapes written, giving 345 Entities
6335 == Now, to write a file, command : writeall filename
6336 == Output on file : /disk1/tmp/aaa.igs
6341 @subsection occt_2142243456_186693113583 STEP commands
6343 These commands are used during the translation of STEP models.
6346 @subsubsection occt_2142243456_1866931135831 stepread
6348 Syntax: stepread file_name result_shape_name [selection]
6350 Read a STEP file to an OCCT shape.
6351 This command will interactively ask the user to select a set of entities to be converted:
6354 After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes.
6355 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.
6356 selection specifies the scope of selected entities in the model. More about selection see in the *STEP FORMAT User’s Guide*.
6357 If as selection we use symbol * all roots will be translated.
6360 # translation all roots from file
6361 stepread /disk01/files/model.stp a *
6363 @subsubsection occt_2142243456_1866931135832 stepwrite
6365 Syntax: stepwrite mode shape_name file_name
6367 Writes an OCCT shape to a STEP file.
6368 The available modes are the following:
6369 0 or ‘a’ - ;as is; mode – mode is selected automatically depending on type & geometry of the shape
6370 1 or ‘m’ - manifold_solid_brep or brep_with_voids
6371 2 or ‘f’ - faceted_brep
6372 3 or ‘w’ - geometric_curve_set
6373 4 or ‘s’ - shell_based_surface_model
6374 For further information see ;STEP FORMAT User’s Guide ;.
6377 # write shape with name a to STEP file with mode 0
6378 stepwrite 0 a /disk1/tmp/aaa.igs
6382 @subsection occt_2142243456_186693113584 General commands
6384 These commands are auxilary commands. Most of them are used for the analysis of result of translation of IGES and STEP files.
6386 @subsubsection occt_2142243456_1866931135841 count
6388 Syntax: count counter [selection]
6390 Is used to calculate statistics on the entities in the model.
6391 Gives us a count of entities.
6392 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 (for example):
6398 @subsubsection occt_2142243456_1866931135842 data
6402 Is used to obtain general statistics on the loaded data.
6403 Information printed by this command depends on the symbol specified:
6406 # print full information about warnings and fails
6409 @subsubsection occt_2142243456_1866931135843 elabel
6413 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.
6418 @subsubsection occt_2142243456_1866931135844 entity
6420 Syntax: entity #(D)_or_num level_of_information
6422 The content of an IGES or STEP entity can be obtained by using this command.
6423 Entity can be determined by its number or label.
6424 level_of_information has range [0-6]. You can get more information about this level using this command without parameters.
6427 # full information for STEP entity with label 84
6430 @subsubsection occt_2142243456_1866931135845 enum
6434 Prints a number for the entity with a given label.
6437 # give a number for IGES entity with label 21
6440 @subsubsection occt_2142243456_1866931135846 estatus
6442 Syntax: estatus #(D)_or_num
6444 The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command.
6449 @subsubsection occt_2142243456_1866931135847 fromshape
6451 Syntax: fromshape shape_name
6453 Gives us 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.
6458 @subsubsection occt_2142243456_1866931135848 givecount
6460 Syntax: givecount selection_name [selection_name]
6464 givecount xst-model-roots
6466 @subsubsection occt_2142243456_1866931135849 givelist
6468 Syntax: givelist selection_name
6470 Prints a list of a subset of loaded entities defined by the selection argument:
6474 # give a list of all entities of the model
6475 givelist xst-model-all
6477 @subsubsection occt_2142243456_18669311358410 listcount
6479 Syntax: listcount counter [selection ...]
6481 Prints a list of entities per each type matching the criteria defined by arguments.
6482 Optional selection argument, if specified, defines a subset of entities, which are to be taken into account. Argument counter should be one of the currently defined counters:
6488 @subsubsection occt_2142243456_18669311358411 listitems
6492 This command prints a list of objects (counters, selections etc.) defined in the current session.
6497 @subsubsection occt_2142243456_18669311358412 listtypes
6499 Syntax: listtypes [selection_name ...]
6501 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.
6504 # full list of all entities with thier counts
6507 @subsubsection occt_2142243456_18669311358413 newmodel
6511 Clears the current model.
6516 @subsubsection occt_2142243456_18669311358414 param
6518 Syntax: param [parameter] [value]
6520 This command is used to manage translation parameters.
6521 Command without arguments gives us a full list of parameters with current values.
6522 Command with parameter (without value) gives us the current value of this parameter and all possible values for it. Command with value sets this new value to parameter.
6523 For more information about translation parameters see the corresponding User’s Guide.
6526 # info about possible schemes for writing STEP file
6527 param write.step.schema
6529 @subsubsection occt_2142243456_18669311358415 sumcount
6531 Syntax: sumcount counter [selection ...]
6533 Prints only a number of entities per each type matching the criteria defined by arguments.
6538 @subsubsection occt_2142243456_18669311358416 tpclear
6542 Clears the map of correspondences between IGES or STEP entities and OCCT shapes.
6547 @subsubsection occt_2142243456_18669311358417 tpdraw
6549 Syntax: tpdraw #(D)_or_num
6555 @subsubsection occt_2142243456_18669311358418 tpent
6557 Syntax: tpent #(D)_or_num
6563 @subsubsection occt_2142243456_18669311358419 tpstat
6565 Syntax: tpstat [*|?]symbol [selection]
6567 Gives all statistics on the last transfer, including the list of transferred entities with mapping from IGES or STEP to OCCT types, as well as fail and warning messages. The parameter *symbol *defines what information will be printed:
6570 The sign ‘*’ before the parameters **n**, **s**, **b**, **t**, **r** makes it work on all entities (not only on roots). The sign ‘?’ before **n**, **s**, **b**, **t** limits the scope of information to invalid entities.
6571 Optional argument selection can limit the action of the command with a selected subset of entities.
6574 # translation ratio on IGES faces
6575 tpstat *l iges-faces
6577 @subsubsection occt_2142243456_18669311358420 xload
6579 Syntax: xload file_name
6581 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.
6584 xload /disk1/tmp/aaa.stp
6588 @subsection occt_2142243456_186693113585 Overview of XDE commands
6590 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:
6591 * **XDE translation commands**
6592 * **XDE general commands**
6593 * **XDE shape’s commands**
6594 * **XDE color’s commands**
6595 * **XDE layer’s commands**
6596 * **XDE property’s commands**
6600 @subsection occt_2142243456_186693113586 XDE translation commands
6602 Reminding: All operations of translation are performed with parameters managed by command param (see above)
6604 @subsubsection occt_2142243456_1866931135861 ReadIges
6606 Syntax: ReadIges document file_name
6608 Reads information from an IGES file to an XCAF document.
6611 ReadIges D /disk1/tmp/aaa.igs
6612 == Document saved with name D
6614 @subsubsection occt_2142243456_1866931135862 ReadStep
6616 Syntax: ReadStep document file_name
6618 Reads information from a STEP file to an XCAF document.
6621 ReadStep D /disk1/tmp/aaa.stp
6622 == Document saved with name D
6624 @subsubsection occt_2142243456_1866931135863 WriteIges
6626 Syntax: WriteIges document file_name
6630 WriteIges D /disk1/tmp/aaa.igs
6632 @subsubsection occt_2142243456_1866931135864 WriteStep
6634 Syntax: WriteStep document file_name
6636 Writes information from an XCAF document to a STEP file.
6639 WriteStep D /disk1/tmp/aaa.stp
6641 @subsubsection occt_2142243456_1866931135865 XFileCur
6645 Returns the name of file which is set as the current one in the Draw session.
6651 @subsubsection occt_2142243456_1866931135866 XFileList
6655 Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file.
6659 == *as1-ct-Bolt.stp*
6660 == *as1-ct-L-Bracktet.stp*
6665 @subsubsection occt_2142243456_1866931135867 XFileSet
6667 Syntax: XFileSet filename
6669 Sets the current file taking it from the components list of the assemble file.
6672 XFileSet as1-ct-NBA.stp
6674 @subsubsection occt_2142243456_1866931135868 XFromShape
6676 Syntax: XFromShape shape
6678 This command is similar to command *fromshape* (see above) but gives additional information about the name of file. It is useful in the case when a shape was translated from several files.
6682 == Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp
6685 @subsection occt_2142243456_186693113587 XDE general commands
6687 @subsubsection occt_2142243456_1866931135871 XNewDoc
6689 Syntax: XNewDoc document
6691 Creates a new XCAF document.
6696 @subsubsection occt_2142243456_1866931135872 XShow
6698 Syntax: XShow document [ label1 … ]
6700 Shows a shape from a given label in the 3D viewer. If the label is not given – shows all shapes from the document.
6703 # show shape from label 0:1:1:4 from document D
6706 @subsubsection occt_2142243456_1866931135873 XStat
6708 Syntax: XStat document
6710 Prints common information from an XCAF document.
6714 ==Statistis of shapes in the document:
6718 ==Total number of labels for shapes in the document = 32
6719 ==Number of labels with name = 27
6720 ==Number of labels with color link = 3
6721 ==Number of labels with layer link = 0
6722 ==Statistis of Props in the document:
6723 ==Number of Centroid Props = 5
6724 ==Number of Volume Props = 5
6725 ==Number of Area Props = 5
6726 ==Number of colors = 4
6727 ==BLUE1 RED YELLOW BLUE2
6728 ==Number of layers = 0
6730 @subsubsection occt_2142243456_1866931135874 XWdump
6732 Syntax: XWdump document filename
6734 Saves the contents of the viewer window as an image (XWD, png or BMP file).
6735 filename must have a corresponding extention.
6738 XWdump D /disk1/tmp/image.png
6740 @subsubsection occt_2142243456_1866931135875 Xdump
6742 Syntax: Xdump document [int deep {0|1}]
6744 Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes.
6748 == ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
6749 == ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
6750 == ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
6751 == ASSEMBLY 0:1:1:4 PLATE(0xe8387780)
6752 == ASSEMBLY 0:1:1:5 ROD(0xe8475418)
6753 == ASSEMBLY 0:1:1:6 AS1(0xe8476968)
6754 == ASSEMBLY 0:1:1:7 L-BRACKET-ASSEMBLY(0xe8476230)
6755 == ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
6756 == ASSEMBLY 0:1:1:8 NUT-BOLT-ASSEMBLY(0xe8475ec0)
6757 == ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
6758 == ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
6762 @subsection occt_2142243456_186693113588 XDE shape’s commands
6764 @subsubsection occt_2142243456_1866931135881 XAddComponent
6766 Syntax: XAddComponent document label shape
6768 Adds a component shape to assembly.
6771 # Add shape b as component shape to assembly shape from
6773 XAddComponent D 0:1:1:1 b
6775 @subsubsection occt_2142243456_1866931135882 XAddShape
6777 Syntax: XAddShape document shape [makeassembly=1]
6779 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.
6782 # add shape b to document D
6785 # if pointed shape is compound and last parameter in
6786 # XAddShape command is used by default (1), then for
6787 # each subshapes new label is created
6789 @subsubsection occt_2142243456_1866931135883 XFindComponent
6791 Syntax: XFindComponent document shape
6793 Prints a sequence of labels of the assembly path.
6798 @subsubsection occt_2142243456_1866931135884 XFindShape
6800 Syntax: XFindShape document shape
6802 Finds and prints a label with an indicated top-level shape.
6807 @subsubsection occt_2142243456_1866931135885 XGetFreeShapes
6809 Syntax: XGetFreeShapes document [shape_prefix]
6811 Print labels or create DRAW shapes for all free shapes in the document.
6812 If [shape_prefix] is absent – prints labels, else – creates DRAW shapes with names
6813 [shape_prefix]_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).
6814 Note: a free shape is a shape to which no other shape refers to.
6818 == 0:1:1:6 0:1:1:10 0:1:1:12 0:1:1:13
6821 == sh_1 sh_2 sh_3 sh_4
6823 @subsubsection occt_2142243456_1866931135886 XGetOneShape
6825 Syntax: XGetOneShape shape document
6827 Creates one DRAW shape for all free shapes from a document.
6832 @subsubsection occt_2142243456_1866931135887 XGetReferredShape
6834 Syntax: XGetReferredShape document label
6836 Prints a label that contains a top-level shape that corresponds to a shape at a given label.
6839 XGetReferredShape D 0:1:1:1:1
6841 @subsubsection occt_2142243456_1866931135888 XGetShape
6843 Syntax: XGetShape result document label
6845 Puts a shape from the indicated label in document to result.
6848 XGetShape b D 0:1:1:3
6850 @subsubsection occt_2142243456_1866931135889 XGetTopLevelShapes
6852 Syntax: XGetTopLevelShapes document
6854 Prints labels that contain top-level shapes.
6857 XGetTopLevelShapes D
6858 == 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
6861 @subsubsection occt_2142243456_18669311358810 XLabelInfo
6863 Syntax: XLabelInfo document label
6865 Prints information about a shape, stored at an indicated label.
6868 XLabelInfo D 0:1:1:6
6869 == There are TopLevel Shape. There are an Assembly. This Shape don’t used.
6871 @subsubsection occt_2142243456_18669311358811 XNewShape
6873 Syntax: XNewShape document
6875 Creates a new empty top-level shape.
6880 @subsubsection occt_2142243456_18669311358812 XRemoveComponent
6882 Syntax: XRemoveComponent document label
6884 Removes a component from the components label.
6887 XRemoveComponent D 0:1:1:1:1
6889 @subsubsection occt_2142243456_18669311358813 XRemoveShape
6891 Syntax: XRemoveShape document label
6893 Removes a shape from a document (by it’s label).
6896 XRemoveShape D 0:1:1:2
6898 @subsubsection occt_2142243456_18669311358814 XSetShape
6900 Syntax: XSetShape document label shape
6902 Sets a shape at the indicated label.
6905 XSetShape D 0:1:1:3 b
6908 @subsection occt_2142243456_186693113589 XDE color’s commands
6910 @subsubsection occt_2142243456_1866931135891 XAddColor
6912 Syntax: XAddColor document R G B
6914 Adds color in document to the color table. Parameters R,G,B are real.
6917 XAddColor D 0.5 0.25 0.25
6919 @subsubsection occt_2142243456_1866931135892 XFindColor
6921 Syntax: XFindColor document R G B
6923 Finds a label where the indicated color is situated.
6926 XFindColor D 0.25 0.25 0.5
6929 @subsubsection occt_2142243456_1866931135893 XGetAllColors
6931 Syntax: XGetAllColors document
6933 Prints all colors that are defined in the document.
6937 == RED DARKORANGE BLUE1 GREEN YELLOW3
6939 @subsubsection occt_2142243456_1866931135894 XGetColor
6941 Syntax: XGetColor document label
6943 Returns a color defined at the indicated label from the color table.
6949 @subsubsection occt_2142243456_1866931135895 XGetObjVisibility
6951 Syntax: XGetObjVisibility document {label|shape}
6953 Returns the visibility of a shape.
6956 XGetObjVisibility D 0:1:1:4
6958 @subsubsection occt_2142243456_1866931135896 XGetShapeColor
6960 Syntax: XGetShapeColor document label colortype(s|c)
6962 Returns the color defined by label. If colortype=’s’ – returns surface color, else – returns curve color.
6965 XGetShapeColor D 0:1:1:4 c
6967 @subsubsection occt_2142243456_1866931135897 XRemoveColor
6969 Syntax: XRemoveColor document label
6971 Removes a color from the color table in a document.
6974 XRemoveColor D 0:1:2:1
6976 @subsubsection occt_2142243456_1866931135898 XSetColor
6978 Syntax: XSetColor document {label|shape} R G B
6980 Sets an RGB color to a shape given by label.
6983 XsetColor D 0:1:1:4 0.5 0.5 0.
6985 @subsubsection occt_2142243456_1866931135899 XSetObjVisibility
6987 Syntax: XSetObjVisibility document {label|shape} {0|1}
6989 Sets the visibility of a shape.
6992 # set shape from label 0:1:1:4 as invisible
6993 XSetObjVisibility D 0:1:1:4 0
6995 @subsubsection occt_2142243456_18669311358910 XUnsetColor
6997 Syntax: XUnsetColor document {label|shape} colortype
6999 Unset a color given??? type (‘s’ or ‘c’) for the indicated shape.
7002 XUnsetColor D 0:1:1:4 s
7005 @subsection occt_2142243456_1866931135810 XDE layer’s commands
7007 @subsubsection occt_2142243456_18669311358101 XAddLayer
7009 Syntax: XAddLayer document layer
7011 Adds a new layer in an XCAF document. layer - name of new layer (string).
7016 @subsubsection occt_2142243456_18669311358102 XFindLayer
7018 Syntax: XFindLayer document layer
7020 Prints a label where a layer is situated.
7026 @subsubsection occt_2142243456_18669311358103 XGetAllLayers
7028 Syntax: XGetAllLayers document
7030 Prints all layers in an XCAF document.
7034 == *0:1:1:3* *Bolt* *0:1:1:9*
7036 @subsubsection occt_2142243456_18669311358104 XGetLayers
7038 Syntax: XGetLayers document {shape|label}
7040 Returns names of layers, which are pointed to by links of an indicated shape.
7043 XGetLayers D 0:1:1:3
7046 @subsubsection occt_2142243456_18669311358105 XGetOneLayer
7048 Syntax: XGetOneLayer document label
7050 Prints the name of a layer at a given label.
7053 XGetOneLayer D 0:1:3:2
7055 @subsubsection occt_2142243456_18669311358106 XIsVisible
7057 Syntax: XIsVisible document {label|layer}
7059 Returns 1 if the indicated layer is visible, else returns 0.
7062 XIsVisible D 0:1:3:1
7064 @subsubsection occt_2142243456_18669311358107 XRemoveAllLayers
7066 Syntax: XRemoveAllLayers document
7068 Removes all layers from an XCAF document.
7073 @subsubsection occt_2142243456_18669311358108 XRemoveLayer
7075 Syntax: XRemoveLayer document {label|layer}
7077 Removes the indicated layer from an XCAF document.
7080 XRemoveLayer D layer2
7082 @subsubsection occt_2142243456_18669311358109 XSetLayer
7084 Syntax: XSetLayer document {shape|label} layer
7085 [shape_in_one_layer {0|1}]
7087 Sets a reference between a shape and a layer (adds a layer if it is necessary).
7088 Parameter shape_in_one_layer shows whether a shape could be in a number of layers or only in one (0 by default).
7091 XSetLayer D 0:1:1:2 layer2
7093 @subsubsection occt_2142243456_186693113581010 XSetVisibility
7095 Syntax: XSetVisibility document {label|layer} isvisible {0|1}
7097 Sets the visibility of a layer.
7100 # set layer at label 0:1:3:2 as invisible
7101 XSetVisibility D 0:1:3:2 0
7103 @subsubsection occt_2142243456_186693113581011 XUnSetAllLayers
7105 Syntax: XUnSetAllLayers document {label|shape}
7107 Unsets a shape from all layers.
7110 XUnSetAllLayers D 0:1:1:2
7112 @subsubsection occt_2142243456_186693113581012 XUnSetLayer
7114 Syntax: XUnSetLayer document {label|shape} layer
7116 Unsets a shape from the indicated layer.
7119 XUnSetLayer D 0:1:1:2 layer1
7122 @subsection occt_2142243456_1866931135811 XDE property’s commands
7124 @subsubsection occt_2142243456_18669311358111 XCheckProps
7126 Syntax: XCheckProps document [ {0|deflection} [shape|label] ]
7128 Gets properties for a given shape (volume, area and centroid) 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 treated as a deflection. If the deflection is positive the computation is done by triangulations, if it is negative – meshing is forced.
7131 # check properties for shapes at label 0:1:1:1 from
7132 # document using standard Open CASCADE Technology tools
7133 XCheckProps D 0 0:1:1:1
7134 == Label 0:1:1:1 ;L-BRACKET*
7135 == Area defect: -0.0 ( 0%)
7136 == Volume defect: 0.0 ( 0%)
7137 == CG defect: dX=-0.000, dY=0.000, dZ=0.000
7139 @subsubsection occt_2142243456_18669311358112 XGetArea
7141 Syntax: XGetArea document {shape|label}
7143 Returns the area of a given shape.
7147 == 24628.31815094999
7149 @subsubsection occt_2142243456_18669311358113 XGetCentroid
7151 Syntax: XGetCentroid document {shape|label}
7153 Returns the center of gravity coordinates of a given shape.
7156 XGetCentroid D 0:1:1:1
7158 @subsubsection occt_2142243456_18669311358114 XGetVolume
7160 Syntax: XGetVolume document {shape|label}
7162 Returns the volume of a given shape.
7165 XGetVolume D 0:1:1:1
7167 @subsubsection occt_2142243456_18669311358115 XSetArea
7169 Syntax: XSetArea document {shape|label} area
7171 Sets new area to attribute list ??? given shape.
7174 XSetArea D 0:1:1:1 2233.99
7176 @subsubsection occt_2142243456_18669311358116 XSetCentroid
7178 Syntax: XSetCentroid document {shape|label} x y z
7180 Sets new center of gravity to the attribute list ??? given shape.
7183 XSetCentroid D 0:1:1:1 0. 0. 100.
7185 @subsubsection occt_2142243456_18669311358117 XSetMaterial
7187 Syntax: XSetMaterial document {shape|label} name
7190 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 agiven shape or a given label. The last parameter sets the density of a pointed material.
7193 XSetMaterial D 0:1:1:1 Titanium 8899.77
7195 @subsubsection occt_2142243456_18669311358118 XSetVolume
7197 Syntax: XSetVolume document {shape|label} volume
7199 Sets new volume to the attribute list ??? given shape.
7202 XSetVolume D 0:1:1:1 444555.33
7204 @subsubsection occt_2142243456_18669311358119 XShapeMassProps
7206 Syntax: XShapeMassProps document [ deflection [{shape|label}] ]
7208 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.
7212 == Shape from label : 0:1:1:1
7213 == Mass = 193.71681469282299
7214 == CenterOfGravity X = 14.594564763807696,Y =
7215 20.20271885211281,Z = 49.999999385313245
7216 == Shape from label : 0:1:1:2 not have a mass
7219 @subsubsection occt_2142243456_186693113581110 XShapeVolume
7221 Syntax: XShapeVolume shape deflection
7223 Calculates the real volume of a pointed shape with a given deflection.
7228 @section occt_2142243456_1672096717 Shape Healing commands
7232 @subsection occt_2142243456_16720967171 General commands
7234 @subsubsection occt_2142243456_1672096717111 bsplres
7236 Syntax: bsplres result shape tol3d tol2d reqdegree reqnbsegments continuity3d continuity2d PriorDeg RationalConvert
7238 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).
7240 @subsubsection occt_2142243456_1672096717112 checkfclass2d
7242 Syntax: checkfclass2d face ucoord vcoord
7244 Shows where a point which is given by coordinates is located in relation to a given face – outbound, inside or at the bounds.
7247 checkfclass2d f 10.5 1.1
7250 @subsubsection occt_2142243456_1672096717113 checkoverlapedges
7252 Syntax: checkoverlapedges edge1 edge2 [toler domaindist]
7254 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.
7257 checkoverlapedges e1 e2
7259 @subsubsection occt_2142243456_1672096717114 comtol
7261 Syntax: comptol shape [nbpoints] [prefix]
7263 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.
7268 == Edges tolerance computed by 871 points:
7269 == MAX=8.0001130696523449e-008 AVG=6.349346868091096e-009
7271 == Relation real tolerance / tolerance set in edge
7272 == MAX=0.80001130696523448 AVG=0.06349345591805905 MIN=0
7273 == Edge with max tolerance saved to t_edge_tol
7274 == Concerned faces saved to shapes t_1, t_2
7277 @subsubsection occt_2142243456_1672096717115 convtorevol
7279 Syntax: convtorevol result shape
7281 Converts all elementary surfaces of a given shape into surfaces of revolution.
7282 Results are put into the shape, which is given as theresult parameter.
7287 @subsubsection occt_2142243456_1672096717116 directfaces
7289 Syntax: directfaces result shape
7291 Converts indirect surfaces and returns the results into the shape, which is given as the result parameter.
7296 @subsubsection occt_2142243456_1672096717117 expshape
7298 Syntax: expshape shape maxdegree maxseg
7300 Gives statistics for a given shape. This test command is working with Bezier and BSpline entities.
7304 == Number of Rational Bspline curves 128
7305 == Number of Rational Bspline pcurves 48
7307 @subsubsection occt_2142243456_1672096717118 fixsmall
7309 Syntax: fixsmall result shape [toler=1.]
7311 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.
7316 @subsubsection occt_2142243456_1672096717119 fixsmalledges
7318 Syntax: fixsmalledges result shape [toler mode maxangle]
7320 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 mode 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 maxangle 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.
7323 fixsmalledges r a 0.1 1
7325 @subsubsection occt_2142243456_16720967171110 fixshape
7327 Syntax: fixshape result shape [preci [maxpreci]] [{switches}]
7329 Performs fixes of all sub-shapes (such as Solids, Shells, Faces, Wires and Edges) of a given shape. Parameter preci sets a basic precision value, maxpreci sets the maximal allowed tolerance. Results are put into the shape, which is given as parameter result.
7330 {switches} allows to tune parameters of ShapeFix
7331 The following syntax is used: symbolparameter
7332 - symbol may be - to set parameter off, + to set on or * to set default
7333 - parameters are identified by letters:
7335 o - FixOrientationMode
7337 m - FixMissingSeamMode
7338 d - FixDegeneratedMode
7340 i - FixSelfIntersectionMode
7341 n - FixNotchedEdgesMode
7342 For enhanced message output, use switch '+?'
7347 @subsubsection occt_2142243456_16720967171111 fixwgaps
7349 Syntax: fixwgaps result shape [toler=0]
7351 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.
7356 @subsubsection occt_2142243456_16720967171112 offsetcurve, offset2dcurve
7358 Syntax: offsetcurve result curve offset direction(as point)
7359 offset2dcurve result curve offset
7361 Both commands are intended to create a new offset curve by copying the given curve to distance, given by parameter offset. Parameter direction 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 result. **offsetcurve **works with the curve in 3d space, **offset2dcurve **in 2d space accordingly.
7365 offsetcurve r c 20 pp
7367 @subsubsection occt_2142243456_16720967171113 projcurve
7369 Syntax: projcurve edge|curve3d|curve3d first last X Y Z
7371 **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.
7375 ==Edge k_1 Params from 0 to 1.3
7376 ==Precision (BRepBuilderAPI) : 9.9999999999999995e-008 ==Projection : 0 1 5
7377 ==Result : 0 1.1000000000000001 0
7378 ==Param = -0.20000000000000001 Gap = 5.0009999000199947
7381 @subsubsection occt_2142243456_16720967171114 projface
7383 Syntax: projface face X Y [Z]
7385 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.
7388 projface a_1 10.0 0.0
7389 == Point UV U = 10 V = 0
7390 == = proj X = -116 Y = -45 Z = 0
7392 @subsubsection occt_2142243456_16720967171115 scaleshape
7394 Syntax: scaleshape result shape scale
7398 scaleshape r a_1 0.8
7400 @subsubsection occt_2142243456_16720967171116 settolerance
7402 Syntax: settolerance shape [mode=v-e-w-f-a] val(fix value) or
7405 Sets new values of tolerance for a given shape. If the given second parameter (mode) is given, then the atolerance value is set only for these sub shapes.
7408 settolerance a 0.001
7410 @subsubsection occt_2142243456_16720967171117 splitface
7412 Syntax: splitface result face [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]
7414 Splits a given face in parametric space and puts the result into the given parameter result.
7415 Returns the status of split face.
7418 # split face f by parameter u = 5
7420 == Splitting by U: ,5
7423 @subsubsection occt_2142243456_16720967171118 statshape
7425 Syntax: statshape shape [particul]
7427 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 surfaces. The last parameter becomes out of date.
7433 == 402 Edge (oriented)
7434 == 402 Edge (Shared)
7437 == 804 Vertex (Oriented)
7438 == 402 Vertex (Shared)
7440 == 4 Face with more than one wire
7441 == 34 bspsur: BSplineSurface
7443 @subsubsection occt_2142243456_16720967171119 tolerance
7445 Syntax: tolerance shape [mode:D v e f c] [tolmin tolmax:real]
7447 Returns tolerance (maximal, avg and minimal values) of all given shapes and tolerance of their Faces, Edges and Vertices. If parameter tolmin or tolmax 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 (all shapes (D) (v) vertices (e) edges (f) faces (c) combined (faces)) is given as the second parameter then only this group will be analyzed for tolerance.
7451 == Tolerance MAX=0.31512672416608001 AVG=0.14901359484722074 MIN=9.9999999999999995e-08
7452 == FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
7453 == EDGE : MAX=0.31512672416608001 AVG=0.098691334511810405 MIN=9.9999999999999995e-08
7454 == VERTEX : MAX=0.31512672416608001 AVG=0.189076074499648 MIN=9.9999999999999995e-08
7456 tolerance a v 0.1 0.001
7457 == Analysing Vertices gives 6 Shapes between tol1=0.10000000000000001 and tol2=0.001 , named tol_1 to tol_6
7461 @subsection occt_2142243456_16720967172 Convertion commands
7462 More detailed information about using here classes can be found into Shape Healing documentation. All this commands are created for testing.
7464 @subsubsection occt_2142243456_1672096717121 DT_ClosedSplit
7466 Syntax: DT_ClosedSplit result shape
7468 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.
7469 Note: Closed face – it’s face with one or more seam.
7474 @subsubsection occt_2142243456_1672096717122 DT_ShapeConvert, DT_ShapeConvertRev
7476 Syntax: DT_ShapeConvert result shape convert2d convert3d
7477 DT_ShapeConvertRev result shape convert2d convert3d
7479 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.
7482 DT_ShapeConvert r a 1 1
7485 @subsubsection occt_2142243456_1672096717123 DT_ShapeDivide
7487 Syntax: DT_ShapeDivide result shape tol
7489 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:
7490 OK : no splitting was done
7491 Done1 : Some edges were split
7492 Done2 : Surface was split
7493 Fail1 : Some errors occurred
7496 DT_ShapeDivide r a 0.001
7499 @subsubsection occt_2142243456_1672096717124 DT_SplitAngle
7501 Syntax: DT_SplitAngle result shape [MaxAngle=95]
7503 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.
7504 This command illustrates how class ShapeUpgrade_ShapeDivideAngle works.
7510 @subsubsection occt_2142243456_1672096717125 DT_SplitCurve
7512 Syntax: DT_SplitCurve curve tol split(0|1)
7514 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.
7519 @subsubsection occt_2142243456_1672096717126 DT_SplitCurve2d
7521 Syntax: DT_SplitCurve2d Curve Tol Split(0/1)
7523 Works just as DT_SplitCurve (see above), only with 2d curve.
7528 @subsubsection occt_2142243456_1672096717127 DT_SplitSurface
7530 Syntax: DT_SplitSurface result Surface|GridSurf tol split(0|1)
7532 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.
7537 # split surface with name "su"
7538 DT_SplitSurface res su 0.1 1
7540 == appel a SplitSurface::Init
7541 == appel a SplitSurface::Build
7542 == appel a SplitSurface::GlobalU/VKnots
7543 == nb GlobalU;nb GlobalV=7 2 0 1 2 3 4 5 6.2831853072 0 1
7545 == transfert resultat
7546 == res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1
7549 @subsubsection occt_2142243456_1672096717128 DT_ToBspl
7551 Syntax: DT_ToBspl result shape
7553 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.
7557 == error = 5.20375663162094e-08 spans = 10
7558 == Surface is aproximated with continuity 2
7560 @section occt_draw_commands_perf Performance evaluation commands
7563 @subsection occt_draw_commands_perf_vdrawsphere VDrawSphere
7565 Syntax: vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToEnableVBO=1] [NumberOfViewerUpdate=1] [ToShowEdges=0]
7567 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.
7569 This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter.
7572 vdrawsphere s 200 1 1 1 500 1 == Compute Triangulation... == NumberOfPoints: 39602 == NumberOfTriangles: 79200 == Amount of memory required for PolyTriangulation without Normals: 2 Mb == Amount of memory for colors: 0 Mb == Amount of memory for PolyConnect: 1 Mb == Amount of graphic card memory required: 2 Mb == Number of scene redrawings: 1 == CPU user time: 15.6000999999998950 msec == CPU system time: 0.0000000000000000 msec == CPU average time of scene redrawing: 15.6000999999998950 msec
7576 @section occt_2142243456_713659999 Extending Test Harness with custom commands
7579 The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism.
7582 @subsection occt_2142243456_7136599991 Custom command implementation
7584 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.
7588 static Standard_Integer myadvcurve(Draw_Interpretor& di,
7596 For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx).
7599 @subsection occt_2142243456_7136599992 Registration of commands in Test Harness
7601 To become available in the Test Harness the custom command must be registered in it. This should be done as follows.
7605 void MyPack::CurveCommands(Draw_Interpretor& theCommands)
7608 char* g = ;Advanced curves creation;;
7611 theCommands.Add ( ;myadvcurve;, ;myadvcurve name p1 p2 p3 –
7612 Creates my advanced curve from points;,
7613 __FILE__, myadvcurve, g);
7618 @subsection occt_2142243456_7136599993 Creating a toolkit (library) as a plug-in
7620 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.
7621 This exported function PLUGINFACTORY() must be implemented only once per library.
7622 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.
7625 #include Draw_PluginMacro.hxx
7627 void MyPack::Factory(Draw_Interpretor& theDI)
7631 MyPack::CurveCommands(theDI);
7635 // Declare entry point PLUGINFACTORY
7639 @subsection occt_2142243456_7136599994 Creation of the plug-in resource file
7641 As mentioned above, the plug-in resource file must be compliant with Open CASCADE Technology requirements (see Resource_Manager.cdl file for details). In particular, it should contain keys separated from their values by a colon (;:;).
7642 For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name.
7643 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.
7644 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.
7645 **Examples** (file MyDrawPlugin):
7647 ! Hierarchy of plug-ins
7648 ALL : ADVMODELING, MESHING
7650 ADVMODELING : ADVSURF, ADVCURV
7652 ! Mapping from naming to toolkits (libraries)
7653 ADVSURF : TKMyAdvSurf
7654 ADVCURV : TKMyAdvCurv
7658 For other examples of the plug-in resource file refer to the *;Plug-in resource file;* chapter above or to the $CASROOT/src/DrawPlugin file shipped with Open CASCADE Technology.
7661 @subsection occt_2142243456_7136599995 Dynamic loading and activation
7663 Loading a plug-in and activating its commands is described in the *;Activation of the commands implemented in the plug-in;* chapter.
7665 The procedure consists in defining the system variables and using the pload commands in the Test Harness session.
7670 Draw[] set env(CSF_MyDrawPluginDefaults) /users/test