0025674: Debug dev guide: misprint in Saving and dumping shapes and geometric objects...
[occt.git] / dox / user_guides / draw_test_harness / draw_test_harness.md
CommitLineData
18006a0f 1Draw Test Harness {#occt_user_guides__test_harness}
72b7576f 2===============================
e5bd0d98 3
4@tableofcontents
72b7576f 5
e5bd0d98 6@section occt_draw_1 Introduction
72b7576f 7
18006a0f 8This manual explains how to use Draw, the test harness for Open CASCADE Technology (**OCCT**).
72b7576f 9Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
10
e5bd0d98 11@subsection occt_draw_1_1 Overview
72b7576f 12
13Draw 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.
14
15Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
16
17Scripts may be written to customize Draw and perform tests. New types of objects and new commands may be added using the C++ programing language.
18
19Draw consists of:
20
21 * A command interpreter based on the TCL command language.
22 * A 3d graphic viewer based on the X system.
23 * A basic set of commands covering scripts, variables and graphics.
24 * A set of geometric commands allowing the user to create and modify curves and surfaces and to use OCCT geometry algorithms. This set of commands is optional.
25 * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
26
27
28There is also a set of commands for each delivery unit in the modeling libraries:
29
e5bd0d98 30 * GEOMETRY,
31 * TOPOLOGY,
32 * ADVALGOS,
33 * GRAPHIC,
34 * PRESENTATION.
72b7576f 35
36
e5bd0d98 37@subsection occt_draw_1_2 Contents of this documentation
72b7576f 38
39This documentation describes:
40
41 * The command language.
42 * The basic set of commands.
43 * The graphical commands.
44 * The Geometry set of commands.
45 * The Topology set of commands.
46
47This document does not describe other sets of commands and does not explain how to extend Draw using C++.
48
49This document is a reference manual. It contains a full description of each command. All descriptions have the format illustrated below for the exit command.
72b7576f 50
e5bd0d98 51~~~~~
52exit
53~~~~~
72b7576f 54
55Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file.
56
e5bd0d98 57**Example:**
72b7576f 58
e5bd0d98 59~~~~~
72b7576f 60# this is a very short example
61exit
e5bd0d98 62~~~~~
72b7576f 63
64
e5bd0d98 65@subsection occt_draw_1_3 Getting started
72b7576f 66
4ee1bdf4 67Install Draw and launch Emacs. Get a command line in Emacs using *Esc x* and key in *woksh*.
72b7576f 68
e5bd0d98 69All 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.
72b7576f 70
e5bd0d98 71Declaration 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.
72b7576f 72
e5bd0d98 73@subsubsection occt_draw_1_3_1 Launching DRAW Test Harness
72b7576f 74
ba06f8bb 75Test 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).
72b7576f 76
72b7576f 77
e5bd0d98 78@subsubsection occt_draw_1_3_2 Plug-in resource file
72b7576f 79
e5bd0d98 80Open CASCADE Technology is shipped with the DrawPlugin resource file located in the <i>$CASROOT/src/DrawResources</i> directory.
72b7576f 81
e5bd0d98 82The format of the file is compliant with standard Open CASCADE Technology resource files (see the *Resource_Manager.cdl* file for details).
72b7576f 83
84Each 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.
e5bd0d98 85
86**Example:** (excerpt from DrawPlugin):
72b7576f 87~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
dba69de2 88OCAF : VISUALIZATION, OCAFKERNEL
89VISUALIZATION : AISV
90OCAFKERNEL : DCAF
72b7576f 91
dba69de2 92DCAF : TKDCAF
93AISV : TKViewerTest
72b7576f 94~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
e5bd0d98 96@subsubsection occt_draw_1_3_3 Activation of commands implemented in the plug-in
72b7576f 97
98To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness:
99
e5bd0d98 100~~~~~
101pload [-PluginFileName] [[Key1] [Key2]...]
102~~~~~
103
bf62b306 104where:
72b7576f 105
bf62b306 106* <i>-PluginFileName</i> - defines the name of a plug-in resource file (prefix "-" is mandatory) described above. If this parameter is omitted then the default name *DrawPlugin* is used.
e5bd0d98 107* *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).
72b7576f 108
e5bd0d98 109According 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.
72b7576f 110
e5bd0d98 111~~~~~
dba69de2 112Draw[] pload -DrawPlugin OCAF
e5bd0d98 113~~~~~
114This 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.
72b7576f 115
e5bd0d98 116~~~~~
dba69de2 117Draw[] pload (equivalent to pload -DrawPlugin DEFAULT).
e5bd0d98 118~~~~~
119This command will find the default DrawPlugin file and the DEFAULT key. The latter finally maps to the TKTopTest toolkit which implements basic modeling commands.
72b7576f 120
121
e5bd0d98 122@section occt_draw_2 The Command Language
72b7576f 123
e5bd0d98 124@subsection occt_draw_2_1 Overview
72b7576f 125
e5bd0d98 126The 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.
72b7576f 127
128This 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:
129
130 * Syntax of the TCL language.
131 * Accessing variables in TCL and Draw.
132 * Control structures.
133 * Procedures.
134
e5bd0d98 135@subsection occt_draw_2_2 Syntax of TCL
72b7576f 136
137TCL 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.
138
139The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons.
e5bd0d98 140
72b7576f 141~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
142set a 24
143set b 15
144set a 25; set b 15
145~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 146
72b7576f 147Each command consists of one or more *words*; the first word is the name of a command and additional words are arguments to that command.
148
149Words 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.
150
151The 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.
152
153The following substitutions are performed by TCL:
154
e5bd0d98 155Variable 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.
156
157**Example:**
72b7576f 158~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
159# set a variable value
160set file documentation
161puts $file #to display file contents on the screen
162
163# a simple substitution, set psfile to documentation.ps
164set psfile $file.ps
165puts $psfile
166
167# another substitution, set pfile to documentationPS
168set pfile ${file}PS
169
170# a last one,
171# delete files NEWdocumentation and OLDdocumentation
172foreach prefix {NEW OLD} {rm $prefix$file}
173~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 174
175Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted.
176
72b7576f 177Compare command construction in csh.
178
e5bd0d98 179**Example:**
72b7576f 180~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
181set degree 30
182set pi 3.14159265
183# expr is a command evaluating a numeric expression
184set radian [expr $pi*$degree/180]
185~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 186
187Backslash 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.
188
72b7576f 189TCL uses two forms of *quoting* to prevent substitution and word breaking.
190
e5bd0d98 191Double quote *quoting* enables the definition of a string with space and tabs as a single word. Substitutions are still performed inside the inverted commas " ".
72b7576f 192
e5bd0d98 193**Example:**
72b7576f 194~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
195# set msg to ;the price is 12.00;
196set price 12.00
197set msg ;the price is $price;
198~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 199
200Braces *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.
201
202**Example:**
72b7576f 203~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
204set x 0
205# this will loop for ever
206# because while argument is ;0 3;
207while ;$x 3; {set x [expr $x+1]}
208# this will terminate as expected because
209# while argument is {$x 3}
210while {$x 3} {set x [expr $x+1]}
211# this can be written also
212while {$x 3} {
213set x [expr $x+1]
214}
215# the following cannot be written
216# because while requires two arguments
217while {$x 3}
218{
219set x [expr $x+1]
220}
221~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 222
223Comments 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.
224
225**Example:**
72b7576f 226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
227# This is a comment
228set a 1 # this is not a comment
229set b 1; # this is a comment
230~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 231
e5bd0d98 232The 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.
72b7576f 233
e5bd0d98 234
235**Example:**
72b7576f 236~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237# I want to delete two files
238
239set files ;foo bar;
240
241# this will fail because rm will receive only one argument
242# and complain that ;foo bar; does not exit
243
244exec rm $files
245
246# a second evaluation will do it
247~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248
e5bd0d98 249@subsection occt_draw_2_3 Accessing variables in TCL and Draw
72b7576f 250
e5bd0d98 251TCL 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.
72b7576f 252
253TCL provides a mechanism to link user data to variables. Using this functionality, Draw defines its variables as TCL variables with associated data.
254
bf62b306 255The string value of a Draw variable is meaningless. It is usually set to the name of the variable itself. Consequently, preceding a Draw variable with a <i>$</i> does not change the result of a command. The content of a Draw variable is accessed using appropriate commands.
72b7576f 256
257There are many kinds of Draw variables, and new ones may be added with C++. Geometric and topological variables are described below.
258
bf62b306 259Draw 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.
72b7576f 260
e5bd0d98 261**Example:**
72b7576f 262~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
263# dset is used for numeric variables
264# pi is a predefined Draw variable
265dset angle pi/3 radius 10
266point p radius*cos(angle) radius*sin(angle) 0
267~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bf62b306 268It 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.
e5bd0d98 269
270@subsubsection occt_draw_2_3_1 set, unset
72b7576f 271
e5bd0d98 272Syntax:
72b7576f 273
e5bd0d98 274~~~~~
275set varname [value]
72b7576f 276unset varname [varname varname ...]
e5bd0d98 277~~~~~
278
bf62b306 279*set* assigns a string value to a variable. If the variable does not already exist, it is created.
72b7576f 280
bf62b306 281Without a value, *set* returns the content of the variable.
72b7576f 282
bf62b306 283*unset* deletes variables. It is is also used to delete Draw variables.
72b7576f 284
e5bd0d98 285**Example:**
72b7576f 286~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
e5bd0d98 287set a "Hello world"
288set b "Goodbye"
72b7576f 289set a
e5bd0d98 290== "Hello world"
72b7576f 291unset a b
292set a
293~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
294
e5bd0d98 295**Note**, that the *set* command can set only one variable, unlike the *dset* command.
72b7576f 296
72b7576f 297
e5bd0d98 298@subsubsection occt_draw_2_3_2 dset, dval
72b7576f 299
e5bd0d98 300Syntax
72b7576f 301
e5bd0d98 302~~~~~
303dset var1 value1 vr2 value2 ...
72b7576f 304dval name
e5bd0d98 305~~~~~
72b7576f 306
e5bd0d98 307*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.
72b7576f 308
e5bd0d98 309*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.
310
311
312**Example:**
72b7576f 313~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
314# z is set to 0
315dset x 10 y 15 z
316== 0
317
318# no $ required for Draw commands
319point p x y z
320
4ee1bdf4 321# "puts" prints a string
72b7576f 322puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)];
323== x = 10, cos(x/pi) = -0.99913874099467914
324~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 325
4ee1bdf4 326**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.
72b7576f 327
328
e5bd0d98 329@subsection occt_draw_2_4 lists
72b7576f 330
331TCL 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.
332
333This allows you to insert lists within lists.
e5bd0d98 334
335**Example:**
72b7576f 336~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
337# a list of 3 strings
338;a b c;
339
340# a list of two strings the first is a list of 2
341;{a b} c;
342~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 343
e5bd0d98 344Many TCL commands return lists and **foreach** is a useful way to create loops on list elements.
345
346@subsubsection occt_draw_2_5 Control Structures
72b7576f 347
348TCL 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:
349
e5bd0d98 350* You use braces instead of parentheses to enclose conditions.
351* You do not start the script on the next line of your command.
352
353
354@subsubsection occt_draw_2_5_1 if
355
356Syntax
357
358~~~~~
359if condition script [elseif script .... else script]
360~~~~~
72b7576f 361
e5bd0d98 362**If** evaluates the condition and the script to see whether the condition is true.
72b7576f 363
72b7576f 364
72b7576f 365
e5bd0d98 366**Example:**
72b7576f 367~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
368if {$x 0} {
369puts ;positive;
370} elseif {$x == 0} {
371puts ;null;
372} else {
373puts ;negative;
374}
375~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376
e5bd0d98 377@subsubsection occt_draw_2_5_2 while, for, foreach
72b7576f 378
e5bd0d98 379Syntax:
380
381
382~~~~~~
383while condition script
72b7576f 384for init condition reinit script
385foreach varname list script
e5bd0d98 386~~~~~
387
388The 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. \
72b7576f 389
e5bd0d98 390**Example:**
72b7576f 391~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
392# while example
393dset x 1.1
394while {[dval x] 100} {
395 circle c 0 0 x
396 dset x x*x
397}
398# for example
399# incr var d, increments a variable of d (default 1)
400for {set i 0} {$i 10} {incr i} {
401 dset angle $i*pi/10
402 point p$i cos(angle0 sin(angle) 0
403}
404# foreach example
405foreach object {crapo tomson lucas} {display $object}
406~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 407
e5bd0d98 408@subsubsection occt_draw_2_5_3 break, continue
72b7576f 409
e5bd0d98 410Syntax:
72b7576f 411
e5bd0d98 412~~~~~
413break
72b7576f 414continue
e5bd0d98 415~~~~~
72b7576f 416
e5bd0d98 417Within loops, the **break** and **continue** commands have the same effect as in C.
72b7576f 418
e5bd0d98 419**break** interrupts the innermost loop and **continue** jumps to the next iteration.
420
421**Example:**
72b7576f 422~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
423# search the index for which t$i has value ;secret;
424for {set i 1} {$i = 100} {incr i} {
425 if {[set t$i] == ;secret;} break;
426}
427~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 428
e5bd0d98 429@subsection occt_draw_2_6 Procedures
430
431TCL 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.
72b7576f 432
433The 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.
434
e5bd0d98 435There 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.
436
437As 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.
72b7576f 438
72b7576f 439
e5bd0d98 440@subsubsection occt_draw_2_6_1 proc
72b7576f 441
e5bd0d98 442Syntax:
72b7576f 443
e5bd0d98 444~~~~~
445proc argumentlist script
446~~~~~
72b7576f 447
e5bd0d98 448**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.
72b7576f 449
e5bd0d98 450**return** gives a return value to the procedure.
451
452**Example:**
72b7576f 453~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
454# simple procedure
455proc hello {} {
456 puts ;hello world;
457}
458# procedure with arguments and default values
459proc distance {x1 y1 {x2 0} {y2 0}} {
460 set d [expr (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)]
461 return [expr sqrt(d)]
462}
463proc fact n {
464 if {$n == 0} {return 1} else {
465 return [expr n*[fact [expr n -1]]]
466 }
467}
468~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 469
470
e5bd0d98 471@subsubsection occt_draw_2_6_2 global, upvar
472
473Syntax:
72b7576f 474
e5bd0d98 475~~~~~
476global varname [varname ...]
72b7576f 477upvar varname localname [varname localname ...]
e5bd0d98 478~~~~~
72b7576f 479
72b7576f 480
e5bd0d98 481**global** accesses high level variables. Unlike C, global variables are not visible in procedures.
72b7576f 482
e5bd0d98 483**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.
484
485**Note** that in the following examples the \$ character is always necessarily used to access the arguments.
486
487**Example:**
72b7576f 488~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
489# convert degree to radian
490# pi is a global variable
491proc deg2rad (degree} {
492 return [dval pi*$degree/2.]
493}
494# create line with a point and an angle
495proc linang {linename x y angle} {
496 upvar linename l
497 line l $x $y cos($angle) sin($angle)
498}
499~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500
e5bd0d98 501@section occt_draw_3 Basic Commands
72b7576f 502
503This 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:
504
505 * General commands, which are used for Draw and TCL management.
506 * Variable commands, which are used to manage Draw variables such as storing and dumping.
507 * Graphic commands, which are used to manage the graphic system, and so pertain to views.
508 * Variable display commands, which are used to manage the display of objects within given views.
509
e5bd0d98 510Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands
72b7576f 511
512
e5bd0d98 513@subsection occt_draw_3_1 General commands
72b7576f 514
e5bd0d98 515This section describes several useful commands:
72b7576f 516
e5bd0d98 517 * **help** to get information,
518 * **source** to eval a script from a file,
519 * **spy** to capture the commands in a file,
520 * **cpulimit** to limit the process cpu time,
521 * **wait** to waste some time,
522 * **chrono** to time commands.
72b7576f 523
e5bd0d98 524@subsubsection occt_draw_3_1_1 help
72b7576f 525
e5bd0d98 526Syntax:
72b7576f 527
e5bd0d98 528~~~~~
529help [command [helpstring group]]
530~~~~~
72b7576f 531
532Provides help or modifies the help information.
533
e5bd0d98 534**help** without arguments lists all groups and the commands in each group.
72b7576f 535
e5bd0d98 536Specifying 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.
537
538**Example:**
72b7576f 539~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
540# Gives help on all commands starting with *a*
541~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 542
72b7576f 543
e5bd0d98 544@subsubsection occt_draw_3_1_2 source
545
546Syntax:
547
548~~~~~
549source filename
550~~~~~
72b7576f 551Executes a file.
552
e5bd0d98 553The **exit** command will terminate the file.
72b7576f 554
e5bd0d98 555@subsubsection occt_draw_3_1_3 spy
72b7576f 556
e5bd0d98 557Syntax:
72b7576f 558
e5bd0d98 559~~~~~
560spy [filename]
561~~~~~
72b7576f 562
e5bd0d98 563Saves 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.
72b7576f 564
72b7576f 565If a command returns an error it is saved with a comment mark.
566
e5bd0d98 567The file created by **spy** can be executed with the **source** command.
568
569**Example:**
72b7576f 570~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
571# all commands will be saved in the file ;session;
572spy session
573# the file ;session; is closed and commands are not saved
574spy
575~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 576
577
72b7576f 578
e5bd0d98 579@subsubsection occt_draw_3_1_4 cpulimit
580
581Syntax:
72b7576f 582
e5bd0d98 583~~~~~
584cpulimit [nbseconds]
585~~~~~
586
587**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.
588
589**Example:**
72b7576f 590~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
591#limit cpu to one hour
592cpulimit 3600
593~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
594
e5bd0d98 595@subsubsection occt_draw_3_1_5 wait
72b7576f 596
e5bd0d98 597Syntax:
598~~~~~
599wait [nbseconds]
600~~~~~
72b7576f 601Suspends 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.
602
e5bd0d98 603~~~~~
72b7576f 604# You have ten seconds ...
605wait
e5bd0d98 606~~~~~
72b7576f 607
e5bd0d98 608@subsubsection occt_draw_3_1_6 chrono
72b7576f 609
e5bd0d98 610Syntax:
72b7576f 611
e5bd0d98 612~~~~~
613chrono [ name start/stop/reset/show]
614~~~~~
72b7576f 615
e5bd0d98 616Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed.
72b7576f 617
e5bd0d98 618With arguments, **chrono** is used to manage activated chronometers. You can perform the following actions with a chronometer.
72b7576f 619 * run the chronometer (start).
620 * stop the chronometer (stop).
621 * reset the chronometer to 0 (reset).
622 * display the current time (show).
623
e5bd0d98 624**Example:**
72b7576f 625~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
626chrono
627==Chronometers activated.
628ptorus t 20 5
629==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds
630==CPU user time: 0.01 seconds
631==CPU system time: 0 seconds
632~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
633
e5bd0d98 634@subsection occt_draw_3_2 Variable management commands
72b7576f 635
e5bd0d98 636@subsubsection occt_draw_3_2_1 isdraw, directory
72b7576f 637
e5bd0d98 638Syntax:
639~~~~~
640isdraw varname
72b7576f 641directory [pattern]
e5bd0d98 642~~~~~
643
644**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.
72b7576f 645
e5bd0d98 646Use **directory** to return a list of all Draw global variables matching a pattern.
72b7576f 647
e5bd0d98 648**Example:**
72b7576f 649~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
650set a 1
651isdraw a
652=== 0
653
654dset a 1
655isdraw a
656=== 1
657
658circle c 0 0 1 0 5
659isdraw c
660=== 1
661
662# to destroy all Draw objects with name containing curve
663foreach var [directory *curve*] {unset $var}
664~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 665
666
e5bd0d98 667@subsubsection occt_draw_3_2_2 whatis, dump
72b7576f 668
e5bd0d98 669Syntax:
670
671~~~~~
672whatis varname [varname ...]
72b7576f 673dump varname [varname ...]
e5bd0d98 674~~~~~
72b7576f 675
e5bd0d98 676**whatis** returns short information about a Draw variable. This is usually the type name.
72b7576f 677
e5bd0d98 678**dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable.
72b7576f 679
e5bd0d98 680**Example:**
72b7576f 681~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
682circle c 0 0 1 0 5
683whatis c
684c is a 2d curve
685
686dump c
687
688***** Dump of c *****
689Circle
690Center :0, 0
691XAxis :1, 0
692YAxis :-0, 1
693Radius :5
694~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 695
696**Note** The behavior of *whatis* on other variables (not Draw) is not excellent.
72b7576f 697
698
e5bd0d98 699@subsubsection occt_draw_3_2_3 rename, copy
72b7576f 700
e5bd0d98 701Syntax:
702~~~~~
703rename varname tovarname [varname tovarname ...]
72b7576f 704copy varname tovarname [varname tovarname ...]
e5bd0d98 705~~~~~
72b7576f 706
e5bd0d98 707 * **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.
708 * **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.
72b7576f 709
e5bd0d98 710**Example:**
72b7576f 711~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
712circle c1 0 0 1 0 5
713rename c1 c2
714
715# curves are copied, c2 will not be modified
716copy c2 c3
717~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
718
e5bd0d98 719@subsubsection occt_draw_3_2_4 datadir, save, restore
72b7576f 720
e5bd0d98 721Syntax:
722~~~~~
723datadir [directory]
72b7576f 724save variable [filename]
725restore filename [variablename]
e5bd0d98 726~~~~~
72b7576f 727
e5bd0d98 728 * **datadir** without arguments prints the path of the current data directory.
729 * **datadir** with an argument sets the data directory path. \
72b7576f 730
e5bd0d98 731If the path starts with a dot (.) only the last directory name will be changed in the path.
72b7576f 732
e5bd0d98 733 * **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.
734 * **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.
72b7576f 735
736The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent.
e5bd0d98 737
738**Example:**
72b7576f 739~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
740# note how TCL accesses shell environment variables
741# using $env()
742datadir
743==.
744
745datadir $env(WBCONTAINER)/data/default
746==/adv_20/BAG/data/default
747
748box b 10 20 30
749save b theBox
750==/adv_20/BAG/data/default/theBox
751
752# when TCL does not find a command it tries a shell command
753ls [datadir]
754== theBox
755
756restore theBox
757== theBox
758~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 759
e5bd0d98 760@subsection occt_draw_3_3 User defined commands
72b7576f 761
bf62b306 762*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.
72b7576f 763
bf62b306 764*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.
72b7576f 765
e5bd0d98 766@subsubsection occt_draw_3_3_1 set
767
768#### In *DrawTrSurf* package:
72b7576f 769
e5bd0d98 770~~~~~
bf62b306 771void Set(Standard_CString& Name,const gp_Pnt& G) ;
772void Set(Standard_CString& Name,const gp_Pnt2d& G) ;
773void Set(Standard_CString& Name,
774const Handle(Geom_Geometry)& G) ;
775void Set(Standard_CString& Name,
776const Handle(Geom2d_Curve)& C) ;
777void Set(Standard_CString& Name,
778const Handle(Poly_Triangulation)& T) ;
779void Set(Standard_CString& Name,
780const Handle(Poly_Polygon3D)& P) ;
781void Set(Standard_CString& Name,
782const Handle(Poly_Polygon2D)& P) ;
e5bd0d98 783~~~~~
72b7576f 784
e5bd0d98 785#### In *DBRep* package:
72b7576f 786
e5bd0d98 787~~~~~
72b7576f 788void Set(const Standard_CString Name,
bf62b306 789const TopoDS_Shape& S) ;
e5bd0d98 790~~~~~
72b7576f 791
e5bd0d98 792Example of *DrawTrSurf*
72b7576f 793
e5bd0d98 794~~~~~
72b7576f 795Handle(Geom2d_Circle) C1 = new Geom2d_Circle
796(gce_MakeCirc2d (gp_Pnt2d(50,0,) 25));
797DrawTrSurf::Set(char*, C1);
e5bd0d98 798~~~~~
72b7576f 799
e5bd0d98 800Example of *DBRep*
72b7576f 801
e5bd0d98 802~~~~~
72b7576f 803TopoDS_Solid B;
804B = BRepPrimAPI_MakeBox (10,10,10);
805DBRep::Set(char*,B);
e5bd0d98 806~~~~~
72b7576f 807
e5bd0d98 808@subsubsection occt_draw_3_3_2 get
72b7576f 809
e5bd0d98 810#### In *DrawTrSurf* package:
811
812~~~~~
bf62b306 813Handle_Geom_Geometry Get(Standard_CString& Name) ;
e5bd0d98 814~~~~~
72b7576f 815
e5bd0d98 816#### In *DBRep* package:
72b7576f 817
e5bd0d98 818~~~~~
bf62b306 819TopoDS_Shape Get(Standard_CString& Name,
72b7576f 820const TopAbs_ShapeEnum Typ = TopAbs_SHAPE,
821const Standard_Boolean Complain
822= Standard_True) ;
e5bd0d98 823~~~~~
72b7576f 824
e5bd0d98 825Example of *DrawTrSurf*
826
827~~~~~
72b7576f 828Standard_Integer MyCommand
bf62b306 829(Draw_Interpretor& theCommands,
72b7576f 830Standard_Integer argc, char** argv)
831{......
832// Creation of a Geom_Geometry from a Draw geometric
833// name
834Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]);
835}
e5bd0d98 836~~~~~
72b7576f 837
e5bd0d98 838Example of *DBRep*
72b7576f 839
e5bd0d98 840~~~~~
72b7576f 841Standard_Integer MyCommand
bf62b306 842(Draw_Interpretor& theCommands,
72b7576f 843Standard_Integer argc, char** argv)
844{......
845// Creation of a TopoDS_Shape from a Draw topological
846// name
847TopoDS_Solid B = DBRep::Get(argv[1]);
848}
e5bd0d98 849~~~~~
72b7576f 850
e5bd0d98 851@section occt_draw_4 Graphic Commands
72b7576f 852
853Graphic 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.
854
e5bd0d98 855@subsection occt_draw_4_1 Axonometric viewer
72b7576f 856
e5bd0d98 857@subsubsection occt_draw_4_1_1 view, delete
72b7576f 858
e5bd0d98 859Syntax:
860~~~~~
861view index type [X Y W H]
72b7576f 862delete [index]
e5bd0d98 863~~~~~
72b7576f 864
e5bd0d98 865**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.
72b7576f 866
e5bd0d98 867As 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..
72b7576f 868
e5bd0d98 869**delete** deletes a view. If no index is given, all the views are deleted.
72b7576f 870
871Type selects from the following range:
872
e5bd0d98 873 * *AXON* : Axonometric view
874 * *PERS* : Perspective view
bf62b306 875 * <i>+X+Y</i> : View on both axes (i.e. a top view), other codes are <i>-X+Y</i>, <i>+Y-Z</i>, etc.
876 * <i>-2D-</i> : 2d view
72b7576f 877
878The index, the type, the current zoom are displayed in the window title .
e5bd0d98 879
880**Example:**
72b7576f 881~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
882# this is the content of the mu4 procedure
883proc mu4 {} {
884delete
885view 1 +X+Z 320 20 400 400
886view 2 +X+Y 320 450 400 400
887view 3 +Y+Z 728 20 400 400
888view 4 AXON 728 450 400 400
889}
890~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 891
72b7576f 892See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview**
893
e5bd0d98 894@subsubsection occt_draw_4_1_2 axo, pers, top, ...
895
896Syntax:
72b7576f 897
e5bd0d98 898~~~~~
899axo
72b7576f 900pers
901...
902smallview type
e5bd0d98 903~~~~~
72b7576f 904
905All 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.
906
e5bd0d98 907 * **axo** creates a large window axonometric view;
908 * **pers** creates a large window perspective view;
909 * **top**, **bottom**, **left**, **right**, **front**, **back** create a large window axis view;
910 * **mu4** creates four small window views: front, left, top and axo.
911 * **v2d** creates a large window 2d view.
912 * **av2d** creates two small window views, one 2d and one axo
913 * **smallview** creates a view at the bottom right of the screen of the given type.
72b7576f 914
915See also: **view**, **delete**
916
e5bd0d98 917@subsubsection occt_draw_4_1_3 mu, md, 2dmu, 2dmd, zoom, 2dzoom
72b7576f 918
e5bd0d98 919Syntax:
72b7576f 920
e5bd0d98 921~~~~~
922 mu [index] value
923 2dmu [index] value
924 zoom [index] value
925 wzoom
926~~~~~
72b7576f 927
e5bd0d98 928* **mu** (magnify up) increases the zoom in one or several views by a factor of 10%.
929* **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd**
72b7576f 930perform the same on one or all 2d views.
e5bd0d98 931* **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.
932* **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.
72b7576f 933
e5bd0d98 934**Example:**
72b7576f 935~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
e5bd0d98 936 # set a zoom of 2.5
937 zoom 2.5
72b7576f 938
e5bd0d98 939 # magnify by 10%
940 mu 1
72b7576f 941
e5bd0d98 942 # magnify by 20%
72b7576f 943~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
944See also: **fit**, **2dfit**
945
946
e5bd0d98 947@subsubsection occt_draw_4_14 pu, pd, pl, pr, 2dpu, 2dpd, 2dpl, 2dpr
72b7576f 948
bf62b306 949Syntax:
950
951~~~~~
952pu [index]
72b7576f 953pd [index]
bf62b306 954~~~~~
72b7576f 955
bf62b306 956The <i>p_</i> commands are used to pan. **pu** and **pd** pan up and down respectively; **pl** and **pr** pan to the left and to the right respectively. Each time the view is displaced by 40 pixels. When no index is given, all views will pan in the direction specified.
957~~~~~
958# you have selected one anonometric view
959pu
960# or
961pu 1
72b7576f 962
bf62b306 963# you have selected an mu4 view; the object in the third view will pan up
964pu 3
965~~~~~
72b7576f 966See also: **fit**, **2dfit**
967
968
e5bd0d98 969@subsubsection occt_draw_4_1_5 fit, 2dfit
970
971Syntax:
72b7576f 972
e5bd0d98 973~~~~~
974fit [index]
72b7576f 9752dfit [index]
e5bd0d98 976~~~~~
72b7576f 977
e5bd0d98 978**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.
72b7576f 979
980When fitting all views a unique zoom is computed for all the views. All views are on the same scale.
981
e5bd0d98 982**Example:**
72b7576f 983~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
984# fit only view 1
985fit 1
986# fit all 2d views
9872dfit
988~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
989See also: **zoom**, **mu**, **pu**
990
991
e5bd0d98 992@subsubsection occt_draw_4_1_6 u, d, l, r
72b7576f 993
e5bd0d98 994Syntax:
995
996~~~~~
997u [index]
72b7576f 998d [index]
999l [index]
1000r [index]
e5bd0d98 1001~~~~~
72b7576f 1002
e5bd0d98 1003**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.
72b7576f 1004
e5bd0d98 1005**Example:**
72b7576f 1006~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1007# rotate the view up
1008u
1009~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1010
e5bd0d98 1011@subsubsection occt_draw_4_1_7 focal, fu, fd
72b7576f 1012
e5bd0d98 1013Syntax:
1014~~~~~
1015focal [f]
72b7576f 1016fu [index]
1017fd [index]
e5bd0d98 1018~~~~~
1019
1020* **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.
1021* **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object.
72b7576f 1022
e5bd0d98 1023**Example:**
72b7576f 1024~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1025pers
1026repeat 10 fd
1027~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 1028
1029**Note**: Do not use a negative or null focal value.
72b7576f 1030
1031See also: **pers**
1032
e5bd0d98 1033@subsubsection occt_draw_4_1_8 color
1034
1035Syntax:
72b7576f 1036
e5bd0d98 1037~~~~~
1038color index name
1039~~~~~
72b7576f 1040
e5bd0d98 1041**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.
72b7576f 1042
e5bd0d98 1043The 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.
72b7576f 1044
e5bd0d98 1045**Example:**
72b7576f 1046~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1047# change the value of blue
e5bd0d98 1048color 3 "navy blue"
72b7576f 1049~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1050
1051
e5bd0d98 1052**Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc.
1053
1054@subsubsection occt_draw_4_1_9 dtext
72b7576f 1055
e5bd0d98 1056Syntax:
1057~~~~~
1058dtext [x y [z]] string
1059~~~~~
72b7576f 1060
e5bd0d98 1061**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.
72b7576f 1062
1063The coordinates are real space coordinates.
1064
e5bd0d98 1065**Example:**
72b7576f 1066~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1067# mark the origins
1068dtext 0 0 bebop
1069dtext 0 0 0 bebop
1070~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1071
e5bd0d98 1072@subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd
72b7576f 1073
e5bd0d98 1074Syntax:
1075~~~~~
1076hardcopy [index]
72b7576f 1077hcolor index width gray
1078xwd [index] filename
e5bd0d98 1079~~~~~
72b7576f 1080
e5bd0d98 1081* **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.
1082* **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.
1083* **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**.
72b7576f 1084
e5bd0d98 1085**Example:**
72b7576f 1086~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1087# all blue lines (color 3)
1088# will be half-width and gray
1089hcolor 3 0.5
1090
1091# make a postscript file and print it
1092hardcopy
1093lpr a4.ps
1094
1095# make an xwd file and display it
1096xwd theview
1097xwud -in theview
1098~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 1099
1100**Note:** When more than one view is present, specify the index of the view.
1101
1102Only use a postscript printer to print postscript files.
72b7576f 1103
1104See also: **color**
1105
1106
e5bd0d98 1107@subsubsection occt_draw_4_1_11 wclick, pick
72b7576f 1108
e5bd0d98 1109Syntax:
1110~~~~~
1111wclick
72b7576f 1112pick index X Y Z b [nowait]
e5bd0d98 1113~~~~~
72b7576f 1114
e5bd0d98 1115**wclick** defers an event until the mouse button is clicked. The message <code>just click</code> is displayed.
72b7576f 1116
e5bd0d98 1117Use the **pick** command to get graphic input. The arguments must be names for variables where the results are stored.
72b7576f 1118 * index: index of the view where the input was made.
1119 * X,Y,Z: 3d coordinates in real world.
1120 * b: b is the mouse button 1,2 or 3.
1121
1122When 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.
1123
1124This option is useful for tracking the pointer.
1125
e5bd0d98 1126**Note** that the results are stored in Draw numeric variables.
1127
1128**Example:**
72b7576f 1129~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1130# make a circle at mouse location
1131pick index x y z b
1132circle c x y z 0 0 1 1 0 0 0 30
1133
1134# make a dynamic circle at mouse location
1135# stop when a button is clicked
1136# (see the repaint command)
1137
1138dset b 0
1139while {[dval b] == 0} {
1140pick index x y z b nowait
1141circle c x y z 0 0 1 1 0 0 0 30
1142repaint
1143}
1144~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1145See also: **repaint**
1146
1147
e5bd0d98 1148Draw provides commands to manage the display of objects.
1149* **display**, **donly** are used to display,
1150* **erase**, **clear**, **2dclear** to erase.
1151* **autodisplay** command is used to check whether variables are displayed when created.
72b7576f 1152
e5bd0d98 1153The 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.
72b7576f 1154 * 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.
1155 * 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.
e5bd0d98 1156 * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands.
72b7576f 1157
e5bd0d98 1158**Example:**
72b7576f 1159~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1160# OK use dot to dump an object on the screen
1161dump .
1162
1163point . x y z
1164
1165#Not OK. display points on a curve c
1166# with dot no variables are created
1167for {set i 0} {$i = 10} {incr i} {
1168cvalue c $i/10 x y z
1169point . x y z
1170}
1171
1172# point p x y z
1173# would have displayed only one point
1174# because the precedent variable content is erased
1175
1176# point p$i x y z
1177# is an other solution, creating variables
1178# p0, p1, p2, ....
1179
1180# give a name to a graphic object
1181rename . x
1182~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1183
72b7576f 1184
e5bd0d98 1185@subsubsection occt_draw_4_1_12 autodisplay
72b7576f 1186
e5bd0d98 1187Syntax:
1188
1189~~~~~
1190autodisplay [0/1]
1191~~~~~
1192
1193By 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.
1194
1195When **autodisplay** is off, using the dot return argument is ineffective.
1196
1197**Example:**
72b7576f 1198~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1199# c is displayed
1200circle c 0 0 1 0 5
1201
1202# toggle the mode
1203autodisplay
1204== 0
1205circle c 0 0 1 0 5
1206
1207# c is erased, but not displayed
1208display c
1209~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1210
e5bd0d98 1211@subsubsection occt_draw_4_1_13 display, donly
72b7576f 1212
e5bd0d98 1213Syntax:
1214~~~~~
1215display varname [varname ...]
72b7576f 1216donly varname [varname ...]
e5bd0d98 1217~~~~~
72b7576f 1218
e5bd0d98 1219* **display** makes objects visible.
1220* **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen.
72b7576f 1221
e5bd0d98 1222**Example:**
72b7576f 1223~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
e5bd0d98 1224\# to see all objects
72b7576f 1225foreach var [directory] {display $var}
1226
e5bd0d98 1227\# to select two objects and erase the other ones
72b7576f 1228donly . .
1229~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1230
1231
e5bd0d98 1232@subsubsection occt_draw_4_1_14 erase, clear, 2dclear
1233
1234Syntax:
72b7576f 1235
e5bd0d98 1236~~~~~
1237erase [varname varname ...]
72b7576f 1238clear
12392dclear
e5bd0d98 1240~~~~~
72b7576f 1241
e5bd0d98 1242**erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d.
72b7576f 1243
e5bd0d98 1244**clear** erases only 3d objects and **2dclear** only 2d objects. **erase** without arguments is similar to **clear; 2dclear**.
1245
1246
1247**Example:**
72b7576f 1248~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1249# erase eveerything with a name starting with c_
1250foreach var [directory c_*] {erase $var}
1251
1252# clear 2d views
ca0f3082 12532dclear
72b7576f 1254~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1255
e5bd0d98 1256@subsubsection occt_draw_4_1_15 repaint, dflush
72b7576f 1257
72b7576f 1258
e5bd0d98 1259Syntax:
1260
1261~~~~~
1262repaint
1263dflush
1264~~~~~
1265
1266* **repaint** forces repainting of views.
1267* **dflush** flushes the graphic buffers.
72b7576f 1268
1269These commands are useful within loops or in scripts.
1270
e5bd0d98 1271When 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.
1272
1273Graphic 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.
72b7576f 1274
bf62b306 1275See also: <a href="#occt_draw_4_1_11">pick</a> command.
72b7576f 1276
e5bd0d98 1277@subsection occt_draw_4_2 AIS viewer – view commands
72b7576f 1278
e5bd0d98 1279@subsubsection occt_draw_4_2_1 vinit
72b7576f 1280
e5bd0d98 1281Syntax:
1282~~~~~
1283vinit
1284~~~~~
72b7576f 1285Creates the 3D viewer window
1286
e5bd0d98 1287@subsubsection occt_draw_4_2_2 vhelp
72b7576f 1288
e5bd0d98 1289Syntax:
1290~~~~~
1291vhelp
1292~~~~~
72b7576f 1293Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities.
1294
e5bd0d98 1295@subsubsection occt_draw_4_2_3 vtop
72b7576f 1296
e5bd0d98 1297Syntax:
1298~~~~~
1299vtop
1300~~~~~
72b7576f 1301
1302Displays top view in the 3D viewer window.
e5bd0d98 1303
1304**Example:**
72b7576f 1305~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1306vinit
1307box b 10 10 10
1308vdisplay b
1309vfit
1310vtop
1311~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1312
e5bd0d98 1313@subsubsection occt_draw_4_2_4 vaxo
1314
1315Syntax:
1316~~~~~
1317vaxo
1318~~~~~
72b7576f 1319
1320Displays axonometric view in the 3D viewer window.
e5bd0d98 1321
1322**Example:**
72b7576f 1323~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1324vinit
1325box b 10 10 10
1326vdisplay b
1327vfit
1328vaxo
1329~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1330
e5bd0d98 1331@subsubsection occt_draw_4_2_5 vsetbg
72b7576f 1332
e5bd0d98 1333Syntax:
1334~~~~~
1335vsetbg imagefile [filltype]
1336~~~~~
72b7576f 1337
e5bd0d98 1338Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH.
1339
1340**Example:**
1341~~~~~
72b7576f 1342vinit
1343vsetbg myimage.brep CENTERED
e5bd0d98 1344~~~~~
72b7576f 1345
e5bd0d98 1346@subsubsection occt_draw_4_2_6 vclear
72b7576f 1347
e5bd0d98 1348Syntax:
1349~~~~~
1350vclear
1351~~~~~
72b7576f 1352Removes all objects from the viewer.
1353
e5bd0d98 1354@subsubsection occt_draw_4_2_7 vrepaint
72b7576f 1355
e5bd0d98 1356Syntax:
1357~~~~~
1358vrepaint
1359~~~~~
72b7576f 1360Forcedly redisplays the shape in the 3D viewer window.
1361
e5bd0d98 1362@subsubsection occt_draw_4_2_8 vfit
72b7576f 1363
e5bd0d98 1364Syntax:
1365~~~~~
1366vfit
1367~~~~~
72b7576f 1368Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface.
1369
e5bd0d98 1370@subsubsection occt_draw_4_2_9 vzfit
72b7576f 1371
e5bd0d98 1372Syntax:
1373~~~~~
1374vzfit
1375~~~~~
72b7576f 1376
1377Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space.
1378
e5bd0d98 1379@subsubsection occt_draw_4_2_10 vreadpixel
72b7576f 1380
e5bd0d98 1381Syntax:
1382~~~~~
1383vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]
1384~~~~~
1385Read pixel value for active view.
72b7576f 1386
72b7576f 1387
e5bd0d98 1388@subsubsection occt_draw_4_2_11 vselect
1389
1390Syntax:
1391~~~~~
1392vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [shift_selection = 0|1]
1393~~~~~
1394
1395Emulates different types of selection:
1396
1397 * single mouse click selection
bf62b306 1398 * selection with a rectangle having the upper left and bottom right corners in <i>(x1,y1)</i> and <i>(x2,y2)</i> respectively
1399 * selection with a polygon having the corners in pixel positions <i>(x1,y1), (x2,y2),…, (xn,yn)</i>
e5bd0d98 1400 * any of these selections if shift_selection is set to 1.
1401
1402@subsubsection occt_draw_4_2_12 vmoveto
1403
1404Syntax:
1405
1406~~~~~
1407vmoveto x y
1408~~~~~
1409Emulates cursor movement to pixel position (x,y).
1410
1411@subsubsection occt_draw_4_2_13 vviewparams
1412
1413Syntax:
1414~~~~~
1415vviewparams [scale center_X center_Y proj_X proj_Y proj_Z up_X up_Y up_Z at_X at_Y at_Z]
1416~~~~~
1417Gets or sets the current view characteristics.
1418
1419@subsubsection occt_draw_4_2_14 vchangeselected
1420
1421Syntax:
1422~~~~~
1423vchangeselected shape
1424~~~~~
1425Adds a shape to selection or removes one from it.
1426
1427@subsubsection occt_draw_4_2_15 vzclipping
1428
1429Syntax:
1430~~~~~
1431vzclipping [mode] [depth width]
1432~~~~~
1433Gets or sets ZClipping mode, width and depth, where
1434 - *mode = OFF|BACK|FRONT|SLICE*
1435 - *depth* is a real value from segment [0,1]
1436 - *width* is a real value from segment [0,1]
1437
1438@subsubsection occt_draw_4_2_16 vnbselected
1439
1440Syntax:
1441~~~~~
1442vnbselected
1443~~~~~
1444Returns the number of selected objects in the interactive context.
1445
1446@subsubsection occt_draw_4_2_17 vantialiasing
1447
1448Syntax:
1449~~~~~
8d44b0a0 1450vantialiasing 1|0
e5bd0d98 1451~~~~~
1452Sets antialiasing if the command is called with 1 or unsets otherwise.
1453
1454@subsubsection occt_draw_4_2_18 vpurgedisplay
1455
1456Syntax:
1457~~~~~
1458vpurgedisplay [CollectorToo = 0|1]
1459~~~~~
1460Removes structures which do not belong to objects displayed in neutral point.
1461
1462@subsubsection occt_draw_4_2_19 vhlr
1463
1464Syntax:
1465~~~~~
1466vhlr is_enabled={on|off}
1467~~~~~
1468Switches hidden line removal (computed) mode on/off.
1469
1470@subsubsection occt_draw_4_2_20 vhlrtype
1471
1472Syntax:
1473~~~~~
1474vhlrtype algo_type={algo|polyalgo} [shape_1 ... shape_n]
1475~~~~~
1476
1477Changes the type of HLR algorithm used for shapes.
1478If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes.
1479
bf62b306 1480If 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.
e5bd0d98 1481
1482**Note** that this command works with instances of *AIS_Shape* or derived classes only, other interactive object types are ignored.
1483
18006a0f 1484@subsubsection occt_draw_4_2_21 vcamera
1485
1486Syntax:
1487~~~~~
1488vcamera
1489~~~~~
1490
1491Manages camera parameters.
1492
1493**Example:**
1494~~~~~
1495vinit
1496box b 10 10 10
1497vdisplay b
1498vfit
1499vcamera -persp
1500~~~~~
1501
1502@subsubsection occt_draw_4_2_22 vstereo
1503
1504Syntax:
1505~~~~~
1506vstereo [0:1]
1507~~~~~
1508
1509Turns stereo usage On/Off.
1510
1511**Example:**
1512~~~~~
1513vinit
1514box b 10 10 10
1515vdisplay b
1516vstereo 1
1517vfit
1518vcamera -stereo -iod 1
1519vcamera -lefteye
1520vcamera -righteye
1521~~~~~
1522
1523@subsubsection occt_draw_4_2_23 vfrustumculling
1524
1525Syntax:
1526~~~~~
1527vfrustumculling [toEnable]
1528~~~~~
1529
1530Enables/disables objects clipping.
1531
e5bd0d98 1532
1533@subsection occt_draw_4_3 AIS viewer – display commands
1534
1535@subsubsection occt_draw_4_3_1 vdisplay
1536
bf62b306 1537Syntax:
1538~~~~~
18006a0f 1539vdisplay [-noupdate|-update] [-local] [-mutable] name1 [name2] … [name n]
668c2575 1540~~~~~
bf62b306 1541
18006a0f 1542Displays named objects. Automatically redraws view by default.
1543Redraw can be suppressed by -noupdate option.
72b7576f 1544
668c2575 1545**Example:**
bf62b306 1546~~~~~
72b7576f 1547vinit
1548box b 40 40 40 10 10 10
1549psphere s 20
1550vdisplay s b
1551vfit
bf62b306 1552~~~~~
72b7576f 1553
668c2575 1554@subsubsection occt_draw_4_3_2 vdonly
72b7576f 1555
668c2575 1556Syntax:
1557~~~~~
bf62b306 1558vdonly [name1] … [name n]
1559~~~~~
1560
72b7576f 1561Displays only selected or named objects. If there are no selected or named objects, nothing is done.
72b7576f 1562
668c2575 1563**Example:**
bf62b306 1564~~~~~
72b7576f 1565vinit
1566box b 40 40 40 10 10 10
1567psphere s 20
1568vdonly b
bf62b306 1569vfit
1570~~~~~
1571
668c2575 1572@subsubsection occt_draw_4_3_3 vdisplayall
72b7576f 1573
668c2575 1574Syntax:
bf62b306 1575~~~~~
668c2575 1576vdisplayall
bf62b306 1577~~~~~
72b7576f 1578
bf62b306 1579Displays all created objects.
668c2575 1580
1581**Example:**
bf62b306 1582~~~~~
72b7576f 1583vinit
1584box b 40 40 40 10 10 10
1585psphere s 20
1586vdisplayall
1587vfit
bf62b306 1588~~~~~
72b7576f 1589
668c2575 1590@subsubsection occt_draw_4_3_4 verase
1591
bf62b306 1592Syntax:
668c2575 1593~~~~~
bf62b306 1594verase [name1] [name2] … [name n]
1595~~~~~
72b7576f 1596
1597Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
72b7576f 1598
668c2575 1599**Example:**
1600~~~~~
72b7576f 1601vinit
1602box b1 40 40 40 10 10 10
1603box b2 -40 -40 -40 10 10 10
1604psphere s 20
1605vdisplayall
1606vfit
bf62b306 1607# erase only first box
72b7576f 1608verase b1
bf62b306 1609# erase second box and sphere
1610verase
1611~~~~~
72b7576f 1612
668c2575 1613@subsubsection occt_draw_4_3_5 veraseall
72b7576f 1614
668c2575 1615Syntax:
1616~~~~~
bf62b306 1617veraseall
1618~~~~~
668c2575 1619
bf62b306 1620Erases all objects displayed in the viewer.
668c2575 1621
bf62b306 1622**Example:**
1623~~~~~
72b7576f 1624vinit
1625box b1 40 40 40 10 10 10
1626box b2 -40 -40 -40 10 10 10
1627psphere s 20
1628vdisplayall
1629vfit
bf62b306 1630# erase only first box
72b7576f 1631verase b1
bf62b306 1632# erase second box and sphere
1633verseall
1634~~~~~
72b7576f 1635
668c2575 1636@subsubsection occt_draw_4_3_6 vsetdispmode
1637
1638Syntax:
668c2575 1639~~~~~
bf62b306 1640vsetdispmode [name] mode(0,1,2,3)
1641~~~~~
72b7576f 1642
bf62b306 1643Sets display mode for all, selected or named objects.
1644* *0* (*WireFrame*),
1645* *1* (*Shading*),
1646* *2* (*Quick HideLineremoval*),
1647* *3* (*Exact HideLineremoval*).
72b7576f 1648
e5bd0d98 1649**Example:**
668c2575 1650~~~~~
72b7576f 1651vinit
1652box b 10 10 10
1653vdisplay b
1654vsetdispmode 1
bf62b306 1655vfit
668c2575 1656~~~~~
bf62b306 1657
668c2575 1658@subsubsection occt_draw_4_3_7 vdisplaytype
1659
1660Syntax:
1661~~~~~
bf62b306 1662vdisplaytype type
1663~~~~~
668c2575 1664
bf62b306 1665Displays all objects of a given type.
1666The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
668c2575 1667
1668@subsubsection occt_draw_4_3_8 verasetype
72b7576f 1669
bf62b306 1670Syntax:
1671~~~~~
1672verasetype type
1673~~~~~
72b7576f 1674
1675Erases all objects of a given type.
bf62b306 1676Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
72b7576f 1677
bf62b306 1678@subsubsection occt_draw_4_3_9 vtypes
72b7576f 1679
bf62b306 1680Syntax:
1681~~~~~
1682vtypes
1683~~~~~
72b7576f 1684
bf62b306 1685Makes a list of known types and signatures in AIS.
72b7576f 1686
18006a0f 1687@subsubsection occt_draw_4_3_10 vaspects
72b7576f 1688
18006a0f 1689Syntax:
bf62b306 1690~~~~~
18006a0f 1691vaspects [-noupdate|-update] [name1 [name2 [...]]]
1692 [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]
1693 [-setmaterial MatName] [-unsetmaterial]
1694 [-settransparency Transp] [-unsettransparency]
1695 [-setwidth LineWidth] [-unsetwidth]
1696 [-subshapes subname1 [subname2 [...]]]
72b7576f 1697
18006a0f 1698~~~~~
72b7576f 1699
18006a0f 1700Aliases:
1701~~~~~
1702vsetcolor [shapename] colorname
72b7576f 1703
bf62b306 1704~~~~~
72b7576f 1705
72b7576f 1706
18006a0f 1707Manages presentation properties (color, material, transparency) of all objects, selected or named.
bf62b306 1708
18006a0f 1709**Color**. The *ColorName* can be: *BLACK*, *MATRAGRAY*, *MATRABLUE*, *ALICEBLUE*, *ANTIQUEWHITE*, *ANTIQUEWHITE1*, *ANTIQUEWHITE2*, *ANTIQUEWHITE3*, *ANTIQUEWHITE4*, *AQUAMARINE1*, *AQUAMARINE2*, *AQUAMARINE4*, *AZURE*, *AZURE2*, *AZURE3*, *AZURE4*, *BEIGE*, *BISQUE*, *BISQUE2*, *BISQUE3*, *BISQUE4*, *BLANCHEDALMOND*, *BLUE1*, *BLUE2*, *BLUE3*, *BLUE4*, *BLUEVIOLET*, *BROWN*, *BROWN1*, *BROWN2*, *BROWN3*, *BROWN4*, *BURLYWOOD*, *BURLYWOOD1*, *BURLYWOOD2*, *BURLYWOOD3*, *BURLYWOOD4*, *CADETBLUE*, *CADETBLUE1*, *CADETBLUE2*, *CADETBLUE3*, *CADETBLUE4*, *CHARTREUSE*, *CHARTREUSE1*, *CHARTREUSE2*, *CHARTREUSE3*, *CHARTREUSE4*, *CHOCOLATE*, *CHOCOLATE1*, *CHOCOLATE2*, *CHOCOLATE3*, *CHOCOLATE4*, *CORAL*, *CORAL1*, *CORAL2*, *CORAL3*, *CORAL4*, *CORNFLOWERBLUE*, *CORNSILK1*, *CORNSILK2*, *CORNSILK3*, *CORNSILK4*, *CYAN1*, *CYAN2*, *CYAN3*, *CYAN4*, *DARKGOLDENROD*, *DARKGOLDENROD1*, *DARKGOLDENROD2*, *DARKGOLDENROD3*, *DARKGOLDENROD4*, *DARKGREEN*, *DARKKHAKI*, *DARKOLIVEGREEN*, *DARKOLIVEGREEN1*, *DARKOLIVEGREEN2*, *DARKOLIVEGREEN3*, *DARKOLIVEGREEN4*, *DARKORANGE*, *DARKORANGE1*, *DARKORANGE2*, *DARKORANGE3*, *DARKORANGE4*, *DARKORCHID*, *DARKORCHID1*, *DARKORCHID2*, *DARKORCHID3*, *DARKORCHID4*, *DARKSALMON*, *DARKSEAGREEN*, *DARKSEAGREEN1*, *DARKSEAGREEN2*, *DARKSEAGREEN3*, *DARKSEAGREEN4*, *DARKSLATEBLUE*, *DARKSLATEGRAY1*, *DARKSLATEGRAY2*, *DARKSLATEGRAY3*, *DARKSLATEGRAY4*, *DARKSLATEGRAY*, *DARKTURQUOISE*, *DARKVIOLET*, *DEEPPINK*, *DEEPPINK2*, *DEEPPINK3*, *DEEPPINK4*, *DEEPSKYBLUE1*, *DEEPSKYBLUE2*, *DEEPSKYBLUE3*, *DEEPSKYBLUE4*, *DODGERBLUE1*, *DODGERBLUE2*, *DODGERBLUE3*, *DODGERBLUE4*, *FIREBRICK*, *FIREBRICK1*, *FIREBRICK2*, *FIREBRICK3*, *FIREBRICK4*, *FLORALWHITE*, *FORESTGREEN*, *GAINSBORO*, *GHOSTWHITE*, *GOLD*, *GOLD1*, *GOLD2*, *GOLD3*, *GOLD4*, *GOLDENROD*, *GOLDENROD1*, *GOLDENROD2*, *GOLDENROD3*, *GOLDENROD4*, *GRAY*, *GRAY0*, *GRAY1*, *GRAY10*, *GRAY11*, *GRAY12*, *GRAY13*, *GRAY14*, *GRAY15*, *GRAY16*, *GRAY17*, *GRAY18*, *GRAY19*, *GRAY2*, *GRAY20*, *GRAY21*, *GRAY22*, *GRAY23*, *GRAY24*, *GRAY25*, *GRAY26*, *GRAY27*, *GRAY28*, *GRAY29*, *GRAY3*, *GRAY30*, *GRAY31*, *GRAY32*, *GRAY33*, *GRAY34*, *GRAY35*, *GRAY36*, *GRAY37*, *GRAY38*, *GRAY39*, *GRAY4*, *GRAY40*, *GRAY41*, *GRAY42*, *GRAY43*, *GRAY44*, *GRAY45*, *GRAY46*, *GRAY47*, *GRAY48*, *GRAY49*, *GRAY5*, *GRAY50*, *GRAY51*, *GRAY52*, *GRAY53*, *GRAY54*, *GRAY55*, *GRAY56*, *GRAY57*, *GRAY58*, *GRAY59*, *GRAY6*, *GRAY60*, *GRAY61*, *GRAY62*, *GRAY63*, *GRAY64*, *GRAY65*, *GRAY66*, *GRAY67*, *GRAY68*, *GRAY69*, *GRAY7*, *GRAY70*, *GRAY71*, *GRAY72*, *GRAY73*, *GRAY74*, *GRAY75*, *GRAY76*, *GRAY77*, *GRAY78*, *GRAY79*, *GRAY8*, *GRAY80*, *GRAY81*, *GRAY82*, *GRAY83*, *GRAY85*, *GRAY86*, *GRAY87*, *GRAY88*, *GRAY89*, *GRAY9*, *GRAY90*, *GRAY91*, *GRAY92*, *GRAY93*, *GRAY94*, *GRAY95*, *GREEN*, *GREEN1*, *GREEN2*, *GREEN3*, *GREEN4*, *GREENYELLOW*, *GRAY97*, *GRAY98*, *GRAY99*, *HONEYDEW*, *HONEYDEW2*, *HONEYDEW3*, *HONEYDEW4*, *HOTPINK*, *HOTPINK1*, *HOTPINK2*, *HOTPINK3*, *HOTPINK4*, *INDIANRED*, *INDIANRED1*, *INDIANRED2*, *INDIANRED3*, *INDIANRED4*, *IVORY*, *IVORY2*, *IVORY3*, *IVORY4*, *KHAKI*, *KHAKI1*, *KHAKI2*, *KHAKI3*, *KHAKI4*, *LAVENDER*, *LAVENDERBLUSH1*, *LAVENDERBLUSH2*, *LAVENDERBLUSH3*, *LAVENDERBLUSH4*, *LAWNGREEN*, *LEMONCHIFFON1*, *LEMONCHIFFON2*, *LEMONCHIFFON3*, *LEMONCHIFFON4*, *LIGHTBLUE*, *LIGHTBLUE1*, *LIGHTBLUE2*, *LIGHTBLUE3*, *LIGHTBLUE4*, *LIGHTCORAL*, *LIGHTCYAN1*, *LIGHTCYAN2*, *LIGHTCYAN3*, *LIGHTCYAN4*, *LIGHTGOLDENROD*, *LIGHTGOLDENROD1*, *LIGHTGOLDENROD2*, *LIGHTGOLDENROD3*, *LIGHTGOLDENROD4*, *LIGHTGOLDENRODYELLOW*, *LIGHTGRAY*, *LIGHTPINK*, *LIGHTPINK1*, *LIGHTPINK2*, *LIGHTPINK3*, *LIGHTPINK4*, *LIGHTSALMON1*, *LIGHTSALMON2*, *LIGHTSALMON3*, *LIGHTSALMON4*, *LIGHTSEAGREEN*, *LIGHTSKYBLUE*, *LIGHTSKYBLUE1*, *LIGHTSKYBLUE2*, *LIGHTSKYBLUE3*, *LIGHTSKYBLUE4*, *LIGHTSLATEBLUE*, *LIGHTSLATEGRAY*, *LIGHTSTEELBLUE*, *LIGHTSTEELBLUE1*, *LIGHTSTEELBLUE2*, *LIGHTSTEELBLUE3*, *LIGHTSTEELBLUE4*, *LIGHTYELLOW*, *LIGHTYELLOW2*, *LIGHTYELLOW3*, *LIGHTYELLOW4*, *LIMEGREEN*, *LINEN*, *MAGENTA1*, *MAGENTA2*, *MAGENTA3*, *MAGENTA4*, *MAROON*, *MAROON1*, *MAROON2*, *MAROON3*, *MAROON4*, *MEDIUMAQUAMARINE*, *MEDIUMORCHID*, *MEDIUMORCHID1*, *MEDIUMORCHID2*, *MEDIUMORCHID3*, *MEDIUMORCHID4*, *MEDIUMPURPLE*, *MEDIUMPURPLE1*, *MEDIUMPURPLE2*, *MEDIUMPURPLE3*, *MEDIUMPURPLE4*, *MEDIUMSEAGREEN*, *MEDIUMSLATEBLUE*, *MEDIUMSPRINGGREEN*, *MEDIUMTURQUOISE*, *MEDIUMVIOLETRED*, *MIDNIGHTBLUE*, *MINTCREAM*, *MISTYROSE*, *MISTYROSE2*, *MISTYROSE3*, *MISTYROSE4*, *MOCCASIN*, *NAVAJOWHITE1*, *NAVAJOWHITE2*, *NAVAJOWHITE3*, *NAVAJOWHITE4*, *NAVYBLUE*, *OLDLACE*, *OLIVEDRAB*, *OLIVEDRAB1*, *OLIVEDRAB2*, *OLIVEDRAB3*, *OLIVEDRAB4*, *ORANGE*, *ORANGE1*, *ORANGE2*, *ORANGE3*, *ORANGE4*, *ORANGERED*, *ORANGERED1*, *ORANGERED2*, *ORANGERED3*, *ORANGERED4*, *ORCHID*, *ORCHID1*, *ORCHID2*, *ORCHID3*, *ORCHID4*, *PALEGOLDENROD*, *PALEGREEN*, *PALEGREEN1*, *PALEGREEN2*, *PALEGREEN3*, *PALEGREEN4*, *PALETURQUOISE*, *PALETURQUOISE1*, *PALETURQUOISE2*, *PALETURQUOISE3*, *PALETURQUOISE4*, *PALEVIOLETRED*, *PALEVIOLETRED1*, *PALEVIOLETRED2*, *PALEVIOLETRED3*, *PALEVIOLETRED4*, *PAPAYAWHIP*, *PEACHPUFF*, *PEACHPUFF2*, *PEACHPUFF3*, *PEACHPUFF4*, *PERU*, *PINK*, *PINK1*, *PINK2*, *PINK3*, *PINK4*, *PLUM*, *PLUM1*, *PLUM2*, *PLUM3*, *PLUM4*, *POWDERBLUE*, *PURPLE*, *PURPLE1*, *PURPLE2*, *PURPLE3*, *PURPLE4*, *RED*, *RED1*, *RED2*, *RED3*, *RED4*, *ROSYBROWN*, *ROSYBROWN1*, *ROSYBROWN2*, *ROSYBROWN3*, *ROSYBROWN4*, *ROYALBLUE*, *ROYALBLUE1*, *ROYALBLUE2*, *ROYALBLUE3*, *ROYALBLUE4*, *SADDLEBROWN*, *SALMON*, *SALMON1*, *SALMON2*, *SALMON3*, *SALMON4*, *SANDYBROWN*, *SEAGREEN*, *SEAGREEN1*, *SEAGREEN2*, *SEAGREEN3*, *SEAGREEN4*, *SEASHELL*, *SEASHELL2*, *SEASHELL3*, *SEASHELL4*, *BEET*, *TEAL*, *SIENNA*, *SIENNA1*, *SIENNA2*, *SIENNA3*, *SIENNA4*, *SKYBLUE*, *SKYBLUE1*, *SKYBLUE2*, *SKYBLUE3*, *SKYBLUE4*, *SLATEBLUE*, *SLATEBLUE1*, *SLATEBLUE2*, *SLATEBLUE3*, *SLATEBLUE4*, *SLATEGRAY1*, *SLATEGRAY2*, *SLATEGRAY3*, *SLATEGRAY4*, *SLATEGRAY*, *SNOW*, *SNOW2*, *SNOW3*, *SNOW4*, *SPRINGGREEN*, *SPRINGGREEN2*, *SPRINGGREEN3*, *SPRINGGREEN4*, *STEELBLUE*, *STEELBLUE1*, *STEELBLUE2*, *STEELBLUE3*, *STEELBLUE4*, *TAN*, *TAN1*, *TAN2*, *TAN3*, *TAN4*, *THISTLE*, *THISTLE1*, *THISTLE2*, *THISTLE3*, *THISTLE4*, *TOMATO*, *TOMATO1*, *TOMATO2*, *TOMATO3*, *TOMATO4*, *TURQUOISE*, *TURQUOISE1*, *TURQUOISE2*, *TURQUOISE3*, *TURQUOISE4*, *VIOLET*, *VIOLETRED*, *VIOLETRED1*, *VIOLETRED2*, *VIOLETRED3*, *VIOLETRED4*, *WHEAT*, *WHEAT1*, *WHEAT2*, *WHEAT3*, *WHEAT4*, *WHITE*, *WHITESMOKE*, *YELLOW*, *YELLOW1*, *YELLOW2*, *YELLOW3*, *YELLOW4* and *YELLOWGREEN*.
1710~~~~~
1711vaspects [name] [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]
1712vsetcolor [name] ColorName
1713vunsetcolor [name]
bf62b306 1714~~~~~
72b7576f 1715
18006a0f 1716**Transparency. The *Transp* may be between 0.0 (opaque) and 1.0 (fully transparent).
bf62b306 1717**Warning**: at 1.0 the shape becomes invisible.
bf62b306 1718~~~~~
18006a0f 1719vaspects [name] [-settransparency Transp] [-unsettransparency]
1720vsettransparency [name] Transp
1721vunsettransparency [name]
bf62b306 1722~~~~~
72b7576f 1723
18006a0f 1724**Material**. The *MatName* can be *BRASS*, *BRONZE*, *COPPER*, *GOLD*, *PEWTER*, *PLASTER*, *PLASTIC*, *SILVER*, *STEEL*, *STONE*, *SHINY_PLASTIC*, *SATIN*, *METALIZED*, *NEON_GNC*, *CHROME*, *ALUMINIUM*, *OBSIDIAN*, *NEON_PHC*, *JADE*, *WATER*, *GLASS*, *DIAMOND* or *CHARCOAL*.
1725~~~~~
1726vaspects [name] [-setmaterial MatName] [-unsetmaterial]
1727vsetmaterial [name] MatName
1728vunsetmaterial [name]
bf62b306 1729~~~~~
72b7576f 1730
18006a0f 1731**Line width**. Specifies width of the edges. The *LineWidth* may be between 0.0 and 10.0.
bf62b306 1732~~~~~
18006a0f 1733vaspects [name] [-setwidth LineWidth] [-unsetwidth]
1734vsetwidth [name] LineWidth
1735vunsetwidth [name]
bf62b306 1736~~~~~
72b7576f 1737
18006a0f 1738**Example:**
bf62b306 1739~~~~~
18006a0f 1740vinit
1741box b 10 10 10
1742vdisplay b
1743vfit
72b7576f 1744
18006a0f 1745vsetdispmode b 1
1746vaspects -setcolor red -settransparency 0.2
1747vrotate 10 10 10
bf62b306 1748~~~~~
72b7576f 1749
72b7576f 1750
72b7576f 1751
72b7576f 1752
72b7576f 1753
18006a0f 1754
1755@subsubsection occt_draw_4_3_11 vsetshading
72b7576f 1756
bf62b306 1757Syntax:
1758~~~~~
1759vsetshading shapename [coefficient]
1760~~~~~
72b7576f 1761
1762Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
72b7576f 1763
bf62b306 1764**Example:**
1765~~~~~
72b7576f 1766vinit
1767psphere s 20
1768vdisplay s
1769vfit
1770vsetdispmode 1
bf62b306 1771vsetshading s 0.005
1772~~~~~
1773
18006a0f 1774@subsubsection occt_draw_4_3_12 vunsetshading
72b7576f 1775
bf62b306 1776Syntax:
1777~~~~~
1778vunsetshading [shapename]
1779~~~~~
72b7576f 1780
1781Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
1782
18006a0f 1783@subsubsection occt_draw_4_3_13 vsetam
72b7576f 1784
bf62b306 1785Syntax:
1786~~~~~
1787vsetam [shapename] mode
1788~~~~~
1789
1790Activates selection mode for all selected or named shapes:
1791* *0* for *shape* itself,
1792* *1* (*vertices*),
1793* *2* (*edges*),
1794* *3* (*wires*),
1795* *4* (*faces*),
1796* *5* (*shells*),
1797* *6* (*solids*),
1798* *7* (*compounds*).
1799
e5bd0d98 1800**Example:**
bf62b306 1801~~~~~
72b7576f 1802vinit
1803box b 10 10 10
1804vdisplay b
1805vfit
bf62b306 1806vsetam b 2
1807~~~~~
1808
18006a0f 1809@subsubsection occt_draw_4_3_14 vunsetam
72b7576f 1810
bf62b306 1811Syntax:
1812~~~~~
1813vunsetam
1814~~~~~
72b7576f 1815
1816Deactivates all selection modes for all shapes.
1817
18006a0f 1818@subsubsection occt_draw_4_3_15 vdump
72b7576f 1819
bf62b306 1820Syntax:
1821~~~~~
18006a0f 1822vdump <filename>.{png|bmp|jpg|gif}
bf62b306 1823~~~~~
72b7576f 1824
18006a0f 1825Extracts the contents of the viewer window to a image file.
72b7576f 1826
18006a0f 1827@subsubsection occt_draw_4_3_16 vdir
72b7576f 1828
bf62b306 1829Syntax:
1830~~~~~
1831vdir
1832~~~~~
72b7576f 1833
1834Displays the list of displayed objects.
1835
18006a0f 1836@subsubsection occt_draw_4_3_17 vsub
72b7576f 1837
bf62b306 1838Syntax:
1839~~~~~
1840vsub 0/1(on/off)[shapename]
1841~~~~~
72b7576f 1842
bf62b306 1843Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
1844
e5bd0d98 1845**Example:**
bf62b306 1846~~~~~
72b7576f 1847vinit
1848box b 10 10 10
1849psphere s 20
1850vdisplay b s
1851vfit
1852vsetdispmode 1
bf62b306 1853vsub b 1
1854~~~~~
72b7576f 1855
18006a0f 1856@subsubsection occt_draw_4_3_18 vardis
72b7576f 1857
bf62b306 1858Syntax:
1859~~~~~
1860vardis
1861~~~~~
72b7576f 1862
1863Displays active areas (for each activated sensitive entity, one or several 2D bounding boxes are displayed, depending on the implementation of a particular entity).
1864
18006a0f 1865@subsubsection occt_draw_4_3_19 varera
72b7576f 1866
bf62b306 1867Syntax:
1868~~~~~
1869varera
1870~~~~~
72b7576f 1871
1872Erases active areas.
1873
18006a0f 1874@subsubsection occt_draw_4_3_20 vsensdis
72b7576f 1875
bf62b306 1876Syntax:
1877~~~~~
1878vsensdis
1879~~~~~
72b7576f 1880
1881Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes).
1882
1883Standard entity types are those defined in Select3D package:
1884 * sensitive box
1885 * sensitive face
1886 * sensitive curve
1887 * sensitive segment
1888 * sensitive circle
1889 * sensitive point
1890 * sensitive triangulation
1891 * sensitive triangle
1892Custom (application-defined) sensitive entity types are not processed by this command.
1893
18006a0f 1894@subsubsection occt_draw_4_3_21 vsensera
72b7576f 1895
bf62b306 1896Syntax:
1897~~~~~
1898vsensera
1899~~~~~
72b7576f 1900
1901Erases active entities.
1902
18006a0f 1903@subsubsection occt_draw_4_3_22 vperf
72b7576f 1904
bf62b306 1905Syntax:
1906~~~~~
1907vperf shapename 1/0 (Transformation/Loacation) 1/0 (Primitives sensibles ON/OFF)
1908~~~~~
72b7576f 1909
1910Tests the animation of an object along a predefined trajectory.
72b7576f 1911
bf62b306 1912**Example:**
1913~~~~~
72b7576f 1914vinit
1915box b 10 10 10
1916psphere s 20
1917vdisplay b s
1918vfit
1919vsetdispmode 0
bf62b306 1920vperf b 1 1
1921~~~~~
1922
18006a0f 1923@subsubsection occt_draw_4_3_23 vr
72b7576f 1924
bf62b306 1925Syntax:
1926~~~~~
1927vr filename
1928~~~~~
72b7576f 1929
1930Reads shape from BREP-format file and displays it in the viewer.
72b7576f 1931
bf62b306 1932**Example:**
1933~~~~~
72b7576f 1934vinit
bf62b306 1935vr myshape.brep
1936~~~~~
1937
18006a0f 1938@subsubsection occt_draw_4_3_24 vstate
72b7576f 1939
bf62b306 1940Syntax:
1941~~~~~
1942vstate [name1] … [name n]
1943~~~~~
72b7576f 1944
1945Makes a list of the status (**Displayed** or **Not Displayed**) of some selected or named objects.
1946
18006a0f 1947@subsubsection occt_draw_4_3_25 vraytrace
1948
1949Syntax:
1950~~~~~
1951vraytrace [0/1]
1952~~~~~
1953
1954Turns on/off ray tracing renderer.
1955
1956@subsubsection occt_draw_4_3_26 vrenderparams
1957
1958Syntax:
1959~~~~~
1960vrenderparams
1961~~~~~
1962
1963Manages rendering parameters:
1964* rayTrace
1965* raster
1966* rayDepth
1967* shadows
1968* reflections
1969* fsaa
1970* gleam
1971* shadingModel
1972
1973**Example:**
1974~~~~~
1975vinit
1976box b 10 10 10
1977vdisplay b
1978vfit
1979vraytrace 1
1980vrenderparams -shadows 1 -reflections 1 -fsaa 1
1981~~~~~
1982@subsubsection occt_draw_4_3_27 vshaderprog
1983
1984Syntax:
1985~~~~~
1986vshaderprog [name] pathToVertexShader pathToFragmentShader
1987~~~~~
1988
1989Enables rendering using a shader program.
1990
1991@subsubsection occt_draw_4_3_28 vsetcolorbg
1992
1993Syntax:
1994~~~~~
1995vsetcolorbg r g b
1996~~~~~
1997
1998Sets background color.
1999
2000**Example:**
2001~~~~~
2002vinit
2003vsetcolorbg 200 0 200
2004~~~~~
72b7576f 2005
bf62b306 2006@subsection occt_draw_4_4 AIS viewer – object commands
72b7576f 2007
bf62b306 2008@subsubsection occt_draw_4_4_1 vtrihedron
72b7576f 2009
bf62b306 2010Syntax:
2011~~~~~
2012vtrihedron name [X0] [Y0] [Z0] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
2013~~~~~
72b7576f 2014
bf62b306 2015Creates a new *AIS_Trihedron* object. If no argument is set, the default trihedron (0XYZ) is created.
2016
e5bd0d98 2017**Example:**
bf62b306 2018~~~~~
72b7576f 2019vinit
bf62b306 2020vtrihedron tr
2021~~~~~
72b7576f 2022
bf62b306 2023@subsubsection occt_draw_4_4_2 vplanetri
72b7576f 2024
bf62b306 2025Syntax:
2026~~~~~
2027vplanetri name
2028~~~~~
72b7576f 2029
2030Creates a plane from a trihedron selection.
2031
2032
bf62b306 2033@subsubsection occt_draw_4_4_3 vsize
72b7576f 2034
bf62b306 2035Syntax:
2036~~~~~
2037vsize [name] [size]
2038~~~~~
72b7576f 2039
bf62b306 2040Changes 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.
2041
e5bd0d98 2042**Example:**
bf62b306 2043~~~~~
72b7576f 2044vinit
2045vtrihedron tr1
2046vtrihedron tr2 0 0 0 1 0 0 1 0 0
bf62b306 2047vsize tr2 400
2048~~~~~
72b7576f 2049
bf62b306 2050@subsubsection occt_draw_4_4_4 vaxis
72b7576f 2051
bf62b306 2052Syntax:
2053~~~~~
2054vaxis name [Xa Ya Za Xb Yb Zb]
2055~~~~~
72b7576f 2056
bf62b306 2057Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
2058
e5bd0d98 2059**Example:**
bf62b306 2060~~~~~
72b7576f 2061vinit
2062vtrihedron tr
2063vaxis axe1 0 0 0 1 0 0
bf62b306 2064~~~~~
72b7576f 2065
bf62b306 2066@subsubsection occt_draw_4_4_5 vaxispara
72b7576f 2067
bf62b306 2068Syntax:
2069~~~~~
2070vaxispara nom
2071~~~~~
72b7576f 2072
2073Creates an axis by interactive selection of an edge and a vertex.
2074
bf62b306 2075@subsubsection occt_draw_4_4_6 vaxisortho
72b7576f 2076
bf62b306 2077Syntax:
2078~~~~~
2079vaxisotrho name
2080~~~~~
72b7576f 2081
2082Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
2083
bf62b306 2084@subsubsection occt_draw_4_4_7 vpoint
72b7576f 2085
bf62b306 2086Syntax:
2087~~~~~
2088vpoint name [Xa Ya Za]
2089~~~~~
72b7576f 2090
2091Creates 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).
72b7576f 2092
bf62b306 2093**Example:**
2094~~~~~
72b7576f 2095vinit
2096vpoint p 0 0 0
bf62b306 2097~~~~~
72b7576f 2098
bf62b306 2099@subsubsection occt_draw_4_4_8 vplane
72b7576f 2100
bf62b306 2101Syntax:
2102~~~~~
2103vplane name [AxisName] [PointName]
2104vplane name [PointName] [PointName] [PointName]
2105vplane name [PlaneName] [PointName]
2106~~~~~
72b7576f 2107
bf62b306 2108Creates a plane from named or interactively selected entities.
2109
e5bd0d98 2110**Example:**
bf62b306 2111~~~~~
72b7576f 2112vinit
2113vpoint p1 0 50 0
2114vaxis axe1 0 0 0 0 0 1
2115vtrihedron tr
2116vplane plane1 axe1 p1
bf62b306 2117~~~~~
72b7576f 2118
bf62b306 2119@subsubsection occt_draw_4_4_9 vplanepara
72b7576f 2120
bf62b306 2121Syntax:
2122~~~~~
2123vplanepara name
2124~~~~~
72b7576f 2125
2126Creates a plane from interactively selected vertex and face.
2127
bf62b306 2128@subsubsection occt_draw_4_4_10 vplaneortho
72b7576f 2129
bf62b306 2130Syntax:
2131~~~~~
2132vplaneortho name
2133~~~~~
72b7576f 2134
2135Creates a plane from interactive selected face and coplanar edge.
2136
bf62b306 2137@subsubsection occt_draw_4_4_11 vline
72b7576f 2138
bf62b306 2139Syntax:
2140~~~~~
2141vline name [PointName] [PointName]
2142vline name [Xa Ya Za Xb Yb Zb]
2143~~~~~
72b7576f 2144
2145Creates a line from coordinates, named or interactively selected vertices.
72b7576f 2146
bf62b306 2147**Example:**
2148~~~~~
72b7576f 2149vinit
2150vtrihedron tr
2151vpoint p1 0 50 0
2152vpoint p2 50 0 0
2153vline line1 p1 p2
2154vline line2 0 0 0 50 0 1
bf62b306 2155~~~~~
72b7576f 2156
bf62b306 2157@subsubsection occt_draw_4_4_12 vcircle
72b7576f 2158
bf62b306 2159Syntax:
2160~~~~~
2161vcircle name [PointName PointName PointName IsFilled]
72b7576f 2162vcircle name [PlaneName PointName Radius IsFilled]
bf62b306 2163~~~~~
72b7576f 2164
bf62b306 2165Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
2166
e5bd0d98 2167**Example:**
bf62b306 2168~~~~~
72b7576f 2169vinit
2170vtrihedron tr
2171vpoint p1 0 50 0
2172vpoint p2 50 0 0
2173vpoint p3 0 0 0
bf62b306 2174vcircle circle1 p1 p2 p3 1
2175~~~~~
72b7576f 2176
bf62b306 2177@subsubsection occt_draw_4_4_13 vtri2d
72b7576f 2178
bf62b306 2179Syntax:
2180~~~~~
2181vtri2d name
2182~~~~~
72b7576f 2183
2184Creates a plane with a 2D trihedron from an interactively selected face.
2185
bf62b306 2186@subsubsection occt_draw_4_4_14 vselmode
72b7576f 2187
bf62b306 2188Syntax:
2189~~~~~
2190vselmode [object] mode On/Off
2191~~~~~
72b7576f 2192
2193Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
bf62b306 2194Value *On* is defined as 1 and *Off* – as 0.
72b7576f 2195
bf62b306 2196**Example:**
2197~~~~~
72b7576f 2198vinit
2199vpoint p1 0 0 0
2200vpoint p2 50 0 0
2201vpoint p3 25 40 0
2202vtriangle triangle1 p1 p2 p3
bf62b306 2203~~~~~
2204
2205@subsubsection occt_draw_4_4_15 vconnect, vconnectsh
72b7576f 2206
bf62b306 2207Syntax:
2208~~~~~
2209vconnect name object Xo Yo Zo Xu Xv Xw Zu Zv Zw
2210vconnectsh name shape Xo Yo Zo Xu Xv Xw Zu Zv Zw
2211~~~~~
72b7576f 2212
2213Creates and displays an object with input location connected to a named entity.
bf62b306 2214The difference between these two commands is that the object created by *vconnect* does not support the selection modes different from 0.
72b7576f 2215
bf62b306 2216**Example:**
2217~~~~~
72b7576f 2218Vinitvinit
2219vpoint p1 0 0 0
2220vpoint p2 50 0 0
2221vsegment segment p1 p2
2222restore CrankArm.brep obj
2223vdisplay obj
bf62b306 2224vconnectsh new obj 100100100 1 0 0 0 0 1
2225~~~~~
72b7576f 2226
bf62b306 2227@subsubsection occt_draw_4_4_16 vtriangle
72b7576f 2228
bf62b306 2229Syntax:
2230~~~~~
2231vtriangle name PointName PointName PointName
2232~~~~~
72b7576f 2233
2234Creates and displays a filled triangle from named points.
72b7576f 2235
bf62b306 2236**Example:**
2237~~~~~
72b7576f 2238vinit
2239vpoint p1 0 0 0
2240vpoint p2 50 0 0
2241vpoint p3 25 40 0
bf62b306 2242vtriangle triangle1 p1 p2 p3
2243~~~~~
72b7576f 2244
bf62b306 2245@subsubsection occt_draw_4_4_17 vsegment
72b7576f 2246
bf62b306 2247Syntax:
2248~~~~~
2249vsegment name PointName PointName
2250~~~~~
72b7576f 2251
2252Creates and displays a segment from named points.
72b7576f 2253
bf62b306 2254**Example:**
2255~~~~~
72b7576f 2256Vinit
2257vpoint p1 0 0 0
2258vpoint p2 50 0 0
2259vsegment segment p1 p2
bf62b306 2260~~~~~
72b7576f 2261
18006a0f 2262@subsubsection occt_draw_4_4_18 vpointcloud
2263
2264Syntax:
2265~~~~~
2266vpointcloud name shape
2267~~~~~
2268
2269Creates an interactive object for an arbitary set of points from the triangulated shape.
2270
2271~~~~~
2272vpointcloud name x y z r npts {surface|volume}
2273~~~~~
2274Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r).
2275
2276**Example:**
2277~~~~~
2278vinit
2279vpointcloud pc 0 0 0 100 100000 surface -randColor
2280vfit
2281~~~~~
2282
2283@subsubsection occt_draw_4_4_19 vclipplane
2284
2285Syntax:
2286~~~~~
2287vclipplane maxplanes <view_name> - gets plane limit for the view.
2288vclipplane create <plane_name> - creates a new plane.
2289vclipplane delete <plane_name> - delete a plane.
2290vclipplane clone <source_plane> <plane_name> - clones the plane definition.
2291vclipplane set/unset <plane_name> object <object list> - sets/unsets the plane for an IO.
2292vclipplane set/unset <plane_name> view <view list> - sets/unsets plane for a view.
2293vclipplane change <plane_name> on/off - turns clipping on/off.
2294vclipplane change <plane_name> equation <a> <b> <c> <d> - changes plane equation.
2295vclipplane change <plane_name> capping on/off - turns capping on/off.
2296vclipplane change <plane_name> capping color <r> <g> <b> - sets color.
2297vclipplane change <plane name> capping texname <texture> - sets texture.
2298vclipplane change <plane_name> capping texscale <sx> <sy> - sets texture scale.
2299vclipplane change <plane_name> capping texorigin <tx> <ty> - sets texture origin.
2300vclipplane change <plane_name> capping texrotate <angle> - sets texture rotation.
2301vclipplane change <plane_name> capping hatch on/off/<id> - sets hatching mask.
2302~~~~~
2303
2304Manages clipping planes
2305
2306**Example:**
2307~~~~~
2308vinit
2309vclipplane create pln1
2310vclipplane change pln1 equation 1 0 0 -0.1
2311vclipplane set pln1 view Driver1/Viewer1/View1
2312box b 100 100 100
2313vdisplay b
2314vsetdispmode 1
2315vfit
2316vrotate 10 10 10
2317vselect 100 100
2318~~~~~
2319
2320@subsubsection occt_draw_4_4_20 vdimension
2321
2322Syntax:
2323~~~~~
2324vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]
2325 [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2326 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2327 [-arrow external|internal|fit] [{-arrowlength|-arlen} RealArrowLength]
2328 [{-arrowangle|-arangle} ArrowAngle(degrees)] [-plane xoy|yoz|zox]
2329 [-flyout FloatValue -extension FloatValue] [-value CustomNumberValue]
2330 [-dispunits DisplayUnitsString] [-modelunits ModelUnitsString]
2331 [-showunits | -hideunits]
2332~~~~~
2333
2334Builds angle, length, radius or diameter dimension interactive object **name**.
2335
2336**Attension:** length dimension can't be built without working plane.
2337
2338**Example:**
2339~~~~~
2340vpoint p1 0 0 0
2341vpoint p2 50 50 0
2342vdimension dim1 -length -plane xoy -shapes p1 p2
2343
2344vpoint p3 100 0 0
2345vdimension dim2 -angle -shapes p1 p2 p3
2346
2347vcircle circle p1 p2 p3 0
2348vdimension dim3 -radius -shapes circle
2349vfit
2350~~~~~
2351
2352@subsubsection occt_draw_4_4_21 vdimparam
2353
2354Syntax:
2355~~~~~
2356vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2357 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2358 [-arrow external|internal|fit]
2359 [{-arrowlength|-arlen} RealArrowLength]
2360 [{-arrowangle|-arangle} ArrowAngle(degrees)]
2361 [-plane xoy|yoz|zox]
2362 [-flyout FloatValue -extension FloatValue]
2363 [-value CustomNumberValue]
2364 [-dispunits DisplayUnitsString]
2365 [-modelunits ModelUnitsString]
2366 [-showunits | -hideunits]
2367~~~~~
2368
2369Sets parameters for angle, length, radius and diameter dimension **name**.
2370
2371**Example:**
2372~~~~~
2373vpoint p1 0 0 0
2374vpoint p2 50 50 0
2375vdimension dim1 -length -plane xoy -shapes p1 p2
2376vdimparam dim1 -flyout -15 -arrowlength 4 -showunits -value 10
2377~~~~~
2378
2379@subsubsection occt_draw_4_4_22 vmovedim
2380
2381Syntax:
2382~~~~~
2383vmovedim [name] [x y z]
2384~~~~~
2385
2386Moves picked or named (if **name** parameter is defined) dimension
2387to picked mouse position or input point with coordinates **x**,**y**,**z**.
2388Text label of dimension **name** is moved to position, another parts of dimension
2389are adjusted.
2390
2391**Example:**
2392~~~~~
2393vpoint p1 0 0 0
2394vpoint p2 50 50 0
2395vdimension dim1 -length -plane xoy -shapes p1 p2
2396vmovedim dim1 -10 30 0
2397~~~~~
2398
2399
bf62b306 2400@subsection occt_draw_4_5 AIS viewer – Mesh Visualization Service
72b7576f 2401
bf62b306 2402**MeshVS** (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
72b7576f 2403
bf62b306 2404@subsubsection occt_draw_4_5_1 meshfromstl
72b7576f 2405
bf62b306 2406Syntax:
2407~~~~~
2408meshfromstl meshname file
2409~~~~~
2410
2411Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately.
2412
2413**Example:**
2414~~~~~
2415meshfromstl mesh myfile.stl
2416~~~~~
72b7576f 2417
bf62b306 2418@subsubsection occt_draw_4_5_2 meshdispmode
72b7576f 2419
bf62b306 2420Syntax:
2421~~~~~
2422meshdispmode meshname displaymode
2423~~~~~
72b7576f 2424
bf62b306 2425Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
2426* *1* for *wireframe*,
2427* *2* for *shading* mode, or
2428* *3* for *shrink* mode.
72b7576f 2429
e5bd0d98 2430**Example:**
bf62b306 2431~~~~~
2432vinit
72b7576f 2433meshfromstl mesh myfile.stl
bf62b306 2434meshdispmode mesh 2
2435~~~~~
72b7576f 2436
bf62b306 2437@subsubsection occt_draw_4_5_3 meshselmode
72b7576f 2438
bf62b306 2439Syntax:
2440~~~~~
2441meshselmode meshname selectionmode
2442~~~~~
72b7576f 2443
bf62b306 2444Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
2445* *1* – node selection;
2446* *2* – 0D elements (not supported in STL);
2447* *4* – links (not supported in STL);
2448* *8* – faces.
2449
e5bd0d98 2450**Example:**
bf62b306 2451~~~~~
72b7576f 2452vinit
2453meshfromstl mesh myfile.stl
bf62b306 2454meshselmode mesh 1
2455~~~~~
72b7576f 2456
bf62b306 2457@subsubsection occt_draw_4_5_4 meshshadcolor
72b7576f 2458
bf62b306 2459Syntax:
2460~~~~~
2461meshshadcolor meshname red green blue
2462~~~~~
72b7576f 2463
ca0f3082 2464Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
bf62b306 2465
e5bd0d98 2466**Example:**
bf62b306 2467~~~~~
72b7576f 2468vinit
2469meshfromstl mesh myfile.stl
bf62b306 2470meshshadcolormode mesh 0.5 0.5 0.5
2471~~~~~
72b7576f 2472
bf62b306 2473@subsubsection occt_draw_4_5_5 meshlinkcolor
72b7576f 2474
bf62b306 2475Syntax:
2476~~~~~
2477meshlinkcolor meshname red green blue
2478~~~~~
72b7576f 2479
bf62b306 2480Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2481
e5bd0d98 2482**Example:**
bf62b306 2483~~~~~
72b7576f 2484vinit
2485meshfromstl mesh myfile.stl
bf62b306 2486meshlinkcolormode mesh 0.5 0.5 0.5
2487~~~~~
72b7576f 2488
bf62b306 2489@subsubsection occt_draw_4_5_6 meshmat
72b7576f 2490
bf62b306 2491Syntax:
2492~~~~~
2493meshmat meshname material
2494~~~~~
2495
2496Changes the material of object **meshname**.
2497
2498*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
18006a0f 2499* *0 - BRASS,*
2500* *1 - BRONZE,*
bf62b306 2501* *2 - COPPER,*
2502* *3 - GOLD,*
2503* *4 - PEWTER,*
2504* *5 - PLASTER,*
2505* *6 - PLASTIC,*
2506* *7 - SILVER,*
2507* *8 - STEEL,*
2508* *9 - STONE,*
2509* *10 - SHINY_PLASTIC,*
2510* *11 - SATIN,*
2511* *12 - METALIZED,*
2512* *13 - NEON_GNC,*
2513* *14 - CHROME,*
2514* *15 - ALUMINIUM,*
2515* *16 - OBSIDIAN,*
2516* *17 - NEON_PHC,*
2517* *18 - JADE,*
2518* *19 - DEFAULT,*
2519* *20 - UserDefined*
2520
e5bd0d98 2521**Example:**
bf62b306 2522~~~~~
72b7576f 2523vinit
2524meshfromstl mesh myfile.stl
2525meshmat mesh JADE
bf62b306 2526~~~~~
72b7576f 2527
bf62b306 2528@subsubsection occt_draw_4_5_7 meshshrcoef
72b7576f 2529
bf62b306 2530Syntax:
2531~~~~~
2532meshshrcoef meshname shrinkcoefficient
2533~~~~~
72b7576f 2534
bf62b306 2535Changes 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.
2536
e5bd0d98 2537**Example:**
bf62b306 2538~~~~~
72b7576f 2539vinit
2540meshfromstl mesh myfile.stl
bf62b306 2541meshshrcoef mesh 0.05
2542~~~~~
72b7576f 2543
bf62b306 2544@subsubsection occt_draw_4_5_8 meshshow
72b7576f 2545
bf62b306 2546Syntax:
2547~~~~~
2548meshshow meshname
2549~~~~~
72b7576f 2550
bf62b306 2551Displays **meshname** in the viewer (if it is erased).
2552
e5bd0d98 2553**Example:**
bf62b306 2554~~~~~
72b7576f 2555vinit
2556meshfromstl mesh myfile.stl
bf62b306 2557meshshow mesh
2558~~~~~
72b7576f 2559
bf62b306 2560@subsubsection occt_draw_4_5_9 meshhide
72b7576f 2561
bf62b306 2562Syntax:
2563~~~~~
2564meshhide meshname
2565~~~~~
72b7576f 2566
2567Hides **meshname** in the viewer.
72b7576f 2568
bf62b306 2569**Example:**
2570~~~~~
72b7576f 2571vinit
2572meshfromstl mesh myfile.stl
bf62b306 2573meshhide mesh
2574~~~~~
72b7576f 2575
bf62b306 2576@subsubsection occt_draw_4_5_10 meshhidesel
72b7576f 2577
bf62b306 2578Syntax:
2579~~~~~
2580meshhidesel meshname
2581~~~~~
72b7576f 2582
2583Hides only selected entities. The other part of **meshname** remains visible.
2584
bf62b306 2585@subsubsection occt_draw_4_5_11 meshshowsel
72b7576f 2586
bf62b306 2587Syntax:
2588~~~~~
2589meshshowsel meshname
2590~~~~~
72b7576f 2591
2592Shows only selected entities. The other part of **meshname** becomes invisible.
2593
bf62b306 2594@subsubsection occt_draw_4_5_12 meshshowall
72b7576f 2595
bf62b306 2596Syntax:
2597~~~~~
2598meshshowall meshname
2599~~~~~
72b7576f 2600
2601Changes the state of all entities to visible for **meshname**.
2602
bf62b306 2603@subsubsection occt_draw_4_5_13 meshdelete
72b7576f 2604
bf62b306 2605Syntax:
2606~~~~~
2607meshdelete meshname
2608~~~~~
72b7576f 2609
2610Deletes MeshVS_Mesh object **meshname**.
72b7576f 2611
bf62b306 2612**Example:**
2613~~~~~
72b7576f 2614vinit
2615meshfromstl mesh myfile.stl
2616meshdelete mesh
bf62b306 2617~~~~~
72b7576f 2618
18006a0f 2619@subsection occt_draw_4_6 VIS Viewer commands
2620
2621A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness:
2622
2623~~~~
2624\> pload VIS
2625~~~~
2626
2627@subsubsection occt_draw_4_6_1 ivtkinit
2628
2629Syntax:
2630~~~~~
2631ivtkinit
2632~~~~~
2633
2634Creates a window for VTK viewer.
2635
2636@figure{/user_guides/draw_test_harness/images/draw_image001.png}
2637
2638@subsection occt_draw_4_6_2 ivtkdisplay
2639
2640Syntax:
2641~~~~~
2642ivtkdisplay name1 [name2] …[name n]
2643~~~~~
2644
2645Displays named objects.
2646
2647**Example:**
2648~~~~~
2649ivtkinit
2650# create cone
2651pcone c 5 0 10
2652ivtkdisplay c
2653~~~~~
2654
2655@figure{/user_guides/draw_test_harness/images/draw_image002.png}
2656
2657@subsection occt_draw_4_6_3 ivtkerase
2658
2659Syntax:
2660~~~~~
2661ivtkerase [name1] [name2] … [name n]
2662~~~~~
2663
2664Erases named objects. If no arguments are passed, erases all displayed objects.
2665
2666**Example:**
2667~~~~~
2668ivtkinit
2669# create a sphere
2670psphere s 10
2671# create a cone
2672pcone c 5 0 10
2673# create a cylinder
2674pcylinder cy 5 10
2675# display objects
2676ivtkdisplay s c cy
2677# erase only the cylinder
2678ivtkerase cy
2679# erase the sphere and the cone
2680ivtkerase s c
2681~~~~~
2682
2683@subsection occt_draw_4_6_4 ivtkfit
2684
2685Syntax:
2686~~~~~
2687ivtkfit
2688~~~~~
2689
2690Automatic zoom/panning.
2691
2692@subsection occt_draw_4_6_5 ivtkdispmode
2693
2694Syntax:
2695~~~~~
2696ivtksetdispmode [name] {0|1}
2697~~~~~
2698
2699Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects
2700The possible modes are: 0 (WireFrame) and 1 (Shading).
2701
2702**Example:**
2703~~~~~
2704ivtkinit
2705# create a cone
2706pcone c 5 0 10
2707# display the cone
2708ivtkdisplay c
2709# set shading mode for the cone
2710ivtksetdispmode c 1
2711~~~~~
2712
2713@figure{/user_guides/draw_test_harness/images/draw_image003.png}
2714
2715@subsection occt_draw_4_6_6 ivtksetselmode
2716
2717Syntax:
2718~~~~~
2719ivtksetselmode [name] mode {0|1}
2720~~~~~
2721
2722Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects.
2723
2724**Example:**
2725~~~~~
2726ivtkinit
2727# load a shape from file
2728restore CrankArm.brep a
2729# display the loaded shape
2730ivtkdisplay a
2731# set the face selection mode
2732ivtksetselmode a 4 1
2733~~~~~
2734
2735@figure{/user_guides/draw_test_harness/images/draw_image004.png}
2736
2737@subsection occt_draw_4_6_7 ivtkmoveto
2738
2739Syntax:
2740~~~~~
2741ivtkmoveto x y
2742~~~~~
2743
2744Imitates mouse cursor moving to point with the given display coordinates **x**,**y**.
2745
2746**Example:**
2747~~~~~
2748ivtkinit
2749pcone c 5 0 10
2750ivtkdisplay c
2751ivtkmoveto 40 50
2752~~~~~
2753
2754@subsection occt_draw_4_6_8 ivtkselect
2755
2756Syntax:
2757~~~~~
2758ivtkselect x y
2759~~~~~
2760
2761Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
2762
2763**Example:**
2764~~~~~
2765ivtkinit
2766pcone c 5 0 10
2767ivtkdisplay c
2768ivtkselect 40 50
2769~~~~~
2770
2771@subsection occt_draw_4_6_9 ivtkdump
2772
2773Syntax:
2774~~~~~
2775ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}]
2776~~~~~
2777
2778Dumps the contents of VTK viewer to image. It supports:
2779* dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM.
2780* dumping of different buffers: RGB, RGBA or depth buffer.
2781* defining of image sizes (width and height in pixels).
2782* dumping of stereo projections (left or right).
2783
2784**Example:**
2785~~~~~
2786ivtkinit
2787pcone c 5 0 10
2788ivtkdisplay c
2789ivtkdump D:/ConeSnapshot.png rgb 768 768
2790~~~~~
2791
2792@subsection occt_draw_4_6_10 ivtkbgcolor
2793
2794
2795Syntax:
2796~~~~~
2797ivtkbgcolor r g b [r2 g2 b2]
2798~~~~~
2799
2800Sets uniform background color or gradient background if second triple of parameters is set. Color parameters r,g,b have to be chosen in the interval [0..255].
2801
2802**Example:**
2803~~~~~
2804ivtkinit
2805ivtkbgcolor 200 220 250
2806~~~~~
2807
2808@figure{/user_guides/draw_test_harness/images/draw_image005.png}
2809
2810~~~~~
2811ivtkbgcolor 10 30 80 255 255 255
2812~~~~~
2813
2814@figure{/user_guides/draw_test_harness/images/draw_image006.png}
2815
2816
bf62b306 2817@section occt_draw_5 OCAF commands
72b7576f 2818
2819
2820This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
2821
2822
bf62b306 2823@subsection occt_draw_5_1 Application commands
72b7576f 2824
2825
bf62b306 2826@subsubsection occt_draw_5_1_1 NewDocument
72b7576f 2827
bf62b306 2828Syntax:
2829~~~~~
2830NewDocument docname [format]
2831~~~~~
72b7576f 2832
2833Creates a new **docname** document with MDTV-Standard or described format.
72b7576f 2834
bf62b306 2835**Example:**
2836~~~~~
72b7576f 2837# Create new document with default (MDTV-Standard) format
2838NewDocument D
2839
2840# Create new document with BinOcaf format
2841NewDocument D2 BinOcaf
bf62b306 2842~~~~~
72b7576f 2843
bf62b306 2844@subsubsection occt_draw_5_1_2 IsInSession
72b7576f 2845
bf62b306 2846Syntax:
2847~~~~~
2848IsInSession path
2849~~~~~
72b7576f 2850
bf62b306 2851Returns *0*, if **path** document is managed by the application session, *1* – otherwise.
72b7576f 2852
bf62b306 2853**Example:**
2854~~~~~
72b7576f 2855IsInSession /myPath/myFile.std
bf62b306 2856~~~~~
72b7576f 2857
bf62b306 2858@subsubsection occt_draw_5_1_3 ListDocuments
72b7576f 2859
bf62b306 2860Syntax:
2861~~~~~
2862ListDocuments
2863~~~~~
72b7576f 2864
2865Makes a list of documents handled during the session of the application.
2866
2867
bf62b306 2868@subsubsection occt_draw_5_1_4 Open
72b7576f 2869
bf62b306 2870Syntax:
2871~~~~~
2872Open path docname
2873~~~~~
72b7576f 2874
2875Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session.
72b7576f 2876
bf62b306 2877**Example:**
2878~~~~~
2879Open /myPath/myFile.std D
2880~~~~~
72b7576f 2881
bf62b306 2882@subsubsection occt_draw_5_1_5 Close
72b7576f 2883
bf62b306 2884Syntax:
2885~~~~~
2886Close docname
2887~~~~~
72b7576f 2888
2889Closes **docname** document. The document is no longer handled by the applicative session.
72b7576f 2890
bf62b306 2891**Example:**
2892~~~~~
72b7576f 2893Close D
bf62b306 2894~~~~~
72b7576f 2895
bf62b306 2896@subsubsection occt_draw_5_1_6 Save
72b7576f