]> OCCT Git - occt.git/blob - dox/user_guides/draw_test_harness.md
0024336: Content of OCCT documentation should be updated. Iter 2
[occt.git] / dox / user_guides / draw_test_harness.md
1 Draw Test Harness  {#user_guides__test_harness}
2 ===============================
3
4 @tableofcontents
5  
6 @section occt_draw_1 Introduction
7
8 This manual explains how to use Draw, the test harness for Open CASCADE Technology (**OCCT**). It provides basic documentation on using Draw. For advanced information on Draw and its applications, see our offerings on our web site at <a href="http://www.opencascade.org/support/training">http://www.opencascade.org/support/training</a>  
9
10 Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries. 
11
12
13 @subsection occt_draw_1_1 Overview
14
15 Draw is a test harness for Open CASCADE Technology. It provides a flexible and easy to use means of testing and demonstrating the OCCT modeling libraries. 
16
17 Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes. 
18
19 Scripts may be written to customize Draw and perform tests. New types of objects and new commands may be added using the C++ programing language. 
20
21 Draw consists of: 
22
23   * A command interpreter based on the TCL command language.
24   * A 3d graphic viewer based on the X system.
25   * A basic set of commands covering scripts, variables and graphics.
26   * A set of geometric commands allowing the user to create and modify curves and surfaces and to use OCCT geometry algorithms. This set of commands is optional.
27   * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
28
29
30 There is also a set of commands for each delivery unit in the modeling libraries: 
31
32   * GEOMETRY, 
33   * TOPOLOGY, 
34   * ADVALGOS, 
35   * GRAPHIC, 
36   * PRESENTATION. 
37
38
39 @subsection occt_draw_1_2 Contents of this documentation
40
41 This documentation describes: 
42
43   * The command language.
44   * The basic set of commands.
45   * The graphical commands.
46   * The Geometry set of commands.
47   * The Topology set of commands.
48
49 This document does not describe other sets of commands and does not explain how to extend Draw using C++. 
50
51 This document is a reference manual. It contains a full description of each command. All descriptions have the format illustrated below for the exit command. 
52
53 ~~~~~
54 exit
55 ~~~~~
56
57 Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file. 
58
59 **Example:** 
60
61 ~~~~~
62 # this is a very short example 
63 exit 
64 ~~~~~
65
66
67 @subsection occt_draw_1_3 Getting started
68
69 Install Draw and launch Emacs. Get a command line in Emacs using *Esc x *and key in *woksh*. 
70
71 All DRAW Test Harness can be activated in the common executable called **DRAWEXE**. They are grouped in toolkits and can be loaded at run-time thereby implementing dynamically loaded plug-ins. Thus, it is possible to work only with the required commands adding them dynamically without leaving the Test Harness session. 
72
73 Declaration of available plug-ins is done through the special resource file(s). The *pload* command loads the plug-in in accordance with the specified resource file and activates the commands implemented in the plug-in. 
74
75 @subsubsection occt_draw_1_3_1 Launching DRAW Test Harness
76
77 Test Harness executable *DRAWEXE* is located in the <i>$CASROOT/<platform>/bin</i> directory (where <platform> is Win for Windows and Linux for Linux operating systems). Prior to launching it is important to make sure that the environment is correctly set-up (usually this is done automatically after the installation process on Windows or after launching specific scripts on Linux).  
78
79
80 @subsubsection occt_draw_1_3_2 Plug-in resource file
81
82 Open CASCADE Technology is shipped with the DrawPlugin resource file located in the <i>$CASROOT/src/DrawResources</i> directory. 
83
84 The format of the file is compliant with standard Open CASCADE Technology resource files (see the *Resource_Manager.cdl* file for details). 
85
86 Each key defines a sequence of either further (nested) keys or a name of the dynamic library. Keys can be nested down to an arbitrary level. However, cyclic dependencies between the keys are not checked. 
87
88 **Example:** (excerpt from DrawPlugin): 
89 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
90 OCAF               : VISUALIZATION, OCAFKERNEL 
91 VISUALIZATION      : AISV 
92 OCAFKERNEL         : DCAF 
93
94 DCAF               : TKDCAF 
95 AISV               : TKViewerTest 
96 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97
98 @subsubsection occt_draw_1_3_3 Activation of commands implemented in the plug-in
99
100 To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness: 
101
102 ~~~~~
103 pload [-PluginFileName] [[Key1] [Key2]...]
104 ~~~~~
105
106 where: 
107
108 * <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. 
109 * *Key…* - defines the key(s) enumerating plug-ins to be loaded. If no keys are specified then the key named *DEFAULT* is used (if there is no such key in the file then no plug-ins are loaded). 
110
111 According to the OCCT resource file management rules, to access the resource file the environment variable *CSF_PluginFileNameDefaults* (and optionally *CSF_PluginFileNameUserDefaults*) must be set and point to the directory storing the resource file. If it is omitted then the plug-in resource file will be searched in the <i>$CASROOT/src/DrawResources</i> directory. 
112
113 ~~~~~
114 Draw[]        pload -DrawPlugin OCAF 
115 ~~~~~
116 This command will search the resource file *DrawPlugin* using variable *CSF_DrawPluginDefaults* (and *CSF_DrawPluginUserDefaults*) and will start with the OCAF key. Since the *DrawPlugin* is the file shipped with Open CASCADE Technology it will be found in the <i>$CASROOT/src/DrawResources</i> directory (unless this location is redefined by user's variables). The OCAF key will be recursively extracted into two toolkits/plug-ins: *TKDCAF* and *TKViewerTest* (e.g. on Windows they correspond to *TKDCAF.dll* and *TKViewerTest.dll*). Thus, commands implemented for Visualization and OCAF will be loaded and activated in Test Harness. 
117
118 ~~~~~
119 Draw[]        pload (equivalent to pload -DrawPlugin DEFAULT). 
120 ~~~~~
121 This command will find the default DrawPlugin file and the DEFAULT key. The latter finally maps to the TKTopTest toolkit which implements basic modeling commands. 
122
123
124 @section occt_draw_2 The Command Language
125
126 @subsection occt_draw_2_1 Overview
127
128 The command language used in Draw is Tcl. Tcl documentation such as "TCL and the TK Toolkit" by John K. Ousterhout (Addison-Wesley) will prove useful if you intend to use Draw extensively. 
129
130 This chapter is designed to give you a short outline of both the TCL language and some extensions included in Draw. The following topics are covered: 
131
132   * Syntax of the TCL language.
133   * Accessing variables in TCL and Draw.
134   * Control structures.
135   * Procedures.
136
137 @subsection occt_draw_2_2 Syntax of TCL
138
139 TCL is an interpreted command language, not a structured language like C, Pascal, LISP or Basic. It uses a shell similar to that of csh. TCL is, however, easier to use than csh because control structures and procedures are easier to define. As well, because TCL does not assign a process to each command, it is faster than csh. 
140
141 The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons. 
142
143 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
144 set a 24 
145 set b 15 
146 set a 25; set b 15 
147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148
149 Each command consists of one or more *words*; the first word is the name of a command and additional words are arguments to that command. 
150
151 Words are separated by spaces or tabs. In the preceding example each of the four commands has three words. A command may contain any number of words and each word is a string of arbitrary length. 
152
153 The evaluation of a command by TCL is done in two steps. In the first step, the command is parsed and broken into words. Some substitutions are also performed. In the second step, the command procedure corresponding to the first word is called and the other words are interpreted as arguments. In the first step, there is only string manipulation, The words only acquire *meaning* in the second step by the command procedure. 
154
155 The following substitutions are performed by TCL: 
156
157 Variable substitution is triggered by the $ character (as with csh), the content of the variable is substitued; { } may be used as in csh to enclose the name of the variable. 
158
159 **Example:** 
160 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
161 # set a variable value 
162 set file documentation 
163 puts $file #to display file contents on the screen 
164
165 # a simple substitution, set psfile to documentation.ps 
166 set psfile $file.ps 
167 puts $psfile 
168
169 # another substitution, set pfile to documentationPS 
170 set pfile ${file}PS 
171
172 # a last one, 
173 # delete files NEWdocumentation and OLDdocumentation 
174 foreach prefix {NEW OLD} {rm $prefix$file} 
175 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
177 Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted. 
178
179 Compare command construction in csh. 
180
181 **Example:** 
182 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
183 set degree 30 
184 set pi 3.14159265 
185 # expr is a command evaluating a numeric expression 
186 set radian [expr $pi*$degree/180] 
187 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188
189 Backslash substitution is triggered by the backslash character. It is used to insert special characters like $, [ , ] , etc. It is also useful to insert a new line, a backslash terminated line is continued on the following line. 
190
191 TCL uses two forms of *quoting* to prevent substitution and word breaking. 
192
193 Double quote *quoting* enables the definition of a string with space and tabs as a single word. Substitutions are still performed inside the inverted commas " ". 
194
195 **Example:** 
196 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
197 # set msg to ;the price is 12.00; 
198 set price 12.00 
199 set msg ;the price is $price; 
200 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201
202 Braces *quoting* prevents all substitutions. Braces are also nested. The main use of braces is to defer evaluation when defining procedures and control structures. Braces are used for a clearer presentation of TCL scripts on several lines. 
203
204 **Example:** 
205 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
206 set x 0 
207 # this will loop for ever 
208 # because while argument is ;0  3; 
209 while ;$x  3; {set x [expr $x+1]} 
210 # this will terminate as expected because 
211 # while argument is {$x  3} 
212 while {$x  3} {set x [expr $x+1]} 
213 # this can be written also 
214 while {$x  3} { 
215 set x [expr $x+1] 
216
217 # the following cannot be written 
218 # because while requires two arguments 
219 while {$x  3} 
220
221 set x [expr $x+1] 
222
223 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
225 Comments start with a \# character as the first non-blank character in a command. To add a comment at the end of the line, the comment must be preceded by a semi-colon to end the preceding command. 
226
227 **Example:** 
228 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
229 # This is a comment 
230 set a 1 # this is not a comment 
231 set b 1; # this is a comment 
232 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233
234 The number of words is never changed by substitution when parsing in TCL. For example, the result of a substitution is always a single word. This is different from csh but convenient as the behavior of the parser is more predictable. It may sometimes be necessary to force a second round of parsing. **eval** accomplishes this: it accepts several arguments, concatenates them and executes the resulting script. 
235
236
237 **Example:** 
238 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239 # I want to delete two files 
240
241 set files ;foo bar; 
242
243 # this will fail because rm will receive only one argument 
244 # and complain that ;foo bar; does not exit 
245
246 exec rm $files 
247
248 # a second evaluation will do it 
249 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250
251 @subsection occt_draw_2_3 Accessing variables in TCL and Draw
252
253 TCL variables have only string values. Note that even numeric values are stored as string literals, and computations using the **expr** command start by parsing the strings. Draw, however, requires variables with other kinds of values such as curves, surfaces or topological shapes. 
254
255 TCL provides a mechanism to link user data to variables. Using this functionality, Draw defines its variables as TCL variables with associated data. 
256
257 The string value of a Draw variable is meaningless. It is usually set to the name of the variable itself. Consequently, preceding a Draw variable with a <i>$</i> does not change the result of a command. The content of a Draw variable is accessed using appropriate commands. 
258
259 There are many kinds of Draw variables, and new ones may be added with C++. Geometric and topological variables are described below. 
260
261 Draw numeric variables can be used within an expression anywhere a Draw command requires a numeric value. The *expr* command is useless in this case as the variables are stored not as strings but as floating point values. 
262
263 **Example:** 
264 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
265 # dset is used for numeric variables 
266 # pi is a predefined Draw variable 
267 dset angle pi/3 radius 10 
268 point p radius*cos(angle) radius*sin(angle) 0 
269 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270 It is recommended that you use TCL variables only for strings and Draw for numerals. That way, you will avoid the *expr* command. As a rule, Geometry and Topology require numbers but no strings. 
271
272 @subsubsection occt_draw_2_3_1 set, unset
273
274 Syntax:                  
275
276 ~~~~~
277 set varname [value] 
278 unset varname [varname varname ...] 
279 ~~~~~
280
281 *set* assigns a string value to a variable. If the variable does not already exist, it is created. 
282
283 Without a value, *set* returns the content of the variable. 
284
285 *unset* deletes variables. It is is also used to delete Draw variables. 
286
287 **Example:** 
288 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
289 set a "Hello world"
290 set b "Goodbye" 
291 set a 
292 == "Hello world" 
293 unset a b 
294 set a 
295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296
297 **Note**, that the *set* command can set only one variable, unlike the *dset* command. 
298
299
300 @subsubsection occt_draw_2_3_2 dset, dval
301
302 Syntax
303
304 ~~~~~
305 dset var1 value1 vr2 value2 ... 
306 dval name 
307 ~~~~~
308
309 *dset* assigns values to Draw numeric variables. The argument can be any numeric expression including Draw numeric variables. Since all Draw commands expect a numeric expression, there is no need to use $ or *expr*. The *dset* command can assign several variables. If there is an odd number of arguments, the last variable will be assigned a value of 0. If the variable does not exist, it will be created. 
310
311 *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. 
312
313
314 **Example:** 
315 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
316 # z is set to 0 
317 dset x 10 y 15 z 
318 == 0 
319
320 # no $ required for Draw commands 
321 point p x y z 
322
323 # *puts* prints a string 
324 puts ;x = [dval x], cos(x/pi) = [dval cos(x/pi)]; 
325 == x = 10, cos(x/pi) = -0.99913874099467914 
326 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327
328 **Note,** that in TCL, parentheses are not considered to be special characters. Do not forget to quote an expression if it contains spaces in order to avoid parsing different words. <i>(a + b)</i> is parsed as three words: <i>"(a + b)"</i> or <i>(a+b)</i> are correct.* 
329
330
331 @subsection occt_draw_2_4 lists
332
333 TCL uses lists. A list is a string containing elements separated by spaces or tabs. If the string contains braces, the braced part accounts as one element. 
334
335 This allows you to insert lists within lists. 
336
337 **Example:** 
338 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
339 # a list of 3 strings 
340 ;a b c; 
341
342 # a list of two strings the first is a list of 2 
343 ;{a b} c; 
344 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345
346 Many TCL commands return lists and **foreach** is a useful way to create loops on list elements. 
347
348 @subsubsection occt_draw_2_5 Control Structures
349
350 TCL allows looping using control structures. The control structures are implemented by commands and their syntax is very similar to that of their C counterparts (**if**, **while**, **switch**, etc.). In this case, there are two main differences between TCL and C: 
351
352 * You use braces instead of parentheses to enclose conditions. 
353 * You do not start the script on the next line of your command. 
354
355
356 @subsubsection occt_draw_2_5_1 if
357
358 Syntax       
359
360 ~~~~~
361 if condition script [elseif script .... else script] 
362 ~~~~~
363
364 **If** evaluates the condition and the script to see whether the condition is true. 
365
366
367
368 **Example:** 
369 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
370 if {$x  0} { 
371 puts ;positive; 
372 } elseif {$x == 0} { 
373 puts ;null; 
374 } else { 
375 puts ;negative; 
376
377 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378
379 @subsubsection occt_draw_2_5_2 while, for, foreach
380
381 Syntax:                  
382
383
384 ~~~~~~
385 while condition script 
386 for init condition reinit script 
387 foreach varname list script 
388 ~~~~~
389
390 The three loop structures are similar to their C or csh equivalent. It is important to use braces to delay evaluation. **foreach** will assign the elements of the list to the variable before evaluating the script. \
391
392 **Example:** 
393 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
394 # while example 
395 dset x 1.1 
396 while {[dval x]  100} { 
397   circle c 0 0 x 
398   dset x x*x 
399
400 # for example 
401 # incr var d, increments a variable of d (default 1) 
402 for {set i 0} {$i  10} {incr i} { 
403   dset angle $i*pi/10 
404   point p$i cos(angle0 sin(angle) 0 
405
406 # foreach example 
407 foreach object {crapo tomson lucas} {display $object} 
408 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
409
410 @subsubsection occt_draw_2_5_3 break, continue
411
412 Syntax:                  
413
414 ~~~~~
415 break 
416 continue 
417 ~~~~~
418
419 Within loops, the **break** and **continue** commands have the same effect as in C. 
420
421 **break** interrupts the innermost loop and **continue** jumps to the next iteration. 
422
423 **Example:** 
424 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
425 # search the index for which t$i has value ;secret; 
426 for {set i 1} {$i = 100} {incr i} { 
427   if {[set t$i] == ;secret;} break; 
428
429 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
430
431 @subsection occt_draw_2_6 Procedures
432
433 TCL can be extended by defining procedures using the **proc** command, which sets up a context of local variables, binds arguments and executes a TCL script. 
434
435 The only problematic aspect of procedures is that variables are strictly local, and as they are implicitly created when used, it may be difficult to detect errors. 
436
437 There are two means of accessing a variable outside the scope of the current procedures: **global** declares a global variable (a variable outside all procedures); **upvar** accesses a variable in the scope of the caller. Since arguments in TCL are always string values, the only way to pass Draw variables is by reference, i.e. passing the name of the variable and using the **upvar** command as in the following examples. 
438
439 As TCL is not a strongly typed language it is very difficult to detect programming errors and debugging can be tedious. TCL procedures are, of course, not designed for large scale software development but for testing and simple command or interactive writing. 
440
441
442 @subsubsection occt_draw_2_6_1 proc
443
444 Syntax:
445
446 ~~~~~
447 proc argumentlist script 
448 ~~~~~
449
450 **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. 
451
452 **return** gives a return value to the procedure. 
453
454 **Example:** 
455 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
456 # simple procedure 
457 proc hello {} { 
458   puts ;hello world; 
459
460 # procedure with arguments and default values 
461 proc distance {x1 y1 {x2 0} {y2 0}} { 
462   set d [expr (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)] 
463   return [expr sqrt(d)] 
464
465 proc fact n { 
466   if {$n == 0} {return 1} else { 
467     return [expr n*[fact [expr n -1]]] 
468   } 
469
470 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
471
472
473 @subsubsection occt_draw_2_6_2 global, upvar
474
475 Syntax:                 
476
477 ~~~~~
478 global varname [varname ...] 
479 upvar varname localname [varname localname ...] 
480 ~~~~~
481
482
483 **global** accesses high level variables. Unlike C, global variables are not visible in procedures. 
484
485 **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. 
486
487 **Note** that in the following examples the \$ character is always necessarily used to access the arguments.
488  
489 **Example:** 
490 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
491 # convert degree to radian 
492 # pi is a global variable 
493 proc deg2rad (degree} { 
494   return [dval pi*$degree/2.] 
495
496 # create line with a point and an angle 
497 proc linang {linename x y angle} { 
498   upvar linename l 
499   line l $x $y cos($angle) sin($angle) 
500 }
501 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
502
503 @section occt_draw_3 Basic Commands
504
505 This chapter describes all the commands defined in the basic Draw package. Some are TCL commands, but most of them have been formulated in Draw. These commands are found in all Draw applications. The commands are grouped into four sections: 
506
507   * General commands, which are used for Draw and TCL management.
508   * Variable commands, which are used to manage Draw variables such as storing and dumping.
509   * Graphic commands, which are used to manage the graphic system, and so pertain to views.
510   * Variable display commands, which are used to manage the display of objects within given views.
511
512 Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands 
513
514
515 @subsection occt_draw_3_1 General commands
516
517 This section describes several useful commands:
518
519   * **help** to get information, 
520   * **source** to eval a script from a file, 
521   * **spy** to capture the commands in a file,
522   * **cpulimit** to limit the process cpu time, 
523   * **wait** to waste some time, 
524   * **chrono** to time commands. 
525
526 @subsubsection occt_draw_3_1_1 help
527
528 Syntax:                  
529
530 ~~~~~
531 help [command [helpstring group]] 
532 ~~~~~
533
534 Provides help or modifies the help information. 
535
536 **help** without arguments lists all groups and the commands in each group. 
537
538 Specifying the command returns its syntax and in some cases, information on the command, The joker \* is automatically added at the end so that all completing commands are returned as well. 
539
540 **Example:** 
541 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
542 # Gives help on all commands starting with *a* 
543 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544
545
546 @subsubsection occt_draw_3_1_2 source
547
548 Syntax:
549
550 ~~~~~
551 source filename 
552 ~~~~~
553 Executes a file. 
554
555 The **exit** command will terminate the file. 
556
557 @subsubsection occt_draw_3_1_3 spy
558
559 Syntax:                  
560
561 ~~~~~
562 spy [filename] 
563 ~~~~~
564
565 Saves interactive commands in the file. If spying has already been performed, the current file is closed. **spy** without an argument closes the current file and stops spying. If a file already exists, the file is overwritten. Commands are not appended. 
566
567 If a command returns an error it is saved with a comment mark. 
568
569 The file created by **spy** can be executed with the **source** command. 
570
571 **Example:** 
572 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
573 # all commands will be saved in the file ;session; 
574 spy session 
575 # the file ;session; is closed and commands are not saved 
576 spy 
577 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
578
579
580
581 @subsubsection occt_draw_3_1_4 cpulimit
582
583 Syntax:                  
584
585 ~~~~~
586 cpulimit [nbseconds] 
587 ~~~~~
588
589 **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. 
590
591 **Example:** 
592 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
593 #limit cpu to one hour 
594 cpulimit 3600 
595 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
596
597 @subsubsection occt_draw_3_1_5 wait
598
599 Syntax:
600 ~~~~~
601 wait [nbseconds] 
602 ~~~~~
603 Suspends execution for the number of seconds specified in *nbseconds*. The default value is ten (10) seconds. This is a useful command for a slide show. 
604
605 ~~~~~
606 # You have ten seconds ... 
607 wait 
608 ~~~~~
609
610 @subsubsection occt_draw_3_1_6 chrono
611
612 Syntax:                  
613
614 ~~~~~
615 chrono [ name start/stop/reset/show] 
616 ~~~~~
617
618 Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed. 
619
620 With arguments, **chrono** is used to manage activated chronometers. You can perform the following actions with a chronometer. 
621   * run the chronometer (start).
622   * stop the chronometer (stop).
623   * reset the chronometer to 0 (reset).
624   * display the current time (show).
625
626 **Example:** 
627 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
628 chrono 
629 ==Chronometers activated. 
630 ptorus t 20 5 
631 ==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds 
632 ==CPU user time: 0.01 seconds 
633 ==CPU system time: 0 seconds 
634 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
635
636 @subsection occt_draw_3_2  Variable management commands
637
638 @subsubsection occt_draw_3_2_1 isdraw, directory
639
640 Syntax:                  
641 ~~~~~
642 isdraw varname 
643 directory [pattern] 
644 ~~~~~
645
646 **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. 
647
648 Use **directory** to return a list of all Draw global variables matching a pattern. 
649
650 **Example:** 
651 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
652 set a 1 
653 isdraw a 
654 === 0 
655
656 dset a 1 
657 isdraw a 
658 === 1 
659
660 circle c 0 0 1 0 5 
661 isdraw c 
662 === 1 
663
664 # to destroy all Draw objects with name containing curve 
665 foreach var [directory *curve*] {unset $var} 
666 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
667
668
669 @subsubsection occt_draw_3_2_2 whatis, dump
670
671 Syntax:
672
673 ~~~~~
674 whatis varname [varname ...] 
675 dump varname [varname ...] 
676 ~~~~~
677
678 **whatis** returns short information about a Draw variable. This is usually the type name. 
679
680 **dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable. 
681
682 **Example:** 
683 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
684 circle c 0 0 1 0 5 
685 whatis c 
686 c is a 2d curve 
687
688 dump c 
689
690 ***** Dump of c ***** 
691 Circle 
692 Center :0, 0 
693 XAxis :1, 0 
694 YAxis :-0, 1 
695 Radius :5 
696 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
697
698 **Note** The behavior of *whatis* on other variables (not Draw) is not excellent. 
699
700
701 @subsubsection occt_draw_3_2_3 rename, copy
702
703 Syntax:      
704 ~~~~~
705 rename varname tovarname [varname tovarname ...] 
706 copy varname tovarname [varname tovarname ...] 
707 ~~~~~
708
709   * **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. 
710   * **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. 
711
712 **Example:** 
713 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
714 circle c1 0 0 1 0 5 
715 rename c1 c2 
716
717 # curves are copied, c2 will not be modified 
718 copy c2 c3 
719 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
720
721 @subsubsection occt_draw_3_2_4 datadir, save, restore
722
723 Syntax:
724 ~~~~~
725 datadir [directory] 
726 save variable [filename] 
727 restore filename [variablename] 
728 ~~~~~
729
730   * **datadir** without arguments prints the path of the current data directory. 
731   * **datadir** with an argument sets the data directory path. \
732
733 If the path starts with a dot (.) only the last directory name will be changed in the path. 
734
735   * **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. 
736   * **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. 
737
738 The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent. 
739
740 **Example:** 
741 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
742 # note how TCL accesses shell environment variables 
743 # using $env() 
744 datadir 
745 ==. 
746
747 datadir $env(WBCONTAINER)/data/default 
748 ==/adv_20/BAG/data/default 
749
750 box b 10 20 30 
751 save b theBox 
752 ==/adv_20/BAG/data/default/theBox 
753
754 # when TCL does not find a command it tries a shell command 
755 ls [datadir] 
756 == theBox 
757
758 restore theBox 
759 == theBox 
760 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
761
762 @subsection occt_draw_3_3 User defined commands
763
764 *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. 
765
766 *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. 
767
768 @subsubsection occt_draw_3_3_1 set
769
770 #### In *DrawTrSurf* package:
771
772 ~~~~~
773 void Set(Standard_CString& Name,const gp_Pnt& G) ; 
774 void Set(Standard_CString& Name,const gp_Pnt2d& G) ; 
775 void Set(Standard_CString& Name, 
776 const Handle(Geom_Geometry)& G) ; 
777 void Set(Standard_CString& Name, 
778 const Handle(Geom2d_Curve)& C) ; 
779 void Set(Standard_CString& Name, 
780 const Handle(Poly_Triangulation)& T) ; 
781 void Set(Standard_CString& Name, 
782 const Handle(Poly_Polygon3D)& P) ; 
783 void Set(Standard_CString& Name, 
784 const Handle(Poly_Polygon2D)& P) ; 
785 ~~~~~
786
787 #### In *DBRep* package:
788
789 ~~~~~
790 void Set(const Standard_CString Name, 
791 const TopoDS_Shape& S) ; 
792 ~~~~~
793
794 Example of *DrawTrSurf*
795
796 ~~~~~
797 Handle(Geom2d_Circle) C1 = new Geom2d_Circle 
798 (gce_MakeCirc2d (gp_Pnt2d(50,0,) 25)); 
799 DrawTrSurf::Set(char*, C1); 
800 ~~~~~
801
802 Example of *DBRep* 
803
804 ~~~~~
805 TopoDS_Solid B; 
806 B = BRepPrimAPI_MakeBox (10,10,10); 
807 DBRep::Set(char*,B); 
808 ~~~~~
809
810 @subsubsection occt_draw_3_3_2 get
811
812 #### In *DrawTrSurf* package:
813  
814 ~~~~~
815 Handle_Geom_Geometry Get(Standard_CString& Name) ; 
816 ~~~~~
817
818 #### In *DBRep* package:
819
820 ~~~~~
821 TopoDS_Shape Get(Standard_CString& Name, 
822 const TopAbs_ShapeEnum Typ = TopAbs_SHAPE, 
823 const Standard_Boolean Complain 
824 = Standard_True) ; 
825 ~~~~~
826
827 Example of *DrawTrSurf*
828
829 ~~~~~
830 Standard_Integer MyCommand 
831 (Draw_Interpretor& theCommands, 
832 Standard_Integer argc, char** argv) 
833 {...... 
834 // Creation of a Geom_Geometry from a Draw geometric 
835 // name 
836 Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]); 
837
838 ~~~~~
839
840 Example of *DBRep*
841
842 ~~~~~
843 Standard_Integer MyCommand 
844 (Draw_Interpretor& theCommands, 
845 Standard_Integer argc, char** argv) 
846 {...... 
847 // Creation of a TopoDS_Shape from a Draw topological 
848 // name 
849 TopoDS_Solid B = DBRep::Get(argv[1]); 
850
851 ~~~~~
852
853 @section occt_draw_4 Graphic Commands
854
855 Graphic commands are used to manage the Draw graphic system. Draw provides a 2d and a 3d viewer with up to 30 views. Views are numbered and the index of the view is displayed in the window’s title. Objects are displayed in all 2d views or in all 3d views, depending on their type. 2d objects can only be viewed in 2d views while 3d objects – only in 3d views correspondingly. 
856
857 @subsection occt_draw_4_1 Axonometric viewer
858
859 @subsubsection occt_draw_4_1_1 view, delete
860
861 Syntax:                  
862 ~~~~~
863 view index type [X Y W H] 
864 delete [index] 
865 ~~~~~
866
867 **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. 
868
869 As a rule it is far simpler either to use the procedures **axo**, **top**, **left** or to click on the desired view type in the menu under *Views* in the task bar.. 
870
871 **delete** deletes a view. If no index is given, all the views are deleted. 
872
873 Type selects from the following range: 
874
875   * *AXON* : Axonometric view
876   * *PERS* : Perspective view
877   * <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.
878   * <i>-2D-</i> : 2d view
879
880 The index, the type, the current zoom are displayed in the window title . 
881
882 **Example:** 
883 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
884 # this is the content of the mu4 procedure 
885 proc mu4 {} { 
886 delete 
887 view 1 +X+Z 320 20 400 400 
888 view 2 +X+Y 320 450 400 400 
889 view 3 +Y+Z 728 20 400 400 
890 view 4 AXON 728 450 400 400 
891
892 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
893
894 See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview** 
895
896 @subsubsection occt_draw_4_1_2  axo, pers, top, ...
897
898 Syntax:      
899
900 ~~~~~
901 axo 
902 pers 
903 ... 
904 smallview type 
905 ~~~~~
906
907 All these commands are procedures used to define standard screen layout. They delete all existing views and create new ones. The layout usually complies with the European convention, i.e. a top view is under a front view. 
908
909   * **axo** creates a large window axonometric view;
910   * **pers** creates a large window perspective view;
911   * **top**, **bottom**, **left**, **right**, **front**, **back** create a large window axis view;
912   * **mu4** creates four small window views: front, left, top and axo.
913   * **v2d** creates a large window 2d view.
914   * **av2d** creates two small window views, one 2d and one axo
915   * **smallview** creates a view at the bottom right of the screen of the given type. 
916
917 See also: **view**, **delete** 
918
919 @subsubsection occt_draw_4_1_3 mu, md, 2dmu, 2dmd, zoom, 2dzoom
920
921 Syntax:
922
923 ~~~~~
924     mu [index] value 
925     2dmu [index] value 
926     zoom [index] value 
927     wzoom 
928 ~~~~~
929
930 * **mu** (magnify up) increases the zoom in one or several views by a factor of 10%. 
931 * **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd** 
932 perform the same on one or all 2d views. 
933 * **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. 
934 * **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. 
935
936 **Example:** 
937 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
938     # set a zoom of 2.5 
939     zoom 2.5 
940
941     # magnify by 10% 
942     mu 1 
943
944     # magnify by 20% 
945 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
946 See also: **fit**, **2dfit** 
947
948
949 @subsubsection occt_draw_4_14 pu, pd, pl, pr, 2dpu, 2dpd, 2dpl, 2dpr
950
951 Syntax:                  
952
953 ~~~~~
954 pu [index] 
955 pd [index] 
956 ~~~~~
957
958 The <i>p_</i> commands are used to pan. **pu** and **pd** pan up and down respectively; **pl** and **pr** pan to the left and to the right respectively. Each time the view is displaced by 40 pixels. When no index is given, all views will pan in the direction specified. 
959 ~~~~~
960 # you have selected one anonometric view
961 pu
962 # or
963 pu 1
964
965 # you have selected an mu4 view; the object in the third view will pan up
966 pu 3
967 ~~~~~
968 See also: **fit**, **2dfit** 
969
970
971 @subsubsection occt_draw_4_1_5 fit, 2dfit
972
973 Syntax:      
974
975 ~~~~~
976 fit [index] 
977 2dfit [index] 
978 ~~~~~
979
980 **fit** computes the best zoom and pans on the content of the view. The content of the view will be centered and fit the whole window. 
981
982 When fitting all views a unique zoom is computed for all the views. All views are on the same scale. 
983
984 **Example:** 
985 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
986 # fit only view 1 
987 fit 1 
988 # fit all 2d views 
989 2dfit 
990 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
991 See also: **zoom**, **mu**, **pu** 
992
993
994 @subsubsection occt_draw_4_1_6 u, d, l, r
995
996 Syntax:      
997
998 ~~~~~
999 u [index] 
1000 d [index] 
1001 l [index] 
1002 r [index] 
1003 ~~~~~
1004
1005 **u**, **d**, **l**, **r** Rotate the object in view around its axis by five degrees up, down, left or right respectively. This command is restricted to axonometric and perspective views. 
1006
1007 **Example:** 
1008 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1009 # rotate the view up 
1010
1011 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1012
1013 @subsubsection occt_draw_4_1_7 focal, fu, fd
1014
1015 Syntax:                  
1016 ~~~~~
1017 focal [f] 
1018 fu [index] 
1019 fd [index] 
1020 ~~~~~
1021
1022 * **focal** changes the vantage point in perspective views. A low f value increases the perspective effect; a high one give a perspective similar to that of an axonometric view. The default value is 500. 
1023 * **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object. 
1024
1025 **Example:** 
1026 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1027 pers 
1028 repeat 10 fd 
1029 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1030
1031 **Note**: Do not use a negative or null focal value. 
1032
1033 See also: **pers** 
1034
1035 @subsubsection occt_draw_4_1_8 color
1036
1037 Syntax: 
1038
1039 ~~~~~
1040 color index name 
1041 ~~~~~
1042
1043 **color** sets the color to a value. The index of the *color* is a value between 0 and 15. The name is an X window color name. The list of these can be found in the file *rgb.txt* in the X library directory. 
1044
1045 The default values are: 0 White, 1 Red, 2 Green, 3 Blue, 4 Cyan, 5 Gold, 6 Magenta, 7 Marron, 8 Orange, 9 Pink, 10 Salmon, 11 Violet, 12 Yellow, 13 Khaki, 14 Coral. 
1046
1047 **Example:** 
1048 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1049 # change the value of blue 
1050 color 3 "navy blue" 
1051 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1052
1053
1054 **Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc. 
1055
1056 @subsubsection occt_draw_4_1_9 dtext
1057
1058 Syntax:      
1059 ~~~~~
1060 dtext [x y [z]] string 
1061 ~~~~~
1062
1063 **dtext** displays a string in all 3d or 2d views. If no coordinates are given, a graphic selection is required. If two coordinates are given, the text is created in a 2d view at the position specified. With 3 coordinates, the text is created in a 3d view. 
1064
1065 The coordinates are real space coordinates. 
1066
1067 **Example:** 
1068 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1069 # mark the origins 
1070 dtext 0 0 bebop 
1071 dtext 0 0 0 bebop 
1072 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1073
1074 @subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd
1075
1076 Syntax:      
1077 ~~~~~
1078 hardcopy [index] 
1079 hcolor index width gray 
1080 xwd [index] filename 
1081 ~~~~~
1082
1083 * **hardcopy** creates a postcript file called a4.ps in the current directory. This file contains the postscript description of the view index, and will allow you to print the view. 
1084 * **hcolor** lets you change the aspect of lines in the postscript file. It allows to specify a width and a gray level for one of the 16 colors. **width** is measured in points with default value as 1, **gray** is the gray level from 0 = black to 1 = white with default value as 0. All colors are bound to the default values at the beginning. 
1085 * **xwd** creates an X window xwd file from an active view. By default, the index is set to1. To visualize an xwd file, use the unix command **xwud**. 
1086
1087 **Example:** 
1088 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1089 # all blue lines (color 3) 
1090 # will be half-width and gray 
1091 hcolor 3 0.5 
1092
1093 # make a postscript file and print it 
1094 hardcopy 
1095 lpr a4.ps 
1096
1097 # make an xwd file and display it 
1098 xwd theview 
1099 xwud -in theview 
1100 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1101
1102 **Note:** When more than one view is present, specify the index of the view. 
1103
1104 Only use a postscript printer to print postscript files. 
1105
1106 See also: **color** 
1107
1108
1109 @subsubsection occt_draw_4_1_11 wclick, pick
1110
1111 Syntax:      
1112 ~~~~~
1113 wclick 
1114 pick index X Y Z b [nowait] 
1115 ~~~~~
1116
1117 **wclick** defers an event until the mouse button is clicked. The message <code>just click</code> is displayed. 
1118
1119 Use the **pick** command to get graphic input. The arguments must be names for variables where the results are stored. 
1120   * index: index of the view where the input was made.
1121   * X,Y,Z: 3d coordinates in real world.
1122   * b: b is the mouse button 1,2 or 3.
1123
1124 When there is an extra argument, its value is not used and the command does not wait for a click; the value of b may then be 0 if there has not been a click. 
1125
1126 This option is useful for tracking the pointer. 
1127
1128 **Note** that the results are stored in Draw numeric variables.
1129
1130 **Example:** 
1131 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1132 # make a circle at mouse location 
1133 pick index x y z b 
1134 circle c x y z 0 0 1 1 0 0 0 30 
1135
1136 # make a dynamic circle at mouse location 
1137 # stop when a button is clicked 
1138 # (see the repaint command) 
1139
1140 dset b 0 
1141 while {[dval b] == 0} { 
1142 pick index x y z b nowait 
1143 circle c x y z 0 0 1 1 0 0 0 30 
1144 repaint 
1145
1146 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1147 See also: **repaint** 
1148
1149
1150 Draw provides commands to manage the display of objects. 
1151 * **display**, **donly** are used to display, 
1152 * **erase**, **clear**, **2dclear** to erase. 
1153 * **autodisplay** command is used to check whether variables are displayed when created. 
1154
1155 The variable name "." (dot) has a special status in Draw. Any Draw command expecting a Draw object as argument can be passed a dot. The meaning of the dot is the following. 
1156   * If the dot is an input argument, a graphic selection will be made. Instead of getting the object from a variable, Draw will ask you to select an object in a view.
1157   * If the dot is an output argument, an unnamed object will be created. Of course this makes sense only for graphic objects: if you create an unnamed number you will not be able to access it. This feature is used when you want to create objects for display only.
1158   * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands.
1159
1160 **Example:** 
1161 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1162 # OK use dot to dump an object on the screen 
1163 dump . 
1164
1165 point . x y z 
1166
1167 #Not OK. display points on a curve c 
1168 # with dot no variables are created 
1169 for {set i 0} {$i = 10} {incr i} { 
1170 cvalue c $i/10 x y z 
1171 point . x y z 
1172
1173
1174 # point p x y z 
1175 # would have displayed only one point 
1176 # because the precedent variable content is erased 
1177
1178 # point p$i x y z 
1179 # is an other solution, creating variables 
1180 # p0, p1, p2, .... 
1181
1182 # give a name to a graphic object 
1183 rename . x 
1184 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1185
1186
1187 @subsubsection occt_draw_4_1_12 autodisplay
1188
1189 Syntax:      
1190
1191 ~~~~~
1192 autodisplay [0/1] 
1193 ~~~~~
1194
1195 By default, Draw automatically displays any graphic object as soon as it is created. This behavior known as autodisplay can be removed with the command **autodisplay**. Without arguments, **autodisplay** toggles the autodisplay mode. The command always returns the current mode. 
1196
1197 When **autodisplay** is off, using the dot return argument is ineffective. 
1198
1199 **Example:** 
1200 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1201 # c is displayed 
1202 circle c 0 0 1 0 5 
1203
1204 # toggle the mode 
1205 autodisplay 
1206 == 0 
1207 circle c 0 0 1 0 5 
1208
1209 # c is erased, but not displayed 
1210 display c 
1211 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1212
1213 @subsubsection occt_draw_4_1_13 display, donly
1214
1215 Syntax:      
1216 ~~~~~
1217 display varname [varname ...] 
1218 donly varname [varname ...] 
1219 ~~~~~
1220
1221 * **display** makes objects visible. 
1222 * **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen. 
1223
1224 **Example:** 
1225 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1226 \# to see all objects 
1227 foreach var [directory] {display $var} 
1228
1229 \# to select two objects and erase the other ones 
1230 donly . . 
1231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1232
1233
1234 @subsubsection occt_draw_4_1_14 erase, clear, 2dclear
1235
1236 Syntax:      
1237
1238 ~~~~~
1239 erase [varname varname ...] 
1240 clear 
1241 2dclear 
1242 ~~~~~
1243
1244 **erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d. 
1245
1246 **clear** erases only 3d objects and **2dclear** only 2d objects. **erase** without arguments is similar to  **clear; 2dclear**.
1247
1248
1249 **Example:** 
1250 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1251 # erase eveerything with a name starting with c_ 
1252 foreach var [directory c_*] {erase $var} 
1253
1254 # clear 2d views 
1255 2d clear 
1256 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1257
1258 @subsubsection occt_draw_4_1_15 repaint, dflush
1259
1260
1261 Syntax:
1262
1263 ~~~~~
1264 repaint 
1265 dflush 
1266 ~~~~~
1267
1268 * **repaint** forces repainting of views. 
1269 * **dflush** flushes the graphic buffers. 
1270
1271 These commands are useful within loops or in scripts. 
1272
1273 When an object is modified or erased, the whole view must be repainted. To avoid doing this too many times, Draw sets up a flag and delays the repaint to the end of the command in which the new prompt is issued. In a script, you may want to display the result of a change immediately. If the flag is raised, **repaint** will repaint the views and clear the flag. 
1274
1275 Graphic operations are buffered by Draw (and also by the X system). Usually the buffer is flushed at the end of a command and before graphic selection. If you want to flush the buffer from inside a script, use the **dflush** command. 
1276
1277 See also: <a href="#occt_draw_4_1_11">pick</a> command.  
1278
1279 @subsection occt_draw_4_2 AIS viewer – view commands
1280
1281 @subsubsection occt_draw_4_2_1 vinit
1282
1283 Syntax:                  
1284 ~~~~~
1285 vinit 
1286 ~~~~~
1287 Creates the 3D viewer window 
1288
1289 @subsubsection occt_draw_4_2_2 vhelp
1290
1291 Syntax:
1292 ~~~~~
1293 vhelp 
1294 ~~~~~
1295 Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities. 
1296
1297 @subsubsection occt_draw_4_2_3 vtop
1298
1299 Syntax:
1300 ~~~~~
1301 vtop 
1302 ~~~~~
1303
1304 Displays top view in the 3D viewer window. 
1305
1306 **Example:** 
1307 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1308 vinit 
1309 box b 10 10 10 
1310 vdisplay b 
1311 vfit 
1312 vtop 
1313 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1314
1315 @subsubsection occt_draw_4_2_4 vaxo
1316
1317 Syntax:                  
1318 ~~~~~
1319 vaxo 
1320 ~~~~~
1321
1322 Displays axonometric view in the 3D viewer window. 
1323
1324 **Example:** 
1325 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1326 vinit 
1327 box b 10 10 10 
1328 vdisplay b 
1329 vfit 
1330 vaxo 
1331 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1332
1333 @subsubsection occt_draw_4_2_5 vsetbg
1334
1335 Syntax:                  
1336 ~~~~~
1337 vsetbg imagefile [filltype] 
1338 ~~~~~
1339
1340 Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH. 
1341
1342 **Example:** 
1343 ~~~~~
1344 vinit 
1345 vsetbg myimage.brep CENTERED 
1346 ~~~~~
1347
1348 @subsubsection occt_draw_4_2_6 vclear
1349
1350 Syntax:                  
1351 ~~~~~
1352 vclear 
1353 ~~~~~
1354 Removes all objects from the viewer. 
1355
1356 @subsubsection occt_draw_4_2_7 vrepaint
1357
1358 Syntax:                  
1359 ~~~~~
1360 vrepaint 
1361 ~~~~~
1362 Forcedly redisplays the shape in the 3D viewer window. 
1363
1364 @subsubsection occt_draw_4_2_8 vfit
1365
1366 Syntax:                  
1367 ~~~~~
1368 vfit 
1369 ~~~~~
1370 Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface. 
1371
1372 @subsubsection occt_draw_4_2_9 vzfit
1373
1374 Syntax:                  
1375 ~~~~~
1376 vzfit 
1377 ~~~~~
1378
1379 Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space. 
1380
1381 @subsubsection occt_draw_4_2_10  vreadpixel
1382
1383 Syntax:     
1384 ~~~~~
1385 vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name] 
1386 ~~~~~
1387 Read pixel value for active view.
1388
1389
1390 @subsubsection occt_draw_4_2_11  vselect
1391
1392 Syntax:     
1393 ~~~~~
1394 vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [shift_selection = 0|1]
1395 ~~~~~
1396
1397 Emulates different types of selection:
1398
1399   * single mouse click selection
1400   * selection with a rectangle having the upper left and bottom right corners in <i>(x1,y1)</i> and <i>(x2,y2)</i> respectively
1401   * selection with a polygon having the corners in pixel positions <i>(x1,y1), (x2,y2),…, (xn,yn)</i>
1402   * any of these selections if shift_selection is set to 1.
1403
1404 @subsubsection occt_draw_4_2_12  vmoveto
1405
1406 Syntax:     
1407
1408 ~~~~~
1409 vmoveto x y
1410 ~~~~~
1411 Emulates cursor movement to pixel position (x,y).
1412
1413 @subsubsection occt_draw_4_2_13  vviewparams
1414
1415 Syntax:     
1416 ~~~~~
1417 vviewparams [scale center_X center_Y proj_X proj_Y proj_Z up_X up_Y up_Z at_X at_Y at_Z]
1418 ~~~~~
1419 Gets or sets the current view characteristics.
1420
1421 @subsubsection occt_draw_4_2_14  vchangeselected
1422
1423 Syntax:     
1424 ~~~~~
1425 vchangeselected shape
1426 ~~~~~
1427 Adds a shape to selection or removes one from it.
1428
1429 @subsubsection occt_draw_4_2_15  vzclipping
1430
1431 Syntax:     
1432 ~~~~~
1433 vzclipping [mode] [depth width]
1434 ~~~~~
1435 Gets or sets ZClipping mode, width and depth, where
1436  - *mode = OFF|BACK|FRONT|SLICE*
1437  - *depth* is a real value from segment [0,1]
1438  - *width* is a real value from segment [0,1]
1439
1440 @subsubsection occt_draw_4_2_16  vnbselected
1441
1442 Syntax:     
1443 ~~~~~
1444 vnbselected
1445 ~~~~~
1446 Returns the number of selected objects in the interactive context.
1447
1448 @subsubsection occt_draw_4_2_17  vantialiasing
1449
1450 Syntax:     
1451 ~~~~~
1452 valntialiasing 1|0
1453 ~~~~~
1454 Sets antialiasing if the command is called with 1 or unsets otherwise.
1455
1456 @subsubsection occt_draw_4_2_18  vpurgedisplay
1457
1458 Syntax:     
1459 ~~~~~
1460 vpurgedisplay [CollectorToo = 0|1]
1461 ~~~~~
1462 Removes structures which do not belong to objects displayed in neutral point.
1463
1464 @subsubsection occt_draw_4_2_19  vhlr
1465
1466 Syntax:     
1467 ~~~~~
1468 vhlr is_enabled={on|off}
1469 ~~~~~
1470 Switches hidden line removal (computed) mode on/off.
1471
1472 @subsubsection occt_draw_4_2_20  vhlrtype
1473
1474 Syntax:     
1475 ~~~~~
1476 vhlrtype  algo_type={algo|polyalgo} [shape_1 ... shape_n]
1477 ~~~~~
1478
1479 Changes the type of HLR algorithm used for shapes.
1480 If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes. 
1481
1482 If no shape is specified through the command arguments, the given HLR algorithm_type is applied to all *AIS_Shape* isntances in the current context, and the command also changes the default HLR algorithm type.
1483
1484 **Note** that this command works with instances of *AIS_Shape* or derived classes only, other interactive object types are ignored.
1485
1486
1487 @subsection occt_draw_4_3 AIS viewer – display commands
1488
1489 @subsubsection occt_draw_4_3_1 vdisplay
1490
1491 Syntax: 
1492 ~~~~~                 
1493 vdisplay name1 [name2] … [name n] 
1494 ~~~~~
1495
1496 Displays named objects. 
1497
1498 **Example:** 
1499 ~~~~~ 
1500 vinit 
1501 box b 40 40 40 10 10 10 
1502 psphere s 20 
1503 vdisplay s b 
1504 vfit 
1505 ~~~~~ 
1506
1507 @subsubsection occt_draw_4_3_2 vdonly
1508
1509 Syntax:                  
1510 ~~~~~
1511 vdonly [name1] … [name n]
1512 ~~~~~ 
1513
1514 Displays only selected or named objects. If there are no selected or named objects, nothing is done. 
1515
1516 **Example:** 
1517 ~~~~~ 
1518 vinit 
1519 box b 40 40 40 10 10 10 
1520 psphere s 20 
1521 vdonly b 
1522 vfit
1523 ~~~~~ 
1524  
1525 @subsubsection occt_draw_4_3_3 vdisplayall
1526
1527 Syntax:                  
1528 ~~~~~ 
1529 vdisplayall 
1530 ~~~~~ 
1531
1532 Displays all created objects. 
1533
1534 **Example:** 
1535 ~~~~~ 
1536 vinit 
1537 box b 40 40 40 10 10 10 
1538 psphere s 20 
1539 vdisplayall 
1540 vfit 
1541 ~~~~~ 
1542
1543 @subsubsection occt_draw_4_3_4 verase
1544
1545 Syntax:                  
1546 ~~~~~
1547 verase [name1] [name2] … [name n]
1548 ~~~~~ 
1549
1550 Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased. 
1551
1552 **Example:** 
1553 ~~~~~
1554 vinit 
1555 box b1 40 40 40 10 10 10 
1556 box b2 -40 -40 -40 10 10 10 
1557 psphere s 20 
1558 vdisplayall 
1559 vfit 
1560 # erase only first box 
1561 verase b1 
1562 # erase second box and sphere 
1563 verase
1564 ~~~~~ 
1565
1566 @subsubsection occt_draw_4_3_5 veraseall
1567
1568 Syntax:                  
1569 ~~~~~
1570 veraseall
1571 ~~~~~ 
1572
1573 Erases all objects displayed in the viewer. 
1574
1575 **Example:**
1576 ~~~~~ 
1577 vinit 
1578 box b1 40 40 40 10 10 10 
1579 box b2 -40 -40 -40 10 10 10 
1580 psphere s 20 
1581 vdisplayall 
1582 vfit 
1583 # erase only first box 
1584 verase b1 
1585 # erase second box and sphere 
1586 verseall
1587 ~~~~~ 
1588
1589 @subsubsection occt_draw_4_3_6 vsetdispmode
1590
1591 Syntax:                  
1592 ~~~~~
1593 vsetdispmode [name] mode(0,1,2,3)
1594 ~~~~~ 
1595
1596 Sets display mode for all, selected or named objects. 
1597 * *0* (*WireFrame*), 
1598 * *1* (*Shading*), 
1599 * *2* (*Quick HideLineremoval*), 
1600 * *3* (*Exact HideLineremoval*). 
1601
1602 **Example:** 
1603 ~~~~~
1604 vinit 
1605 box b 10 10 10 
1606 vdisplay b 
1607 vsetdispmode 1 
1608 vfit
1609 ~~~~~
1610  
1611 @subsubsection occt_draw_4_3_7 vdisplaytype
1612
1613 Syntax:                  
1614 ~~~~~
1615 vdisplaytype type
1616 ~~~~~ 
1617
1618 Displays all objects of a given type. 
1619 The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*. 
1620
1621 @subsubsection occt_draw_4_3_8 verasetype
1622
1623 Syntax:                  
1624 ~~~~~
1625 verasetype type
1626 ~~~~~ 
1627
1628 Erases all objects of a given type. 
1629 Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*. 
1630
1631 @subsubsection occt_draw_4_3_9 vtypes
1632
1633 Syntax:                  
1634 ~~~~~
1635 vtypes
1636 ~~~~~ 
1637
1638 Makes a list of known types and signatures in AIS. 
1639
1640 @subsubsection occt_draw_4_3_10 vsetcolor
1641
1642 Syntax:                  
1643 ~~~~~
1644 vsetcolor [shapename] colorname
1645 ~~~~~ 
1646
1647 Sets color for all, selected or named shapes. 
1648 Possible *colorname* is: *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*.
1649
1650 @subsubsection occt_draw_4_3_11 vunsetcolor
1651
1652 Syntax:                  
1653 ~~~~~
1654 vunsetcolor [shapename]
1655 ~~~~~ 
1656
1657 Sets default color for all, selected or named shapes. 
1658
1659 @subsubsection occt_draw_4_3_12 vsettransparency
1660
1661 Syntax:                  
1662 ~~~~~
1663 vsettransparency [shapename] coeficient
1664 ~~~~~ 
1665
1666 Sets transparency for all selected or named shapes. The *coefficient* may be between 0.0 (opaque) and 1.0 (fully transparent). 
1667
1668 **Warning**: at 1.0 the shape becomes invisible.
1669  
1670 **Example:** 
1671 ~~~~~
1672 vinit 
1673 box b 10 10 10 
1674 psphere s 20 
1675 vdisplay b s 
1676 vfit 
1677 vsetdispmode 1 
1678 vsettransparency b 0.5
1679 ~~~~~ 
1680
1681 @subsubsection occt_draw_4_3_13 vunsettransparency
1682
1683 Syntax:                  
1684 ~~~~~
1685 vunsettransparency [shapename]
1686 ~~~~~ 
1687
1688 Sets default transparency (0.0) for all selected or named shapes. 
1689
1690 @subsubsection occt_draw_4_3_14 vsetmaterial
1691
1692 Syntax:                  
1693 ~~~~~
1694 vsetmaterial [shapename] materialname
1695 ~~~~~ 
1696
1697 Sets material for all selected or named shapes. 
1698
1699 **materialname** can be *BRASS*, *BRONZE*, *COPPER*, *GOLD*, *PEWTER*, *PLASTER*, *PLASTIC*, *SILVER*, *STEEL*, *STONE*, *SHINY_PLASTIC*, *SATIN*, *METALIZED*, *NEON_GNC*, *CHROME*, *ALUMINIUM*, *OBSIDIAN*, *NEON_PHC* or *JADE*.
1700  
1701 **Example:** 
1702 ~~~~~
1703 vinit 
1704 psphere s 20 
1705 vdisplay s 
1706 vfit 
1707 vsetdispmode 1 
1708 vsetmaterial s JADE 
1709 ~~~~~
1710
1711 @subsubsection occt_draw_4_3_15 vunsetmaterial
1712
1713 Syntax:                  
1714 ~~~~~
1715 vunsetmaterial [shapename]
1716 ~~~~~ 
1717
1718 Sets default material for all selected or named shapes. 
1719
1720 @subsubsection occt_draw_4_3_16 vsetwidth
1721
1722 Syntax:                  
1723 ~~~~~
1724 vsetwidth [shapename] coeficient
1725 ~~~~~ 
1726
1727 Sets width of the edges for all selected or named shapes. 
1728 The *coefficient* may be between 0.0 and 10.0.
1729  
1730 **Example:** 
1731 ~~~~~
1732 vinit 
1733 box b 10 10 10 
1734 vdisplay b 
1735 vfit 
1736 vsetwidth b 5
1737 ~~~~~ 
1738
1739 @subsubsection occt_draw_4_3_17 vunsetwidth
1740
1741 Syntax:                  
1742 ~~~~~
1743 vunsetwidth [shapename]
1744 ~~~~~ 
1745
1746 Sets default width of edges (0.0) for all selected or named shapes. 
1747
1748 @subsubsection occt_draw_4_3_18 vsetshading
1749
1750 Syntax:                  
1751 ~~~~~
1752 vsetshading shapename [coefficient]
1753 ~~~~~ 
1754
1755 Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008. 
1756
1757 **Example:** 
1758 ~~~~~
1759 vinit 
1760 psphere s 20 
1761 vdisplay s 
1762 vfit 
1763 vsetdispmode 1 
1764 vsetshading s 0.005
1765 ~~~~~
1766  
1767 @subsubsection occt_draw_4_3_19 vunsetshading
1768
1769 Syntax:                  
1770 ~~~~~
1771 vunsetshading [shapename]
1772 ~~~~~ 
1773
1774 Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008. 
1775
1776 @subsubsection occt_draw_4_3_20 vsetam
1777
1778 Syntax:                  
1779 ~~~~~
1780 vsetam [shapename] mode
1781 ~~~~~ 
1782
1783 Activates selection mode for all selected or named shapes: 
1784 * *0* for *shape* itself, 
1785 * *1* (*vertices*), 
1786 * *2* (*edges*), 
1787 * *3* (*wires*), 
1788 * *4* (*faces*), 
1789 * *5* (*shells*),
1790 * *6* (*solids*),
1791 * *7* (*compounds*).
1792  
1793 **Example:** 
1794 ~~~~~
1795 vinit 
1796 box b 10 10 10 
1797 vdisplay b 
1798 vfit 
1799 vsetam b 2
1800 ~~~~~
1801  
1802 @subsubsection occt_draw_4_3_21 vunsetam
1803
1804 Syntax:                  
1805 ~~~~~
1806 vunsetam
1807 ~~~~~ 
1808
1809 Deactivates all selection modes for all shapes. 
1810
1811 @subsubsection occt_draw_4_3_22 vdump
1812
1813 Syntax:                  
1814 ~~~~~
1815 vdump <filename>.{png|xwd|bmp}
1816 ~~~~~ 
1817
1818 Extracts the contents of the viewer window to a png, XWD or BMP file. 
1819
1820 @subsubsection occt_draw_4_3_23 vdir
1821
1822 Syntax:                  
1823 ~~~~~
1824 vdir
1825 ~~~~~ 
1826
1827 Displays the list of displayed objects. 
1828
1829 @subsubsection occt_draw_4_3_24 vsub
1830
1831 Syntax:                  
1832 ~~~~~
1833 vsub 0/1(on/off)[shapename]
1834 ~~~~~ 
1835
1836 Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
1837  
1838 **Example:** 
1839 ~~~~~
1840 vinit 
1841 box b 10 10 10 
1842 psphere s 20 
1843 vdisplay b s 
1844 vfit 
1845 vsetdispmode 1 
1846 vsub b 1
1847 ~~~~~ 
1848
1849 @subsubsection occt_draw_4_3_25 vardis
1850
1851 Syntax:                  
1852 ~~~~~
1853 vardis
1854 ~~~~~ 
1855
1856 Displays active areas (for each activated sensitive entity, one or several 2D bounding boxes are displayed, depending on the implementation of a particular entity). 
1857
1858 @subsubsection occt_draw_4_3_26 varera
1859
1860 Syntax:                  
1861 ~~~~~
1862 varera
1863 ~~~~~ 
1864
1865 Erases active areas. 
1866
1867 @subsubsection occt_draw_4_3_27 vsensdis
1868
1869 Syntax:                  
1870 ~~~~~
1871 vsensdis
1872 ~~~~~ 
1873
1874 Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes). 
1875
1876 Standard entity types are those defined in Select3D package: 
1877   * sensitive box
1878   * sensitive face
1879   * sensitive curve
1880   * sensitive segment
1881   * sensitive circle
1882   * sensitive point
1883   * sensitive triangulation
1884   * sensitive triangle
1885 Custom (application-defined) sensitive entity types are not processed by this command. 
1886
1887 @subsubsection occt_draw_4_3_28 vsensera
1888
1889 Syntax:                  
1890 ~~~~~
1891 vsensera
1892 ~~~~~ 
1893
1894 Erases active entities. 
1895
1896 @subsubsection occt_draw_4_3_29 vperf
1897
1898 Syntax:                  
1899 ~~~~~
1900 vperf shapename 1/0 (Transformation/Loacation) 1/0 (Primitives sensibles ON/OFF)
1901 ~~~~~ 
1902
1903 Tests the animation of an object along a predefined trajectory. 
1904
1905 **Example:** 
1906 ~~~~~
1907 vinit 
1908 box b 10 10 10 
1909 psphere s 20 
1910 vdisplay b s 
1911 vfit 
1912 vsetdispmode 0 
1913 vperf b 1 1
1914 ~~~~~
1915  
1916 @subsubsection occt_draw_4_3_30 vr
1917
1918 Syntax:                  
1919 ~~~~~
1920 vr filename
1921 ~~~~~ 
1922
1923 Reads shape from BREP-format file and displays it in the viewer. 
1924
1925 **Example:** 
1926 ~~~~~
1927 vinit 
1928 vr myshape.brep
1929 ~~~~~
1930  
1931 @subsubsection occt_draw_4_3_31 vstate
1932
1933 Syntax:                  
1934 ~~~~~
1935 vstate [name1] … [name n]
1936 ~~~~~ 
1937
1938 Makes a list of the status (**Displayed** or **Not Displayed**) of some selected or named objects. 
1939
1940
1941 @subsection occt_draw_4_4 AIS viewer – object commands
1942
1943 @subsubsection occt_draw_4_4_1 vtrihedron
1944
1945 Syntax:                  
1946 ~~~~~
1947 vtrihedron name [X0] [Y0] [Z0] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
1948 ~~~~~ 
1949
1950 Creates a new *AIS_Trihedron* object. If no argument is set, the default trihedron (0XYZ) is created.
1951  
1952 **Example:** 
1953 ~~~~~
1954 vinit 
1955 vtrihedron tr
1956 ~~~~~ 
1957
1958 @subsubsection occt_draw_4_4_2 vplanetri
1959
1960 Syntax:                  
1961 ~~~~~
1962 vplanetri name
1963 ~~~~~ 
1964
1965 Creates a plane from a trihedron selection. 
1966
1967
1968 @subsubsection occt_draw_4_4_3 vsize
1969
1970 Syntax:                  
1971 ~~~~~
1972 vsize [name] [size]
1973 ~~~~~ 
1974
1975 Changes the size of a named or selected trihedron. If the name is not defined: it affects the selected trihedrons otherwise nothing is done. If the value is not defined, it is set to 100 by default.
1976  
1977 **Example:** 
1978 ~~~~~
1979 vinit 
1980 vtrihedron tr1 
1981 vtrihedron tr2 0 0 0 1 0 0 1 0 0 
1982 vsize tr2 400
1983 ~~~~~ 
1984
1985 @subsubsection occt_draw_4_4_4 vaxis
1986
1987 Syntax:                  
1988 ~~~~~
1989 vaxis name [Xa Ya Za Xb Yb Zb]
1990 ~~~~~ 
1991
1992 Creates an axis. If  the values are not defined, an axis is created by interactive selection of two vertices or one edge
1993  
1994 **Example:** 
1995 ~~~~~
1996 vinit 
1997 vtrihedron tr 
1998 vaxis axe1 0 0 0 1 0 0 
1999 ~~~~~
2000
2001 @subsubsection occt_draw_4_4_5 vaxispara
2002
2003 Syntax:                  
2004 ~~~~~
2005 vaxispara nom
2006 ~~~~~ 
2007
2008 Creates an axis by interactive selection of an edge and a vertex. 
2009
2010 @subsubsection occt_draw_4_4_6 vaxisortho
2011
2012 Syntax:                  
2013 ~~~~~
2014 vaxisotrho name
2015 ~~~~~ 
2016
2017 Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge. 
2018
2019 @subsubsection occt_draw_4_4_7 vpoint
2020
2021 Syntax:                  
2022 ~~~~~
2023 vpoint name [Xa Ya Za]
2024 ~~~~~ 
2025
2026 Creates a point from coordinates. If the values are not defined, a point is created by interactive selection of a vertice or an edge (in the center of the edge). 
2027
2028 **Example:** 
2029 ~~~~~
2030 vinit 
2031 vpoint p 0 0 0 
2032 ~~~~~
2033
2034 @subsubsection occt_draw_4_4_8 vplane
2035
2036 Syntax:                  
2037 ~~~~~
2038 vplane name [AxisName] [PointName] 
2039 vplane name [PointName] [PointName] [PointName] 
2040 vplane name [PlaneName] [PointName]
2041 ~~~~~ 
2042
2043 Creates a plane from named or interactively selected entities.
2044  
2045 **Example:** 
2046 ~~~~~
2047 vinit 
2048 vpoint p1 0 50 0 
2049 vaxis axe1 0 0 0 0 0 1 
2050 vtrihedron tr 
2051 vplane plane1 axe1 p1 
2052 ~~~~~
2053
2054 @subsubsection occt_draw_4_4_9 vplanepara
2055
2056 Syntax:                  
2057 ~~~~~
2058 vplanepara name
2059 ~~~~~ 
2060
2061 Creates a plane from interactively selected vertex and face. 
2062
2063 @subsubsection occt_draw_4_4_10 vplaneortho
2064
2065 Syntax:                  
2066 ~~~~~
2067 vplaneortho name
2068 ~~~~~ 
2069
2070 Creates a plane from interactive selected face and coplanar edge. 
2071
2072 @subsubsection occt_draw_4_4_11 vline
2073
2074 Syntax:                  
2075 ~~~~~
2076 vline name [PointName] [PointName] 
2077 vline name [Xa Ya Za Xb Yb Zb]
2078 ~~~~~ 
2079
2080 Creates a line from coordinates, named or interactively selected vertices. 
2081
2082 **Example:** 
2083 ~~~~~
2084 vinit 
2085 vtrihedron tr 
2086 vpoint p1 0 50 0 
2087 vpoint p2 50 0 0 
2088 vline line1 p1 p2 
2089 vline line2 0 0 0 50 0 1 
2090 ~~~~~
2091
2092 @subsubsection occt_draw_4_4_12 vcircle
2093
2094 Syntax:      
2095 ~~~~~
2096 vcircle name [PointName PointName PointName IsFilled] 
2097 vcircle name [PlaneName PointName Radius IsFilled] 
2098 ~~~~~
2099
2100 Creates a circle from named or interactively selected entities.  Parameter IsFilled is defined as 0 or 1.
2101  
2102 **Example:** 
2103 ~~~~~
2104 vinit 
2105 vtrihedron tr 
2106 vpoint p1 0 50 0 
2107 vpoint p2 50 0 0 
2108 vpoint p3 0 0 0 
2109 vcircle circle1 p1 p2 p3 1
2110 ~~~~~ 
2111
2112 @subsubsection occt_draw_4_4_13 vtri2d
2113
2114 Syntax:                  
2115 ~~~~~
2116 vtri2d name
2117 ~~~~~ 
2118
2119 Creates a plane with a 2D trihedron from an interactively selected face. 
2120
2121 @subsubsection occt_draw_4_4_14 vselmode
2122
2123 Syntax:                  
2124 ~~~~~
2125 vselmode [object] mode On/Off
2126 ~~~~~ 
2127
2128 Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects. 
2129 Value *On* is defined as 1 and *Off* – as 0. 
2130
2131 **Example:** 
2132 ~~~~~
2133 vinit 
2134 vpoint p1 0 0 0 
2135 vpoint p2 50 0 0 
2136 vpoint p3 25 40 0 
2137 vtriangle triangle1 p1 p2 p3 
2138 ~~~~~
2139
2140 @subsubsection occt_draw_4_4_15 vconnect, vconnectsh
2141
2142 Syntax:                  
2143 ~~~~~
2144 vconnect name object Xo Yo Zo Xu Xv Xw Zu Zv Zw 
2145 vconnectsh name shape Xo Yo Zo Xu Xv Xw Zu Zv Zw
2146 ~~~~~ 
2147
2148 Creates and displays an object with input location connected to a named entity. 
2149 The difference between these two commands is that the object created by *vconnect* does not support the selection modes different from 0. 
2150
2151 **Example:** 
2152 ~~~~~
2153 Vinitvinit 
2154 vpoint p1 0 0 0 
2155 vpoint p2 50 0 0 
2156 vsegment segment p1 p2 
2157 restore CrankArm.brep obj 
2158 vdisplay obj 
2159 vconnectsh new obj 100100100 1 0 0 0 0 1
2160 ~~~~~ 
2161
2162 @subsubsection occt_draw_4_4_16 vtriangle
2163
2164 Syntax:                  
2165 ~~~~~
2166 vtriangle name PointName PointName PointName
2167 ~~~~~ 
2168
2169 Creates and displays a filled triangle from named points. 
2170
2171 **Example:** 
2172 ~~~~~
2173 vinit 
2174 vpoint p1 0 0 0 
2175 vpoint p2 50 0 0 
2176 vpoint p3 25 40 0 
2177 vtriangle triangle1 p1 p2 p3
2178 ~~~~~ 
2179
2180 @subsubsection occt_draw_4_4_17 vsegment
2181
2182 Syntax:                  
2183 ~~~~~
2184 vsegment name PointName PointName 
2185 ~~~~~
2186
2187 Creates and displays a segment from named points. 
2188
2189 **Example:** 
2190 ~~~~~
2191 Vinit 
2192 vpoint p1 0 0 0 
2193 vpoint p2 50 0 0 
2194 vsegment segment p1 p2 
2195 ~~~~~
2196
2197 @subsection occt_draw_4_5 AIS viewer – Mesh Visualization Service
2198
2199 **MeshVS** (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
2200
2201 @subsubsection occt_draw_4_5_1 meshfromstl
2202
2203 Syntax:                  
2204 ~~~~~
2205 meshfromstl meshname file
2206 ~~~~~ 
2207
2208 Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately.
2209  
2210 **Example:**
2211 ~~~~~ 
2212 meshfromstl mesh myfile.stl
2213 ~~~~~ 
2214
2215 @subsubsection occt_draw_4_5_2 meshdispmode
2216
2217 Syntax:                  
2218 ~~~~~
2219 meshdispmode meshname displaymode
2220 ~~~~~ 
2221
2222 Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
2223 * *1* for *wireframe*, 
2224 * *2* for *shading* mode, or
2225 * *3* for *shrink* mode. 
2226
2227 **Example:** 
2228 ~~~~~
2229 vinit 
2230 meshfromstl mesh myfile.stl 
2231 meshdispmode mesh 2
2232 ~~~~~ 
2233
2234 @subsubsection occt_draw_4_5_3 meshselmode
2235
2236 Syntax:                  
2237 ~~~~~
2238 meshselmode meshname selectionmode
2239 ~~~~~ 
2240
2241 Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following: 
2242 * *1* – node selection;
2243 * *2* – 0D elements (not supported in STL); 
2244 * *4* – links (not supported in STL); 
2245 * *8* – faces.
2246  
2247 **Example:** 
2248 ~~~~~
2249 vinit 
2250 meshfromstl mesh myfile.stl 
2251 meshselmode mesh 1
2252 ~~~~~ 
2253
2254 @subsubsection occt_draw_4_5_4 meshshadcolor
2255
2256 Syntax:                  
2257 ~~~~~
2258 meshshadcolor meshname red green blue
2259 ~~~~~ 
2260
2261 Changes the face interior color of object **meshname**. The *red*, *green** and *blue* are real values between *0* and *1*.
2262  
2263 **Example:** 
2264 ~~~~~
2265 vinit 
2266 meshfromstl mesh myfile.stl 
2267 meshshadcolormode mesh 0.5 0.5 0.5
2268 ~~~~~ 
2269
2270 @subsubsection occt_draw_4_5_5 meshlinkcolor
2271
2272 Syntax:                  
2273 ~~~~~
2274 meshlinkcolor meshname red green blue
2275 ~~~~~ 
2276
2277 Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2278  
2279 **Example:** 
2280 ~~~~~
2281 vinit 
2282 meshfromstl mesh myfile.stl 
2283 meshlinkcolormode mesh 0.5 0.5 0.5
2284 ~~~~~ 
2285
2286 @subsubsection occt_draw_4_5_6 meshmat
2287
2288 Syntax:                  
2289 ~~~~~
2290 meshmat meshname material
2291 ~~~~~ 
2292
2293 Changes the material of object **meshname**.
2294
2295 *material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*): 
2296 * *0 – BRASS,* 
2297 * *1 – BRONZE,* 
2298 * *2 - COPPER,* 
2299 * *3 - GOLD,* 
2300 * *4 - PEWTER,* 
2301 * *5 - PLASTER,* 
2302 * *6 - PLASTIC,* 
2303 * *7 - SILVER,* 
2304 * *8 - STEEL,* 
2305 * *9 - STONE,* 
2306 * *10 - SHINY_PLASTIC,* 
2307 * *11 - SATIN,*
2308 * *12 - METALIZED,* 
2309 * *13 - NEON_GNC,* 
2310 * *14 - CHROME,*
2311 * *15 - ALUMINIUM,*
2312 * *16 - OBSIDIAN,* 
2313 * *17 - NEON_PHC,* 
2314 * *18 - JADE,*
2315 * *19 - DEFAULT,* 
2316 * *20 - UserDefined*
2317  
2318 **Example:** 
2319 ~~~~~
2320 vinit 
2321 meshfromstl mesh myfile.stl 
2322 meshmat mesh JADE 
2323 ~~~~~
2324
2325 @subsubsection occt_draw_4_5_7 meshshrcoef
2326
2327 Syntax:                  
2328 ~~~~~
2329 meshshrcoef meshname shrinkcoefficient
2330 ~~~~~ 
2331
2332 Changes the value of shrink coefficient used in the shrink mode. In the shrink mode the face is shown as a congruent part of a usual face, so that *shrinkcoefficient* controls the value of this part. The *shrinkcoefficient* is a positive real number.
2333  
2334 **Example:** 
2335 ~~~~~
2336 vinit 
2337 meshfromstl mesh myfile.stl 
2338 meshshrcoef mesh 0.05
2339 ~~~~~ 
2340
2341 @subsubsection occt_draw_4_5_8 meshshow
2342
2343 Syntax:                  
2344 ~~~~~
2345 meshshow meshname
2346 ~~~~~ 
2347
2348 Displays **meshname** in the viewer (if it is erased).
2349  
2350 **Example:** 
2351 ~~~~~
2352 vinit 
2353 meshfromstl mesh myfile.stl 
2354 meshshow mesh
2355 ~~~~~ 
2356
2357 @subsubsection occt_draw_4_5_9 meshhide
2358
2359 Syntax:                  
2360 ~~~~~
2361 meshhide meshname
2362 ~~~~~ 
2363
2364 Hides **meshname** in the viewer. 
2365
2366 **Example:** 
2367 ~~~~~
2368 vinit 
2369 meshfromstl mesh myfile.stl 
2370 meshhide mesh
2371 ~~~~~ 
2372
2373 @subsubsection occt_draw_4_5_10 meshhidesel
2374
2375 Syntax:                  
2376 ~~~~~
2377 meshhidesel meshname
2378 ~~~~~ 
2379
2380 Hides only selected entities. The other part of **meshname** remains visible. 
2381
2382 @subsubsection occt_draw_4_5_11 meshshowsel
2383
2384 Syntax:                  
2385 ~~~~~
2386 meshshowsel meshname
2387 ~~~~~ 
2388
2389 Shows only selected entities. The other part of **meshname** becomes invisible. 
2390
2391 @subsubsection occt_draw_4_5_12 meshshowall
2392
2393 Syntax:                  
2394 ~~~~~
2395 meshshowall meshname
2396 ~~~~~ 
2397
2398 Changes the state of all entities to visible for **meshname**. 
2399
2400 @subsubsection occt_draw_4_5_13 meshdelete
2401
2402 Syntax:                  
2403 ~~~~~
2404 meshdelete meshname
2405 ~~~~~ 
2406
2407 Deletes MeshVS_Mesh object **meshname**. 
2408
2409 **Example:** 
2410 ~~~~~
2411 vinit 
2412 meshfromstl mesh myfile.stl 
2413 meshdelete mesh 
2414 ~~~~~
2415
2416 @section occt_draw_5 OCAF commands
2417
2418
2419 This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF). 
2420
2421
2422 @subsection occt_draw_5_1 Application commands
2423
2424
2425 @subsubsection occt_draw_5_1_1 NewDocument
2426
2427 Syntax:       
2428 ~~~~~
2429 NewDocument docname [format]
2430 ~~~~~ 
2431
2432 Creates a new **docname** document with MDTV-Standard or described format. 
2433
2434 **Example:** 
2435 ~~~~~
2436 # Create new document with default (MDTV-Standard) format 
2437 NewDocument D 
2438
2439 # Create new document with BinOcaf format 
2440 NewDocument D2 BinOcaf 
2441 ~~~~~
2442
2443 @subsubsection occt_draw_5_1_2 IsInSession
2444
2445 Syntax:       
2446 ~~~~~
2447 IsInSession path
2448 ~~~~~ 
2449
2450 Returns *0*, if **path** document is managed by the application session, *1* – otherwise. 
2451
2452 **Example:** 
2453 ~~~~~
2454 IsInSession /myPath/myFile.std 
2455 ~~~~~
2456
2457 @subsubsection occt_draw_5_1_3 ListDocuments
2458
2459 Syntax:       
2460 ~~~~~
2461 ListDocuments
2462 ~~~~~ 
2463
2464 Makes a list of documents handled during the session of the application. 
2465
2466
2467 @subsubsection occt_draw_5_1_4 Open
2468
2469 Syntax:       
2470 ~~~~~
2471 Open path docname
2472 ~~~~~ 
2473
2474 Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session. 
2475
2476 **Example:** 
2477 ~~~~~
2478 Open /myPath/myFile.std D
2479 ~~~~~ 
2480
2481 @subsubsection occt_draw_5_1_5 Close
2482
2483 Syntax:       
2484 ~~~~~
2485 Close docname
2486 ~~~~~ 
2487
2488 Closes **docname** document. The document is no longer handled by the applicative session. 
2489
2490 **Example:** 
2491 ~~~~~
2492 Close D 
2493 ~~~~~
2494
2495 @subsubsection occt_draw_5_1_6 Save
2496
2497 Syntax:       
2498 ~~~~~
2499 Save docname
2500 ~~~~~ 
2501
2502 Saves **docname** active document. 
2503
2504 **Example:** 
2505 ~~~~~
2506 Save D 
2507 ~~~~~
2508
2509 @subsubsection occt_draw_5_1_7 SaveAs
2510
2511 Syntax:       
2512 ~~~~~
2513 SaveAs docname path
2514 ~~~~~ 
2515
2516 Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists. 
2517
2518 **Example:** 
2519 ~~~~~
2520 SaveAs D /myPath/myFile.std
2521 ~~~~~ 
2522
2523 @subsection occt_draw_5_2       Basic commands
2524
2525 @subsubsection occt_draw_5_2_1  Label
2526
2527 Syntax:                 
2528
2529 ~~~~~
2530 Label docname entry
2531 ~~~~~
2532
2533 Creates the label expressed by <i><entry></i> if it does not exist.
2534
2535 Example
2536 ~~~~~
2537 Label D 0:2
2538 ~~~~~
2539
2540 @subsubsection occt_draw_5_2_2  NewChild
2541
2542 Syntax:                 
2543
2544 ~~~~~
2545 NewChild docname [taggerlabel = Root label]
2546 ~~~~~
2547 Finds (or creates) a *TagSource* attribute located at father label of <i><taggerlabel></i> and makes a new child label.
2548
2549 Example
2550 ~~~~~
2551 # Create new child of root label
2552 NewChild D
2553
2554 # Create new child of existing label
2555 Label D 0:2
2556 NewChild D 0:2
2557 ~~~~~
2558
2559 @subsubsection occt_draw_5_2_3  Children
2560
2561 Syntax:         
2562 ~~~~~
2563 Children docname label
2564 ~~~~~
2565 Returns the list of attributes of label.
2566
2567 Example
2568 ~~~~~
2569 Children D 0:2
2570 ~~~~~
2571
2572 @subsubsection occt_draw_5_2_4  ForgetAll
2573
2574 Syntax:                 
2575 ~~~~~
2576 ForgetAll docname label
2577 ~~~~~
2578 Forgets all attributes of the label.
2579
2580 Example
2581 ~~~~~
2582 ForgetAll D 0:2
2583 ~~~~~
2584
2585
2586 @subsubsection occt_draw_5_3 Application commands
2587
2588 @subsubsection occt_draw_5_3_1  Main
2589
2590 Syntax:       
2591 ~~~~~
2592 Main docname
2593 ~~~~~ 
2594
2595 Returns the main label of the framework. 
2596
2597 **Example:** 
2598 ~~~~~
2599 Main D 
2600 ~~~~~
2601
2602 @subsubsection occt_draw_5_3_2  UndoLimit
2603
2604 Syntax:       
2605 ~~~~~
2606 UndoLimit docname [value=0]
2607 ~~~~~ 
2608
2609
2610 Sets the limit on the number of Undo Delta stored. **0** will disable Undo on the document. A negative *value* means that there is no limit. Note that by default Undo is disabled. Enabling it will take effect with the next call to *NewCommand*. Of course, this limit is the same for Redo 
2611
2612 **Example:** 
2613 ~~~~~
2614 UndoLimit D 100 
2615 ~~~~~
2616
2617 @subsubsection occt_draw_5_3_3  Undo
2618
2619 Syntax:       
2620 ~~~~~
2621 Undo docname [value=1]
2622 ~~~~~ 
2623
2624 Undoes **value** steps. 
2625
2626 **Example:** 
2627 ~~~~~
2628 Undo D 
2629 ~~~~~
2630
2631 @subsubsection occt_draw_5_3_4  Redo
2632
2633 Syntax:       
2634 ~~~~~
2635 Redo docname [value=1]
2636 ~~~~~ 
2637
2638 Redoes **value** steps.
2639  
2640 **Example:** 
2641 ~~~~~
2642 Redo D 
2643 ~~~~~
2644
2645 @subsubsection occt_draw_5_3_5  OpenCommand
2646
2647 Syntax:       
2648 ~~~~~
2649 OpenCommand docname
2650 ~~~~~ 
2651
2652 Opens a new command transaction. 
2653
2654 **Example:**
2655 ~~~~~ 
2656 OpenCommand D
2657 ~~~~~ 
2658
2659 @subsubsection occt_draw_5_3_6  CommitCommand
2660
2661 Syntax:       
2662 ~~~~~
2663 CommitCommand docname
2664 ~~~~~ 
2665
2666 Commits the Command transaction. 
2667
2668 **Example:** 
2669 ~~~~~
2670 CommitCommand D
2671 ~~~~~ 
2672
2673 @subsubsection occt_draw_5_3_7  NewCommand
2674
2675 Syntax:       
2676 ~~~~~
2677 NewCommand docname
2678 ~~~~~ 
2679
2680 This is a short-cut for Commit and Open transaction. 
2681
2682 **Example:** 
2683 ~~~~~
2684 NewCommand D 
2685 ~~~~~
2686
2687 @subsubsection occt_draw_5_3_8  AbortCommand
2688
2689 Syntax:       
2690 ~~~~~
2691 AbortCommand docname
2692 ~~~~~ 
2693
2694 Aborts the Command transaction. 
2695
2696 **Example:** 
2697 ~~~~~
2698 AbortCommand D 
2699 ~~~~~
2700
2701 @subsubsection occt_draw_5_3_9  Copy
2702
2703 Syntax:       
2704 ~~~~~
2705 Copy docname entry Xdocname Xentry
2706 ~~~~~ 
2707
2708 Copies the contents of *entry* to *Xentry*. No links are registered. 
2709
2710 **Example:** 
2711 ~~~~~
2712 Copy D1 0:2 D2 0:4 
2713 ~~~~~
2714
2715 @subsubsection occt_draw_5_3_10  UpdateLink
2716
2717 Syntax:       
2718 ~~~~~
2719 UpdateLink docname [entry] 
2720 ~~~~~
2721
2722 Updates external reference set at *entry*. 
2723
2724 **Example:** 
2725 ~~~~~
2726 UpdateLink D 
2727 ~~~~~
2728
2729 @subsubsection occt_draw_5_3_11  CopyWithLink
2730
2731 Syntax:       
2732 ~~~~~
2733 CopyWithLink docname entry Xdocname Xentry
2734 ~~~~~ 
2735
2736 Aborts the Command transaction. 
2737 Copies the content of *entry* to *Xentry*. The link is registered with an *Xlink* attribute at *Xentry*  label. 
2738
2739 **Example:** 
2740 ~~~~~
2741 CopyWithLink D1 0:2 D2 0:4
2742 ~~~~~ 
2743
2744 @subsubsection occt_draw_5_3_12  UpdateXLinks
2745
2746 Syntax:       
2747 ~~~~~
2748 UpdateXLinks docname entry
2749 ~~~~~ 
2750
2751 Sets modifications on labels impacted by external references to the *entry*. The *document* becomes invalid and must be recomputed 
2752
2753 **Example:** 
2754 ~~~~~
2755 UpdateXLinks D 0:2 
2756 ~~~~~
2757
2758 @subsubsection occt_draw_5_3_13  DumpDocument
2759
2760 Syntax:       
2761 ~~~~~
2762 DumpDocument docname
2763 ~~~~~ 
2764
2765 Displays parameters of *docname* document. 
2766
2767 **Example:** 
2768 ~~~~~
2769 DumpDocument D 
2770 ~~~~~
2771
2772
2773 @subsection occt_draw_5_4  Data Framework commands
2774
2775
2776 @subsubsection occt_draw_5_4_1  MakeDF
2777
2778 Syntax:       
2779 ~~~~~
2780 MakeDF dfname
2781 ~~~~~ 
2782
2783 Creates a new data framework. 
2784
2785 **Example:** 
2786 ~~~~~
2787 MakeDF D 
2788 ~~~~~
2789
2790 @subsubsection occt_draw_5_4_2  ClearDF
2791
2792 Syntax:       
2793 ~~~~~
2794 ClearDF dfname
2795 ~~~~~ 
2796
2797 Clears a data framework. 
2798
2799 **Example:** 
2800 ~~~~~
2801 ClearDF D 
2802 ~~~~~
2803
2804 @subsubsection occt_draw_5_4_3  CopyDF
2805
2806 Syntax:       
2807 ~~~~~
2808 CopyDF dfname1 entry1 [dfname2] entry2
2809 ~~~~~ 
2810
2811 Copies a data framework. 
2812
2813 **Example:** 
2814 ~~~~~
2815 CopyDF D 0:2 0:4 
2816 ~~~~~
2817
2818 @subsubsection occt_draw_5_4_4  CopyLabel
2819
2820 Syntax:       
2821 ~~~~~
2822 CopyLabel dfname fromlabel tolablel
2823 ~~~~~ 
2824
2825 Copies a label. 
2826
2827 **Example:** 
2828 ~~~~~
2829 CopyLabel D1 0:2 0:4 
2830 ~~~~~
2831
2832 @subsubsection occt_draw_5_4_5  MiniDumpDF
2833
2834 Syntax:       
2835 ~~~~~
2836 MiniDumpDF dfname
2837 ~~~~~ 
2838
2839 Makes a mini-dump of a data framework. 
2840
2841 **Example:** 
2842 ~~~~~
2843 MiniDumpDF D 
2844 ~~~~~
2845
2846 @subsubsection occt_draw_5_4_6  XDumpDF
2847
2848 Syntax:       
2849 ~~~~~
2850 XDumpDF dfname
2851 ~~~~~ 
2852
2853 Makes an extended dump of a data framework. 
2854
2855 **Example:** 
2856 ~~~~~
2857 XDumpDF D
2858 ~~~~~ 
2859
2860 @subsection occt_draw_5_5  General attributes commands
2861
2862
2863 @subsubsection occt_draw_5_5_1  SetInteger
2864
2865 Syntax:       
2866 ~~~~~
2867 SetInteger dfname entry value
2868 ~~~~~ 
2869
2870 Finds or creates an Integer attribute at *entry* label and sets *value*. 
2871
2872 **Example:** 
2873 ~~~~~
2874 SetInteger D 0:2 100 
2875 ~~~~~
2876
2877 @subsubsection occt_draw_5_5_2  GetInteger
2878
2879 Syntax:       
2880 ~~~~~
2881 GetInteger dfname entry [drawname]
2882 ~~~~~ 
2883
2884 Gets a value of an Integer attribute at *entry* label and sets it to *drawname* variable, if it is defined. 
2885
2886 **Example:** 
2887 ~~~~~
2888 GetInteger D 0:2 Int1 
2889 ~~~~~
2890
2891 @subsubsection occt_draw_5_5_3  SetReal
2892
2893 Syntax:       
2894 ~~~~~
2895 SetReal dfname entry value
2896 ~~~~~ 
2897
2898 Finds or creates a Real attribute at *entry* label and sets *value*. 
2899
2900 **Example:** 
2901 ~~~~~
2902 SetReal D 0:2 100. 
2903 ~~~~~
2904
2905 @subsubsection occt_draw_5_5_4  GetReal
2906
2907 Syntax:       
2908 ~~~~~
2909 GetReal dfname entry [drawname]
2910 ~~~~~ 
2911
2912 Gets a value of a Real attribute at *entry* label and sets it to *drawname* variable, if it is defined. 
2913
2914 **Example:** 
2915 ~~~~~
2916 GetReal D 0:2 Real1 
2917 ~~~~~
2918
2919 @subsubsection occt_draw_5_5_5  SetIntArray
2920
2921 Syntax:       
2922 ~~~~~
2923 SetIntArray dfname entry lower upper value1 value2 … 
2924 ~~~~~
2925
2926 Finds or creates an IntegerArray attribute at *entry* label with lower and upper bounds and sets **value1*, *value2*... 
2927
2928 **Example:** 
2929 ~~~~~
2930 SetIntArray D 0:2 1 4 100 200 300 400
2931 ~~~~~ 
2932
2933 @subsubsection occt_draw_5_5_6  GetIntArray
2934
2935 Syntax:       
2936 ~~~~~
2937 GetIntArray dfname entry
2938 ~~~~~ 
2939
2940 Gets a value of an *IntegerArray* attribute at *entry* label. 
2941
2942 **Example:** 
2943 ~~~~~
2944 GetIntArray D 0:2
2945 ~~~~~ 
2946
2947 @subsubsection occt_draw_5_5_7  SetRealArray
2948
2949 Syntax:       
2950 ~~~~~
2951 SetRealArray dfname entry lower upper value1 value2 …
2952 ~~~~~ 
2953
2954 Finds or creates a RealArray attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*… 
2955
2956 **Example:** 
2957 ~~~~~
2958 GetRealArray D 0:2 1 4 100. 200. 300. 400. 
2959 ~~~~~
2960
2961 @subsubsection occt_draw_5_5_8  GetRealArray
2962
2963 Syntax:       
2964 ~~~~~
2965 GetRealArray dfname entry
2966 ~~~~~ 
2967
2968 Gets a value of a RealArray attribute at *entry* label. 
2969
2970 **Example:** 
2971 ~~~~~
2972 GetRealArray D 0:2 
2973 ~~~~~
2974
2975 @subsubsection occt_draw_5_5_9  SetComment
2976
2977 Syntax:       
2978 ~~~~~
2979 SetComment dfname entry value
2980 ~~~~~ 
2981
2982 Finds or creates a Comment attribute at *entry* label and sets *value*. 
2983
2984 **Example:** 
2985 ~~~~~
2986 SetComment D 0:2 "My comment"
2987 ~~~~~ 
2988
2989 @subsubsection occt_draw_5_5_10  GetComment
2990
2991 Syntax:       
2992 ~~~~~
2993 GetComment dfname entry
2994 ~~~~~ 
2995
2996 Gets a value of a Comment attribute at *entry* label. 
2997
2998 **Example:** 
2999 ~~~~~
3000 GetComment D 0:2
3001 ~~~~~ 
3002
3003 @subsubsection occt_draw_5_5_11  SetExtStringArray
3004
3005 Syntax:       
3006 ~~~~~
3007 SetExtStringArray dfname entry lower upper value1 value2 …
3008 ~~~~~ 
3009
3010 Finds or creates an *ExtStringArray* attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*… 
3011
3012 **Example:** 
3013 ~~~~~
3014 SetExtStringArray D 0:2 1 3 *string1* *string2* *string3*
3015 ~~~~~ 
3016
3017 @subsubsection occt_draw_5_5_12  GetExtStringArray
3018
3019 Syntax:       
3020 ~~~~~
3021 GetExtStringArray dfname entry
3022 ~~~~~ 
3023
3024 Gets a value of an ExtStringArray attribute at *entry* label. 
3025
3026 **Example:** 
3027 ~~~~~
3028 GetExtStringArray D 0:2 
3029 ~~~~~
3030
3031 @subsubsection occt_draw_5_5_13  SetName
3032
3033 Syntax:       
3034 ~~~~~
3035 SetName dfname entry value 
3036 ~~~~~
3037
3038 Finds or creates a Name attribute at *entry* label and sets *value*. 
3039
3040 **Example:** 
3041 ~~~~~
3042 SetName D 0:2 *My name* 
3043 ~~~~~
3044
3045 @subsubsection occt_draw_5_5_14  GetName
3046
3047 Syntax:       
3048 ~~~~~
3049 GetName dfname entry 
3050 ~~~~~
3051
3052 Gets a value of a Name attribute at *entry* label. 
3053
3054 **Example:** 
3055 ~~~~~
3056 GetName D 0:2 
3057 ~~~~~
3058
3059 @subsubsection occt_draw_5_5_15  SetReference
3060
3061 Syntax:       
3062 ~~~~~
3063 SetReference dfname entry reference 
3064 ~~~~~
3065
3066 Creates a Reference attribute at *entry* label and sets *reference*. 
3067
3068 **Example:** 
3069 ~~~~~
3070 SetReference D 0:2 0:4 
3071 ~~~~~
3072
3073 @subsubsection occt_draw_5_5_16  GetReference
3074
3075 Syntax:       
3076 ~~~~~
3077 GetReference dfname entry 
3078 ~~~~~
3079
3080 Gets a value of a Reference attribute at *entry* label. 
3081
3082 **Example:** 
3083 ~~~~~
3084 GetReference D 0:2 
3085 ~~~~~
3086
3087 @subsubsection occt_draw_5_5_17  SetUAttribute
3088
3089 Syntax:       
3090 ~~~~~
3091 SetUAttribute dfname entry localGUID 
3092 ~~~~~
3093
3094 Creates a UAttribute attribute at *entry* label with *localGUID*. 
3095
3096 **Example:** 
3097 ~~~~~
3098 set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" 
3099 SetUAttribute D 0:2 ${localGUID} 
3100 ~~~~~
3101
3102 @subsubsection occt_draw_5_5_18  GetUAttribute
3103
3104 Syntax:       
3105 ~~~~~
3106 GetUAttribute dfname entry loacalGUID 
3107 ~~~~~
3108
3109 Finds a *UAttribute* at *entry* label with *localGUID*. 
3110
3111 **Example:** 
3112 ~~~~~
3113 set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" 
3114 GetUAttribute D 0:2 ${localGUID} 
3115 ~~~~~
3116
3117 @subsubsection occt_draw_5_5_19  SetFunction
3118
3119 Syntax:       
3120 ~~~~~
3121 SetFunction dfname entry ID failure 
3122 ~~~~~
3123
3124 Finds or creates a *Function* attribute at *entry* label with driver ID and *failure* index. 
3125
3126 **Example:** 
3127 ~~~~~
3128 set ID "c73bd076-22ee-11d2-acde-080009dc4422" 
3129 SetFunction D 0:2 ${ID} 1 
3130 ~~~~~
3131
3132 @subsubsection occt_draw_5_5_20  GetFunction
3133
3134 Syntax:       
3135 ~~~~~
3136 GetFunction dfname entry ID failure 
3137 ~~~~~
3138
3139 Finds a Function attribute at *entry* label and sets driver ID to *ID* variable and failure index to *failure* variable. 
3140
3141 **Example:** 
3142 ~~~~~
3143 GetFunction D 0:2 ID failure 
3144 ~~~~~
3145
3146 @subsubsection occt_draw_5_5_21  NewShape
3147
3148 Syntax:       
3149 ~~~~~
3150 NewShape dfname entry [shape] 
3151 ~~~~~
3152
3153 Finds or creates a Shape attribute at *entry* label. Creates or updates the associated *NamedShape* attribute by *shape* if *shape* is defined. 
3154
3155 **Example:** 
3156 ~~~~~
3157 box b 10 10 10 
3158 NewShape D 0:2 b 
3159 ~~~~~
3160
3161 @subsubsection occt_draw_5_5_22  SetShape
3162
3163 Syntax:       
3164 ~~~~~
3165 SetShape dfname entry shape 
3166 ~~~~~
3167
3168 Creates or updates a *NamedShape* attribute at *entry* label by *shape*. 
3169
3170 **Example:** 
3171 ~~~~~
3172 box b 10 10 10 
3173 SetShape D 0:2 b 
3174 ~~~~~
3175
3176 @subsubsection occt_draw_5_5_23  GetShape
3177
3178 Syntax:       
3179 ~~~~~
3180 GetShape2 dfname entry shape 
3181 ~~~~~
3182
3183 Sets a shape from NamedShape attribute associated with *entry* label to *shape* draw variable. 
3184
3185 **Example:** 
3186 ~~~~~
3187 GetShape2 D 0:2 b 
3188 ~~~~~
3189
3190 @subsection occt_draw_5_6  Geometric attributes commands
3191
3192
3193 @subsubsection occt_draw_5_6_1  SetPoint
3194
3195 Syntax:       
3196 ~~~~~
3197 SetPoint dfname entry point
3198 ~~~~~ 
3199
3200 Finds or creates a Point attribute at *entry* label and sets *point* as generated in the associated *NamedShape* attribute. 
3201
3202 **Example:** 
3203 ~~~~~
3204 point p 10 10 10 
3205 SetPoint D 0:2 p 
3206 ~~~~~
3207
3208 @subsubsection occt_draw_5_6_2  GetPoint
3209
3210 Syntax:       
3211 ~~~~~
3212 GetPoint dfname entry [drawname] 
3213 ~~~~~
3214
3215 Gets a vertex from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. 
3216
3217 **Example:** 
3218 ~~~~~
3219 GetPoint D 0:2 p 
3220 ~~~~~
3221
3222 @subsubsection occt_draw_5_6_3  SetAxis
3223
3224 Syntax:       
3225 ~~~~~
3226 SetAxis dfname entry axis 
3227 ~~~~~
3228
3229 Finds or creates an Axis attribute at *entry* label and sets *axis* as generated in the associated *NamedShape* attribute. 
3230
3231 **Example:** 
3232 ~~~~~
3233 line l 10 20 30 100 200 300 
3234 SetAxis D 0:2 l 
3235 ~~~~~
3236
3237 @subsubsection occt_draw_5_6_4  GetAxis
3238
3239 Syntax:       
3240 ~~~~~
3241 GetAxis dfname entry [drawname] 
3242 ~~~~~
3243
3244 Gets a line from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. 
3245
3246 **Example:** 
3247 ~~~~~
3248 GetAxis D 0:2 l 
3249 ~~~~~
3250
3251 @subsubsection occt_draw_5_6_5  SetPlane
3252
3253 Syntax:       
3254 ~~~~~
3255 SetPlane dfname entry plane 
3256 ~~~~~
3257
3258 Finds or creates a Plane attribute at *entry* label and sets *plane* as generated in the associated *NamedShape* attribute. 
3259
3260 **Example:** 
3261 ~~~~~
3262 plane pl 10 20 30 –1 0 0 
3263 SetPlane D 0:2 pl 
3264 ~~~~~
3265
3266 @subsubsection occt_draw_5_6_6  GetPlane
3267
3268 Syntax:       
3269 ~~~~~
3270 GetPlane dfname entry [drawname] 
3271 ~~~~~
3272
3273 Gets a plane from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined. 
3274
3275 **Example:** 
3276 ~~~~~
3277 GetPlane D 0:2 pl 
3278 ~~~~~
3279
3280 @subsubsection occt_draw_5_6_7  SetGeometry
3281
3282 Syntax:       
3283 ~~~~~
3284 SetGeometry dfname entry [type] [shape] 
3285 ~~~~~
3286
3287 Creates a Geometry attribute at *entry* label and sets *type* and *shape* as generated in the associated *NamedShape* attribute if they are defined. *type* must be one of the following: *any, pnt, lin, cir, ell, spl, pln, cyl*. 
3288
3289 **Example:** 
3290 ~~~~~
3291 point p 10 10 10 
3292 SetGeometry D 0:2 pnt p 
3293 ~~~~~
3294
3295 @subsubsection occt_draw_5_6_8  GetGeometryType
3296
3297 Syntax:       
3298 ~~~~~
3299 GetGeometryType dfname entry
3300 ~~~~~ 
3301
3302 Gets a geometry type from Geometry attribute at *entry* label. 
3303
3304 **Example:** 
3305 ~~~~~
3306 GetGeometryType D 0:2 
3307 ~~~~~
3308
3309 @subsubsection occt_draw_5_6_9  SetConstraint
3310
3311 Syntax:       
3312 ~~~~~
3313 SetConstraint dfname entry keyword geometrie [geometrie …] 
3314 SetConstraint dfname entry "plane" geometrie 
3315 SetConstraint dfname entry "value" value
3316 ~~~~~  
3317
3318 1. Creates a Constraint attribute at *entry* label and sets *keyword* constraint between geometry(ies). 
3319 *keyword* must be one of the following: 
3320 *rad, dia, minr, majr, tan, par, perp, concentric, equal, dist, angle, eqrad, symm, midp, eqdist, fix, rigid,* or *from, axis, mate, alignf, aligna, axesa, facesa, round, offset* 
3321 2. Sets plane for the existing constraint. 
3322 3. Sets value for the existing constraint. 
3323
3324 **Example:** 
3325 ~~~~~
3326 SetConstraint D 0:2 "value" 5 
3327 ~~~~~
3328
3329 @subsubsection occt_draw_5_6_10  GetConstraint
3330
3331 Syntax:       
3332 ~~~~~
3333 GetConstraint dfname entry
3334 ~~~~~ 
3335
3336 Dumps a Constraint attribute at *entry* label 
3337
3338 **Example:** 
3339 ~~~~~
3340 GetConstraint D 0:2 
3341 ~~~~~
3342
3343 @subsubsection occt_draw_5_6_11  SetVariable
3344
3345 Syntax:       
3346 ~~~~~
3347 SetVariable dfname entry isconstant(0/1) units 
3348 ~~~~~
3349
3350 Creates a Variable attribute at *entry* label and sets *isconstant* flag and *units* as a string. 
3351
3352 **Example:** 
3353 ~~~~~
3354 SetVariable D 0:2 1 "mm" 
3355 ~~~~~
3356
3357 @subsubsection occt_draw_5_6_12  GetVariable
3358
3359 Syntax:       
3360 ~~~~~
3361 GetVariable dfname entry isconstant units 
3362 ~~~~~
3363
3364 Gets an *isconstant* flag and units of a Variable attribute at *entry* label. 
3365
3366 **Example:** 
3367 ~~~~~
3368 GetVariable D 0:2 isconstant units 
3369 puts "IsConstant=${isconstant}" 
3370 puts "Units=${units}" 
3371 ~~~~~
3372
3373 @subsection occt_draw_5_7  Tree attributes commands
3374
3375
3376 @subsubsection occt_draw_5_7_1  RootNode
3377
3378 Syntax:       
3379 ~~~~~
3380 RootNode dfname treenodeentry [ID]
3381 ~~~~~ 
3382
3383 Returns the ultimate father of *TreeNode* attribute identified by its *treenodeentry* and its *ID* (or default ID, if *ID* is not defined). 
3384
3385
3386 @subsubsection occt_draw_5_7_2  SetNode
3387
3388 Syntax:       
3389 ~~~~~
3390 SetNode dfname treenodeentry [ID]
3391 ~~~~~ 
3392
3393 Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* (or assigns a default ID, if the *ID* is not defined). 
3394
3395
3396 @subsubsection occt_draw_5_7_3  AppendNode
3397
3398 Syntax:       
3399 ~~~~~
3400 AppendNode dfname fatherentry childentry [fatherID]
3401 ~~~~~ 
3402
3403
3404 Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as last child of *fatherentry*. 
3405
3406
3407
3408
3409 @subsubsection occt_draw_5_7_4  PrependNode
3410
3411 Syntax:       
3412 ~~~~~
3413 PrependNode dfname fatherentry childentry [fatherID]
3414 ~~~~~ 
3415
3416
3417 Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as first child of *fatherentry*. 
3418
3419
3420 @subsubsection occt_draw_5_7_5  InsertNodeBefore
3421
3422 Syntax:       
3423 ~~~~~
3424 InsertNodeBefore dfname treenodeentry beforetreenode [ID]
3425 ~~~~~ 
3426
3427 Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *beforetreenode* before *treenodeentry*. 
3428
3429
3430 @subsubsection occt_draw_5_7_6  InsertNodeAfter
3431
3432 Syntax:       
3433 ~~~~~
3434 InsertNodeAfter dfname treenodeentry aftertreenode [ID]
3435 ~~~~~ 
3436
3437 Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *aftertreenode* after *treenodeentry*. 
3438
3439
3440 @subsubsection occt_draw_5_7_7  DetachNode
3441
3442 Syntax:       
3443 ~~~~~
3444 DetachNode dfname treenodeentry [ID]
3445 ~~~~~ 
3446
3447 Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) from *treenodeentry*. 
3448
3449
3450 @subsubsection occt_draw_5_7_8  ChildNodeIterate
3451
3452 Syntax:       
3453 ~~~~~
3454 ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID]
3455 ~~~~~ 
3456
3457
3458 Iterates on the tree of *TreeNode* attributes with tree *ID* (or default ID, if *ID* is not defined). If *alllevels* is set to *1* it explores not only the first, but all the sub Step levels.
3459  
3460 **Example:** 
3461 ~~~~~
3462 Label D 0:2 
3463 Label D 0:3 
3464 Label D 0:4 
3465 Label D 0:5 
3466 Label D 0:6 
3467 Label D 0:7 
3468 Label D 0:8 
3469 Label D 0:9 
3470
3471 # Set root node 
3472 SetNode D 0:2 
3473
3474 AppendNode D 0:2 0:4 
3475 AppendNode D 0:2 0:5 
3476 PrependNode D 0:4 0:3 
3477 PrependNode D 0:4 0:8 
3478 PrependNode D 0:4 0:9 
3479
3480 InsertNodeBefore D 0:5 0:6 
3481 InsertNodeAfter D 0:4 0:7 
3482
3483 DetachNode D 0:8 
3484
3485
3486 # List all levels 
3487 ChildNodeIterate D 0:2 1 
3488
3489 ==0:4 
3490 ==0:9 
3491 ==0:3 
3492 ==0:7 
3493 ==0:6 
3494 ==0:5 
3495
3496
3497 # List only first levels 
3498 ChildNodeIterate D 0:2 1 
3499
3500 ==0:4 
3501 ==0:7 
3502 ==0:6 
3503 ==0:5 
3504 ~~~~~
3505
3506 @subsubsection occt_draw_5_7_9  InitChildNodeIterator
3507
3508 Syntax:       
3509 ~~~~~
3510 InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID]
3511 ~~~~~ 
3512
3513
3514 Initializes the iteration on the tree of *TreeNode* attributes with tree *ID* (or default ID, if *ID* is not defined). If *alllevels* is set to *1* it explores not only the first, but also all sub Step levels. 
3515
3516 **Example:** 
3517 ~~~~~
3518 InitChildNodeIterate D 0:5 1 
3519 set aChildNumber 0 
3520 for {set i 1} {$i  100} {incr i} { 
3521     if {[ChildNodeMore] == *TRUE*} { 
3522         puts *Tree node = [ChildNodeValue]* 
3523         incr aChildNumber 
3524         ChildNodeNext 
3525     } 
3526
3527 puts "aChildNumber=$aChildNumber"
3528 ~~~~~ 
3529
3530 @subsubsection occt_draw_5_7_10  ChildNodeMore
3531
3532 Syntax:       
3533 ~~~~~
3534 ChildNodeMore
3535 ~~~~~ 
3536
3537 Returns TRUE if there is a current item in the iteration. 
3538
3539
3540 @subsubsection occt_draw_5_7_11  ChildNodeNext
3541
3542 Syntax:       
3543 ~~~~~
3544 ChildNodeNext
3545 ~~~~~ 
3546
3547 Moves to the next Item. 
3548
3549
3550 @subsubsection occt_draw_5_7_12  ChildNodeValue
3551
3552 Syntax:       
3553 ~~~~~
3554 ChildNodeValue
3555 ~~~~~ 
3556
3557 Returns the current treenode of *ChildNodeIterator*. 
3558
3559
3560 @subsubsection occt_draw_5_7_13  ChildNodeNextBrother
3561
3562 Syntax:       
3563 ~~~~~
3564 ChildNodeNextBrother
3565 ~~~~~ 
3566
3567 Moves to the next *Brother*. If there is none, goes up. This method is interesting only with *allLevels* behavior. 
3568
3569
3570 @subsection occt_draw_5_8   Standard presentation commands
3571
3572
3573 @subsubsection occt_draw_5_8_1  AISInitViewer
3574
3575 Syntax:       
3576 ~~~~~
3577 AISInitViewer docname
3578 ~~~~~ 
3579
3580 Creates and sets *AISViewer* attribute at root label, creates AIS viewer window. 
3581
3582 **Example:** 
3583 ~~~~~
3584 AISInitViewer D 
3585 ~~~~~
3586
3587 @subsubsection occt_draw_5_8_2  AISRepaint
3588
3589 Syntax:       
3590 ~~~~~
3591 AISRepaint docname 
3592 ~~~~~
3593
3594 Updates the AIS viewer window. 
3595
3596 **Example:** 
3597 ~~~~~
3598 AISRepaint D 
3599 ~~~~~
3600
3601 @subsubsection occt_draw_5_8_3  AISDisplay
3602
3603 Syntax:       
3604 ~~~~~
3605 AISDisplay docname entry [not_update] 
3606 ~~~~~
3607
3608 Displays a presantation of *AISobject* from *entry* label in AIS viewer. If *not_update* is not defined then *AISobject* is recomputed and all visualization settings are applied. 
3609
3610 **Example:** 
3611 ~~~~~
3612 AISDisplay D 0:5 
3613 ~~~~~
3614
3615 @subsubsection occt_draw_5_8_4  AISUpdate
3616
3617 Syntax:       
3618 ~~~~~
3619 AISUpdate docname entry 
3620 ~~~~~
3621
3622 Recomputes a presentation of *AISobject* from *entry* label and applies the visualization setting in AIS viewer. 
3623
3624 **Example:** 
3625 ~~~~~
3626 AISUpdate D 0:5 
3627 ~~~~~
3628
3629 @subsubsection occt_draw_5_8_5  AISErase
3630
3631 Syntax:       
3632 ~~~~~
3633 AISErase docname entry 
3634 ~~~~~
3635
3636 Erases *AISobject* of *entry* label in AIS viewer. 
3637
3638 **Example:** 
3639 ~~~~~
3640 AISErase D 0:5 
3641 ~~~~~
3642
3643 @subsubsection occt_draw_5_8_6  AISRemove
3644
3645 Syntax:       
3646 ~~~~~
3647 AISRemove docname entry 
3648 ~~~~~
3649
3650 Erases *AISobject* of *entry* label in AIS viewer, then *AISobject* is removed from *AIS_InteractiveContext*. 
3651
3652 **Example:** 
3653 ~~~~~
3654 AISRemove D 0:5 
3655 ~~~~~
3656
3657 @subsubsection occt_draw_5_8_7  AISSet
3658
3659 Syntax:       
3660 ~~~~~
3661 AISSet docname entry ID 
3662 ~~~~~
3663
3664 Creates *AISPresentation* attribute at *entry* label and sets as driver ID. ID must be one of the following: *A* (*axis*), *C* (*constraint*), *NS* (*namedshape*), *G* (*geometry*), *PL* (*plane*), *PT* (*point*). 
3665
3666 **Example:** 
3667 ~~~~~
3668 AISSet D 0:5 NS 
3669 ~~~~~
3670
3671 @subsubsection occt_draw_5_8_8  AISDriver
3672
3673 Syntax:       
3674 ~~~~~
3675 AISDriver docname entry [ID] 
3676 ~~~~~
3677
3678 Returns DriverGUID stored in *AISPresentation* attribute of an *entry* label or sets a new one. ID must be one of the following: *A* (*axis*), *C* (*constraint*), *NS* (*namedshape*), *G* (*geometry*), *PL* (*plane*), *PT* (*point*). 
3679
3680 **Example:** 
3681 ~~~~~
3682 # Get Driver GUID 
3683 AISDriver D 0:5 
3684 ~~~~~
3685
3686 @subsubsection occt_draw_5_8_9  AISUnset
3687
3688 Syntax:       
3689 ~~~~~
3690 AISUnset docname entry 
3691 ~~~~~
3692
3693 Deletes *AISPresentation* attribute (if it exists) of an *entry* label. 
3694
3695 **Example:** 
3696 ~~~~~
3697 AISUnset D 0:5 
3698 ~~~~~
3699
3700 @subsubsection occt_draw_5_8_10  AISTransparency
3701
3702 Syntax:       
3703 ~~~~~
3704 AISTransparency docname entry [transparency] 
3705 ~~~~~
3706
3707 Sets (if *transparency* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label. 
3708
3709 **Example:** 
3710 ~~~~~
3711 AISTransparency D 0:5 0.5 
3712 ~~~~~
3713
3714 @subsubsection occt_draw_5_8_11  AISHasOwnTransparency
3715
3716 Syntax:       
3717 ~~~~~
3718 AISHasOwnTransparency docname entry 
3719 ~~~~~
3720
3721 Tests *AISPresentation* attribute of an *entry* label by own transparency. 
3722
3723 **Example:** 
3724 ~~~~~
3725 AISHasOwnTransparency D 0:5 
3726 ~~~~~
3727
3728 @subsubsection occt_draw_5_8_12  AISMaterial
3729
3730 Syntax:       
3731 ~~~~~
3732 AISMaterial docname entry [material] 
3733 ~~~~~
3734
3735 Sets (if *material* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label. *material* is integer from 0 to 20 (see <a href="#occt_draw_4_5_6">meshmat</a> command). 
3736
3737 **Example:** 
3738 ~~~~~
3739 AISMaterial D 0:5 5 
3740 ~~~~~
3741
3742 @subsubsection occt_draw_5_8_13  AISHasOwnMaterial
3743
3744 Syntax:       
3745 ~~~~~
3746 AISHasOwnMaterial docname entry 
3747 ~~~~~
3748
3749 Tests *AISPresentation* attribute of an *entry* label by own material. 
3750
3751 **Example:** 
3752 ~~~~~
3753 AISHasOwnMaterial D 0:5 
3754 ~~~~~
3755
3756 @subsubsection occt_draw_5_8_14  AISColor
3757
3758 Syntax:       
3759 ~~~~~
3760 AISColor docname entry [color] 
3761 ~~~~~
3762
3763 Sets (if *color* is defined) or gets value of color for *AISPresentation* attribute of an *entry* label. *color* is integer from 0 to 516 (see color names in *vsetcolor*). 
3764
3765 **Example:** 
3766 ~~~~~
3767 AISColor D 0:5 25 
3768 ~~~~~
3769
3770 @subsubsection occt_draw_5_8_15  AISHasOwnColor
3771
3772 Syntax:       
3773 ~~~~~
3774 AISHasOwnColor docname entry 
3775 ~~~~~
3776
3777 Tests *AISPresentation* attribute of an *entry* label by own color. 
3778
3779 **Example:** 
3780 ~~~~~
3781 AISHasOwnColor D 0:5 
3782 ~~~~~
3783
3784 @section occt_draw_6 Geometry commands
3785
3786 @subsection occt_draw_6_1 Overview
3787
3788 Draw provides a set of commands to test geometry libraries. These commands are found in the TGEOMETRY executable, or in any Draw executable which includes *GeometryTest* commands. 
3789
3790 In the context of Geometry, Draw includes the following types of variable: 
3791
3792   * 2d and 3d points
3793   * The 2d curve, which corresponds to *Curve* in *Geom2d*.
3794   * The 3d curve and surface, which correspond to *Curve* and *Surface* in <a href="user_guides__modeling_data.html#occt_modat_1">Geom package</a>.
3795   
3796 Draw geometric variables never share data; the *copy* command will always make a complete copy of the content of the variable. 
3797
3798 The following topics are covered in the nine sections of this chapter: 
3799
3800   * **Curve creation** deals with the various types of curves and how to create them.
3801   * **Surface creation** deals with the different types of surfaces and how to create them.
3802   * **Curve and surface modification** deals with the commands used to modify the definition of curves and surfaces, most of which concern modifications to bezier and bspline curves.
3803   * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
3804   * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
3805   * **Intersections** presents intersections of surfaces and curves.
3806   * **Approximations** deals with creating curves and surfaces from a set of points.
3807   * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
3808   * **Display** describes commands to control the display of curves and surfaces.
3809
3810 Where possible, the commands have been made broad in application, i.e. they apply to 2d curves, 3d curves and surfaces. For instance, the *circle* command may create a 2d or a 3d circle depending on the number of arguments given. 
3811
3812 Likewise, the *translate* command will process points, curves or surfaces, depending on argument type. You may not always find the specific command you are looking for in the section where you expect it to be. In that case, look in another section. The *trim* command, for example, is described in the surface section. It can, nonetheless, be used with curves as well. 
3813
3814 @subsection occt_draw_6_2  Curve creation
3815
3816 This section deals with both points and curves. Types of curves are: 
3817
3818   * Analytical curves such as lines, circles, ellipses, parabolas, and hyperbolas.
3819   * Polar curves such as bezier curves and bspline curves.
3820   * Trimmed curves and offset curves made from other curves with the *trim* and *offset* commands. Because they are used on both curves and surfaces, the *trim* and *offset* commands are described in the *surface creation* section.
3821   * NURBS can be created from other curves using *convert* in the *Surface Creation* section.
3822   * Curves can be created from the isoparametric lines of surfaces by the *uiso* and *viso* commands.
3823   * 3d curves can be created from 2d curves and vice versa using the *to3d* and *to2d* commands. The *project* command computes a 2d curve on a 3d surface.
3824
3825 Curves are displayed with an arrow showing the last parameter. 
3826
3827
3828 @subsubsection occt_draw_6_2_1 point
3829
3830 Syntax:      
3831 ~~~~~
3832 point name x y [z] 
3833 ~~~~~
3834   
3835 Creates a 2d or 3d point, depending on the number of arguments. 
3836
3837 **Example:**
3838 ~~~~~
3839 # 2d point 
3840 point p1 1 2 
3841
3842 # 3d point 
3843 point p2 10 20 -5 
3844 ~~~~~
3845   
3846 @subsubsection occt_draw_6_2_2  line
3847
3848 Syntax:      
3849 ~~~~~
3850 line name x y [z] dx dy [dz]
3851 ~~~~~ 
3852
3853   
3854 Creates a 2d or 3d line. *x y z* are the coordinates of the line’s point of origin; *dx, dy, dz* give the direction vector. 
3855
3856 A 2d line will be represented as *x y dx dy*, and a 3d line as *x y z dx dy dz* . A line is parameterized along its length starting from the point of origin along the direction vector. The direction vector is normalized and must not be null. Lines are infinite, even though their representation is not. 
3857
3858 **Example:** 
3859 ~~~~~
3860 # a 2d line at 45 degrees of the X axis 
3861 line l 2 0 1 1 
3862
3863 # a 3d line through the point 10 0 0 and parallel to Z 
3864 line l 10 0 0 0 0 1 
3865 ~~~~~
3866
3867 @subsubsection occt_draw_6_2_3  circle
3868
3869 Syntax:      
3870 ~~~~~
3871 circle name x y [z [dx dy dz]] [ux uy [uz]] radius
3872 ~~~~~ 
3873
3874 Creates a 2d or a 3d circle. 
3875
3876 In 2d, *x, y* are the coordinates of the center and *ux, uy* define the vector towards the point of origin of the parameters. By default, this direction is (1,0). The X Axis of the local coordinate system defines the origin of the parameters of the circle. Use another vector than the x axis to change the origin of parameters. 
3877
3878 In 3d, *x, y, z* are the coordinates of the center; *dx, dy, dz* give the vector normal to the plane of the circle. By default, this vector is (0,0,1) i.e. the Z axis (it must not be null). *ux, uy, uz* is the direction of the origin; if not given, a default direction will be computed. This vector must neither be null nor parallel to *dx, dy, dz*. 
3879
3880 The circle is parameterized by the angle in [0,2*pi] starting from the origin and. Note that the specification of origin direction and plane is the same for all analytical curves and surfaces. 
3881
3882 **Example:** 
3883 ~~~~~
3884 # A 2d circle of radius 5 centered at 10,-2 
3885 circle c1 10 -2 5 
3886
3887 # another 2d circle with a user defined origin 
3888 # the point of parameter 0 on this circle will be 
3889 # 1+sqrt(2),1+sqrt(2) 
3890 circle c2 1 1 1 1 2 
3891
3892 # a 3d circle, center 10 20 -5, axis Z, radius 17 
3893 circle c3 10 20 -5 17 
3894
3895 # same 3d circle with axis Y 
3896 circle c4 10 20 -5 0 1 0 17 
3897
3898 # full 3d circle, axis X, origin on Z 
3899 circle c5 10 20 -5 1 0 0 0 0 1 17 
3900 ~~~~~
3901
3902 @subsubsection occt_draw_6_2_4  ellipse
3903
3904 Syntax: 
3905 ~~~~~
3906 ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius 
3907 ~~~~~
3908
3909 Creates a 2d or 3d ellipse. In a 2d ellipse, the first two arguments define the center; in a 3d ellipse, the first three. The axis system is given by *firstradius*, the major radius, and *secondradius*, the minor radius. The parameter range of the ellipse is [0,2.*pi] starting from the X axis and going towards the Y axis. The Draw ellipse is parameterized by an angle: 
3910
3911 ~~~~~
3912 P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir 
3913 ~~~~~
3914 where: 
3915
3916   * P is the point of parameter *u*,
3917   * *O, Xdir* and *Ydir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system.
3918  
3919 **Example:**
3920 ~~~~~
3921 # default 2d ellipse 
3922 ellipse e1 10 5 20 10 
3923
3924 # 2d ellipse at angle 60 degree 
3925 ellipse e2 0 0 1 2 30 5 
3926
3927 # 3d ellipse, in the XY plane 
3928 ellipse e3 0 0 0 25 5 
3929
3930 # 3d ellipse in the X,Z plane with axis 1, 0 ,1 
3931 ellipse e4 0 0 0 0 1 0 1 0 1 25 5 
3932 ~~~~~
3933
3934 @subsubsection occt_draw_6_2_5  hyperbola
3935
3936 Syntax:      
3937 ~~~~~
3938 hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
3939 ~~~~~ 
3940
3941 Creates a 2d or 3d conic. The first arguments define the center. The axis system is given by *firstradius*, the major radius, and *secondradius*, the minor radius. Note that the hyperbola has only one branch, that in the X direction. 
3942
3943 The Draw hyperbola is parameterized as follows: 
3944 ~~~~~
3945 P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir 
3946 ~~~~~
3947 where: 
3948
3949   * *P* is the point of parameter *U*,
3950   * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *YDirection* of its local coordinate system. 
3951
3952 **Example:** 
3953 ~~~~~
3954 # default 2d hyperbola, with asymptotes 1,1 -1,1 
3955 hyperbola h1 0 0 30 30 
3956
3957 # 2d hyperbola at angle 60 degrees 
3958 hyperbola h2 0 0 1 2 20 20 
3959
3960 # 3d hyperbola, in the XY plane 
3961 hyperbola h3 0 0 0 50 50 
3962 ~~~~~
3963
3964 @subsubsection occt_draw_6_2_6  parabola
3965
3966 Syntax:      
3967 ~~~~~
3968 parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength 
3969 ~~~~~
3970
3971 Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola. 
3972
3973 The *Geom_Parabola* is parameterized as follows: 
3974
3975 ~~~~~
3976 P(u) = O + u*u/(4.*F)*XDir + u*YDir 
3977 ~~~~~
3978
3979 where: 
3980   * *P* is the point of parameter *u*,
3981   * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system,
3982   * *F* is the focal length of the parabola.
3983
3984 **Example:** 
3985 ~~~~~
3986 # 2d parabola 
3987 parabola p1 0 0 50 
3988
3989 # 2d parabola with convexity +Y 
3990 parabola p2 0 0 0 1 50 
3991
3992 # 3d parabola in the Y-Z plane, convexity +Z 
3993 parabola p3 0 0 0 1 0 0 0 0 1 50 
3994 ~~~~~
3995
3996 @subsubsection occt_draw_6_2_7  beziercurve, dbeziercurve
3997
3998 Syntax:      
3999 ~~~~~
4000 beziercurve name nbpole pole, [weight] 
4001 2dbeziercurve name nbpole pole, [weight]
4002 ~~~~~ 
4003
4004 Creates a 3d rational or non-rational Bezier curve. Give the number of poles (control points,) and the coordinates of the poles *(x1 y1 z1 [w1] x2 y2 z2 [w2])*. The degree will be *nbpoles-1*. To create a rational curve, give weights with the poles. You must give weights for all poles or for none. If the weights of all the poles are equal, the curve is polynomial, and therefore non-rational. 
4005
4006 **Example:** 
4007 ~~~~~
4008 # a rational 2d bezier curve (arc of circle) 
4009 2dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1 
4010
4011 # a 3d bezier curve, not rational 
4012 beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10 
4013 ~~~~~
4014
4015 @subsubsection occt_draw_6_2_8  bsplinecurve, dbsplinecurve, pbsplinecurve, dpbsplinecurve
4016
4017 Syntax:      
4018 ~~~~~
4019 bsplinecurve name degree nbknots knot, umult pole, weight 2dbsplinecurve name degree nbknots knot, umult pole, weight pbsplinecurve name degree nbknots knot, umult pole, weight(periodic) 
4020
4021 2dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic) 
4022 ~~~~~
4023
4024 Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves. 
4025
4026 A bspline curve is defined by its degree, its periodic or non-periodic nature, a table of knots and a table of poles (i.e. control points). Consequently, specify the degree, the number of knots, and for each knot, the multiplicity, for each pole, the weight. In the syntax above, the commas link the adjacent arguments which they fall between: knot and multiplicities, pole and weight. 
4027
4028 The table of knots is an increasing sequence of reals without repetition. 
4029 Multiplicities must be lower or equal to the degree of the curve. For non-periodic curves, the first and last multiplicities can be equal to degree+1. For a periodic curve, the first and last multiplicities must be equal. 
4030
4031 The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be: 
4032
4033   * For a non periodic curve: Sum of multiplicities - degree + 1
4034   * For a periodic curve: Sum of multiplicities - last multiplicity
4035
4036 **Example:** 
4037 ~~~~~
4038 # a bspline curve with 4 poles and 3 knots 
4039 bsplinecurve bc 2 3 0 3 1 1 2 3 \ 
4040 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1 
4041 # a 2d periodic circle (parameter from 0 to 2*pi !!) 
4042 dset h sqrt(3)/2 
4043 2dpbsplinecurve c 2 \ 
4044 4 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \ 
4045 0 -h/3 1 \ 
4046 0.5 -h/3 0.5 \ 
4047 0.25 h/6 1 \ 
4048 0 2*h/3 0.5 \ 
4049 -0.25 h/6 1 \ 
4050 -0.5 -h/3 0.5 \ 
4051 0 -h/3 1 
4052 ~~~~~
4053
4054 **Note** that you can create the **NURBS** subset of bspline curves and surfaces by trimming analytical curves and surfaces and executing the command *convert*. 
4055
4056
4057 @subsubsection occt_draw_6_2_9  uiso, viso
4058
4059 Syntax:      
4060 ~~~~~
4061 uiso name surface u 
4062 viso name surface u 
4063 ~~~~~
4064
4065 Creates a U or V isoparametric curve from a surface. 
4066
4067 **Example:** 
4068 ~~~~~
4069 # create a cylinder and extract iso curves 
4070
4071 cylinder c 10 
4072 uiso c1 c pi/6 
4073 viso c2 c 
4074 ~~~~~
4075
4076 **Note** that this cannot be done from offset surfaces.
4077
4078
4079 @subsubsection occt_draw_6_2_10  tod, tod
4080
4081 Syntax:      
4082 ~~~~~
4083 to3d name curve2d [plane] 
4084 to2d name curve3d [plane] 
4085 ~~~~~
4086
4087 Create respectively a 3d curve from a 2d curve and a 2d curve from a 3d curve. The transformation uses a planar surface to define the XY plane in 3d (by default this plane is the default OXYplane). **to3d** always gives a correct result, but as **to2d** is not a projection, it may surprise you. It is always correct if the curve is planar and parallel to the plane of projection. The points defining the curve are projected on the plane. A circle, however, will remain a circle and will not be changed to an ellipse. 
4088
4089 **Example:** 
4090 ~~~~~
4091 # the following commands 
4092 circle c 0 0 5 
4093 plane p -2 1 0 1 2 3 
4094 to3d c c p 
4095
4096 # will create the same circle as 
4097 circle c -2 1 0 1 2 3 5 
4098 ~~~~~
4099
4100 See also: **project** 
4101
4102
4103 @subsubsection occt_draw_6_2_11  project
4104
4105 Syntax:      
4106 ~~~~~
4107 project name curve3d surface 
4108 ~~~~~
4109
4110 Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces. 
4111
4112 If we, for example, intersect a cylinder and a plane and project the resulting ellipse on the cylinder, this will create a 2d sinusoid-like bspline. 
4113
4114 ~~~~~
4115 cylinder c 5 
4116 plane p 0 0 0 0 1 1 
4117 intersect i c p 
4118 project i2d i c 
4119 ~~~~~
4120
4121 @subsection occt_draw_6_3  Surface creation
4122
4123 The following types of surfaces exist: 
4124   * Analytical surfaces: plane, cylinder, cone, sphere, torus;
4125   * Polar surfaces: bezier surfaces, bspline surfaces;
4126   * Trimmed and Offset surfaces;
4127   * Surfaces produced by Revolution and Extrusion, created from curves with the *revsurf* and *extsurf*;
4128   * NURBS surfaces.
4129
4130 Surfaces are displayed with isoparametric lines. To show the parameterization, a small parametric line with a length 1/10 of V is displayed at 1/10 of U. 
4131
4132 @subsubsection occt_draw_6_3_1  plane
4133
4134 Syntax:      
4135 ~~~~~
4136 plane name [x y z [dx dy dz [ux uy uz]]]
4137 ~~~~~ 
4138
4139 Creates an infinite plane. 
4140
4141 A plane is the same as a 3d coordinate system, *x,y,z* is the origin, *dx, dy, dz* is the Z direction and *ux, uy, uz* is the X direction. 
4142
4143 The plane is perpendicular to Z and X is the U parameter. *dx,dy,dz* and *ux,uy,uz* must not be null or collinear. *ux,uy,uz* will be modified to be orthogonal to *dx,dy,dz*. 
4144
4145 There are default values for the coordinate system. If no arguments are given, the global system (0,0,0), (0,0,1), (1,0,0). If only the origin is given, the axes are those given by default(0,0,1), (1,0,0). If the origin and the Z axis are given, the X axis is generated perpendicular to the Z axis. 
4146
4147 Note that this definition will be used for all analytical surfaces. 
4148
4149 **Example:** 
4150 ~~~~~
4151 # a plane through the point 10,0,0 perpendicular to X 
4152 # with U direction on Y 
4153 plane p1 10 0 0 1 0 0 0 1 0 
4154
4155 # an horixontal plane with origin 10, -20, -5 
4156 plane p2 10 -20 -5 
4157 ~~~~~
4158
4159 @subsubsection occt_draw_6_3_2  cylinder
4160
4161 Syntax:      
4162 ~~~~~
4163 cylinder name [x y z [dx dy dz [ux uy uz]]] radius 
4164 ~~~~~
4165
4166 A cylinder is defined by a coordinate system, and a radius. The surface generated is an infinite cylinder with the Z axis as the axis. The U parameter is the angle starting from X going in the Y direction. 
4167
4168 **Example:** 
4169 ~~~~~
4170 # a cylinder on the default Z axis, radius 10 
4171 cylinder c1 10 
4172
4173 # a cylinder, also along the Z axis but with origin 5, 
4174 10, -3 
4175 cylinder c2 5 10 -3 10 
4176
4177 # a cylinder through the origin and on a diagonal 
4178 # with longitude pi/3 and latitude pi/4 (euler angles) 
4179 dset lo pi/3. la pi/4. 
4180 cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo) 
4181 sin(la) 10 
4182 ~~~~~
4183
4184 @subsubsection occt_draw_6_3_3  cone
4185
4186 Syntax:      
4187 ~~~~~
4188 cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius 
4189 ~~~~~
4190 Creates a cone in the infinite coordinate system along the Z-axis. The radius is that of the circle at the intersection of the cone and the XY plane. The semi-angle is the angle formed by the cone relative to the axis; it should be between –90 and 90. If the radius is 0, the vertex is the origin. 
4191
4192 **Example:** 
4193 ~~~~~
4194 # a cone at 45 degrees at the origin on Z 
4195 cone c1 45 0 
4196
4197 # a cone on axis Z with radius r1 at z1 and r2 at z2 
4198 cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1 
4199 ~~~~~
4200
4201 @subsubsection occt_draw_6_3_4  sphere
4202
4203 Syntax:      
4204 ~~~~~
4205 sphere name [x y z [dx dy dz [ux uy uz]]] radius 
4206 ~~~~~
4207
4208 Creates a sphere in the local coordinate system defined in the **plane** command. The sphere is centered at the origin. 
4209
4210 To parameterize the sphere, *u* is the angle from X to Y, between 0 and 2*pi. *v* is the angle in the half-circle at angle *u* in the plane containing the Z axis. *v* is between -pi/2 and pi/2. The poles are the points Z = +/- radius; their parameters are u,+/-pi/2 for any u in 0,2*pi. 
4211
4212 **Example:**
4213 ~~~~~ 
4214 # a sphere at the origin 
4215 sphere s1 10 
4216 # a sphere at 10 10 10, with poles on the axis 1,1,1 
4217 sphere s2 10 10 10 1 1 1 10 
4218 ~~~~~
4219
4220 @subsubsection occt_draw_6_3_5  torus
4221
4222 Syntax:      
4223 ~~~~~
4224 torus name [x y z [dx dy dz [ux uy uz]]] major minor
4225 ~~~~~ 
4226
4227 Creates a torus in the local coordinate system with the given major and minor radii. *Z* is the axis for the major radius. The major radius may be lower in value than the minor radius. 
4228
4229 To parameterize a torus, *u* is the angle from X to Y; *v* is the angle in the plane at angle *u* from the XY plane to Z. *u* and *v* are in 0,2*pi. 
4230
4231 **Example:** 
4232 ~~~~~
4233 # a torus at the origin 
4234 torus t1 20 5 
4235
4236 # a torus in another coordinate system 
4237 torus t2 10 5 -2 2 1 0 20 5 
4238 ~~~~~
4239
4240
4241 @subsubsection occt_draw_6_3_6  beziersurf
4242
4243 Syntax:      
4244 ~~~~~
4245 beziersurf name nbupoles nbvolpes pole, [weight] 
4246 ~~~~~
4247
4248 Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions. 
4249
4250 Then give the poles in the following order: *pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles)* and *pole(nbupoles, nbvpoles)*. 
4251
4252 Weights may be omitted, but if you give one weight you must give all of them. 
4253
4254 **Example:** 
4255 ~~~~~
4256 # a non-rational degree 2,3 surface 
4257 beziersurf s 3 4 \ 
4258 0 0 0 10 0 5 20 0 0 \ 
4259 0 10 2 10 10 3 20 10 2 \ 
4260 0 20 10 10 20 20 20 20 10 \ 
4261 0 30 0 10 30 0 20 30 0 
4262 ~~~~~
4263
4264 @subsubsection occt_draw_6_3_7   bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf
4265
4266 Syntax:     
4267 ~~~~~
4268 bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot 
4269 vmult ... x y z w ... 
4270 upbsplinesurf ... 
4271 vpbsplinesurf ... 
4272 uvpbsplinesurf ... 
4273 ~~~~~
4274
4275 * **bsplinesurf** generates bspline surfaces;
4276 * **upbsplinesurf** creates a bspline surface periodic in u; 
4277 * **vpbsplinesurf** creates one periodic in v; 
4278 * **uvpbsplinesurf** creates one periodic in uv. 
4279
4280 The syntax is similar to the *bsplinecurve* command. First give the degree in u and the knots in u with their multiplicities, then do the same in v. The poles follow. The number of poles is the product of the number in u and the number in v. 
4281
4282 See *bsplinecurve* to compute the number of poles, the poles are first given in U as in the *beziersurf* command. You must give weights if the surface is rational. 
4283
4284 **Example:** 
4285 ~~~~~
4286 # create a bspline surface of degree 1 2 
4287 # with two knots in U and three in V 
4288 bsplinesurf s \ 
4289 1 2 0 2 1 2 \ 
4290 2 3 0 3 1 1 2 3 \ 
4291 0 0 0 1 10 0 5 1 \ 
4292 0 10 2 1 10 10 3 1 \ 
4293 0 20 10 1 10 20 20 1 \ 
4294 0 30 0 1 10 30 0 1 
4295 ~~~~~
4296
4297
4298 @subsubsection occt_draw_6_3_8  trim, trimu, trimv
4299
4300 Syntax:      
4301 ~~~~~
4302 trim newname name [u1 u2 [v1 v2]] 
4303 trimu newname name 
4304 trimv newname name 
4305 ~~~~~
4306
4307 The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package. 
4308 * *trim* creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface.
4309 * *trimu* creates a u-trimmed surface, 
4310 * *trimv* creates a v-trimmed surface. 
4311
4312 After an initial trim, a second execution with no parameters given recreates the basis curve. The curves can be either 2d or 3d. If the trimming parameters decrease and if the curve or surface is not periodic, the direction is reversed. 
4313
4314 **Note** that a trimmed curve or surface contains a copy of the basis geometry: modifying that will not modify the trimmed geometry. Trimming trimmed geometry will not create multiple levels of trimming. The basis geometry will be used. 
4315
4316 **Example:** 
4317 ~~~~~
4318 # create a 3d circle 
4319 circle c 0 0 0 10 
4320
4321 # trim it, use the same variable, the original is 
4322 deleted 
4323 trim c c 0 pi/2 
4324
4325 # the original can be recovered! 
4326 trim orc c 
4327
4328 # trim again 
4329 trim c c pi/4 pi/2 
4330
4331 # the original is not the trimmed curve but the basis 
4332 trim orc c 
4333
4334 # as the circle is periodic, the two following commands 
4335 are identical 
4336 trim cc c pi/2 0 
4337 trim cc c pi/2 2*pi 
4338
4339 # trim an infinite cylinder 
4340 cylinder cy 10 
4341 trimv cy cy 0 50 
4342 ~~~~~
4343
4344 @subsubsection occt_draw_6_3_9  offset
4345
4346 Syntax:      
4347 ~~~~~
4348 offset name basename distance [dx dy dz]
4349 ~~~~~ 
4350
4351 Creates offset curves or surfaces at a given distance from a basis curve or surface. Offset curves and surfaces are classes from the *Geom *package. 
4352
4353 The curve can be a 2d or a 3d curve. To compute the offsets for a 3d curve, you must also give a vector *dx,dy,dz*. For a planar curve, this vector is usually the normal to the plane containing the curve. 
4354
4355 The offset curve or surface copies the basic geometry, which can be modified later. 
4356
4357 **Example:** 
4358 ~~~~~
4359 # graphic demonstration that the outline of a torus 
4360 # is the offset of an ellipse 
4361 smallview +X+Y 
4362 dset angle pi/6 
4363 torus t 0 0 0 0 cos(angle) sin(angle) 50 20 
4364 fit 
4365 ellipse e 0 0 0 50 50*sin(angle) 
4366 # note that the distance can be negative 
4367 offset l1 e 20 0 0 1 
4368 ~~~~~
4369
4370 @subsubsection occt_draw_6_3_10  revsurf
4371
4372 Syntax:      
4373 ~~~~~
4374 revsurf name curvename x y z dx dy dz
4375 ~~~~~ 
4376
4377 Creates a surface of revolution from a 3d curve. 
4378
4379 A surface of revolution or revolved surface is obtained by rotating a curve (called the *meridian*) through a complete revolution about an axis (referred to as the *axis of revolution*). The curve and the axis must be in the same plane (the *reference plane* of the surface). Give the point of origin x,y,z and the vector dx,dy,dz to define the axis of revolution. 
4380
4381 To parameterize a surface of revolution: u is the angle of rotation around the axis. Its origin is given by the position of the meridian on the surface. v is the parameter of the meridian. 
4382
4383 **Example:** 
4384 ~~~~~
4385 # another way of creating a torus like surface 
4386 circle c 50 0 0 20 
4387 revsurf s c 0 0 0 0 1 0 
4388 ~~~~~
4389
4390 @subsubsection occt_draw_6_3*11  extsurf
4391
4392 Syntax:      
4393 ~~~~~
4394 extsurf newname curvename dx dy dz 
4395 ~~~~~
4396
4397 Creates a surface of linear extrusion from a 3d curve. The basis curve is swept in a given direction,the *direction of extrusion* defined by a vector. 
4398
4399 In the syntax, *dx,dy,dz* gives the direction of extrusion. 
4400
4401 To parameterize a surface of extrusion: *u* is the parameter along the extruded curve; the *v* parameter is along the direction of extrusion. 
4402
4403 **Example:** 
4404 ~~~~~
4405 # an elliptic cylinder 
4406 ellipse e 0 0 0 10 5 
4407 extsurf s e 0 0 1 
4408 # to make it finite 
4409 trimv s s 0 10 
4410 ~~~~~
4411
4412 @subsubsection occt_draw_6_3_12  convert
4413
4414 Syntax:      
4415 ~~~~~
4416 convert newname name 
4417 ~~~~~
4418
4419 Creates a 2d or 3d NURBS curve or a NURBS surface from any 2d curve, 3d curve or surface. In other words, conics, beziers and bsplines are turned into NURBS. Offsets are not processed.
4420  
4421 **Example:** 
4422 ~~~~~
4423 # turn a 2d arc of a circle into a 2d NURBS 
4424 circle c 0 0 5 
4425 trim c c 0 pi/3 
4426 convert c1 c 
4427
4428 # an easy way to make a planar bspline surface 
4429 plane p 
4430 trim p p -1 1 -1 1 
4431 convert p1 p 
4432 ~~~~~
4433
4434 **Note** that offset curves and surfaces are not processed by this command.
4435
4436 @subsection occt_draw_6_4  Curve and surface modifications
4437
4438 Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines. 
4439
4440 General modifications: 
4441
4442   * Reversing the parametrization: **reverse**, **ureverse**, **vreverse**
4443
4444 Modifications for both bezier curves and bsplines: 
4445
4446   * Exchanging U and V on a surface: **exchuv**
4447   * Segmentation: **segment**, **segsur**
4448   * Increasing the degree: **incdeg**, **incudeg**, **incvdeg**
4449   * Moving poles: **cmovep**, **movep**, **movecolp**, **moverowp**
4450
4451 Modifications for bezier curves: 
4452
4453   * Adding and removing poles: **insertpole**, **rempole**, **remcolpole**, **remrowpole**
4454
4455 Modifications for bspline: 
4456
4457   * Inserting and removing knots: **insertknot**, **remknot**, **insertuknot**, **remuknot**, **insetvknot**, **remvknot**
4458   * Modifying periodic curves and surfaces: **setperiodic**, **setnotperiodic**, **setorigin**, **setuperiodic**, **setunotperiodic**, **setuorigin**, **setvperiodic**, **setvnotperiodic**, **setvorigin**
4459
4460
4461
4462 @subsubsection occt_draw_6_4_1  reverse, ureverse, vreverse
4463
4464
4465 Syntax:            
4466 ~~~~~
4467 reverse curvename 
4468 ureverse surfacename 
4469 vreverse surfacename 
4470 ~~~~~
4471
4472 The **reverse** command reverses the parameterization and inverses the orientation of a 2d or 3d curve. Note that the geometry is modified. To keep the curve or the surface, you must copy it before modification. 
4473
4474 **ureverse** or **vreverse** reverse the u or v parameter of a surface. Note that the new parameters of the curve may change according to the type of curve. For instance, they will change sign on a line or stay 0,1 on a bezier. 
4475
4476 Reversing a parameter on an analytical surface may create an indirect coordinate system. 
4477
4478 **Example:** 
4479 ~~~~~
4480 # reverse a trimmed 2d circle 
4481 circle c 0 0 5 
4482 trim c c pi/4 pi/2 
4483 reverse c 
4484
4485 # dumping c will show that it is now trimmed between 
4486 # 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4 
4487 ~~~~~
4488
4489 @subsubsection occt_draw_6_4_2  exchuv
4490
4491 Syntax:                 
4492 ~~~~~
4493 exchuv surfacename 
4494 ~~~~~
4495
4496 For a bezier or bspline surface this command exchanges the u and v parameters. 
4497
4498 **Example:** 
4499 ~~~~~
4500 # exchanging u and v on a spline (made from a cylinder) 
4501 cylinder c 5 
4502 trimv c c 0 10 
4503 convert c1 c 
4504 exchuv c1 
4505 ~~~~~
4506
4507 @subsubsection occt_draw_6_4_3  segment, segsur
4508
4509 Syntax:                  
4510 ~~~~~
4511 segment curve Ufirst Ulast 
4512 segsur surface Ufirst Ulast Vfirst Vlast 
4513 ~~~~~
4514
4515 **segment** and **segsur** segment a bezier curve and a bspline curve or surface respectively. 
4516
4517 These commands modify the curve to restrict it between the new parameters: *Ufirst*, the starting point of the modified curve, and *Ulast*, the end point. *Ufirst* is less than *Ulast*. 
4518
4519 This command must not be confused with **trim** which creates a new geometry. 
4520
4521 **Example:** 
4522 ~~~~~
4523 # segment a bezier curve in half 
4524 beziercurve c 3 0 0 0 10 0 0 10 10 0 
4525 segment c ufirst ulast 
4526 ~~~~~
4527
4528 @subsubsection occt_draw_6_4_4  iincudeg, incvdeg
4529
4530 Syntax:      
4531 ~~~~~
4532 incudeg surfacename newdegree 
4533 incvdeg surfacename newdegree 
4534 ~~~~~
4535
4536 **incudeg** and **incvdeg** increase the degree in the U or V parameter of a bezier or bspline surface.
4537  
4538 **Example:** 
4539 ~~~~~
4540 # make a planar bspline and increase the degree to 2 3 
4541 plane p 
4542 trim p p -1 1 -1 1 
4543 convert p1 p 
4544 incudeg p1 2 
4545 incvdeg p1 3 
4546 ~~~~~
4547
4548 **Note** that the geometry is modified.
4549
4550
4551 @subsubsection occt_draw_6_4_5  cmovep, movep, movecolp, moverowp
4552
4553 Syntax:      
4554 ~~~~~
4555 cmovep curve index dx dy [dz] 
4556 movep surface uindex vindex dx dy dz 
4557 movecolp surface uindex dx dy dz 
4558 moverowp surface vindex dx dy dz 
4559 ~~~~~
4560
4561 **move** methods translate poles of a bezier curve, a bspline curve or a bspline surface. 
4562 * **cmovep** and **movep** translate one pole with a given index. 
4563 * **movecolp** and **moverowp** translate a whole column (expressed by the *uindex*) or row (expressed by the *vindex*) of poles. 
4564
4565 **Example:** 
4566 ~~~~~
4567 # start with a plane 
4568 # transform to bspline, raise degree and add relief 
4569 plane p 
4570 trim p p -10 10 -10 10 
4571 convert p1 p 
4572 incud p1 2 
4573 incvd p1 2 
4574 movecolp p1 2 0 0 5 
4575 moverowp p1 2 0 0 5 
4576 movep p1 2 2 0 0 5 
4577 ~~~~~
4578
4579 @subsubsection occt_draw_6_4_6  insertpole, rempole, remcolpole, remrowpole
4580
4581 Syntax:                  
4582 ~~~~~
4583 insertpole curvename index x y [z] [weight] 
4584 rempole curvename index 
4585 remcolpole surfacename index 
4586 remrowpole surfacename index
4587 ~~~~~ 
4588
4589 **insertpole** inserts a new pole into a 2d or 3d bezier curve. You may add a weight for the pole. The default value for the weight is 1. The pole is added at the position after that of the index pole. Use an index 0 to insert the new pole before the first one already existing in your drawing. 
4590
4591 **rempole** removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves. 
4592
4593 **remcolpole** and **remrowpole** remove a column or a row of poles from a bezier surface. A column is in the v direction and a row in the u direction The resulting degree must be at least 1; i.e there will be two rows and two columns left. 
4594
4595 **Example:** 
4596 ~~~~~
4597 # start with a segment, insert a pole at end 
4598 # then remove the central pole 
4599 beziercurve c 2 0 0 0 10 0 0 
4600 insertpole c 2 10 10 0 
4601 rempole c 2 
4602 ~~~~~
4603
4604 @subsubsection occt_draw_6_4_7  insertknot, insertuknot, insertvknot
4605
4606 Syntax:                  
4607 ~~~~~
4608 insertknot name knot [mult = 1] [knot mult ...] 
4609 insertuknot surfacename knot mult 
4610 insertvknot surfacename knot mult 
4611 ~~~~~
4612
4613 **insertknot** inserts knots in the knot sequence of a bspline curve. You must give a knot value and a target multiplicity. The default multiplicity is 1. If there is already a knot with the given value and a multiplicity lower than the target one, its multiplicity will be raised. 
4614
4615 **insertuknot** and **insertvknot** insert knots in a surface. 
4616
4617 **Example:** 
4618 ~~~~~
4619 # create a cylindrical surface and insert a knot 
4620 cylinder c 10 
4621 trim c c 0 pi/2 0 10 
4622 convert c1 c 
4623 insertuknot c1 pi/4 1 
4624 ~~~~~
4625
4626 @subsubsection occt_draw_6_4_8  remknot, remuknot, remvknot
4627
4628 Syntax:      
4629 ~~~~~
4630 remknot index [mult] [tol] 
4631 remuknot index [mult] [tol] 
4632 remvknot index [mult] [tol] 
4633 ~~~~~
4634
4635 **remknot** removes a knot from the knot sequence of a curve or a surface. Give the index of the knot and optionally, the target multiplicity. If the target multiplicity is not 0, the multiplicity of the knot will be lowered. As the curve may be modified, you are allowed to set a tolerance to control the process. If the tolerance is low, the knot will only be removed if the curve will not be modified. 
4636
4637 By default, if no tolerance is given, the knot will always be removed. 
4638
4639 **Example:** 
4640 ~~~~~
4641 # bspline circle, remove a knot 
4642 circle c 0 0 5 
4643 convert c1 c 
4644 incd c1 5 
4645 remknot c1 2 
4646 ~~~~~
4647
4648 **Note** that Curves or Surfaces may be modified.
4649
4650
4651 @subsubsection occt_draw_6_4_9  setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic
4652
4653 Syntax:      
4654 ~~~~~
4655 setperiodic curve 
4656 setnotperiodic curve 
4657 setuperiodic surface 
4658 setunotperiodic surface 
4659 setvperiodic surface 
4660 setvnotperiodic surface
4661 ~~~~~ 
4662
4663 **setperiodic** turns a bspline curve into a periodic bspline curve; the knot vector stays the same and excess poles are truncated. The curve may be modified if it has not been closed. **setnotperiodic** removes the periodicity of a periodic curve. The pole table mau be modified. Note that knots are added at the beginning and the end of the knot vector and the multiplicities are knots set to degree+1 at the start and the end. 
4664
4665 **setuperiodic** and **setvperiodic** make the u or the v parameter of bspline surfaces periodic; **setunotperiodic**, and **setvnotperiodic** remove periodicity from the u or the v parameter of bspline surfaces. 
4666
4667 **Example:** 
4668 ~~~~~
4669 # a circle deperiodicized 
4670 circle c 0 0 5 
4671 convert c1 c 
4672 setnotperiodic c1 
4673 ~~~~~
4674
4675 @subsubsection occt_draw_6_4_10  setorigin, setuorigin, setvorigin
4676
4677 Syntax:      
4678 ~~~~~
4679 setorigin curvename index 
4680 setuorigin surfacename index 
4681 setuorigin surfacename index 
4682 ~~~~~
4683
4684 These commands change the origin of the parameters on periodic curves or surfaces. The new origin must be an existing knot. To set an origin other than an existing knot, you must first insert one with the *insertknot* command. 
4685
4686 **Example:** 
4687 ~~~~~
4688 # a torus with new U and V origins 
4689 torus t 20 5 
4690 convert t1 t 
4691 setuorigin t1 2 
4692 setvorigin t1 2
4693 ~~~~~ 
4694
4695
4696 @subsection occt_draw_6_5  Transformations
4697
4698 Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling. 
4699
4700 @subsubsection occt_draw_6_5_1  translate, dtranslate
4701
4702 Syntax:                  
4703 ~~~~~
4704 translate name [names ...] dx dy dz 
4705 2dtranslate name [names ...] dx dy 
4706 ~~~~~
4707
4708 The **Translate** command translates 3d points, curves and surfaces along a vector *dx,dy,dz*. You can translate more than one object with the same command. 
4709
4710 For 2d points or curves, use the **2dtranslate** command. 
4711
4712 **Example:** 
4713 ~~~~~
4714 # 3d tranlation 
4715 point p 10 20 30 
4716 circle c 10 20 30 5 
4717 torus t 10 20 30 5 2 
4718 translate p c t 0 0 15
4719 ~~~~~
4720  
4721 *NOTE* 
4722 *Objects are modified by this command.* 
4723
4724 @subsubsection occt_draw_6_5_2  rotate, 2drotate
4725
4726 Syntax:      
4727 ~~~~~
4728 rotate name [name ...] x y z dx dy dz angle 
4729 2drotate name [name ...] x y angle
4730 ~~~~~ 
4731
4732 The **rotate** command rotates a 3d point curve or surface. You must give an axis of rotation with a point *x,y,z*, a vector *dx,dy,dz* and an angle in degrees. 
4733
4734 For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative. 
4735
4736 **Example:** 
4737 ~~~~~
4738 # make a helix of circles. create a scripte file with 
4739 this code and execute it using **source**. 
4740 circle c0 10 0 0 3 
4741 for {set i 1} {$i = 10} {incr i} { 
4742 copy c[expr $i-1] c$i 
4743 translate c$i 0 0 3 
4744 rotate c$i 0 0 0 0 0 1 36 
4745
4746 ~~~~~
4747
4748 @subsubsection occt_draw_6_5_3  pmirror, lmirror, smirror, dpmirror, dlmirror
4749
4750 Syntax:      
4751 ~~~~~
4752 pmirror name [names ...] x y z 
4753 lmirror name [names ...] x y z dx dy dz 
4754 smirror name [names ...] x y z dx dy dz 
4755 2dpmirror name [names ...] x y 
4756 2dlmirror name [names ...] x y dx dy 
4757 ~~~~~
4758
4759 The mirror commands perform a mirror transformation of 2d or 3d geometry. 
4760
4761 * **pmirror** is the point mirror, mirroring 3d curves and surfaces about a point of symmetry. 
4762 * **lmirror** is the line mirror commamd, mirroring 3d curves and surfaces about an axis of symmetry.
4763 * **smirror** is the surface mirror, mirroring 3d curves and surfaces about a plane of symmetry. In the last case, the plane of symmetry is perpendicular to dx,dy,dz. 
4764 * **2dpmirror** is the point mirror in 2D.
4765 * **2dlmirror** is the axis symmetry mirror in 2D.
4766
4767 **Example:** 
4768 ~~~~~
4769 # build 3 images of a torus 
4770 torus t 10 10 10 1 2 3 5 1 
4771 copy t t1 
4772 pmirror t1 0 0 0 
4773 copy t t2 
4774 lmirror t2 0 0 0 1 0 0 
4775 copy t t3 
4776 smirror t3 0 0 0 1 0 0 
4777 ~~~~~
4778
4779 @subsubsection occt_draw_6_5_4  pscale, dpscale
4780
4781 Syntax:                  
4782 ~~~~~
4783 pscale name [name ...] x y z s 
4784 2dpscale name [name ...] x y s 
4785 ~~~~~
4786
4787 The **pscale** and **2dpscale** commands transform an object by point scaling. You must give the center and the scaling factor. Because other scalings modify the type of the object, they are not provided. For example, a sphere may be transformed into an ellipsoid. Using a scaling factor of -1 is similar to using **pmirror**.
4788
4789  
4790 **Example:** 
4791 ~~~~~
4792 # double the size of a sphere 
4793 sphere s 0 0 0 10 
4794 pscale s 0 0 0 2 
4795 ~~~~~
4796
4797 @subsection occt_draw_6_6  Curve and surface analysis
4798
4799 **Draw** provides methods to compute information about curves and surfaces: 
4800
4801   * **coord** to find the coordinates of a point.
4802   * **cvalue** and **2dcvalue** to compute points and derivatives on curves.
4803   * **svalue** to compute points and derivatives on a surface.
4804   * **localprop** and **minmaxcurandif** to compute the curvature on a curve.
4805   * **parameters** to compute (u,v) values for a point on a surface.
4806   * **proj** and **2dproj** to project a point on a curve or a surface.
4807   * **surface_radius** to compute the curvature on a surface.
4808
4809 @subsubsection occt_draw_6_6_1  coord
4810
4811 Syntax:            
4812 ~~~~~
4813 coord P x y [z] 
4814 ~~~~~
4815
4816 Sets the x, y (and optionally z) coordinates of the point P. 
4817
4818 **Example:** 
4819 ~~~~~
4820 # translate a point 
4821 point p 10 5 5 
4822 translate p 5 0 0 
4823 coord p x y z 
4824 # x value is 15 
4825 ~~~~~
4826
4827
4828 @subsubsection occt_draw_6_6_2   cvalue, 2dcvalue
4829
4830 Syntax:      
4831 ~~~~~
4832 cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]] 
4833 2dcvalue curve U x y [d1x d1y [d2x d2y]] 
4834 ~~~~~
4835
4836 For a curve at a given parameter, and depending on the number of arguments, **cvalue** computes the coordinates in *x,y,z*, the first derivative in *d1x,d1y,d1z* and the second derivative in *d2x,d2y,d2z*. 
4837
4838 **Example:**
4839
4840 Let on a bezier curve at parameter 0 the point is the first pole; the first derivative is the vector to the second pole multiplied by the degree; the second derivative is the difference first to the second pole, second to the third pole multipied by *degree-1* : 
4841
4842 ~~~~~
4843 2dbeziercurve c 4 0 0 1 1 2 1 3 0 
4844 2dcvalue c 0 x y d1x d1y d2x d2y 
4845
4846 # values of x y d1x d1y d2x d2y 
4847 # are 0 0 3 3 0 -6 
4848 ~~~~~
4849
4850 @subsubsection occt_draw_6_6_3  svalue
4851
4852 Syntax: 
4853 ~~~~~
4854 svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]] 
4855 ~~~~~
4856
4857 Computes points and derivatives on a surface for a pair of parameter values. The result depends on the number of arguments. You can compute the first and the second derivatives. 
4858
4859 **Example:** 
4860 ~~~~~
4861 # display points on a sphere 
4862 sphere s 10 
4863 for {dset t 0} {[dval t] = 1} {dset t t+0.01} { 
4864 svalue s t*2*pi t*pi-pi/2 x y z 
4865 point . x y z 
4866
4867 ~~~~~
4868
4869 @subsubsection occt_draw_6_6_4  localprop, minmaxcurandinf
4870
4871 Syntax:      
4872 ~~~~~
4873 localprop curvename U 
4874 minmaxcurandinf curve
4875 ~~~~~ 
4876
4877 **localprop** computes the curvature of a curve. 
4878 **minmaxcurandinf** computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve. 
4879
4880 **Example:** 
4881 ~~~~~
4882 # show curvature at the center of a bezier curve 
4883 beziercurve c 3 0 0 0 10 2 0 20 0 0 
4884 localprop c 0.5 
4885 == Curvature : 0.02 
4886 ~~~~~
4887
4888 @subsubsection occt_draw_6_6_5  parameters
4889
4890 Syntax:      
4891 ~~~~~
4892 parameters surf/curve x y z U [V] 
4893 ~~~~~
4894
4895 Returns the parameters on the surface of the 3d point *x,y,z* in variables *u* and *v*. This command may only be used on analytical surfaces: plane, cylinder, cone, sphere and torus. 
4896
4897 **Example:** 
4898 ~~~~~
4899 # Compute parameters on a plane 
4900 plane p 0 0 10 1 1 0 
4901 parameters p 5 5 5 u v 
4902 # the values of u and v are : 0 5 
4903 ~~~~~
4904
4905 @subsubsection occt_draw_6_6_6  proj, dproj
4906
4907 Syntax:      
4908 ~~~~~
4909 proj name x y z 
4910 2dproj name xy 
4911 ~~~~~
4912
4913 Use **proj** to project a point on a 3d curve or a surface and **2dproj** for a 2d curve. 
4914
4915 The command will compute and display all points in the projection. The lines joining the point to the projections are created with the names *ext_1, ext_2, ... *
4916
4917 **Example:** 
4918
4919 Let us project a point on a torus 
4920
4921 ~~~~~
4922 torus t 20 5 
4923 proj t 30 10 7 
4924 == ext_1 ext_2 ext_3 ext_4 
4925 ~~~~~
4926
4927 @subsubsection occt_draw_6_6_7  surface_radius
4928
4929 Syntax:      
4930 ~~~~~
4931 surface_radius surface u v [c1 c2] 
4932 ~~~~~
4933
4934 Computes the main curvatures of a surface at parameters *(u,v)*. If there are extra arguments, their curvatures are stored in variables *c1* and *c2*. 
4935
4936 **Example:** 
4937
4938 Let us compute curvatures of a cylinder:
4939
4940 ~~~~~
4941 cylinder c 5 
4942 surface_radius c pi 3 c1 c2 
4943 == Min Radius of Curvature : -5 
4944 == Min Radius of Curvature : infinite 
4945 ~~~~~
4946
4947
4948 @subsection occt_draw_6_7  Intersections
4949
4950 * **intersect** computes intersections of surfaces; 
4951 * **2dintersect** computes intersections of 2d curves.
4952
4953 @subsubsection occt_draw_6_7_1  intersect
4954
4955 Syntax:      
4956 ~~~~~
4957 intersect name surface1 surface2
4958 ~~~~~ 
4959
4960 Intersects two surfaces; if there is one intersection curve it will be named *name*, if there are more than one they will be named *name_1*, *name_2*, ... 
4961
4962 **Example:** 
4963 ~~~~~
4964 # create an ellipse 
4965 cone c 45 0 
4966 plane p 0 0 40 0 1 5 
4967 intersect e c p 
4968 ~~~~~
4969
4970 @subsubsection occt_draw_6_7_2  dintersect
4971
4972 Syntax:      
4973 ~~~~~
4974 2dintersect curve1 curve2 
4975 ~~~~~
4976
4977 Displays the intersection points between two 2d curves. 
4978
4979 **Example:** 
4980 ~~~~~
4981 # intersect two 2d ellipses 
4982 ellipse e1 0 0 5 2 
4983 ellipse e2 0 0 0 1 5 2 
4984 2dintersect e1 e2 
4985 ~~~~~
4986
4987 @subsection occt_draw_6_8  Approximations
4988
4989 Draw provides command to create curves and surfaces by approximation. 
4990
4991 * **2dapprox** fits a curve through 2d points; 
4992 * **appro** fits a curve through 3d points;
4993 * **surfapp** and **grilapp** fit a surface through 3d points;
4994 * **2dinterpolate** interpolates a curve. 
4995
4996 @subsubsection occt_draw_6_8_1   appro, dapprox
4997
4998 Syntax:      
4999 ~~~~~
5000 appro result nbpoint [curve] 
5001 2dapprox result nbpoint [curve / x1 y1 x2 y2]
5002 ~~~~~ 
5003
5004 These commands fit a curve through a set of points. First give the number of points, then choose one of the three ways available to get the points. If you have no arguments, click on the points. If you have a curve argument or a list of points, the command launches computation of the points on the curve. 
5005
5006 **Example:** 
5007
5008 Let us pick points and they will be fitted 
5009
5010 ~~~~~
5011 2dapprox c 10 
5012 ~~~~~
5013
5014 @subsubsection occt_draw_6_8_2  surfapp, grilapp
5015
5016
5017 Syntax: 
5018 ~~~~~
5019 surfapp name nbupoints nbvpoints x y z .... 
5020 grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ... 
5021 ~~~~~
5022
5023 * **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints. 
5024 * **grilapp** has the same function, but the x,y coordinates of the points are on a grid starting at x0,y0 with steps dx,dy. 
5025
5026 **Example:** 
5027 ~~~~~
5028 # a surface using the same data as in the beziersurf 
5029 example sect 4.4 
5030 surfapp s 3 4 \ 
5031 0 0 0 10 0 5 20 0 0 \ 
5032 0 10 2 10 10 3 20 10 2 \ 
5033 0 20 10 10 20 20 20 20 10 \ 
5034 0 30 0 10 30 0 20 30 0 
5035 ~~~~~
5036
5037 @subsection occt_draw_6_9  Constraints
5038
5039 * **cirtang** constructs 2d circles tangent to curves;
5040 * **lintan** constructs 2d lines tangent to curves. 
5041
5042
5043 @subsubsection occt_draw_6_9_1  cirtang
5044
5045 Syntax: 
5046 ~~~~~
5047 cirtang cname curve/point/radius curve/point/radius curve/point/radius 
5048 ~~~~~
5049
5050 Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc. 
5051
5052 **Example:** 
5053 ~~~~~
5054 # a point, a line and a radius. 2 solutions 
5055 point p 0 0 
5056 line 1 10 0 -1 1 
5057 cirtang c p 1 4 
5058 == c_1 c_2 
5059 ~~~~~
5060
5061 @subsubsection occt_draw_6_9_2  lintan
5062
5063 Syntax:      
5064 ~~~~~
5065 lintan name curve curve [angle] 
5066 ~~~~~
5067
5068 Builds all 2d lines tangent to two curves. If the third angle argument is given the second curve must be a line and **lintan** will build all lines tangent to the first curve and forming the given angle with the line. The angle is given in degrees. The solutions are named *name_1*, *name_2*, etc. 
5069
5070 **Example:** 
5071 ~~~~~
5072 # lines tangent to 2 circles, 4 solutions 
5073 circle c1 -10 0 10 
5074 circle c2 10 0 5 
5075 lintan l c1 c2 
5076
5077 # lines at 15 degrees tangent to a circle and a line, 2 
5078 solutions: l1_1 l1_2 
5079 circle c1 -10 0 1 
5080 line l 2 0 1 1 
5081 lintan l1 c1 l 15 
5082 ~~~~~
5083
5084 @subsection occt_draw_6_10  Display
5085
5086 Draw provides commands to control the display of geometric objects. Some display parameters are used for all objects, others are valid for surfaces only, some for bezier and bspline only, and others for bspline only. 
5087
5088 On curves and surfaces, you can control the mode of representation with the **dmode** command. You can control the parameters for the mode with the **defle** command and the **discr** command, which control deflection and discretization respectively. 
5089
5090 On surfaces, you can control the number of isoparametric curves displayed on the surface with the **nbiso** command. 
5091
5092 On bezier and bspline curve and surface you can toggle the display of the control points with the **clpoles** and **shpoles** commands. 
5093
5094 On bspline curves and surfaces you can toggle the display of the knots with the **shknots** and **clknots** commands. 
5095
5096
5097 @subsubsection occt_draw_6_10_1  dmod, discr, defle
5098
5099 Syntax:      
5100 ~~~~~
5101 dmode name [name ...] u/d 
5102 discr name [name ...] nbintervals 
5103 defle name [name ...] deflection 
5104 ~~~~~
5105
5106 **dmod** command allows choosing the display mode for a curve or a surface. 
5107
5108 In mode *u*, or *uniform deflection*, the points are computed to keep the polygon at a distance lower than the deflection of the geometry. The deflection is set with the *defle* command. This mode involves intensive use of computational power. 
5109
5110 In *d*, or discretization mode, a fixed number of points is computed. This number is set with the *discr* command. This is the default mode. On a bspline, the fixed number of points is computed for each span of the curve. (A span is the interval between two knots). 
5111
5112 If the curve or the isolines seem to present too many angles, you can either increase the discretization or lower the deflection, depending on the mode. This will increase the number of points. 
5113
5114 **Example:** 
5115 ~~~~~
5116 # increment the number of points on a big circle 
5117 circle c 0 0 50 50 
5118 discr 100 
5119
5120 # change the mode 
5121 dmode c u 
5122 ~~~~~
5123
5124 @subsubsection occt_draw_6_10_2   nbiso
5125
5126 Syntax:      
5127 ~~~~~
5128 nbiso name [names...] nuiso nviso 
5129 ~~~~~
5130
5131 Changes the number of isoparametric curves displayed on a surface in the U and V directions. On a bspline surface, isoparametric curves are displayed by default at knot values. Use *nbiso* to turn this feature off. 
5132
5133 **Example:** 
5134
5135 Let us  display 35 meridians and 15 parallels on a sphere:
5136 ~~~~~ 
5137 sphere s 20 
5138 nbiso s 35 15 
5139 ~~~~~
5140
5141 @subsubsection occt_draw_6_10_3  clpoles, shpoles
5142
5143 Syntax:      
5144 ~~~~~
5145 clpoles name 
5146 shpoles name 
5147 ~~~~~
5148
5149 On bezier and bspline curves and surfaces, the control polygon is displayed by default: *clpoles* erases it and *shpoles* restores it. 
5150
5151 **Example:** 
5152
5153 Let us make a bezier curve and erase the poles 
5154
5155 ~~~~~
5156 beziercurve c 3 0 0 0 10 0 0 10 10 0 
5157 clpoles c 
5158 ~~~~~
5159
5160 @subsubsection occt_draw_6_10_4  clknots, shknots
5161
5162 Syntax:   
5163 ~~~~~
5164 clknots name 
5165 shknots name 
5166 ~~~~~
5167
5168 By default, knots on a bspline curve or surface are displayed with markers at the points with parametric value equal to the knots. *clknots* removes them and *shknots* restores them. 
5169
5170 **Example:** 
5171 ~~~~~
5172 # hide the knots on a bspline curve 
5173 bsplinecurve bc 2 3 0 3 1 1 2 3 \ 
5174 10 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1 
5175 clknots bc
5176 ~~~~~
5177  
5178 @section occt_draw_7 Topology commands
5179
5180 Draw provides a set of commands to test OCCT Topology libraries. The Draw commands are found in the DRAWEXE executable or in any executable including the BRepTest commands. 
5181
5182 Topology defines the relationship between simple geometric entities, which can thus be linked together to represent complex shapes. The type of variable used by Topology in Draw is the shape variable. 
5183
5184 The <a href="user_guides__modeling_data.html#occt_modat_5">different topological shapes</a> include: 
5185
5186   * **COMPOUND**: A group of any type of topological object.
5187   * **COMPSOLID**: A set of solids connected by their faces. This expands the notions of WIRE and SHELL to solids.
5188   * **SOLID**: A part of space limited by shells. It is three dimensional.
5189   * **SHELL**: A set of faces connected by their edges. A shell can be open or closed.
5190   * **FACE**: In 2d, a plane; in 3d, part of a surface. Its geometry is constrained (trimmed) by contours. It is two dimensional.
5191   * **WIRE**: A set of edges connected by their vertices. It can be open or closed depending on whether the edges are linked or not.
5192   * **EDGE**: A topological element corresponding to a restrained curve. An edge is generally limited by vertices. It has one dimension.
5193   * **VERTEX**: A topological element corresponding to a point. It has a zero dimension.
5194
5195 Shapes are usually shared. **copy** will create a new shape which shares its representation with the original. Nonetheless, two shapes sharing the same topology can be moved independently (see the section on **transformation**). 
5196
5197 The following topics are covered in the eight sections of this chapter: 
5198
5199   * Basic shape commands to handle the structure of shapes and control the display.
5200   * Curve and surface topology, or methods to create topology from geometry and vice versa.
5201   * Primitive construction commands: box, cylinder, wedge etc.
5202   * Sweeping of shapes.
5203   * Transformations of shapes: translation, copy, etc.
5204   * Topological operations, or booleans.
5205   * Drafting and blending.
5206   * Analysis of shapes.
5207
5208
5209 @subsection occt_draw_7_1  Basic topology
5210
5211 The set of basic commands allows simple operations on shapes, or step-by-step construction of objects. These commands are useful for analysis of shape structure and include: 
5212
5213   * **isos** and **discretisation** to control display of shape faces by isoparametric curves .
5214   * **orientation**, **complement** and **invert** to modify topological attributes such as orientation.
5215   * **explode**, **exwire** and **nbshapes** to analyze the structure of a shape.
5216   * **emptycopy**, **add**, **compound** to create shapes by stepwise construction.
5217
5218 In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges: 
5219
5220   * a red edge is an isolated edge, which belongs to no faces.
5221   * a green edge is a free boundary edge, which belongs to one face,
5222   * a yellow edge is a shared edge, which belongs to at least two faces.
5223
5224
5225 @subsubsection occt_draw_7_1_1  isos, discretisation
5226
5227 Syntax:                  
5228 ~~~~~
5229 isos [name ...][nbisos] 
5230 discretisation nbpoints
5231 ~~~~~
5232  
5233 Determines or changes the number of isoparametric curves on shapes. 
5234
5235 The same number is used for the u and v directions. With no arguments, *isos* prints the current default value. To determine, the number of isos for a shape, give it name as the first argument. 
5236
5237 *discretisation* changes the default number of points used to display the curves. The default value is 30. 
5238
5239 **Example:** 
5240 ~~~~~
5241 # Display only the edges (the wireframe) 
5242 isos 0 
5243 ~~~~~
5244
5245 **Warning**: don’t confuse *isos* and *discretisation* with the geometric commands *nbisos* and *discr*. 
5246
5247
5248 @subsubsection occt_draw_7_1_2  orientation, complement, invert, normals, range
5249
5250 Syntax:      
5251 ~~~~~
5252 orientation name [name ...] F/R/E/I 
5253 complement name [name ...] 
5254 invert name 
5255 normals s (length = 10), disp normals 
5256 range name value value 
5257 ~~~~~
5258
5259 * **orientation** assigns the orientation of shapes - simple and complex - to one of the following four values: *FORWARD, REVERSED, INTERNAL, EXTERNAL*. 
5260 * **complement** changes the current orientation of shapes to its complement, *FORWARD - REVERSED, INTERNAL - EXTERNAL*. 
5261 * **invert** creates a new shape which is a copy of the original with the orientation all subshapes reversed. For example, it may be useful to reverse the normals of a solid. 
5262 * *normals** returns the assignment of colors to orientation values. 
5263 * **range** defines the length of a selected edge by defining the values of a starting point and an end point.
5264  
5265 **Example:** 
5266 ~~~~~
5267 # to invert normals of a box 
5268 box b 10 20 30 
5269 normals b 5 
5270 invert b 
5271 normals b 5 
5272
5273 # to assign a value to an edge 
5274 box b1 10 20 30 
5275 # to define the box as edges 
5276 explode b1 e 
5277 b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12 
5278 # to define as an edge 
5279 makedge e 1 
5280 # to define the length of the edge as starting from 0 
5281 and finishing at 1 
5282 range e 0 1 
5283 ~~~~~
5284
5285 @subsubsection occt_draw_7_1_3  explode, exwire, nbshapes
5286
5287 Syntax:      
5288 ~~~~~
5289 explode name [C/So/Sh/F/W/E/V] 
5290 exwire name 
5291 nbshapes name 
5292 ~~~~~
5293
5294 **explode** extracts subshapes from an entity. The subshapes will be named *name_1*, *name_2*, ... Note that they are not copied but shared with the original. 
5295
5296 With name only, **explode** will extract the first sublevel of shapes: the shells of a solid or the edges of a wire, for example. With one argument, **explode** will extract all subshapes of that type: *C* for compounds, *So* for solids, *Sh* for shells, *F* for faces, *W* for wires, *E* for edges, *V* for vertices. 
5297
5298 **exwire** is a special case of **explode** for wires, which extracts the edges in an ordered way, if possible. Each edge, for example, is connected to the following one by a vertex. 
5299
5300 **nbshapes** counts the number of shapes of each type in an entity. 
5301
5302 **Example:** 
5303 ~~~~~
5304 # on a box 
5305 box b 10 20 30 
5306
5307 # whatis returns the type and various information 
5308 whatis b 
5309 = b is a shape SOLID FORWARD Free Modified 
5310
5311 # make one shell 
5312 explode b 
5313 whatis b_1 
5314 = b_1 is a shape SHELL FORWARD Modified Orientable 
5315 Closed 
5316
5317 # extract the edges b_1, ... , b_12 
5318 explode b e 
5319 ==b_1 ... b_12 
5320
5321 # count subshapes 
5322 nbshapes b 
5323 == 
5324 Number of shapes in b 
5325 VERTEX : 8 
5326 EDGE : 12 
5327 WIRE : 6 
5328 FACE : 6 
5329 SHELL : 1 
5330 SOLID : 1 
5331 COMPSOLID : 0 
5332 COMPOUND : 0 
5333 SHAPE : 34 
5334 ~~~~~
5335
5336 @subsubsection occt_draw_7_1_4  emptycopy, add, compound
5337
5338 Syntax:                  
5339 ~~~~~
5340 emptycopy [newname] name 
5341 add name toname 
5342 compound [name ...] compoundname 
5343 ~~~~~
5344
5345 **emptycopy** returns an empty shape with the same orientation, location, and geometry as the target shape, but with no sub-shapes. If the newname argument is not given, the new shape is stored with the same name. This command is used to modify a frozen shape. A frozen shape is a shape used by another one. To modify it, you must emptycopy it. Its subshape may be reinserted with the **add** command. 
5346
5347 **add** inserts shape *C* into shape *S*. Verify that *C* and *S* reference compatible types of objects: 
5348   * Any *Shape* can be added to a *Compound*.
5349   * Only a *Solid* can be added to a *CompSolid*.
5350   * Only a *Shell* can *Edge* or a *Vertex* can be added into a *Solid*.
5351   * Only a *Face* can be added to a *Shell*.
5352   * Only a *Wire* and *Vertex* can be added in a *Solid*.
5353   * Only an *Edge* can be added to a *Wire*.
5354   * Only a *Vertex* can be added to an *Edge*.
5355   * Nothing can be added to a *Vertex*.
5356
5357 **emptycopy** and **add** should be used with care. 
5358
5359 On the other hand, **compound** is a safe way to achieve a similar result. It creates a compound from shapes. If no shapes are given, the compound is empty. 
5360
5361 **Example:** 
5362 ~~~~~
5363 # a compound with three boxes 
5364 box b1 0 0 0 1 1 1 
5365 box b2 3 0 0 1 1 1 
5366 box b3 6 0 0 1 1 1 
5367 compound b1 b2 b3 c 
5368 ~~~~~
5369
5370 @subsubsection occt_draw_7_1_5  checkshape
5371
5372 Syntax:                  
5373 ~~~~~
5374 checkshape [-top] shape [result] [-short] 
5375 ~~~~~
5376
5377 Where: 
5378 * *top* – optional parameter, which allows checking only topological validity of a shape. 
5379 * *shape*– the only required parameter which represents the name of the shape to check. 
5380 * *result* – optional parameter which is the prefix of the output shape names. 
5381 * *short* – a short description of the check. 
5382
5383 **checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape. 
5384
5385 **Example:** 
5386 ~~~~~
5387 # checkshape returns a comment valid or invalid 
5388 box b1 0 0 0 1 1 1 
5389 checkshape b1 
5390 # returns the comment 
5391 this shape seems to be valid 
5392 ~~~~~
5393
5394 **Note** that this test is performed using the tolerance set in the algorithm.
5395
5396
5397 @subsection occt_draw_7_2  Curve and surface topology
5398
5399 This group of commands is used to create topology from shapes and to extract shapes from geometry. 
5400
5401   * To create vertices, use the **vertex** command.
5402   * To create edges use, the **edge**, **mkedge** commands.
5403   * To create wires, use the **wire**, **polyline**, **polyvertex** commands.
5404   * To create faces, use the **mkplane**, **mkface** commands.
5405   * To extract the geometry from edges or faces, use the **mkcurve** and **mkface** commands.
5406   * To extract the 2d curves from edges or faces, use the **pcurve** command.
5407
5408
5409 @subsubsection occt_draw_7_2_1  vertex
5410
5411 Syntax:      
5412 ~~~~~
5413 vertex name [x y z / p edge] 
5414 ~~~~~
5415
5416 Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge. 
5417
5418 **Example:** 
5419 ~~~~~
5420 vertex v1 10 20 30 
5421 ~~~~~
5422
5423 @subsubsection occt_draw_7_2_2  edge, mkedge, uisoedge, visoedge
5424
5425 Syntax:      
5426 ~~~~~
5427 edge name vertex1 vertex2 
5428 mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] 
5429 uisoedge edge face u v1 v2 
5430 visoedge edge face v u1 u2 
5431 ~~~~~
5432
5433 * **edge** creates a straight line edge between two vertices. 
5434 * **mkedge** generates edges from curves<.Two parameters can be given for the vertices: the first and last parameters of the curve are given by default. Vertices can also be given with their parameters, this option allows blocking the creation of new vertices. If the parameters of the vertices are not given, they are computed by projection on the curve. Instead of a 3d curve, a 2d curve and a surface can be given. 
5435
5436 **Example:** 
5437 ~~~~~
5438 # straight line edge 
5439 vertex v1 10 0 0 
5440 vertex v2 10 10 0 
5441 edge e1 v1 v2 
5442
5443 # make a circular edge 
5444 circle c 0 0 0 5 
5445 mkedge e2 c 0 pi/2 
5446
5447 # A similar result may be achieved by trimming the curve 
5448 # The trimming is removed by mkedge 
5449 trim c c 0 pi/2 
5450 mkedge e2 c 
5451 ~~~~~
5452
5453 * **visoedge** and **uisoedge** are commands that generate a *uiso* parameter edge or a *viso* parameter edge. 
5454
5455 **Example:** 
5456 ~~~~~
5457 # to create an edge between v1 and v2 at point u 
5458 # to create the example plane 
5459 plane p 
5460 trim p p 0 1 0 1 
5461 convert p p 
5462 incudeg p 3 
5463 incvdeg p 3 
5464 movep p 2 2 0 0 1 
5465 movep p 3 3 0 0 0.5 
5466 mkface p p 
5467 # to create the edge in the plane at the u axis point 
5468 0.5, and between the v axis points v=0.2 and v =0.8 
5469 uisoedge e p 0.5 0.20 0.8 
5470 ~~~~~
5471
5472 @subsubsection occt_draw_7_2_3  wire, polyline, polyvertex
5473
5474 Syntax:      
5475 ~~~~~
5476 wire wirename e1/w1 [e2/w2 ...] 
5477 polyline name x1 y1 z1 x2 y2 z2 ... 
5478 polyvertex name v1 v2 ... 
5479 ~~~~~
5480
5481 **wire** creates a wire from edges or wires. The order of the elements should ensure that the wire is connected, and vertex locations will be compared to detect connection. If the vertices are different, new edges will be created to ensure topological connectivity. The original edge may be copied in the new one. 
5482
5483 **polyline** creates a polygonal wire from point coordinates. To make a closed wire, you should give the first point again at the end of the argument list. 
5484
5485 **polyvertex** creates a polygonal wire from vertices. 
5486
5487 **Example:** 
5488 ~~~~~
5489 # create two polygonal wires 
5490 # glue them and define as a single wire 
5491 polyline w1 0 0 0 10 0 0 10 10 0 
5492 polyline w2 10 10 0 0 10 0 0 0 0 
5493 wire w w1 w2 
5494 ~~~~~
5495
5496 @subsubsection occt_draw_7_2_4  profile
5497
5498 Syntax       
5499 ~~~~~
5500 profile name [code values] [code values] ... 
5501 ~~~~~
5502
5503
5504 **profile** builds a profile in a plane using a moving point and direction. By default, the profile is closed and a face is created. The original point is 0 0, and direction is 1 0 situated in the XY plane. 
5505
5506
5507 | **Code**     |    **Values **    |       **Action** |
5508 | :------------ | :------------- | :---------------- |
5509 | O                 |                     X Y Z      |          Sets the origin of the plane |
5510 | P                 |         DX DY DZ UX UY UZ  |  Sets the normal and X of the plane |
5511 | F                 |                      X Y    |               Sets the first point |
5512 | X                 |                      DX      |             Translates a point along X |
5513 | Y                 |                      DY       |            Translates a point along Y |
5514 | L                 |                      DL        |            Translates a point along direction |
5515 | XX                |                    X           |           Sets point X coordinate |
5516 | YY                |                    Y           |           Sets point Y coordinate |
5517 | T                 |                      DX DY     |         Translates a point |
5518 | TT                |                     X Y        |           Sets a point |
5519 | R                 |                      Angle     |           Rotates direction |
5520 | RR                |                    Angle       |         Sets direction |
5521 | D                 |                     DX DY      |        Sets direction |
5522 | IX                |                      X         |             Intersects with vertical |
5523 | IY                |                      Y         |             Intersects with horizontal |
5524 | C                 |                Radius Angle    |      Arc of circle tangent to direction |
5525
5526
5527 Codes and values are used to define the next point or change the direction. When the profile changes from a straight line to a curve, a tangent is created. All angles are in degrees and can be negative. 
5528
5529 The point [code values] can be repeated any number of times and in any order to create the profile contour. 
5530
5531 | Suffix | Action |
5532 | :----- | :----- |
5533 | No suffix  |             Makes a closed face |
5534 | W          |               Make a closed wire |
5535 | WW         |            Make an open wire |
5536
5537 The profile shape definition is the suffix; no suffix produces a face, *w* is a closed wire, *ww* is an open wire. 
5538
5539 Code letters are not case-sensitive. 
5540
5541 **Example:** 
5542 ~~~~~
5543 # to create a trianglular plane using a vertex at the 
5544 origin, in the xy plane 
5545 profile p O 0 0 0 X 1 Y 0 x 1 y 1 
5546 ~~~~~
5547
5548 **Example:** 
5549 ~~~~~
5550 # to create a contour using the different code 
5551 possibilities 
5552
5553 # two vertices in the xy plane 
5554 profile p F 1 0 x 2 y 1 ww 
5555
5556 # to view from a point normal to the plane 
5557 top 
5558
5559 # add a circular element of 45 degrees 
5560 profile p F 1 0 x 2 y 1 c 1 45 ww 
5561
5562 # add a tangential segment with a length value 1 
5563 profile p F 1 0 x 2 y 1 c 1 45 l 1 ww 
5564
5565 # add a vertex with xy values of 1.5 and 1.5 
5566 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 ww 
5567
5568 # add a vertex with the x value 0.2, y value is constant 
5569 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 ww 
5570
5571 # add a vertex with the y value 2 x value is constant 
5572 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 yy 2 ww 
5573
5574 # add a circular element with a radius value of 1 and a circular value of 290 degrees 
5575 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 
5576
5577 # wire continues at a tangent to the intersection x = 0 
5578 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 ww 
5579
5580 # continue the wire at an angle of 90 degrees until it intersects the y axis at y= -o.3 
5581 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 r 90 ix -0.3 ww 
5582
5583 #close the wire 
5584 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 r 90 ix -0.3 w 
5585
5586 # to create the plane with the same contour 
5587 profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 yy 2 c 1 290 ix 0 r 90 ix -0.3 
5588 ~~~~~
5589
5590 @subsubsection occt_draw_7_2_5   bsplineprof
5591
5592 Syntax:      
5593 ~~~~~
5594 bsplineprof name [S face] [W WW] 
5595 ~~~~~
5596
5597 * for an edge : <digitizes> ... <mouse button 2>
5598 * to end profile : <mouse button 3>
5599
5600 Builds a profile in the XY plane from digitizes. By default the profile is closed and a face is built. 
5601
5602 **bsplineprof** creates a 2d profile from bspline curves using the mouse as the input. *MB1* creates the points, *MB2* finishes the current curve and starts the next curve, *MB3* closes the profile. 
5603
5604 The profile shape definition is the suffix; no suffix produces a face, **w** is a closed wire, **ww** is an open wire. 
5605
5606 **Example:** 
5607 ~~~~~
5608 #to view the xy plane 
5609 top 
5610 #to create a 2d curve with the mouse 
5611 bsplineprof res 
5612 # click mb1 to start the curve 
5613 # click mb1 to create the second vertex 
5614 # click mb1 to create a curve 
5615 == 
5616 #click mb2 to finish the curve and start a new curve 
5617 == 
5618 # click mb1 to create the second curve 
5619 # click mb3 to create the face 
5620 ~~~~~
5621
5622 @subsubsection occt_draw_7_2_6  mkoffset
5623
5624 Syntax:      
5625 ~~~~~
5626 mkoffset result face/compound of wires nboffset stepoffset 
5627 ~~~~~
5628
5629 **mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurences is not limited. 
5630
5631 The offset distance defines the spacing and the positioning of the occurences. 
5632
5633 **Example:** 
5634 ~~~~~
5635 #Create a box and select a face 
5636 box b 1 2 3 
5637 explode b f 
5638 #Create three exterior parallel contours with an offset 
5639 value of 2 
5640 mkoffset r b_1 3 2 
5641 Create one interior parallel contour with an offset 
5642 value of 
5643 0.4 
5644 mkoffset r b_1 1 -0.4 
5645 ~~~~~
5646
5647 **Note** that *mkoffset* command must be used with prudence, as angular contours produce offset contours with fillets. Interior parallel contours can produce more than one wire, normally these are refused. In the following example, any increase in the offset value is refused.
5648
5649 **Example:** 
5650 ~~~~~
5651 # to create the example contour 
5652 profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w 
5653 # to create an incoherent interior offset 
5654 mkoffset r p 1 -0.50 
5655 ==p is not a FACE but a WIRE 
5656 BRepFill_TrimEdgeTool: incoherent intersection 
5657 # to create two incoherent wires 
5658 mkoffset r p 1 -0.50 
5659 ~~~~~
5660
5661 @subsubsection occt_draw_7_2_7  mkplane, mkface
5662
5663 Syntax:      
5664 ~~~~~
5665 mkplane name wire 
5666 mkface name surface [ufirst ulast vfirst vlast] 
5667 ~~~~~
5668
5669 **mkplane** generates a face from a planar wire. The planar surface will be constructed with an orientation which keeps the face inside the wire. 
5670
5671 **mkface** generates a face from a surface. Parameter values can be given to trim a rectangular area. The default boundaries are those of the surface. 
5672
5673 **Example:** 
5674 ~~~~~
5675 # make a polygonal face 
5676 polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0 
5677 mkplane f f 
5678
5679 # make a cylindrical face 
5680 cylinder g 10 
5681 trim g g -pi/3 pi/2 0 15 
5682 mkface g g 
5683 ~~~~~
5684
5685 @subsubsection occt_draw_7_2_8  mkcurve, mksurface
5686
5687 Syntax:      
5688 ~~~~~
5689 mkcurve curve edge 
5690 mksurface name face 
5691 ~~~~~
5692
5693 **mkcurve** creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries. 
5694
5695 **mksurface** creates a surface from a face. The surface will not be trimmed. 
5696
5697 **Example:** 
5698 ~~~~~
5699 # make a line 
5700 vertex v1 0 0 0 
5701 vertex v2 10 0 0 
5702 edge e v1 v2 
5703 ~~~~~
5704
5705 @subsubsection occt_draw_7_2_9  pcurve
5706
5707 Syntax:      
5708
5709 ~~~~~
5710 pcurve [name edgename] facename 
5711 ~~~~~
5712
5713 Extracts the 2d curve of an edge on a face. If only the face is specified, the command extracts all the curves and colors them according to their orientation. This is useful in checking to see if the edges in a face are correctly oriented, i.e. they turn counter-clockwise. To make curves visible, use a fitted 2d view. 
5714
5715 **Example:** 
5716 ~~~~~
5717 # view the pcurves of a face 
5718 plane p 
5719 trim p p -1 1 -1 1 
5720 mkface p p 
5721 av2d; # a 2d view 
5722 pcurve p 
5723 2dfit 
5724 ~~~~~
5725
5726 @subsubsection occt_draw_7_2_10  chfi2d
5727
5728 Syntax:      
5729 ~~~~~
5730 chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) .... 
5731 ~~~~~
5732
5733
5734 Creates chamfers and fillets on 2D objects. Select two adjacent edges and: 
5735   * a radius value
5736   * two respective distance values
5737   * a distance value and an angle
5738
5739 The radius value produces a fillet between the two faces. 
5740
5741 The distance is the length value from the edge between the two selected faces in a normal direction. 
5742
5743 **Example:** 
5744
5745 Let us create a 2d fillet: 
5746
5747 ~~~~~
5748 top 
5749 profile p x 2 y 2 x -2 
5750 chfi2d cfr p . . F 0.3 
5751 ==Pick an object 
5752 #select an edge 
5753 ==Pick an object 
5754 #select an edge 
5755 ~~~~~
5756
5757 Let us create a 2d chamfer using two distances:
5758  
5759 ~~~~~
5760 profile p x 2 y 2 x -2 
5761 chfi2d cfr p . . CDD 0.3 0.6 
5762 ==Pick an object 
5763 #select an edge 
5764 ==Pick an object 
5765 #select an edge 
5766 ~~~~~
5767
5768 Let us create a 2d chamfer using a defined distance and angle 
5769
5770 ~~~~~
5771 top 
5772 profile p x 2 y 2 x -2 
5773 chfi2d cfr p . . CDA 0.3 75 
5774 ==Pick an object 
5775 #select an edge 
5776 ==Pick an object 
5777 #select an edge 
5778 ~~~~~
5779
5780 @subsubsection occt_draw_7_2_11  nproject
5781
5782 Syntax:      
5783 ~~~~~
5784 nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol 
5785 [continuity [maxdeg [maxseg]]] 
5786 ~~~~~
5787
5788 Creates a shape projection which is normal to the target surface. 
5789
5790 **Example:**
5791 ~~~~~
5792 # create a curved surface 
5793 line l 0 0 0 1 0 0 
5794 trim l l 0 2 
5795 convert l l 
5796
5797 incdeg l 3 
5798 cmovep l 1 0 0.5 0 
5799 cmovep l 3 0 0.5 0 
5800 copy l ll 
5801 translate ll 2 -0.5 0 
5802 mkedge e1 l 
5803 mkedge e2 ll 
5804 wire w e1 e2 
5805 prism p w 0 0 3 
5806 donl p 
5807 #display in four views 
5808 mu4 
5809 fit 
5810 # create the example shape 
5811 circle c 1.8 -0.5 1 0 1 0 1 0 0 0.4 
5812 mkedge e c 
5813 donly p e 
5814 # create the normal projection of the shape(circle) 
5815 nproject r e p 
5816 ~~~~~
5817
5818
5819 @subsection occt_draw_7_3  Primitives
5820
5821 Primitive commands make it possible to create simple shapes. They include: 
5822
5823   * **box** and **wedge** commands.
5824   * **pcylinder**, **pcone**, **psphere**, **ptorus** commands.
5825   * **halfspace** command
5826
5827
5828 @subsubsection occt_draw_7_3_1  box, wedge
5829
5830 Syntax:      
5831 ~~~~~
5832 box name [x y z] dx dy dz 
5833 wedge name dx dy dz ltx / xmin zmin xmax xmax 
5834 ~~~~~
5835
5836 **box** creates a box parallel to the axes with dimensions *dx,dy,dz*. *x,y,z* is the corner of the box. It is the default origin. 
5837
5838 **wedge** creates a box with five faces called a wedge. One face is in the OXZ plane, and has dimensions *dx,dz* while the other face is in the plane *y = dy*. This face either has dimensions *ltx, dz* or is bounded by *xmin,zmin,xmax,zmax*. 
5839
5840 The other faces are defined between these faces. The face in the *y=yd* plane may be degenerated into a line if *ltx = 0*, or a point if *xmin = xmax* and *ymin = ymax*. In these cases, the line and the point both have 5 faces each. To position the wedge use the *ttranslate* and *trotate* commands. 
5841
5842 **Example:** 
5843 ~~~~~
5844 # a box at the origin 
5845 box b1 10 20 30 
5846
5847 # another box 
5848 box b2 30 30 40 10 20 30 
5849
5850 # a wedge 
5851 wedge w1 10 20 30 5 
5852
5853 # a wedge with a sharp edge (5 faces) 
5854 wedge w2 10 20 30 0 
5855
5856 # a pyramid 
5857 wedge w3 20 20 20 10 10 10 10 
5858 ~~~~~
5859
5860 @subsubsection occt_draw_7_3_2  pcylinder, pcone, psphere, ptorus
5861
5862 Syntax:      
5863 ~~~~~
5864 pcylinder name [plane] radius height [angle] 
5865 pcone name [plane] radius1 radius2 height [angle] 
5866 pcone name [plane] radius1 radius2 height [angle] 
5867 psphere name [plane] radius1 [angle1 angle2] [angle] 
5868 ptorus name [plane] radius1 radius2 [angle1 angle2] [angle] 
5869 ~~~~~
5870
5871 All these commands create solid blocks in the default coordinate system, using the Z axis as the axis of revolution and the X axis as the origin of the angles. To use another system, translate and rotate the resulting solid or use a plane as first argument to specify a coordinate system. All primitives have an optional last argument which is an angle expressed in degrees and located on the Z axis, starting from the X axis. The default angle is 360. 
5872
5873 **pcylinder** creates a cylindrical block with the given radius and height. 
5874
5875 **pcone** creates a truncated cone of the given height with radius1 in the plane z = 0 and radius2 in the plane z = height. Neither radius can be negative, but one of them can be null. 
5876
5877 **psphere** creates a solid sphere centered on the origin. If two angles, *angle1* and *angle2*, are given, the solid will be limited by two planes at latitude *angle1* and *angle2*. The angles must be increasing and in the range -90,90. 
5878
5879 **ptorus** creates a solid torus with the given radii, centered on the origin, which is a point along the z axis. If two angles increasing in degree in the range 0 – 360 are given, the solid will be bounded by two planar surfaces at those positions on the circle. 
5880
5881 **Example:** 
5882 ~~~~~
5883 # a can shape 
5884 pcylinder cy 5 10 
5885
5886 # a quarter of a truncated cone 
5887 pcone co 15 10 10 90 
5888
5889 # three-quarters of sphere 
5890 psphere sp 10 270 
5891
5892 # half torus 
5893 ptorus to 20 5 0 90 
5894 ~~~~~
5895
5896 @subsubsection occt_draw_7_3_3  halfspace
5897
5898 Syntax:      
5899 ~~~~~
5900 halfspace result face/shell x y z 
5901 ~~~~~
5902
5903 **halfspace** creates an infinite solid volume based on a face in a defined direction. This volume can be used to perform the boolean operation of cutting a solid by a face or plane. 
5904
5905 **Example:** 
5906 ~~~~~
5907 box b 0 0 0 1 2 3 
5908 explode b f 
5909 ==b_1 b_2 b_3 b_4 b_5 b_6 
5910 halfspace hr b_3 0.5 0.5 0.5 
5911 ~~~~~
5912
5913
5914 @subsection occt_draw_7_4  Sweeping
5915
5916 Sweeping creates shapes by sweeping out a shape along a defined path: 
5917
5918   * **prism** sweeps along a direction.
5919   * **revol** sweeps around an axis.
5920   * **pipe** sweeps along a wire.
5921   * **mksweep** and **buildsweep** are commands to create sweeps by defining the arguments and algorithms.
5922   * **thrusections** creates a sweep from wire in different planes.
5923
5924
5925 @subsubsection occt_draw_7_4_1  prism
5926
5927 Syntax:      
5928 ~~~~~
5929 prism result base dx dy dz [Copy | Inf | SemiInf] 
5930 ~~~~~
5931
5932 Creates a new shape by sweeping a shape in a direction. Any shape can be swept: a vertex gives an edge; an edge gives a face; and a face gives a solid. 
5933
5934 The shape is swept along the vector *dx dy dz*. The original shape will be shared in the result unless *Copy* is specified. If *Inf* is specified the prism is infinite in both directions. If *SemiInf* is specified the prism is infinite in the *dx,dy,dz* direction, and the length of the vector has no importance. 
5935
5936 **Example:** 
5937 ~~~~~
5938 # sweep a planar face to make a solid 
5939 polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0 
5940 mkplane f f 
5941 ~~~~~
5942
5943 @subsubsection occt_draw_7_4_2  revol
5944
5945 Syntax:      
5946 ~~~~~
5947 revol result base x y z dx dy dz angle [Copy] 
5948 ~~~~~
5949
5950 Creates a new shape by sweeping a base shape through an angle along the axis *x,y,z dx,dy,dz*. As with the prism command, the shape can be of any type and is not shared if *Copy* is specified. 
5951
5952 **Example:** 
5953 ~~~~~
5954 # shell by wire rotation 
5955 polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 
5956 revol s w 20 0 0 0 1 0 90 
5957 ~~~~~
5958
5959
5960 @subsubsection occt_draw_7_4_3  pipe
5961
5962 Syntax:      
5963 ~~~~~
5964 pipe name wire_spine Profile 
5965 ~~~~~
5966
5967 Creates a new shape by sweeping a shape known as the profile along a wire known as the spine. 
5968
5969 **Example:** 
5970 ~~~~~
5971 # sweep a circle along a bezier curve to make a solid 
5972 pipe 
5973
5974 beziercurve spine 4 0 0 0 10 0 0 10 10 0 20 10 0 
5975 mkedge spine spine 
5976 wire spine spine 
5977 circle profile 0 0 0 1 0 0 2 
5978 mkedge profile profile 
5979 wire profile profile 
5980 mkplane profile profile 
5981 pipe p spine profile 
5982 ~~~~~
5983
5984 @subsubsection occt_draw_7_4_4  mksweep, addsweep, setsweep, deletesweep, buildsweep, simulsweep
5985
5986 Syntax:      
5987 ~~~~~
5988 mksweep wire 
5989 addsweep wire[vertex][-M][-C] [auxiilaryshape]
5990 deletesweep wire 
5991 setsweep options [arg1 [arg2 [...]]] 
5992 simulsweep r [n] [option] 
5993 buildsweep [r] [option] [Tol] 
5994 ~~~~~
5995
5996 options are : 
5997  * *-FR* : Tangent and Normal are defined by a Frenet trihedron 
5998  * *-CF* : Tangent is given by Frenet, the Normal is computed to minimize the torsion 
5999  * *-DX Surf* : Tangent and Normal are given by Darboux trihedron, surf must be a shell or a face 
6000  * *-CN dx dy dz* : BiNormal is given by *dx dy dz* 
6001  * *-FX Tx Ty TZ [Nx Ny Nz]* : Tangent and Normal are fixed 
6002  * *-G guide* 
6003
6004 These commands are used to create a shape from wires. One wire is designated as the contour that defines the direction; it is called the spine. At least one other wire is used to define the the sweep profile. 
6005 * **mksweep** initializes the sweep creation and defines the wire to be used as the spine. 
6006 * **addsweep** defines the wire to be used as the profile. 
6007 * **deletesweep** cancels the choice of profile wire, without leaving the mksweep mode. You can re-select a profile wire. 
6008 * **setsweep** commands the algorithms used for the construction of the sweep. 
6009 * **simulsweep** can be used to create a preview of the shape. [n] is the number of sections that are used to simulate the sweep. 
6010 * **buildsweep** creates the sweep using the arguments defined by all the commands. 
6011
6012 **Example:** 
6013 ~~~~~
6014 #create a sweep based on a semi-circular wire using the 
6015 Frenet algorithm 
6016 #create a circular figure 
6017 circle c2 0 0 0 1 0 0 10 
6018 trim c2 c2 -pi/2 pi/2 
6019 mkedge e2 c2 
6020 donly e2 
6021 wire w e2 
6022 whatis w 
6023 mksweep w 
6024 # to display all the options for a sweep 
6025 setsweep 
6026 #to create a sweep using the Frenet algorithm where the 
6027 #normal is computed to minimise the torsion 
6028 setsweep -CF 
6029 addsweep w -R 
6030 # to simulate the sweep with a visual approximation 
6031 simulsweep w 3 
6032 ~~~~~
6033
6034 @subsubsection occt_draw_7_4_5  thrusections
6035
6036 Syntax:  
6037 ~~~~~
6038 thrusections [-N] result issolid isruled wire1 wire2 [..wire..] 
6039 ~~~~~
6040
6041 **thrusections** creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices. 
6042 A bezier curve is generated between the vertices of each wire. The option *[-N]* means that no check is made on wires for direction. 
6043
6044 **Example:** 
6045 ~~~~~
6046 #create three wires in three planes 
6047 polyline w1 0 0 0 5 0 0 5 5 0 2 3 0 
6048 polyline w2 0 1 3 4 1 3 4 4 3 1 3 3 
6049 polyline w3 0 0 5 5 0 5 5 5 5 2 3 5 
6050 # create the shape 
6051 thrusections th issolid isruled w1 w2 w3 
6052 ==thrusections th issolid isruled w1 w2 w3 
6053 Tolerances obtenues   -- 3d : 0 
6054 -- 2d : 0 
6055 ~~~~~
6056
6057
6058 @subsection occt_draw_7_5  Topological transformation
6059
6060 Transformations are applications of matrices. When the transformation is nondeforming, such as translation or rotation, the object is not copied. The topology localcoordinate system feature is used. The copy can be enforced with the **tcopy** command. 
6061
6062   * **tcopy** makes a copy of the structure of a shape.
6063   * **ttranslate**, **trotate**, **tmove**, **reset** move a shape.
6064   * **tmirror**, **tscale** always modify the shape.
6065
6066
6067 @subsubsection occt_draw_7_5_1   tcopy
6068
6069 Syntax: 
6070 ~~~~~
6071 tcopy name toname [name toname ...] 
6072 ~~~~~
6073
6074 Copies the structure of one shape, including the geometry, into another, newer shape. 
6075
6076 **Example:** 
6077 ~~~~~
6078 # create an edge from a curve and copy it 
6079 beziercurve c 3 0 0 0 10 0 0 20 10 0 
6080 mkedge e1 c 
6081 ttranslate e1 0 5 0 
6082 tcopy e1 e2 
6083 ttranslate e2 0 5 0 
6084 # now modify the curve, only e1 and e2 will be modified 
6085 ~~~~~
6086
6087 @subsubsection occt_draw_7_5_2   tmove, treset
6088
6089 Syntax:      
6090 ~~~~~
6091 tmove name [name ...] shape 
6092 reset name [name ...] 
6093 ~~~~~
6094
6095 **tmove** and **reset** modify the location, or the local coordinate system of a shape. 
6096
6097 **tmove** applies the location of a given shape to other shapes. **reset** restores one or several shapes it to its or their original coordinate system(s). 
6098
6099 **Example:** 
6100 ~~~~~
6101 # create two boxes 
6102 box b1 10 10 10 
6103 box b2 20 0 0 10 10 10 
6104 # translate the first box 
6105 ttranslate b1 0 10 0 
6106 # and apply the same location to b2 
6107 tmove b2 b1 
6108 # return to original positions 
6109 reset b1 b2 
6110 ~~~~~
6111
6112 @subsubsection occt_draw_7_5_3   ttranslate, trotate
6113
6114 Syntax:      
6115 ~~~~~
6116 ttranslate [name ...] dx dy dz 
6117 trotate [name ...] x y z dx dy dz angle 
6118 ~~~~~
6119
6120 **ttranslate** translates a set of shapes by a given vector, and **trotate** rotates them by a given angle around an axis. Both commands only modify the location of the shape. 
6121 When creating multiple shapes, the same location is used for all the shapes. (See *toto.tcl* example below. Note that the code of this file can also be directly executed in interactive mode.) 
6122
6123 Locations are very economic in the data structure because multiple occurences of an object share the topological description. 
6124
6125 **Example:** 
6126 ~~~~~
6127 # make rotated copies of a sphere in between two cylinders 
6128 # create a file source toto.tcl 
6129 # toto.tcl code: 
6130 for {set i 0} {$i  360} {incr i 20} { 
6131 copy s s$i 
6132 trotate s$i 0 0 0 0 0 1 $i 
6133
6134
6135 # create two cylinders 
6136 pcylinder c1 30 5 
6137 copy c1 c2 
6138 ttranslate c2 0 0 20 
6139
6140 #create a sphere 
6141 psphere s 3 
6142 ttranslate s 25 0 12.5 
6143
6144 # call the source file for multiple copies 
6145 source toto.tcl 
6146 ~~~~~
6147
6148 @subsubsection occt_draw_7_5_4   tmirror, tscale
6149
6150 Syntax:      
6151 ~~~~~
6152 tmirror name x y z dx dy dz 
6153 tscale name x y z scale 
6154 ~~~~~
6155
6156 * **tmirror** makes a mirror copy of a shape about a plane x,y,z dx,dy,dz. 
6157
6158 * **Tscale** applies a central homotopic mapping to a shape. 
6159
6160 **Example:** 
6161 ~~~~~
6162 # mirror a portion of cylinder about the YZ plane 
6163 pcylinder c1 10 10 270 
6164 copy c1 c2 
6165 tmirror c2 15 0 0 1 0 0 
6166 # and scale it 
6167 tscale c1 0 0 0 0.5 
6168 ~~~~~
6169
6170
6171 @subsection occt_draw_7_6  Old Topological operations
6172
6173   *  **fuse**, **cut**, **common** are boolean operations. 
6174   *  **section**, **psection** compute sections. 
6175   *  **sewing** joins two or more shapes. 
6176
6177
6178 @subsubsection occt_draw_7_6_1  fuse, cut, common
6179
6180 Syntax:      
6181 ~~~~~
6182 fuse name shape1 shape2 
6183 cut name shape1 shape2 
6184 common name shape1 shape2 
6185 ~~~~~
6186
6187 **fuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact. 
6188
6189 **cut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes. 
6190
6191 **common** creates a new shape which contains only what is in common between the two original shapes in their intersection. 
6192
6193 **Example:** 
6194 ~~~~~
6195 # all four boolean operations on a box and a cylinder 
6196
6197 box b 0 -10 5 20 20 10 
6198 pcylinder c 5 20 
6199
6200 fuse s1 b c 
6201 ttranslate s1 40 0 0 
6202
6203 cut s2 b c 
6204 ttranslate s2 -40 0 0 
6205
6206 cut s3 c b 
6207 ttranslate s3 0 40 0 
6208
6209 common s4 b c 
6210 ttranslate s4 0 -40 0 
6211 ~~~~~
6212
6213
6214 @subsubsection occt_draw_7_6_2  section, psection
6215
6216 Syntax:      
6217 ~~~~~
6218 section result shape1 shape2 
6219 psection name shape plane 
6220 ~~~~~
6221
6222 **section** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes. 
6223
6224 **psection** creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane. 
6225
6226 **Example:** 
6227 ~~~~~
6228 # section line between a cylinder and a box 
6229 pcylinder c 10 20 
6230 box b 0 0 5 15 15 15 
6231 trotate b 0 0 0 1 1 1 20 
6232 section s b c 
6233
6234 # planar section of a cone 
6235 pcone c 10 30 30 
6236 plane p 0 0 15 1 1 2 
6237 psection s c p 
6238 ~~~~~
6239
6240 @subsubsection occt_draw_7_6_3  sewing
6241
6242 Syntax:      
6243 ~~~~~
6244 sewing result [tolerance] shape1 shape2 ... 
6245 ~~~~~
6246
6247 **Sewing** joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value. 
6248
6249 **Example:** 
6250 ~~~~~
6251 # create two adjacent boxes 
6252 box b 0 0 0 1 2 3 
6253 box b2 0 2 0 1 2 3 
6254 sewing sr b b2 
6255 whatis sr 
6256 sr is a shape COMPOUND FORWARD Free Modified 
6257 ~~~~~
6258
6259 @subsection occt_draw_7_7  New Topological operations
6260
6261
6262 The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm. 
6263
6264
6265 @subsubsection occt_draw_7_7_1  bop, bopfuse, bopcut, boptuc, bopcommon,
6266
6267 * **bop** defines *shape1* and *shape2* subject to ulterior Boolean operations 
6268 * **bopfuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact. 
6269 * **bopcut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes. 
6270 * **boptuc** is a reverced **bopcut**. 
6271 * **bopcommon** creates a new shape which contains only whatever is in common between the two original shapes in their intersection. 
6272
6273 Syntax:      
6274 ~~~~~
6275 bop shape1 shape2 
6276 bopcommon result 
6277 bopfuse result 
6278 bopcut result 
6279 boptuc result 
6280 ~~~~~
6281
6282 These commands have short variants: 
6283
6284 ~~~~~
6285 bcommon result shape1 shape2 
6286 bfuse result shape1 shape2 
6287 bcut result shape1 shape2 
6288 ~~~~~
6289
6290
6291 **bop** fills data structure (DS) of boolean operation for *shape1* and *shape2*. 
6292 **bopcommon, bopfuse, bopcut, boptuc** commands are used after **bop** command. After one **bop** command it is possible to call several commands from the list above. For example:
6293
6294 ~~~~~
6295 bop S1 S2
6296 bopfuse R
6297 ~~~~~ 
6298
6299
6300 **Example:** 
6301
6302 Let us produce all four boolean operations on a box and a cylinder: 
6303
6304 ~~~~~
6305 box b 0 -10 5 20 20 10 
6306 pcylinder c 5 20 
6307
6308 # fills data structure 
6309 bop b c 
6310
6311 bopfuse s1 
6312 ttranslate s1 40 0 0 
6313
6314 bopcut s2 
6315 ttranslate s2 -40 0 0 
6316
6317 boptuc s3 
6318 ttranslate s3 0 40 0 
6319
6320 bopcommon s4 
6321 ttranslate s4 0 -40 0 
6322 ~~~~~
6323
6324 Now use short variants of the commands: 
6325
6326 ~~~~~
6327 bfuse s11 b c 
6328 ttranslate s11 40 0 100 
6329
6330 bcut s12 b c 
6331 ttranslate s12 -40 0 100 
6332
6333 bcommon s14 b c 
6334 ttranslate s14 0 -40 100 
6335 ~~~~~
6336
6337 @subsubsection occt_draw_7_7_2  bopsection
6338
6339 Syntax:      
6340 ~~~~~
6341 bop shape1 shape2 
6342 bopsection result 
6343 ~~~~~
6344
6345 * **bopsection** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
6346 * **bop** fills data structure (DS) of boolean operation for *shape1* and *shape2*. 
6347 * **bopsection** command used after **bop** command.
6348  
6349 Short variant syntax:      
6350 ~~~~~
6351 bsection result shape1 shape2 [-2d/-2d1/-2s2] [-a] 
6352 ~~~~~
6353
6354 * <i>-2d</i>  -  PCurves are computed on both parts. 
6355 * <i>-2d1</i> - PCurves are computed on first part. 
6356 * <i>-2d2</i> - PCurves are computed on second part. 
6357 * <i>-a</i>  -   built geometries  are approximated. 
6358
6359 **Example:** 
6360
6361 Let us build a section line between a cylinder and a box 
6362 ~~~~~
6363 pcylinder c 10 20 
6364 box b 0 0 5 15 15 15 
6365 trotate b 0 0 0 1 1 1 20 
6366 bop b c 
6367 bopsection s 
6368 # Short variant: 
6369 bsection s2 b c 
6370 ~~~~~
6371
6372 @subsubsection occt_draw_7_7_3  bopcheck, bopargshape
6373
6374 Syntax:      
6375 ~~~~~
6376 bopcheck shape 
6377 bopargcheck shape1 [[shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF] 
6378 ~~~~~
6379
6380 **bopcheck** checks a shape for self-interference. 
6381
6382 **bopargcheck** checks the validity of argument(s) for boolean operations. 
6383
6384 * Boolean Operation - (by default a section is made) : 
6385          * **F** (fuse) 
6386          * **O** (common) 
6387          * **C** (cut) 
6388          * **T** (cut21) 
6389          * **S** (section) 
6390          * **U** (unknown) 
6391 * Test Options - (by default all options are enabled) : 
6392          * **R** (disable small edges (shrank range) test) 
6393          * **F** (disable faces verification test) 
6394          * **T** (disable tangent faces searching test) 
6395          * **V** (disable test possibility to merge vertices) 
6396          * **E** (disable test possibility to merge edges) 
6397          * **I** (disable self-interference test) 
6398          * **P** (disable shape type test) 
6399 * Additional Test Options :
6400          * **B** (stop test on first faulty found) - by default it is off; 
6401          * **F** (full output for faulty shapes) - by default the output is made in a short format.
6402
6403 **Note** that Boolean Operation and Test Options are used only for a couple of argument shapes, except for <b>I</b> and <b>P</b> options that are always used to test a couple of shapes as well as a single shape.
6404
6405 **Example:** 
6406 ~~~~~
6407 # checks a shape on self-interference 
6408 box b1 0 0 0 1 1 1 
6409 bopcheck b1 
6410
6411 # checks the validity of argument for boolean cut operations 
6412 box b2 0 0 0 10 10 10 
6413 bopargcheck b1 b2 -C 
6414 ~~~~~
6415
6416 @subsection occt_draw_7_8  Drafting and blending
6417
6418 Drafting is creation of a new shape by tilting faces through an angle. 
6419
6420 Blending is the creation of a new shape by rounding edges to create a fillet. 
6421
6422   * Use the **depouille** command for drafting.
6423   * Use the **chamf** command to add a chamfer to an edge
6424   * Use the **blend** command for simple blending.
6425   * Use **fubl** for a fusion + blending operation.
6426   * Use **buildevol**, **mkevol**, **updatevol** to realize varying radius blending.
6427
6428
6429 @subsubsection occt_draw_7_8_1  depouille
6430
6431 Syntax: 
6432 ~~~~~
6433 dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...] 
6434 ~~~~~
6435
6436 Creates a new shape by drafting one or more faces of a shape. 
6437
6438 Identify the shape(s) to be drafted, the drafting direction, and the face(s) with an angle and an axis of rotation for each face. You can use dot syntax to identify the faces. 
6439
6440 **Example:** 
6441 ~~~~~
6442 # draft a face of a box 
6443 box b 10 10 10 
6444 explode b f 
6445 == b_1 b_2 b_3 b_4 b_5 b_6 
6446
6447 dep a b 0 0 1 b_2 10 0 10 0 1 0 5 
6448 ~~~~~
6449
6450 @subsubsection occt_draw_7_8_2  chamf
6451
6452 Syntax:      
6453 ~~~~~
6454 chamf newname shape edge face S dist 
6455 chamf newname shape edge face dist1 dist2 
6456 chamf newname shape edge face A dist angle 
6457 ~~~~~
6458
6459 Creates a chamfer along the edge between faces using: 
6460
6461   * a equal distances from the edge
6462   * the edge, a face and distance, a second distance
6463   * the edge, a reference face and an angle
6464
6465 Use the dot syntax to select the faces and edges. 
6466
6467 **Examples:**
6468
6469 Let us create a chamfer based on equal distances from the edge (45 degree angle):
6470 ~~~~~
6471 # create a box 
6472 box b 1 2 3 
6473 chamf ch b . . S 0.5 
6474 ==Pick an object 
6475 # select an edge 
6476 ==Pick an object 
6477 # select an adjacent face 
6478 ~~~~~
6479
6480 Let us create a chamfer based on different distances from the selected edge:
6481 ~~~~~
6482 box b 1 2 3 
6483 chamf ch b . . 0.3 0.4 
6484 ==Pick an object 
6485 # select an edge 
6486 ==Pick an object 
6487 # select an adjacent face
6488 ~~~~~
6489  
6490 Let us create a chamfer based on a distance from the edge and an angle:
6491  
6492 ~~~~~
6493 box b 1 2 3 
6494 chamf ch b . . A 0.4 30 
6495 ==Pick an object 
6496 # select an edge 
6497 ==Pick an object 
6498 # select an adjacent face 
6499 ~~~~~
6500
6501 @subsubsection occt_draw_7_8_3  blend
6502
6503 Syntax:      
6504 ~~~~~
6505 blend result object rad1 ed1 rad2 ed2 ... [R/Q/P] 
6506 ~~~~~
6507
6508 Creates a new shape by filleting the edges of an existing shape. The edge must be inside the shape. You may use the dot syntax. Note that the blend is propagated to the edges of tangential planar, cylindrical or conical faces. 
6509
6510 **Example:** 
6511 ~~~~~
6512 # blend a box, click on an edge 
6513 box b 20 20 20 
6514 blend b b 2 . 
6515 ==tolerance ang : 0.01 
6516 ==tolerance 3d : 0.0001 
6517 ==tolerance 2d : 1e-05 
6518 ==fleche : 0.001 
6519 ==tolblend 0.01 0.0001 1e-05 0.001 
6520 ==Pick an object 
6521 # click on the edge you want ot fillet 
6522
6523 ==COMPUTE: temps total 0.1s dont : 
6524 ==- Init + ExtentAnalyse 0s 
6525 ==- PerformSetOfSurf 0.02s 
6526 ==- PerformFilletOnVertex 0.02s 
6527 ==- FilDS 0s 
6528 ==- Reconstruction 0.06s 
6529 ==- SetRegul 0s 
6530 ~~~~~
6531
6532 @subsubsection occt_draw_7_8_4  fubl
6533
6534 Syntax:      
6535 ~~~~~
6536 fubl name shape1 shape2 radius
6537 ~~~~~ 
6538  
6539 Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius. 
6540
6541 **Example:** 
6542 ~~~~~
6543 # fuse-blend two boxes 
6544 box b1 20 20 5 
6545 copy b1 b2 
6546 ttranslate b2 -10 10 3 
6547 fubl a b1 b2 1 
6548 ~~~~~
6549
6550
6551 @subsubsection occt_draw_7_8_5  mkevol, updatevol, buildevol
6552
6553 Syntax:      
6554 ~~~~~
6555 mkevol result object (then use updatevol) [R/Q/P] 
6556 updatevol edge u1 radius1 [u2 radius2 ...] 
6557 buildevol 
6558 ~~~~~
6559
6560 These three commands work together to create fillets with evolving radii. 
6561
6562 * **mkevol** allows specifying the shape and the name of the result. It returns the tolerances of the fillet. 
6563 * **updatevol** allows describing the filleted edges you want to create. For each edge, you give a set of coordinates: parameter and radius and the command prompts you to pick the edge of the shape which you want to modify. The parameters will be calculated along the edges and the radius function applied to the whole edge. 
6564 * **buildevol** produces the result described previously in **mkevol** and **updatevol**. 
6565
6566 **Example:** 
6567 ~~~~~
6568 # makes an evolved radius on a box 
6569 box b 10 10 10 
6570 mkevol b b 
6571 ==tolerance ang : 0.01 
6572 ==tolerance 3d : 0.0001 
6573 ==tolerance 2d : 1e-05 
6574 ==fleche : 0.001 
6575 ==tolblend 0.01 0.0001 1e-05 0.001 
6576
6577 # click an edge 
6578 updatevol . 0 1 1 3 2 2 
6579 ==Pick an object 
6580
6581 buildevol 
6582 ==Dump of SweepApproximation 
6583 ==Error 3d = 1.28548881203818e-14 
6584 ==Error 2d = 1.3468326936926e-14 , 
6585 ==1.20292299999388e-14 
6586 ==2 Segment(s) of degree 3 
6587
6588 ==COMPUTE: temps total 0.91s dont : 
6589 ==- Init + ExtentAnalyse 0s 
6590 ==- PerformSetOfSurf 0.33s 
6591 ==- PerformFilletOnVertex 0.53s 
6592 ==- FilDS 0.01s 
6593 ==- Reconstruction 0.04s 
6594 ==- SetRegul 0s 
6595 ~~~~~
6596
6597
6598 @subsection occt_draw_7_9  Topological analysis
6599
6600 Analysis of shapes includes commands to compute length, area, volumes and inertial properties. 
6601
6602   * Use **lprops**, **sprops**, **vprops** to compute integral properties.
6603   * Use **bounding** to display the bounding box of a shape.
6604   * Use **distmini** to calculate the minimum distance between two shapes.
6605
6606
6607 @subsubsection occt_draw_7_9_1  lprops, sprops, vprops
6608
6609 Syntax:      
6610 ~~~~~
6611 lprops shape 
6612 sprops shape 
6613 vprops shape 
6614 ~~~~~
6615
6616 * **lprops** computes the mass properties of all edges in the shape with a linear density of 1;
6617 * **sprops** of all faces with a surface density of 1;
6618 * **vprops** of all solids with a density of 1. 
6619
6620 All three commands print the mass, the coordinates of the center of gravity, the matrix of inertia and the moments. Mass is either the length, the area or the volume. The center and the main axis of inertia are displayed. 
6621
6622 **Example:** 
6623 ~~~~~
6624 # volume of a cylinder 
6625 pcylinder c 10 20 
6626 vprops c 
6627 == results 
6628 Mass : 6283.18529981086 
6629
6630 Center of gravity : 
6631 X = 4.1004749224903e-06 
6632 Y = -2.03392858349861e-16 
6633 Z = 9.9999999941362 
6634
6635 Matrix of Inertia : 
6636 366519.141445068                    5.71451850691484e-12 
6637 0.257640437382627 
6638 5.71451850691484e-12                366519.141444962 
6639 2.26823064169991e-10                0.257640437382627 
6640 2.26823064169991e-10                314159.265358863 
6641
6642 Moments : 
6643 IX = 366519.141446336 
6644 IY = 366519.141444962 
6645 I.Z = 314159.265357595 
6646 ~~~~~
6647
6648
6649 @subsubsection occt_draw_7_9_2   bounding
6650
6651 Syntax:      
6652 ~~~~~
6653 bounding shape 
6654 ~~~~~
6655
6656 Displays the bounding box of a shape. The bounding box is a cuboid created with faces parallel to the x, y, and z planes. The command returns the dimension values of the the box, *xmin ymin zmin xmax ymax zmax.* 
6657
6658 **Example:** 
6659 ~~~~~
6660 # bounding box of a torus 
6661 ptorus t 20 5 
6662 bounding t 
6663 ==-27.059805107309852              -27.059805107309852 - 
6664 5.0000001000000003 
6665 ==27.059805107309852               27.059805107309852 
6666 5.0000001000000003 
6667 ~~~~~
6668
6669 @subsubsection occt_draw_7_9_3  distmini
6670
6671 Syntax:      
6672 ~~~~~
6673 distmini name Shape1 Shape2 
6674 ~~~~~
6675
6676 Calculates the minimum distance between two shapes. The calculation returns the number of solutions, If more than one solution exists. The options are displayed in the viewer(red) and the results are listed in the shell window. The *distmini* lines are considered as shapes which have a value v. 
6677
6678 **Example:** 
6679 ~~~~~
6680 box b 0 0 0 10 20 30 
6681 box b2 30 30 0 10 20 30 
6682 distmini d1 b b2 
6683 ==the distance value is : 22.3606797749979 
6684 ==the number of solutions is :2 
6685
6686 ==solution number 1 
6687 ==the type of the solution on the first shape is 0 
6688 ==the type of the solution on the second shape is 0 
6689 ==the coordinates of the point on the first shape are: 
6690 ==X=10 Y=20 Z=30 
6691 ==the coordinates of the point on the second shape 
6692 are: 
6693 ==X=30 Y=30 Z=30 
6694
6695 ==solution number 2: 
6696 ==the type of the solution on the first shape is 0 
6697 ==the type of the solution on the second shape is 0 
6698 ==the coordinates of the point on the first shape are: 
6699 ==X=10 Y=20 Z=0 
6700 ==the coordinates of the point on the second shape 
6701 are: 
6702 ==X=30 Y=30 Z=0 
6703
6704 ==d1_val d1 d12 
6705 ~~~~~
6706
6707 @subsection occt_draw_7_10  Surface creation
6708
6709 Surface creation commands include surfaces created from boundaries and from spaces between shapes. 
6710   * **gplate** creates a surface from a boundary definition.
6711   * **filling** creates a surface from a group of surfaces.
6712
6713 @subsubsection occt_draw_7_10_1   gplate,
6714
6715 Syntax: 
6716 ~~~~~
6717 gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ... 
6718 ~~~~~
6719
6720 Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces. 
6721
6722 **Example:**
6723 ~~~~~
6724 plane p 
6725 trim p p -1 3 -1 3 
6726 mkface p p 
6727
6728 beziercurve c1 3 0 0 0 1 0 1 2 0 0 
6729 mkedge e1 c1 
6730 tcopy e1 e2 
6731 tcopy e1 e3 
6732
6733 ttranslate e2 0 2 0 
6734 trotate e3 0 0 0 0 0 1 90 
6735 tcopy e3 e4 
6736 ttranslate e4 2 0 0 
6737 # create the surface 
6738 gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0 
6739 == 
6740 ======== Results =========== 
6741 DistMax=8.50014503228635e-16 
6742 * GEOMPLATE END* 
6743 Calculation time: 0.33 
6744 Loop number: 1 
6745 Approximation results 
6746 Approximation error : 2.06274907619957e-13 
6747 Criterium error : 4.97600631215754e-14 
6748
6749 #to create a surface defined by edges and passing through a point 
6750 # to define the border edges and the point 
6751 plane p 
6752 trim p p -1 3 -1 3 
6753 mkface p p 
6754
6755 beziercurve c1 3 0 0 0 1 0 1 2 0 0 
6756 mkedge e1 c1 
6757 tcopy e1 e2 
6758 tcopy e1 e3 
6759
6760 ttranslate e2 0 2 0 
6761 trotate e3 0 0 0 0 0 1 90 
6762 tcopy e3 e4 
6763 ttranslate e4 2 0 0 
6764 # to create a point 
6765 point pp 1 1 0 
6766 # to create the surface 
6767 gplate r2 4 1 p e1 0 e2 0 e3 0 e4 0 pp 
6768 == 
6769 ======== Results =========== 
6770 DistMax=3.65622157610934e-06 
6771 * GEOMPLATE END* 
6772 Calculculation time: 0.27 
6773 Loop number: 1 
6774 Approximation results 
6775 Approximation error : 0.000422195884750181 
6776 Criterium error : 3.43709808053967e-05 
6777 ~~~~~
6778
6779 @subsubsection occt_draw_7_10_2   filling, fillingparam
6780
6781 Syntax:      
6782 ~~~~~
6783 filling result nbB nbC nbP [SurfInit] [edge][face]order... 
6784 edge[face]order... point/u v face order... 
6785 ~~~~~
6786
6787 Creates a surface between borders. This command uses the **gplate** algorithm but creates a surface that is tangential to the adjacent surfaces. The result is a smooth continuous surface based on the G1 criterion. 
6788
6789 To define the surface border: 
6790
6791   * enter the number of edges, constraints, and points
6792   * enumerate the edges, constraints and points
6793
6794 The surface can pass through other points. These are defined after the border definition. 
6795
6796 You can use the *fillingparam* command to access the filling parameters. 
6797
6798 The options are: 
6799
6800  * <i>-l</i> : to list current values 
6801  * <i>-i</i> : to set default values 
6802  * <i>-rdeg nbPonC nbIt anis </i> : to set filling options 
6803  * <i>-c t2d t3d tang tcur </i> : to set tolerances 
6804  * <i>-a maxdeg maxseg </i> : Approximation option 
6805
6806 **Example:** 
6807 ~~~~~
6808 # to create four curved survaces and a point 
6809 plane p 
6810 trim p p -1 3 -1 3 
6811 mkface p p 
6812
6813 beziercurve c1 3 0 0 0 1 0 1 2 0 0 
6814 mkedge e1 c1 
6815 tcopy e1 e2 
6816 tcopy e1 e3 
6817
6818 ttranslate e2 0 2 0 
6819 trotate e3 0 0 0 0 0 1 90 
6820 tcopy e3 e4 
6821 ttranslate e4 2 0 0 
6822
6823 point pp 1 1 0 
6824
6825 prism f1 e1 0 -1 0 
6826 prism f2 e2 0 1 0 
6827 prism f3 e3 -1 0 0 
6828 prism f4 e4 1 0 0 
6829
6830 # to create a tangential surface 
6831 filling r1 4 0 0 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 
6832 # to create a tangential surface passing through point pp 
6833 filling r2 4 0 1 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 pp# 
6834 # to visualise the surface in detail 
6835 isos r2 40 
6836 # to display the current filling parameters 
6837 fillingparam -l 
6838 == 
6839 Degree = 3 
6840 NbPtsOnCur = 10 
6841 NbIter = 3 
6842 Anisotropie = 0 
6843 Tol2d = 1e-05 
6844 Tol3d = 0.0001 
6845 TolAng = 0.01 
6846 TolCurv = 0.1 
6847
6848 MaxDeg = 8 
6849 MaxSegments = 9 
6850 ~~~~~
6851
6852
6853 @subsection occt_draw_7_11  Complex Topology
6854
6855 Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling. 
6856
6857
6858 @subsubsection occt_draw_7_11_1  offsetshape, offsetcompshape
6859
6860 Syntax:      
6861 ~~~~~
6862 offsetshape r shape offset [tol] [face ...] 
6863 offsetcompshape r shape offset [face ...] 
6864 ~~~~~
6865
6866 **offsetshape** and **offsetcompshape** assign a thickness to the edges of a shape. The *offset* value can be negative or positive. This value defines the thickness and direction of the resulting shape. Each face can be removed to create a hollow object. 
6867
6868 The resulting shape is based on a calculation of intersections. In case of simple shapes such as a box, only the adjacent intersections are required and you can use the **offsetshape** command. 
6869
6870 In case of complex shapes, where intersections can occur from non-adjacent edges and faces, use the **offsetcompshape** command. **comp** indicates complete and requires more time to calculate the result. 
6871
6872 The opening between the object interior and exterior is defined by the argument face or faces. 
6873
6874 **Example:** 
6875 ~~~~~
6876 box b1 10 20 30 
6877 explode b1 f 
6878 == b1_1 b1_2 b1_3 b1_4 b1_5 b1_6 
6879 offsetcompshape r b1 -1 b1_3 
6880 ~~~~~
6881
6882 @subsubsection occt_draw_7_11_2  featprism, featdprism, featrevol, featlf, featrf
6883
6884 Syntax:      
6885 ~~~~~
6886 featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1) 
6887 featdprism shape face skface angle Fuse(0/1/2) Modify(0/1) 
6888 featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1) 
6889 featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1) 
6890 featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1) 
6891 featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil] 
6892 featperformval prism/revol/dprism/lf result value 
6893 ~~~~~
6894
6895 **featprism** loads the arguments for a prism with contiguous sides normal to the face. 
6896
6897 **featdprism** loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle. 
6898
6899 **featrevol** loads the arguments for a prism with a circular evolution. 
6900
6901 **featlf** loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline. 
6902
6903 **featrf** loads the arguments for a rib or slot with a curved surface. This feature uses a circular face and a wire as a guideline. 
6904
6905 **featperform** loads the arguments to create the feature. 
6906
6907 **featperformval** uses the defined arguments to create a feature with a limiting value. 
6908
6909 All the features are created from a set of arguments which are defined when you initialize the feature context. Negative values can be used to create depressions. 
6910
6911 **Examples:** 
6912
6913 Let us create a feature prism with a draft angle and a normal direction :
6914
6915 ~~~~~
6916 # create a box with a wire contour on the upper face 
6917 box b 1 1 1 
6918 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5 
6919 explode b f 
6920 # loads the feature arguments defining the draft angle 
6921 featdprism b f b_6 5 1 0 
6922 # create the feature 
6923 featperformval dprism r 1 
6924 ==BRepFeat_MakeDPrism::Perform(Height) 
6925 BRepFeat_Form::GlobalPerform () 
6926         Gluer 
6927         still Gluer 
6928         Gluer result 
6929 ~~~~~
6930
6931 Let us  create a feature prism with circular direction :
6932
6933 ~~~~~
6934 # create a box with a wire contour on the upper face 
6935 box b 1 1 1 
6936 profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5 
6937 explode b f 
6938 # loads the feature arguments defining a rotation axis 
6939 featrevol b f b_6 1 0 1 0 1 0 1 0 
6940 featperformval revol r 45 
6941 ==BRepFeat_MakeRevol::Perform(Angle) 
6942 BRepFeat_Form::GlobalPerform () 
6943         Gluer 
6944         still Gluer 
6945         Gluer result 
6946 ~~~~~
6947
6948
6949 Let us create a slot using the linear feature :
6950
6951 ~~~~~
6952 #create the base model using the multi viewer 
6953 mu4 
6954 profile p x 5 y 1 x -3 y -0.5 x -1.5 y 0.5 x 0.5 y 4 x -1 y -5 
6955 prism pr p 0 0 1 
6956 # create the contour for the linear feature 
6957 vertex v1 -0.2 4 0.3 
6958 vertex v2 0.2 4 0.3 
6959 vertex v3 0.2 0.2 0.3 
6960 vertex v4 4 0.2 0.3 
6961 vertex v5 4 -0.2 0.3 
6962 edge e1 v1 v2 
6963 edge e2 v2 v3 
6964 edge e3 v3 v4 
6965 edge e4 v4 v5 
6966 wire w e1 e2 e3 e4 
6967 # define a plane 
6968 plane pl 0.2 0.2 0.3 0 0 1 
6969 # loads the linear feature arguments 
6970 featlf pr w pl 0 0 0.3 0 0 0 0 1 
6971 featperform lf result 
6972 ~~~~~
6973
6974 Let us create a rib using the revolution feature :
6975
6976 ~~~~~
6977 #create the base model using the multi viewer 
6978 mu4 
6979 pcylinder c1 3 5 
6980 # create the contour for the revolution feature 
6981 profile w c 1 190 WW 
6982 trotate w 0 0 0 1 0 0 90 
6983 ttranslate w -3 0 1 
6984 trotate w -3 0 1.5 0 0 1 180 
6985 plane pl -3 0 1.5 0 1 0 
6986 # loads the revolution feature arguments 
6987 featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1 
6988 featperform rf result 
6989 ~~~~~
6990
6991 @subsubsection occt_draw_7_11_3  draft
6992
6993 Syntax: 
6994 ~~~~~
6995 draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal] 
6996 ~~~~~
6997
6998 Computes a draft angle surface from a wire. The surface is determined by the draft direction, the inclination of the draft surface, a draft angle, and a limiting distance. 
6999
7000   * The draft angle is measured in radians.
7001   * The draft direction is determined by the argument -INTERNAL
7002   * The argument Ri/Ro deftermines wether the corner edges of the draft surfaces are angular or rounded.
7003   * Arguments that can be used to define the surface distance are:
7004           * length, a defined distance
7005           * shape, until the surface contacts a shape
7006           * surface, until the surface contacts a surface.
7007
7008 **Note** that the original aim of adding a draft angle to a shape is to produce a shape which can be removed easily from a mould. The Examples below use larger angles than are used normally and the calculation results returned are not indicated.
7009
7010 **Example:** 
7011 ~~~~~
7012 # to create a simple profile 
7013 profile p F 0 0 x 2 y 4 tt 0 4 w 
7014 # creates a draft with rounded angles 
7015 draft res p 0 0 1 3 1 -Ro 
7016 # to create a profile with an internal angle 
7017 profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w 
7018 # creates a draft with rounded external angles 
7019 draft res p 0 0 1 3 1 -Ro 
7020 ~~~~~
7021
7022 @subsubsection occt_draw_7_11_4  deform
7023
7024 Syntax:      
7025 ~~~~~
7026 deform newname name CoeffX CoeffY CoeffZ
7027 ~~~~~
7028
7029 Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions. 
7030  
7031 **Example:** 
7032 ~~~~~
7033 pcylinder c 20 20 
7034 deform a c 1 3 5 
7035 # the conversion to bspline is followed by the 
7036 deformation 
7037 ~~~~~
7038
7039
7040 @subsubsection occt_draw_7_11_5 nurbsconvert
7041
7042 Syntax:
7043  
7044 ~~~~~
7045 nurbsconvert result name [result name] 
7046 ~~~~~
7047
7048 Changes the NURBS curve definition of a shape to a Bspline curve definition. This conversion is required for assymetric deformation and prepares the arguments for other commands such as **deform**. The conversion can be necessary when transferring shape data to other applications. 
7049
7050
7051 @subsection occt_draw_7_12  Texture Mapping to a Shape
7052
7053 Texture mapping allows you to map textures on a shape. Textures are texture image files and several are predefined. You can control the number of occurrences of the texture on a face, the position of a texture and the scale factor of the texture. 
7054
7055 @subsubsection occt_draw_7_12_1  vtexture
7056
7057 Syntax:      
7058 ~~~~~
7059 vtexture NameOfShape TextureFile 
7060 vtexture NameOfShape 
7061 vtexture NameOfShape ? 
7062 vtexture NameOfShape IdOfTexture 
7063 ~~~~~
7064
7065 **TextureFile** identifies the file containing the texture you want. The same syntax without **TextureFile** disables texture mapping. The question-mark <b>?</b> lists available textures. **IdOfTexture** allows applying predefined textures. 
7066
7067 @subsubsection occt_draw_7_12_2  vtexscale
7068
7069 Syntax:      
7070 ~~~~~
7071 vtexscale NameOfShape ScaleU ScaleV 
7072 vtexscale NameOfShape ScaleUV 
7073 vtexscale NameOfShape 
7074 ~~~~~
7075
7076 *ScaleU* and *Scale V* allow scaling the texture according to the U and V parameters individually, while *ScaleUV* applies the same scale to both parameters. 
7077
7078 The syntax without *ScaleU*, *ScaleV* or *ScaleUV* disables texture scaling. 
7079
7080 @subsubsection occt_draw_7_12_3  vtexorigin
7081
7082 Syntax:       
7083 ~~~~~
7084 vtexorigin NameOfShape UOrigin VOrigin 
7085 vtexorigin NameOfShape UVOrigin 
7086 vtexorigin NameOfShape 
7087 ~~~~~
7088
7089 *UOrigin* and *VOrigin* allow placing the texture according to the U and V parameters individually, while *UVOrigin* applies the same position value to both parameters. 
7090
7091 The syntax without *UOrigin*, *VOrigin* or *UVOrigin* disables origin positioning. 
7092
7093 @subsubsection occt_draw_7_12_4  vtexrepeat
7094
7095 Syntax:       
7096 ~~~~~
7097 vtexrepeat NameOfShape URepeat VRepeat 
7098 vtexrepeat NameOfShape UVRepeat 
7099 vtexrepeat NameOfShape 
7100 ~~~~~
7101
7102 *URepeat* and *VRepeat* allow repeating the texture along the U and V parameters individually, while *UVRepeat* applies the same number of repetitions for both parameters. 
7103
7104 The same syntax without *URepeat*, *VRepeat* or *UVRepeat* disables texture repetition. 
7105
7106 @subsubsection occt_draw_7_12_5  vtexdefault
7107
7108 Syntax:       
7109 ~~~~~
7110 vtexdefault NameOfShape 
7111 ~~~~~
7112
7113 *Vtexdefault* sets or resets the texture mapping default parameters. 
7114
7115 The defaults are: 
7116
7117  * *URepeat = VRepeat = 1* no repetition 
7118  * *UOrigin = VOrigin = 1*  origin set at (0,0) 
7119  * *UScale = VScale = 1*  texture covers 100% of the face 
7120
7121 @section occt_draw_8 Data Exchange commands
7122
7123 This paragraph presents some general information about Data Exchange (DE) operations. 
7124
7125 DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.) 
7126
7127 This files include a number of entities. Each entity has its own number in the file which we call label and denote as # for a STEP file and D for an IGES file. Each file has entities called roots (one or more). A full description of such entities is contained in the Users' Guides 
7128 * for <a href="user_guides__step.html#occt_step_1">STEP format</a> and
7129 * for <a href="user_guides__iges.html#occt_iges_1">IGES format</a>. 
7130
7131 Each Draw session has an interface model, which is a structure for keeping various information. 
7132
7133 The first step of translation is loading information from a file into a model. 
7134 The second step is creation of an OpenCASCADE shape from this model. 
7135
7136 Each entity from a file has its own number in the model (num). During the translation a map of correspondences between labels(from file) and numbers (from model) is created. 
7137
7138 The model and the map are used for working with most of DE commands. 
7139
7140 @subsection occt_draw_8_1  IGES commands 
7141
7142 @subsubsection occt_draw_8_1_1  igesread
7143
7144 Syntax:      
7145 ~~~~~
7146 igesread <file_name> <result_shape_name> [<selection>]
7147 ~~~~~
7148
7149 Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted. 
7150
7151
7152 | N     | Mode  | Description |
7153 | :-- | :-- | :---------- |
7154 | 0     | End   | finish conversion and exit igesbrep |
7155 | 1     | Visible roots | convert only visible roots |
7156 | 2     | All roots     | convert all roots |
7157 | 3     | One entity | convert entity with number provided by the user |
7158 | 4     | Selection     | convert only entities contained in selection |
7159
7160
7161 After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes (e.g., one shape per root or one shape for all the entities). It is also possible to save loaded shapes in files, and to cancel loading. 
7162
7163 The second parameter of this command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was *s*, they will be *s_1, ... s_N*. 
7164
7165 <i><selection></i> specifies the scope of selected entities in the model, by default it is *xst-transferrable-roots*.  If we use symbol <i>*</i> as <i><selection></i> all roots will be translated. 
7166
7167 See also the detailed description of <a href="user_guides__iges.html#occt_iges_2_3_4">Selecting IGES entities</a>.
7168
7169 **Example:**
7170 ~~~~~
7171 # translation all roots from file 
7172 igesread /disk01/files/model.igs a  * 
7173 ~~~~~
7174
7175 @subsubsection occt_draw_8_1_2   tplosttrim
7176
7177 Syntax:      
7178 ~~~~~
7179 tplosttrim [<IGES_type>] 
7180 ~~~~~
7181
7182 Sometimes the trimming contours of IGES faces (i.e., entity 141 for 143, 142 for 144) can be lost during translation due to fails. This command gives us a number of lost trims and the number of corresponding IGES entities. 
7183 It outputs the rank and numbers of faces that lost their trims and their numbers for each type (143, 144, 510) and their total number. If a face lost several of its trims it is output only once. 
7184 Optional parameter <i><IGES_type></i> can be *0TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces. 
7185
7186 **Example:**
7187 ~~~~~
7188 tplosttrim TrimmedSurface 
7189 ~~~~~
7190
7191 @subsubsection occt_draw_8_1_3  brepiges
7192
7193 Syntax:      
7194 ~~~~~
7195 brepiges <shape_name> <filename.igs>
7196 ~~~~~
7197
7198 Writes an OCCT shape to an IGES file. 
7199
7200 **Example:** 
7201 ~~~~~    
7202 # write shape with name aa to IGES file 
7203 brepiges aa /disk1/tmp/aaa.igs 
7204 == unit (write) : MM 
7205 == mode  write  : Faces 
7206 ==   To modifiy : command  param 
7207 == 1 Shapes written, giving 345 Entities 
7208 ==  Now, to write a file, command : writeall filename 
7209 ==  Output on file : /disk1/tmp/aaa.igs 
7210 ==  Write OK 
7211 ~~~~~
7212
7213 @subsection occt_draw_8_2  STEP commands 
7214
7215 These commands are used during the translation of STEP models. 
7216
7217
7218 @subsubsection occt_draw_8_2_1  stepread
7219
7220 Syntax:      
7221 ~~~~~
7222 stepread file_name result_shape_name [selection] 
7223 ~~~~~
7224
7225 Read a STEP file to an OCCT shape. 
7226 This command will interactively ask the user to select a set of entities to be converted: 
7227
7228 | N | Mode | Description |
7229 | :---- | :---- | :---- |  
7230 | 0     | End   | Finish transfer and exit stepread | 
7231 | 1     | root with rank 1      | Transfer first root | 
7232 | 2     | root by its rank      | Transfer root specified by its rank | 
7233 | 3     | One entity    | Transfer entity with a number provided by the user | 
7234 | 4     | Selection     | Transfer only entities contained in selection | 
7235
7236 After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes. 
7237 The second parameter of this command defines the name of the loaded shape. If several shapes are created, they will get indexed names. For instance, if the last parameter was *s*, they will be *s_1, ... s_N*. 
7238 <i><selection></i> specifies the scope of selected entities in the model.  If we use symbol <i>*</i> as <i><selection></i> all roots will be translated. 
7239
7240 See also the detailed description of <a href="user_guides__step.html#occt_step_2_3_6">Selecting STEP entities</a>.
7241
7242 **Example:**
7243 ~~~~~
7244 # translation all roots from file 
7245 stepread /disk01/files/model.stp a  * 
7246 ~~~~~
7247
7248 @subsubsection occt_draw_8_2_2   stepwrite
7249
7250 Syntax:      
7251 ~~~~~
7252 stepwrite mode shape_name file_name 
7253 ~~~~~
7254
7255 Writes an OCCT shape to a STEP file. 
7256
7257 The following  modes are available : 
7258     * *a* - as is – mode is selected automatically depending on the type & geometry of the shape; 
7259     * *m* - *manifold_solid_brep* or *brep_with_voids* 
7260     * *f* - *faceted_brep* 
7261     * *w* - *geometric_curve_set* 
7262     * *s* - *shell_based_surface_model* 
7263         
7264 For further information see <a href="#user_guides__step.html#occt_step_6_5">Writing a STEP file</a>. 
7265
7266 **Example:**
7267
7268 Let us write shape *a* to a STEP file in mode *0*. 
7269
7270 ~~~~~
7271 stepwrite 0 a /disk1/tmp/aaa.igs 
7272 ~~~~~
7273
7274
7275 @subsection occt_draw_8_3  General commands 
7276
7277 These are auxilary commands used for the analysis of result of translation of IGES and STEP files. 
7278
7279 @subsubsection occt_draw_8_3_1  count
7280
7281 Syntax:      
7282 ~~~~~
7283 count <counter> [<selection>] 
7284 ~~~~~
7285
7286 Calculates statistics on the entities in the model and outputs a count of entities. 
7287
7288 The optional selection argument, if specified, defines a subset of entities, which are to be taken into account. The first argument should be one of the currently defined counters. 
7289
7290 | Counter       | Operation |
7291 | :-------- | :-------- | 
7292 | xst-types     | Calculates how many entities of each OCCT type exist | 
7293 | step214-types | Calculates how many entities of each STEP type exist |
7294
7295 **Example:**
7296 ~~~~~
7297 count xst-types 
7298 ~~~~~
7299
7300 @subsubsection occt_draw_8_3_2 data
7301
7302 Syntax:      
7303 ~~~~~
7304 data <symbol>
7305 ~~~~~
7306
7307 Obtains general statistics on the loaded data. 
7308 The information printed by this command depends on the symbol specified. 
7309
7310 **Example:**
7311 ~~~~~
7312 # print full information about warnings and fails 
7313 data c 
7314 ~~~~~
7315
7316 | Symbol        | Output |
7317 | :------ | :------ |
7318 | g     | Prints the information contained in the header of the file |
7319 | c or f        | Prints messages generated during the loading of the STEP file (when the procedure of the integrity of the loaded data check is performed) and the resulting statistics (f works only with fail messages while c with both fail and warning messages) |
7320 | t     | The same as c or f, with a list of failed or warned entities |
7321 | m or l | The same as t but also prints a status for each entity | 
7322 | e | Lists all entities of the model with their numbers, types, validity status etc. |
7323 | R     | The same as e but lists only root entities |
7324
7325
7326
7327 @subsubsection occt_draw_8_3_3  elabel
7328
7329 Syntax:      
7330 ~~~~~
7331 elabel <num>
7332 ~~~~~
7333
7334 Entities in the IGES and STEP files are numbered in the succeeding order. An entity can be identified either by its number or by its label. Label is the letter ‘#'(for STEP, for IGES use ‘D’) followed by the rank. This command gives us a label for an entity with a known number. 
7335
7336 **Example:**
7337 ~~~~~
7338 elabel 84 
7339 ~~~~~
7340
7341 @subsubsection occt_draw_8_3_4  entity
7342
7343 Syntax:      
7344 ~~~~~
7345 entity <#(D)>_or_<num> <level_of_information>
7346 ~~~~~
7347
7348 The content of an IGES or STEP entity can be obtained by using this command. 
7349 Entity can be determined by its number or label. 
7350 <i><level_of_information></i> has range [0-6]. You can get more information about this level using this command without parameters. 
7351
7352 **Example:**
7353 ~~~~~
7354 # full information for STEP entity with label 84 
7355 entity #84 6 
7356 ~~~~~
7357
7358 @subsubsection occt_draw_8_3_5  enum
7359
7360 Syntax:      
7361 ~~~~~
7362 enum <#(D)> 
7363 ~~~~~
7364
7365 Prints a number for the entity with a given label. 
7366
7367 **Example:**
7368 ~~~~~
7369 # give a number for IGES entity with label 21 
7370 enum D21 
7371 ~~~~~
7372
7373 @subsubsection occt_draw_8_3_6  estatus
7374
7375 Syntax:      
7376 ~~~~~
7377 estatus <#(D)>_or_<num>
7378 ~~~~~
7379
7380 The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command. 
7381
7382 **Example:**
7383 ~~~~~
7384 estatus #315 
7385 ~~~~~
7386
7387 @subsubsection occt_draw_8_3_7  fromshape
7388
7389 Syntax:      
7390 ~~~~~
7391 fromshape <shape_name>
7392 ~~~~~
7393
7394 Gives the number of an IGES or STEP entity corresponding to an OCCT shape. If no corresponding entity can be found and if OCCT shape is a compound the command explodes it to subshapes and try to find corresponding entities for them. 
7395
7396 **Example:**
7397 ~~~~~
7398 fromshape a_1_23 
7399 ~~~~~
7400
7401 @subsubsection occt_draw_8_3_8  givecount
7402
7403 Syntax:      
7404 ~~~~~
7405 givecount <selection_name> [<selection_name>]
7406 ~~~~~
7407
7408
7409 Prints a number of loaded entities defined by the selection argument.
7410 Possible values of <selection_name> you can find in the “IGES FORMAT Users’s Guide”.
7411
7412 **Example:**
7413 ~~~~~
7414 givecount xst-model-roots 
7415 ~~~~~
7416
7417 @subsubsection occt_draw_8_3_9  givelist
7418
7419 Syntax:      
7420 ~~~~~
7421 givelist <selection_name>
7422 ~~~~~
7423
7424 Prints a list of a subset of loaded entities defined by the selection argument: 
7425 | Selection |   Description |
7426 | :------- | :----------- |
7427 | xst-model-all | all entities of the model |
7428 | xst-model-roots |     all roots |
7429 | xst-pointed | (Interactively) pointed entities (not used in DRAW) |
7430 | xst-transferrable-all | all transferable (recognized) entities |
7431 | xst-transferrable-roots       | Transferable roots | 
7432
7433
7434 **Example:**
7435 ~~~~~
7436 # give a list of all entities of the model 
7437 givelist xst-model-all 
7438 ~~~~~
7439
7440 @subsubsection occt_draw_8_3_10  listcount
7441
7442 Syntax:     listcount <counter> [<selection> ...]
7443
7444 Prints a list of entities per each type matching the criteria defined by arguments. 
7445 Optional <i><selection></i> argument, if specified, defines a subset of entities, which are to be taken into account. Argument <i><counter></i>  should be one of the currently defined counters: 
7446
7447 | Counter |     Operation |
7448 | :----- | :------ |
7449 | xst-types     | Calculates how many entities of each OCCT type exist |
7450 | iges-types    | Calculates how many entities of each IGES type and form exist |
7451 | iges-levels   | Calculates how many entities lie in different IGES levels |
7452
7453 **Example:**
7454 ~~~~~
7455 listcount xst-types 
7456 ~~~~~
7457
7458 @subsubsection occt_draw_8_3_11  listitems
7459
7460 Syntax:      
7461 ~~~~~
7462 listitems 
7463 ~~~~~
7464
7465 This command prints a list of objects (counters, selections etc.) defined in the current session. 
7466
7467
7468 @subsubsection occt_draw_8_3_12  listtypes
7469
7470 Syntax:      
7471 ~~~~~
7472 listtypes [<selection_name> ...]
7473 ~~~~~
7474
7475 Gives a list of entity types which were encountered in the last loaded file (with a number of entities of each type). The list can be shown not for all entities but for a subset of them. This subset is defined by an optional selection argument. 
7476
7477
7478 @subsubsection occt_draw_8_3_13  newmodel
7479
7480 Syntax:      
7481 ~~~~~
7482 newmodel 
7483 ~~~~~
7484
7485 Clears the current model. 
7486
7487
7488 @subsubsection occt_draw_8_3_14  param
7489
7490 Syntax:      
7491 ~~~~~
7492 param [<parameter>] [<value>]
7493 ~~~~~
7494
7495 This command is used to manage translation parameters. 
7496 Command without arguments gives a full list of parameters with current values. 
7497 Command with <i><parameter></i> (without <i><value></i>) gives us the current value of this parameter and all possible values for it. Command with <i><value></i> sets this new value to <i><parameter></i>.
7498
7499 **Example:**
7500
7501 Let us get the information about possible schemes for writing STEP file :
7502
7503 ~~~~~
7504 param write.step.schema 
7505 ~~~~~
7506
7507 @subsubsection occt_draw_8_3_15  sumcount
7508
7509 Syntax:      
7510 ~~~~~
7511 sumcount <counter> [<selection> ...]
7512 ~~~~~
7513
7514 Prints only a number of entities per each type matching the criteria defined by arguments. 
7515
7516 **Example:**
7517 ~~~~~
7518 sumcount xst-types 
7519 ~~~~~
7520
7521 @subsubsection occt_draw_8_3_16  tpclear
7522
7523 Syntax:      
7524 ~~~~~
7525 tpclear  
7526 ~~~~~
7527
7528 Clears the map of correspondences between IGES or STEP entities and OCCT shapes. 
7529
7530
7531
7532 @subsubsection occt_draw_8_3_17  tpdraw
7533
7534 Syntax:      
7535 ~~~~~
7536 tpdraw <#(D)>_or_<num>
7537 ~~~~~
7538
7539 **Example:**
7540 ~~~~~
7541 tpdraw 57 
7542 ~~~~~
7543
7544 @subsubsection occt_draw_8_3_18  tpent
7545
7546 Syntax:      
7547 ~~~~~
7548 tpent <#(D)>_or_<num>
7549 ~~~~~
7550
7551 Get information about the result of translation of the given IGES or STEP entity.
7552
7553 **Example:**
7554 ~~~~~
7555 tpent \#23 
7556 ~~~~~
7557
7558 @subsubsection occt_draw_8_3_19  tpstat
7559
7560 Syntax:      
7561 ~~~~~
7562 tpstat [*|?]<symbol> [<selection>]
7563 ~~~~~
7564
7565
7566 Provides all statistics on the last transfer, including a list of transferred entities with mapping from IGES or STEP to OCCT types, as well as fail and warning messages. The parameter <i><symbol></i> defines what information will be printed: 
7567
7568 * *g*   - General statistics (a list of results and messages)
7569 * *c*   - Count of all warning and fail messages
7570 * *C*   - List of all warning and fail messages
7571 * *f*   - Count of all fail messages
7572 * *F*   - List of all fail messages
7573 * *n*   - List of all transferred roots
7574 * *s*   - The same, with types of source entity and the type of result
7575 * *b*   - The same, with messages
7576 * *t*   - Count of roots for geometrical types
7577 * *r*   - Count of roots for topological types
7578 * *l*   - The same, with the type of the source entity
7579
7580 The sign \* before parameters *n, s, b, t, r* makes it work on all entities (not only on roots).
7581
7582 The sign ? before *n, s, b, t* limits the scope of information to invalid entities. 
7583
7584 Optional argument \<selection\> can limit the action of the command to the selection, not to all entities. 
7585
7586 To get help, run this command without arguments. 
7587
7588 **Example:**
7589 ~~~~~
7590 # translation ratio on IGES faces 
7591 tpstat *l iges-faces 
7592 ~~~~~
7593
7594 @subsubsection occt_draw_8_3_20  xload
7595
7596 Syntax:      
7597 ~~~~~
7598 xload <file_name>
7599 ~~~~~
7600
7601 This command loads an IGES or STEP file into memory (i.e. to fill the model with data from the file) without creation of an OCCT shape. 
7602
7603 **Example:**
7604 ~~~~~
7605 xload /disk1/tmp/aaa.stp 
7606 ~~~~~
7607
7608
7609 @subsection occt_draw_8_4  Overview of XDE commands 
7610
7611 These commands are used for translation of IGES and STEP files into an XCAF document (special document is inherited from CAF document and is intended for Extended Data Exchange (XDE) ) and working with it. XDE translation allows reading and writing of shapes with additional attributes – colors, layers etc. All commands can be divided into the following groups: 
7612   * XDE translation commands
7613   * XDE general commands
7614   * XDE shape’s commands
7615   * XDE color’s commands
7616   * XDE layer’s commands
7617   * XDE property’s commands
7618
7619 Reminding: All operations of translation are performed with parameters managed by command  <a href="#occt_draw_8_3_14">the command *param*</a>.
7620
7621 @subsubsection occt_draw_8_4_1  ReadIges
7622
7623 Syntax:      
7624 ~~~~~
7625 ReadIges document file_name 
7626 ~~~~~
7627
7628 Reads information from an IGES file to an XCAF document. 
7629
7630 **Example:**
7631 ~~~~~
7632 ReadIges D /disk1/tmp/aaa.igs 
7633 ==> Document saved with name D 
7634 ~~~~~
7635
7636 @subsubsection occt_draw_8_4_2  ReadStep
7637
7638 Syntax:      
7639 ~~~~~
7640 ReadStep <document> <file_name>
7641 ~~~~~
7642
7643 Reads information from a STEP file to an XCAF document. 
7644
7645 **Example:**
7646 ~~~~~
7647 ReadStep D /disk1/tmp/aaa.stp 
7648 == Document saved with name D 
7649 ~~~~~
7650
7651 @subsubsection occt_draw_8_4_3  WriteIges
7652
7653 Syntax:      
7654 ~~~~~
7655 WriteIges <document> <file_name>
7656 ~~~~~
7657
7658 **Example:**
7659 ~~~~~
7660 WriteIges D /disk1/tmp/aaa.igs 
7661 ~~~~~
7662
7663 @subsubsection occt_draw_8_4_4  WriteStep
7664
7665 Syntax:      
7666 ~~~~~
7667 WriteStep <document> <file_name>
7668 ~~~~~
7669
7670 Writes information from an XCAF document to a STEP file. 
7671
7672 **Example:**
7673 ~~~~~
7674 WriteStep D /disk1/tmp/aaa.stp 
7675 ~~~~~
7676
7677 @subsubsection occt_draw_8_4_5  XFileCur
7678
7679 Syntax:      
7680 ~~~~~
7681 XFileCur  
7682 ~~~~~
7683
7684 Returns the name of file which is set as the current one in the Draw session. 
7685
7686 **Example:**
7687 ~~~~~
7688 XFileCur 
7689 == *as1-ct-203.stp* 
7690 ~~~~~
7691
7692 @subsubsection occt_draw_8_4_6  XFileList
7693
7694 Syntax:      
7695 ~~~~~
7696 XFileList  
7697 ~~~~~
7698
7699 Returns a list all files that were transferred by the last transfer. This command is  meant (assigned) for the assemble step file. 
7700
7701 **Example:**
7702 ~~~~~
7703 XFileList 
7704 ==> *as1-ct-Bolt.stp* 
7705 ==> *as1-ct-L-Bracktet.stp* 
7706 ==> *as1-ct-LBA.stp* 
7707 ==> *as1-ct-NBA.stp* 
7708 ==> … 
7709 ~~~~~
7710
7711 @subsubsection occt_draw_8_4_7  XFileSet
7712
7713 Syntax:      
7714 ~~~~~
7715 XFileSet <filename> 
7716 ~~~~~
7717
7718 Sets the current file taking it from the components list of the assemble file. 
7719
7720 **Example:**
7721 ~~~~~
7722 XFileSet as1-ct-NBA.stp 
7723 ~~~~~
7724
7725 @subsubsection occt_draw_8_4_8  XFromShape
7726
7727 Syntax:      
7728 ~~~~~
7729 XFromShape <shape>
7730 ~~~~~
7731
7732 This command is similar to <a href="#occt_draw_8_3_7">the command *fromshape*</a>, but gives additional information about the file name. It is useful if a shape was translated from several files. 
7733
7734 **Example:**
7735 ~~~~~
7736 XFromShape a 
7737 ==> Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp 
7738 ~~~~~
7739
7740 @subsection occt_draw_8_5  XDE general commands 
7741
7742 @subsubsection occt_draw_8_5_1  XNewDoc
7743
7744 Syntax:      
7745 ~~~~~
7746 XNewDoc <document>
7747 ~~~~~
7748
7749 Creates a new XCAF document. 
7750
7751 **Example:**
7752 ~~~~~
7753 XNewDoc D 
7754 ~~~~~
7755
7756 @subsubsection occt_draw_8_5_2  XShow
7757
7758 Syntax:      
7759 ~~~~~
7760 XShow <document> [ <label1> … ]
7761 ~~~~~
7762
7763 Shows a shape from a given label in the 3D viewer. If the label is not given – shows all shapes from the document. 
7764
7765 **Example:**
7766 ~~~~~
7767 # show shape from label 0:1:1:4 from document D 
7768 XShow D 0:1:1:4 
7769 ~~~~~
7770
7771 @subsubsection occt_draw_8_5_3  XStat
7772
7773 Syntax:      
7774 ~~~~~
7775 XStat <document>
7776 ~~~~~
7777
7778 Prints common information from an XCAF document. 
7779
7780 **Example:**
7781 ~~~~~
7782 XStat D 
7783 ==>Statistis of shapes in the document: 
7784 ==>level N 0 : 9 
7785 ==>level N 1 : 18 
7786 ==>level N 2 : 5 
7787 ==>Total number of labels for shapes in the document = 32 
7788 ==>Number of labels with name = 27 
7789 ==>Number of labels with color link = 3 
7790 ==Number of labels with layer link = 0 
7791 ==>Statistis of Props in the document: 
7792 ==>Number of Centroid Props = 5 
7793 ==>Number of Volume Props = 5 
7794 ==>Number of Area Props = 5 
7795 ==>Number of colors = 4 
7796 ==>BLUE1 RED YELLOW BLUE2 
7797 ==>Number of layers = 0 
7798 ~~~~~
7799
7800 @subsubsection occt_draw_8_5_4  XWdump
7801
7802 Syntax:      
7803 ~~~~~
7804 XWdump <document> <filename>
7805 ~~~~~
7806
7807 Saves the contents of the viewer window as an image (XWD, png or BMP file). 
7808 <i><filename></i> must have a corresponding extention. 
7809
7810 **Example:**
7811 ~~~~~
7812 XWdump D /disk1/tmp/image.png 
7813 ~~~~~
7814
7815 @subsubsection occt_draw_8_5_5  Xdump
7816
7817 Syntax:      
7818 ~~~~~
7819 Xdump <document> [int deep {0|1}]
7820 ~~~~~
7821
7822 Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes. 
7823
7824 **Example:**
7825 ~~~~~
7826 Xdump D 1 
7827 ==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448) 
7828 ==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8) 
7829 ==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000) 
7830 ==> ASSEMBLY 0:1:1:4 PLATE(0xe8387780) 
7831 ==> ASSEMBLY 0:1:1:5 ROD(0xe8475418) 
7832 ==> ASSEMBLY 0:1:1:6 AS1(0xe8476968) 
7833 ==>    ASSEMBLY 0:1:1:7 L-BRACKET-ASSEMBLY(0xe8476230) 
7834 ==>       ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448) 
7835 ==>       ASSEMBLY 0:1:1:8 NUT-BOLT-ASSEMBLY(0xe8475ec0) 
7836 ==>               ASSEMBLY 0:1:1:2 NUT(0xe82151e8) 
7837 ==>               ASSEMBLY 0:1:1:3 BOLT(0xe829b000) 
7838 etc. 
7839 ~~~~~
7840
7841 @subsection occt_draw_8_6  XDE shape commands 
7842
7843 @subsubsection occt_draw_8_6_1  XAddComponent
7844
7845 Syntax:      
7846 ~~~~~
7847 XAddComponent <document> <label> <shape> 
7848 ~~~~~
7849
7850 Adds a component shape to assembly. 
7851
7852 **Example:**
7853
7854 Let us add shape b as component shape to assembly shape from label *0:1:1:1* 
7855
7856 ~~~~~
7857 XAddComponent D 0:1:1:1 b 
7858 ~~~~~
7859
7860 @subsubsection occt_draw_8_6_2  XAddShape
7861
7862 Syntax:      
7863 ~~~~~
7864 XAddShape <document> <shape> [makeassembly=1]
7865 ~~~~~
7866
7867 Adds a shape (or an assembly) to a document. If this shape already exists in the document, then prints the label which points to it. By default, a new shape is added as an assembly (i.e. last parameter 1), otherwise it is necessary to pass 0 as the last parameter. 
7868
7869 **Example:**
7870 ~~~~~
7871 # add shape b to document D 
7872 XAddShape D b 0 
7873 == 0:1:1:10 
7874 # if pointed shape is compound and last parameter in 
7875 # XAddShape command is used by default (1), then for 
7876 # each subshapes new label is created 
7877 ~~~~~
7878
7879 @subsubsection occt_draw_8_6_3  XFindComponent
7880
7881 Syntax:      
7882 ~~~~~
7883 XFindComponent <document> <shape>
7884 ~~~~~
7885
7886 Prints a sequence of labels of the assembly path. 
7887
7888 **Example:**
7889 ~~~~~
7890 XFindComponent D b 
7891 ~~~~~
7892
7893 @subsubsection occt_draw_8_6_4  XFindShape
7894
7895 Syntax:      
7896 ~~~~~
7897 XFindShape <document> <shape>
7898 ~~~~~
7899
7900 Finds and prints a label with an indicated top-level shape. 
7901
7902 **Example:**
7903 ~~~~~
7904 XFindShape D a 
7905 ~~~~~
7906
7907 @subsubsection occt_draw_8_6_5  XGetFreeShapes
7908
7909 Syntax:      
7910 ~~~~~
7911 XGetFreeShapes <document> [shape_prefix]
7912 ~~~~~
7913
7914 Print labels or create DRAW shapes for all free shapes in the document. 
7915 If *shape_prefix* is absent – prints labels, else – creates DRAW shapes with names 
7916 <i>shape_prefix</i>_num (i.e. for example: there are 3 free shapes and *shape_prefix* = a therefore shapes will be created with names a_1, a_2 and a_3). 
7917
7918 **Note**: a free shape is a shape to which no other shape refers to. 
7919
7920 **Example:**
7921 ~~~~~
7922 XGetFreeShapes D 
7923 == 0:1:1:6 0:1:1:10 0:1:1:12 0:1:1:13 
7924
7925 XGetFreeShapes D sh 
7926 == sh_1 sh_2 sh_3 sh_4 
7927 ~~~~~
7928
7929 @subsubsection occt_draw_8_6_6  XGetOneShape
7930
7931 Syntax:      
7932 ~~~~~
7933 XGetOneShape <shape> <document>
7934 ~~~~~
7935
7936 Creates one DRAW shape for all free shapes from a document. 
7937
7938 **Example:**
7939 ~~~~~
7940 XGetOneShape a D 
7941 ~~~~~
7942
7943 @subsubsection occt_draw_8_6_7  XGetReferredShape
7944
7945 Syntax:      
7946 ~~~~~
7947 XGetReferredShape <document> <label>
7948 ~~~~~
7949
7950 Prints a label that contains a top-level shape that corresponds to a shape at a given label. 
7951
7952 **Example:**
7953 ~~~~~
7954 XGetReferredShape D 0:1:1:1:1 
7955 ~~~~~
7956
7957 @subsubsection occt_draw_8_6_8  XGetShape
7958
7959 Syntax:      
7960 ~~~~~
7961 XGetShape <result> <document> <label>
7962 ~~~~~
7963
7964 Puts a shape from the indicated label in document to result. 
7965
7966 **Example:**
7967 ~~~~~
7968 XGetShape b D 0:1:1:3 
7969 ~~~~~
7970
7971 @subsubsection occt_draw_8_6_9  XGetTopLevelShapes
7972
7973 Syntax:      
7974 ~~~~~
7975 XGetTopLevelShapes <document>
7976 ~~~~~
7977
7978 Prints labels that contain top-level shapes. 
7979
7980 **Example:**
7981 ~~~~~
7982 XGetTopLevelShapes D 
7983 == 0:1:1:1 0:1:1:2 0:1:1:3 0:1:1:4 0:1:1:5 0:1:1:6 0:1:1:7 
7984 0:1:1:8 0:1:1:9 
7985 ~~~~~
7986
7987 @subsubsection occt_draw_8_6_10  XLabelInfo
7988
7989 Syntax:      
7990 ~~~~~
7991 XLabelInfo <document> <label>
7992 ~~~~~
7993
7994 Prints information about a shape, stored at an indicated label. 
7995
7996 **Example:** 
7997 ~~~~~    
7998 XLabelInfo D 0:1:1:6 
7999 ==> There are TopLevel shapes. There is an Assembly. This Shape is not used. 
8000 ~~~~~
8001
8002 @subsubsection occt_draw_8_6_11  XNewShape
8003
8004 Syntax:      
8005 ~~~~~
8006 XNewShape <document>
8007 ~~~~~
8008
8009 Creates a new empty top-level shape. 
8010
8011 **Example:**
8012 ~~~~~
8013 XNewShape D 
8014 ~~~~~
8015
8016 @subsubsection occt_draw_8_6_12  XRemoveComponent
8017
8018 Syntax:      
8019 ~~~~~
8020 XRemoveComponent <document> <label>
8021 ~~~~~
8022
8023 Removes a component from the components label. 
8024
8025 **Example:**
8026 ~~~~~
8027 XRemoveComponent D 0:1:1:1:1 
8028 ~~~~~
8029
8030 @subsubsection occt_draw_8_6_13  XRemoveShape
8031
8032 Syntax:      
8033 ~~~~~
8034 XRemoveShape <document> <label>
8035 ~~~~~
8036
8037 Removes a shape from a document (by it’s label). 
8038
8039 **Example:**
8040 ~~~~~
8041 XRemoveShape D 0:1:1:2 
8042 ~~~~~
8043
8044 @subsubsection occt_draw_8_6_14  XSetShape
8045
8046 Syntax:      
8047 ~~~~~
8048 XSetShape <document> <label> <shape>
8049 ~~~~~
8050
8051 Sets a shape at the indicated label. 
8052
8053 **Example:**
8054 ~~~~~
8055 XSetShape D 0:1:1:3 b 
8056 ~~~~~
8057
8058
8059 @subsection occt_draw_8_7_  XDE color commands 
8060
8061 @subsubsection occt_draw_8_7_1  XAddColor
8062
8063 Syntax:      
8064 ~~~~~
8065 XAddColor <document> <R> <G> <B>
8066 ~~~~~
8067
8068 Adds color in document to the color table. Parameters R,G,B are real. 
8069
8070 **Example:**
8071 ~~~~~
8072 XAddColor D 0.5 0.25 0.25 
8073 ~~~~~
8074
8075 @subsubsection occt_draw_8_7_2  XFindColor
8076
8077 Syntax:      
8078 ~~~~~
8079 XFindColor <document> <R> <G> <B>
8080 ~~~~~
8081
8082 Finds a label where the indicated color is situated. 
8083
8084 **Example:**
8085 ~~~~~
8086 XFindColor D 0.25 0.25 0.5 
8087 ==> 0:1:2:2 
8088 ~~~~~
8089
8090 @subsubsection occt_draw_8_7_3  XGetAllColors
8091
8092 Syntax:      
8093 ~~~~~
8094 XGetAllColors <document> 
8095 ~~~~~
8096
8097 Prints all colors that are defined in the document. 
8098
8099 **Example:**
8100 ~~~~~
8101 XGetAllColors D 
8102 ==> RED DARKORANGE BLUE1 GREEN YELLOW3 
8103 ~~~~~
8104
8105 @subsubsection occt_draw_8_7_4  XGetColor
8106
8107 Syntax:      
8108 ~~~~~
8109 XGetColor <document> <label>
8110 ~~~~~
8111
8112 Returns a color defined at the indicated label from the color table. 
8113
8114 **Example:**
8115 ~~~~~
8116 XGetColor D 0:1:2:3 
8117 == BLUE1 
8118 ~~~~~
8119
8120 @subsubsection occt_draw_8_7_5  XGetObjVisibility
8121
8122 Syntax:      
8123 ~~~~~
8124 XGetObjVisibility <document> {<label>|<shape>}
8125 ~~~~~
8126
8127 Returns the visibility of a shape. 
8128
8129 **Example:**
8130 ~~~~~
8131 XGetObjVisibility D 0:1:1:4 
8132 ~~~~~
8133
8134 @subsubsection occt_draw_8_7_6  XGetShapeColor
8135
8136 Syntax:      
8137 ~~~~~
8138 XGetShapeColor <document> <label> <colortype(s|c)>
8139 ~~~~~
8140
8141 Returns the color defined by label. If <i>colortype</i>=’s’ – returns surface color, else – returns curve color. 
8142
8143 **Example:**
8144 ~~~~~
8145 XGetShapeColor D 0:1:1:4 c 
8146 ~~~~~
8147
8148 @subsubsection occt_draw_8_7_7  XRemoveColor
8149
8150 Syntax:      
8151 ~~~~~
8152 XRemoveColor <document> <label>
8153 ~~~~~
8154
8155 Removes a color from the color table in a document. 
8156
8157 **Example:**
8158 ~~~~~
8159 XRemoveColor D 0:1:2:1 
8160 ~~~~~
8161
8162 @subsubsection occt_draw_8_7_8  XSetColor
8163
8164 Syntax:      
8165 ~~~~~
8166 XSetColor <document> {<label>|<shape>} <R> <G> <B>
8167 ~~~~~
8168
8169 Sets an RGB color to a shape given by label. 
8170
8171 **Example:**
8172 ~~~~~
8173 XsetColor D 0:1:1:4 0.5 0.5 0. 
8174 ~~~~~
8175
8176 @subsubsection occt_draw_8_7_9  XSetObjVisibility
8177
8178 Syntax:      
8179 ~~~~~
8180 XSetObjVisibility <document> {<label>|<shape>} {0|1}
8181 ~~~~~
8182
8183 Sets the visibility of a shape. 
8184
8185 **Example:**
8186 ~~~~~
8187 # set shape from label 0:1:1:4 as invisible 
8188 XSetObjVisibility D 0:1:1:4 0 
8189 ~~~~~
8190
8191 @subsubsection occt_draw_8_7_10  XUnsetColor
8192
8193 Syntax:      
8194 ~~~~~
8195 XUnsetColor <document> {<label>|<shape>} <colortype>
8196 ~~~~~
8197
8198 Unset a color given type (‘s’ or ‘c’) for the indicated shape. 
8199
8200 **Example:**
8201 ~~~~~
8202 XUnsetColor D 0:1:1:4 s 
8203 ~~~~~
8204
8205
8206 @subsection occt_draw_8_8_  XDE layer commands 
8207
8208 @subsubsection occt_draw_8_8_1  XAddLayer
8209
8210 Syntax:      
8211 ~~~~~
8212 XAddLayer <document> <layer>
8213 ~~~~~
8214
8215 Adds a new layer in an XCAF document. 
8216
8217 **Example:**
8218 ~~~~~
8219 XAddLayer D layer2 
8220 ~~~~~
8221
8222 @subsubsection occt_draw_8_8_2  XFindLayer
8223
8224 Syntax:      
8225 ~~~~~
8226 XFindLayer <document> <layer>
8227 ~~~~~
8228
8229 Prints a label where a layer is situated. 
8230
8231 **Example:**
8232 ~~~~~
8233 XFindLayer D Bolt 
8234 == 0:1:3:2 
8235 ~~~~~
8236
8237 @subsubsection occt_draw_8_8_3  XGetAllLayers
8238
8239 Syntax:      
8240 ~~~~~
8241 XGetAllLayers <document> 
8242 ~~~~~
8243
8244 Prints all layers in an XCAF document. 
8245
8246 **Example:**
8247 ~~~~~
8248 XGetAllLayers D 
8249 == *0:1:1:3* *Bolt* *0:1:1:9* 
8250 ~~~~~
8251
8252 @subsubsection occt_draw_8_8_4  XGetLayers
8253
8254 Syntax:      
8255 ~~~~~
8256 XGetLayers <document> {<shape>|<label>}
8257 ~~~~~
8258
8259 Returns names of layers, which are pointed to by links of an indicated shape. 
8260
8261 **Example:**
8262 ~~~~~
8263 XGetLayers D 0:1:1:3 
8264 == *bolt* *123* 
8265 ~~~~~
8266
8267 @subsubsection occt_draw_8_8_5  XGetOneLayer
8268
8269 Syntax:      
8270 ~~~~~
8271 XGetOneLayer <document> <label>
8272 ~~~~~
8273
8274 Prints the name of a layer at a given label. 
8275
8276 **Example:**
8277 ~~~~~
8278 XGetOneLayer D 0:1:3:2 
8279 ~~~~~
8280
8281 @subsubsection occt_draw_8_8_6  XIsVisible
8282
8283 Syntax:      
8284 ~~~~~
8285 XIsVisible <document> {<label>|<layer>}
8286 ~~~~~
8287
8288 Returns 1 if the indicated layer is visible, else returns 0. 
8289
8290 **Example:**
8291 ~~~~~
8292 XIsVisible D 0:1:3:1 
8293 ~~~~~
8294
8295 @subsubsection occt_draw_8_8_7  XRemoveAllLayers
8296
8297 Syntax:      
8298 ~~~~~
8299 XRemoveAllLayers <document> 
8300 ~~~~~
8301
8302 Removes all layers from an XCAF document. 
8303
8304 **Example:**
8305 ~~~~~
8306 XRemoveAllLayers D 
8307 ~~~~~
8308
8309 @subsubsection occt_draw_8_8_8  XRemoveLayer
8310
8311 Syntax:      
8312 ~~~~~
8313 XRemoveLayer <document> {<label>|<layer>}
8314 ~~~~~
8315
8316 Removes the indicated layer from an XCAF document. 
8317
8318 **Example:**
8319 ~~~~~
8320 XRemoveLayer D layer2 
8321 ~~~~~
8322
8323 @subsubsection occt_draw_8_8_9  XSetLayer
8324
8325 Syntax:      
8326 ~~~~~
8327 XSetLayer XSetLayer <document> {<shape>|<label>} <layer> [shape_in_one_layer {0|1}]
8328
8329 ~~~~~
8330  
8331 Sets a reference between a shape and a layer (adds a layer if it is necessary). 
8332 Parameter <i><shape_in_one_layer></i> shows whether a shape could be in a number of layers or only in one (0 by default). 
8333
8334 **Example:**
8335 ~~~~~
8336 XSetLayer D 0:1:1:2 layer2 
8337 ~~~~~
8338
8339 @subsubsection occt_draw_8_8_10  XSetVisibility
8340
8341 Syntax:      
8342 ~~~~~
8343 XSetVisibility <document> {<label>|<layer>} <isvisible {0|1}>
8344 ~~~~~
8345
8346 Sets the visibility of a layer. 
8347
8348 **Example:**
8349 ~~~~~
8350 # set layer at label 0:1:3:2 as invisible 
8351 XSetVisibility D 0:1:3:2 0 
8352 ~~~~~
8353
8354 @subsubsection occt_draw_8_8_11  XUnSetAllLayers
8355
8356 Syntax:      
8357 ~~~~~
8358 XUnSetAllLayers <document> {<label>|<shape>}
8359 ~~~~~
8360
8361 Unsets a shape from all layers. 
8362
8363 **Example:**
8364 ~~~~~
8365 XUnSetAllLayers D 0:1:1:2 
8366 ~~~~~
8367
8368 @subsubsection occt_draw_8_8_12  XUnSetLayer
8369
8370 Syntax:      
8371 ~~~~~
8372 XUnSetLayer <document> {<label>|<shape>} <layer>
8373 ~~~~~
8374
8375 Unsets a shape from the indicated layer. 
8376
8377 **Example:**
8378 ~~~~~
8379 XUnSetLayer D 0:1:1:2 layer1 
8380 ~~~~~
8381
8382 @subsection occt_draw_8_9  XDE property commands 
8383
8384 @subsubsection occt_draw_8_9_1  XCheckProps
8385
8386 Syntax:      
8387 ~~~~~
8388 XCheckProps <document> [ {0|deflection} [<shape>|<label>] ]
8389 ~~~~~
8390
8391 Gets properties for a given shape (*volume*, *area* and <i>centroid</i>) and compares them with the results after internal calculations. If the second parameter is 0, the standard OCCT tool is used for the computation of properties. If the second parameter is not 0, it is processed as a deflection. If the deflection is positive the computation is done by triangulations, if it is negative – meshing is forced. 
8392
8393 **Example:**
8394 ~~~~~
8395 # check properties for shapes at label 0:1:1:1 from 
8396 # document using standard Open CASCADE Technology tools 
8397 XCheckProps D 0 0:1:1:1 
8398 == Label 0:1:1:1      ;L-BRACKET* 
8399 ==  Area defect:        -0.0 (  0%) 
8400 ==  Volume defect:       0.0 (  0%) 
8401 ==  CG defect: dX=-0.000, dY=0.000, dZ=0.000 
8402 ~~~~~
8403
8404 @subsubsection occt_draw_8_9_2  XGetArea
8405
8406 Syntax:      
8407 ~~~~~
8408 XGetArea <document> {<shape>|<label>}
8409 ~~~~~
8410
8411 Returns the area of a given shape. 
8412
8413 **Example:**
8414 ~~~~~
8415 XGetArea D 0:1:1:1 
8416 == 24628.31815094999 
8417 ~~~~~
8418
8419 @subsubsection occt_draw_8_9_3  XGetCentroid
8420
8421 Syntax:      
8422 ~~~~~
8423 XGetCentroid <document> {<shape>|<label>}
8424 ~~~~~
8425
8426 Returns the center of gravity coordinates of a given shape. 
8427
8428 **Example:**
8429 ~~~~~
8430 XGetCentroid D 0:1:1:1 
8431 ~~~~~
8432
8433 @subsubsection occt_draw_8_9_4  XGetVolume
8434
8435 Syntax:      
8436 ~~~~~
8437 XGetVolume <document> {<shape>|<label>}
8438 ~~~~~
8439
8440 Returns the volume of a given shape. 
8441
8442 **Example:**
8443 ~~~~~
8444 XGetVolume D 0:1:1:1 
8445 ~~~~~
8446
8447 @subsubsection occt_draw_8_9_5  XSetArea
8448
8449 Syntax:      
8450 ~~~~~
8451 XSetArea <document> {<shape>|<label>} <area>
8452 ~~~~~
8453
8454 Sets new area to attribute list ??? given shape. 
8455
8456 **Example:**
8457 ~~~~~
8458 XSetArea D 0:1:1:1 2233.99 
8459 ~~~~~
8460
8461 @subsubsection occt_draw_8_9_6  XSetCentroid
8462
8463 Syntax:      
8464 ~~~~~
8465 XSetCentroid <document> {<shape>|<label>} <x> <y> <z>
8466 ~~~~~
8467
8468 Sets new center of gravity  to the attribute list given shape. 
8469
8470 **Example:**
8471 ~~~~~
8472 XSetCentroid D 0:1:1:1 0. 0. 100. 
8473 ~~~~~
8474
8475 @subsubsection occt_draw_8_9_7  XSetMaterial
8476
8477 Syntax:      
8478 ~~~~~
8479 XSetMaterial <document> {<shape>|<label>} <name> <density(g/cu sm)>
8480 ~~~~~ 
8481
8482 Adds a new label with material into the material table in a document, and adds a link to this material to the attribute list of a given shape or a given label. The last parameter sets the density of a pointed material. 
8483
8484 **Example:**
8485 ~~~~~
8486 XSetMaterial D 0:1:1:1 Titanium 8899.77 
8487 ~~~~~
8488
8489 @subsubsection occt_draw_8_9_8  XSetVolume
8490
8491 Syntax:      
8492 ~~~~~
8493 XSetVolume <document> {<shape>|<label>} <volume>
8494 ~~~~~
8495
8496 Sets new volume to the attribute list ??? given shape. 
8497
8498 **Example:**
8499 ~~~~~
8500 XSetVolume D 0:1:1:1 444555.33 
8501 ~~~~~
8502
8503 @subsubsection occt_draw_8_9_9  XShapeMassProps
8504
8505 Syntax:      
8506 ~~~~~
8507 XShapeMassProps <document> [ <deflection> [{<shape>|<label>}] ]
8508 ~~~~~
8509
8510 Computes and returns real mass and real center of gravity for a given shape or for all shapes in a document. The second parameter is used for calculation of the volume and CG(center of gravity). If it is 0, then the standard CASCADE tool (geometry) is used for computation, otherwise - by triangulations with a given deflection. 
8511
8512 **Example:**
8513 ~~~~~
8514 XShapeMassProps D 
8515 == Shape from label : 0:1:1:1 
8516 == Mass = 193.71681469282299 
8517 == CenterOfGravity X = 14.594564763807696,Y = 
8518     20.20271885211281,Z = 49.999999385313245 
8519 == Shape from label : 0:1:1:2 not have a mass 
8520 etc. 
8521 ~~~~~
8522
8523 @subsubsection occt_draw_8_9_10  XShapeVolume
8524
8525 Syntax:      
8526 ~~~~~
8527 XShapeVolume <shape> <deflection>
8528 ~~~~~
8529
8530 Calculates the real volume of a pointed shape with a given deflection. 
8531
8532 **Example:**
8533 ~~~~~
8534 XShapeVolume a 0 
8535 ~~~~~
8536
8537 @section occt_draw_9 Shape Healing commands
8538
8539
8540
8541 @subsection occt_draw_9_1 General commands 
8542
8543 @subsubsection occt_draw_9_1_1 bsplres
8544
8545 Syntax:      
8546 ~~~~~
8547 bsplres <result> <shape> <tol3d> <tol2d< <reqdegree> <reqnbsegments> <continuity3d> <continuity2d> <PriorDeg> <RationalConvert>
8548 ~~~~~
8549
8550 Performs approximations of a given shape (BSpline curves and surfaces or other surfaces) to BSpline with given required parameters. The specified continuity can be reduced if the approximation with a specified continuity was not done successfully. Results are put into the shape, which is given as a parameter result. For a more detailed description see the ShapeHealing User’s Guide (operator: **BSplineRestriction**). 
8551
8552 @subsubsection occt_draw_9_1_2 checkfclass2d
8553
8554 Syntax:      
8555 ~~~~~
8556 checkfclass2d <face> <ucoord> <vcoord>
8557 ~~~~~
8558
8559 Shows where a point which is given by coordinates is located in relation to a given face – outbound, inside or at the bounds. 
8560
8561 **Example:**
8562 ~~~~~
8563 checkfclass2d f 10.5 1.1 
8564 == Point is OUT 
8565 ~~~~~
8566
8567 @subsubsection occt_draw_9_1_3 checkoverlapedges
8568
8569 Syntax:      
8570 ~~~~~
8571 checkoverlapedges <edge1> <edge2> [<toler> <domaindist>]
8572 ~~~~~
8573
8574 Checks the overlapping of two given edges. If the distance between two edges is less than the given value of tolerance then edges are overlapped. Parameter <domaindist> sets length of part of edges on which edges are overlapped. 
8575
8576 **Example:**
8577 ~~~~~
8578 checkoverlapedges e1 e2 
8579 ~~~~~
8580
8581 @subsubsection occt_draw_9_1_4 comtol
8582
8583 Syntax:      
8584 ~~~~~
8585 comptol <shape> [nbpoints] [prefix]
8586 ~~~~~
8587
8588 Compares the real value of tolerance on curves with the value calculated by standard (using 23 points). The maximal value of deviation of 3d curve from pcurve at given simple points is taken as a real value (371 is by default). Command returns the maximal, minimal and average value of tolerance for all edges and difference between real values and set values. Edges with the maximal value of tolerance and relation will be saved if the ‘prefix’ parameter is given. 
8589
8590 **Example:** 
8591 ~~~~~    
8592 comptol h 871 t 
8593
8594 ==> Edges tolerance computed by 871 points: 
8595 ==> MAX=8.0001130696523449e-008 AVG=6.349346868091096e-009 MIN=0 
8596 ==> Relation real tolerance / tolerance set in edge 
8597 ==> MAX=0.80001130696523448 AVG=0.06349345591805905 MIN=0 
8598 ==> Edge with max tolerance saved to t_edge_tol 
8599 ==> Concerned faces saved to shapes t_1, t_2 
8600 ~~~~~
8601
8602 @subsubsection occt_draw_9_1_5 convtorevol
8603
8604 Syntax:      
8605 ~~~~~
8606 convtorevol <result> <shape>
8607 ~~~~~
8608
8609 Converts all elementary surfaces of a given shape into surfaces of revolution. 
8610 Results are put into the shape, which is given as the <i><result></i> parameter. 
8611
8612 **Example:**
8613 ~~~~~
8614 convtorevol r a 
8615 ~~~~~
8616
8617 @subsubsection occt_draw_9_1_6 directfaces
8618
8619 Syntax:      
8620 ~~~~~
8621 directfaces <result> <shape>
8622 ~~~~~
8623
8624 Converts indirect surfaces and returns the results into the shape, which is given as the result parameter. 
8625
8626 **Example:**
8627 ~~~~~
8628 directfaces r a 
8629 ~~~~~
8630
8631 @subsubsection occt_draw_9_1_7 expshape
8632
8633 Syntax:   
8634 ~~~~~
8635 expshape <shape> <maxdegree> <maxseg>
8636 ~~~~~
8637
8638 Gives statistics for a given shape. This test command is working with Bezier and BSpline entities. 
8639
8640 **Example:**
8641 ~~~~~
8642 expshape a 10 10 
8643 ==> Number of Rational Bspline curves 128 
8644 ==> Number of Rational Bspline pcurves 48 
8645 ~~~~~
8646
8647 @subsubsection occt_draw_9_1_8 fixsmall
8648
8649 Syntax:      
8650 ~~~~~
8651 fixsmall <result> <shape> [<toler>=1.]
8652 ~~~~~
8653
8654 Fixes small edges in given shape by merging adjacent edges with agiven tolerance. Results are put into the shape, which is given as the result parameter. 
8655
8656 **Example:**
8657 ~~~~~
8658 fixsmall r a 0.1 
8659 ~~~~~
8660
8661 @subsubsection occt_draw_9_1_9 fixsmalledges
8662
8663 Syntax:      
8664 ~~~~~
8665 fixsmalledges <result> <shape> [<toler> <mode> <maxangle>]
8666 ~~~~~
8667
8668 Searches at least one small edge at a given shape. If such edges have been found, then small edges are merged with a given tolerance. If parameter <i><mode></i> is equal to *Standard_True* (can be given any values, except 2), then  small edges, which can not be merged, are removed, otherwise they are to be kept (*Standard_False* is used by default). Parameter <i><maxangle></i> sets a maximum possible angle for merging two adjacent edges, by default no limit angle is applied (-1). Results are put into the shape, which is given as parameter result. 
8669
8670 **Example:**
8671 ~~~~~
8672 fixsmalledges r a 0.1 1 
8673 ~~~~~
8674
8675 @subsubsection occt_draw_9_1_10 fixshape
8676
8677 Syntax:      
8678 ~~~~~
8679 fixshape <result> <shape> [<preci> [<maxpreci>]] [{switches}]
8680 ~~~~~
8681
8682 Performs fixes of all sub-shapes (such as *Solids*, *Shells*, *Faces*, *Wires* and *Edges*) of a given shape. Parameter <i><preci></i> sets a basic precision value, <i><maxpreci></i> sets the maximal allowed tolerance. Results are put into the shape, which is given as parameter result. <b>{switches}</b> allows to tune parameters of ShapeFix 
8683
8684 The following syntax is used: 
8685 * <i><symbol></i> may be
8686          * "-" to set parameter off, 
8687          * "+" to set on or  
8688          * "*" to set default 
8689 * <i><parameter></i> is identified by  letters: 
8690          * l - FixLackingMode 
8691          * o - FixOrientationMode 
8692          * h - FixShiftedMode 
8693          * m - FixMissingSeamMode 
8694          * d - FixDegeneratedMode 
8695          * s - FixSmallMode 
8696          * i - FixSelfIntersectionMode 
8697          * n - FixNotchedEdgesMode 
8698 For enhanced message output, use switch '+?' 
8699
8700 **Example:**
8701 ~~~~~
8702 fixshape r a 0.001 
8703 ~~~~~
8704
8705 @subsubsection occt_draw_9_1_11 fixwgaps
8706
8707 Syntax:      
8708 ~~~~~
8709 fixwgaps <result> <shape> [<toler>=0]
8710 ~~~~~
8711
8712 Fixes gaps between ends of curves of adjacent edges (both 3d and pcurves) in wires in a given shape with a given tolerance. Results are put into the shape, which is given as parameter result. 
8713
8714 **Example:**
8715 ~~~~~
8716 fixwgaps r a 
8717 ~~~~~
8718
8719 @subsubsection occt_draw_9_1_12 offsetcurve, offset2dcurve
8720
8721 Syntax:      
8722 ~~~~~
8723 offsetcurve <result> <curve> <offset> <direction(as point)>
8724 offset2dcurve <result> <curve> <offset>
8725 ~~~~~
8726
8727 **offsetcurve** works with the curve in 3d space, **offset2dcurve** in 2d space. 
8728
8729 Both commands are intended to create a new offset curve by copying the given curve to distance, given by parameter <i><offset></i>. Parameter <i><direction></i> defines direction of the offset curve. It is created as a point. For correct work of these commands the direction of normal of the offset curve must be perpendicular to the plane, the basis curve is located there. Results are put into the curve, which is given as parameter <i><result></i>.  
8730
8731 **Example:**
8732 ~~~~~
8733 point pp 10 10 10 
8734 offsetcurve r c 20 pp 
8735 ~~~~~
8736
8737 @subsubsection occt_draw_9_1_13 projcurve
8738
8739 Syntax:      
8740 ~~~~~
8741 projcurve <edge>|<curve3d>|<curve3d first last>  <X> <Y> <Z>
8742 ~~~~~
8743
8744 **projcurve** returns the projection of a given point on a given curve. The curve may be defined by three ways: by giving the edge name, giving the 3D curve and by giving the unlimited curve and limiting it by pointing its start and finish values. 
8745
8746 **Example:** 
8747 ~~~~~    
8748 projcurve k_1 0 1 5 
8749 ==Edge k_1 Params from 0 to 1.3 
8750 ==Precision (BRepBuilderAPI) : 9.9999999999999995e-008  ==Projection : 0  1  5 
8751 ==Result : 0  1.1000000000000001  0 
8752 ==Param = -0.20000000000000001  Gap = 5.0009999000199947 
8753 ~~~~~
8754
8755 @subsubsection occt_draw_9_1_14 projface
8756
8757 Syntax:      
8758 ~~~~~
8759 projface <face> <X> <Y> [<Z>]
8760 ~~~~~
8761
8762 Returns the projection of a given point to a given face in 2d or 3d space. If two coordinates (2d space) are given then returns coordinates projection of this point in 3d space and vice versa. 
8763
8764 **Example:**
8765 ~~~~~
8766 projface a_1 10.0 0.0 
8767 ==  Point UV  U = 10  V = 0 
8768 ==   =   proj  X = -116  Y = -45  Z = 0 
8769 ~~~~~
8770
8771 @subsubsection occt_draw_9_1_15 scaleshape
8772
8773 Syntax:   
8774 ~~~~~
8775 scaleshape <result> <shape> <scale>
8776 ~~~~~
8777
8778 Returns a new shape, which is the result of scaling of a given shape with a coefficient equal to the parameter <i><scale></i>. Tolerance is calculated for the  new shape as well.
8779
8780 **Example:**
8781 ~~~~~
8782 scaleshape r a_1 0.8 
8783 ~~~~~
8784
8785 @subsubsection occt_draw_9_1_16 settolerance
8786
8787 Syntax:      
8788 ~~~~~
8789 settolerance <shape> [<mode>=v-e-w-f-a] <val>(fix value) or
8790                    <tolmin> <tolmax>
8791 ~~~~~ 
8792
8793 Sets new values of tolerance for a given shape. If the second parameter <i>mode</i> is given, then the tolerance value is set only for these sub shapes. 
8794
8795 **Example:**
8796 ~~~~~
8797 settolerance a 0.001 
8798 ~~~~~
8799
8800 @subsubsection occt_draw_9_1_17 splitface
8801
8802 Syntax:      
8803 ~~~~~
8804 splitface <result> <face> [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]
8805 ~~~~~
8806
8807 Splits a given face in parametric space and puts the result into the given parameter <i><result></i>. 
8808 Returns the status of split face. 
8809
8810 **Example:**
8811 ~~~~~
8812 # split face f by parameter u = 5 
8813 splitface r f u 5 
8814 ==> Splitting by   U:   ,5 
8815 ==> Status:  DONE1 
8816 ~~~~~
8817
8818 @subsubsection occt_draw_9_1_18 statshape
8819
8820 Syntax:      
8821 ~~~~~
8822 statshape <shape> [particul]
8823 ~~~~~
8824
8825 Returns the number of sub-shapes, which compose the given shape. For example, the number of solids, number of faces etc.  It also returns the number of geometrical objects or sub-shapes with a specified type, example, number of free faces, number of C0 
8826 surfaces. The last parameter becomes out of date. 
8827
8828 **Example:**
8829 ~~~~~
8830 statshape a 
8831 ==> Count     Item 
8832 ==> -----     ---- 
8833 ==> 402     Edge (oriented) 
8834 ==> 402     Edge (Shared) 
8835 ==> 74      Face 
8836 ==> 74      Face (Free) 
8837 ==> 804     Vertex (Oriented) 
8838 ==> 402     Vertex (Shared) 
8839 ==> 78      Wire 
8840 ==> 4      Face with more than one wire 
8841 ==> 34     bspsur: BSplineSurface 
8842 ~~~~~
8843
8844 @subsubsection occt_draw_9_1_19 tolerance
8845
8846 Syntax:      
8847 ~~~~~
8848 tolerance <shape> [<mode>:D v e f c] [<tolmin> <tolmax>:real]
8849 ~~~~~
8850
8851 Returns tolerance (maximal, avg and minimal values)  of all given shapes and tolerance of their *Faces*, *Edges* and *Vertices*. If parameter <i><tolmin></i> or <i><tolmax></i> or both of them are given, then sub-shapes are returned as a result of analys of this shape, which satisfy the given tolerances. If a particular value of entity ((**D**)all shapes  (**v**) *vertices* (**e**) *edges* (**f**) *faces* (**c**) *combined* (*faces*)) is given as the second parameter then only this group will be analyzed for tolerance. 
8852
8853 **Example:**
8854 ~~~~~
8855 tolerance a 
8856 ==> Tolerance MAX=0.31512672416608001 AVG=0.14901359484722074 MIN=9.9999999999999995e-08 
8857 ==> FACE    : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08 
8858 ==> EDGE    : MAX=0.31512672416608001 AVG=0.098691334511810405 MIN=9.9999999999999995e-08 
8859 ==> VERTEX  : MAX=0.31512672416608001 AVG=0.189076074499648 MIN=9.9999999999999995e-08 
8860
8861 tolerance a v 0.1 0.001 
8862 ==>  Analysing Vertices gives 6 Shapes between tol1=0.10000000000000001 and tol2=0.001 , named tol_1 to tol_6 
8863 ~~~~~
8864
8865
8866 @subsection occt_draw_9_2 Conversion commands 
8867
8868 @subsubsection occt_draw_9_2_1 DT_ClosedSplit
8869
8870 Syntax:      
8871 ~~~~~
8872 DT_ClosedSplit <result> <shape>
8873 ~~~~~
8874
8875 Divides all closed faces in the shape (for example cone) and returns result of given shape into shape, which is given as parameter result. Number of faces in resulting shapes will be increased. 
8876 Note: Closed face – it’s face with one or more seam. 
8877
8878 **Example:**
8879 ~~~~~
8880 DT_ClosetSplit r a 
8881 ~~~~~
8882
8883 @subsubsection occt_draw_9_2_2 DT_ShapeConvert, DT_ShapeConvertRev
8884
8885 Syntax:      
8886 ~~~~~
8887 DT_ShapeConvert <result> <shape> <convert2d> <convert3d>
8888 DT_ShapeConvertRev <result> <shape> <convert2d> <convert3d>
8889 ~~~~~
8890  
8891 Both commands are intended for the conversion of 3D, 2D curves to Bezier curves and surfaces to Bezier based surfaces. Parameters convert2d and convert3d take on a value 0 or 1. If the given value is 1, then the conversion will be performed, otherwise it will not be performed. The results are put into the shape, which is given as parameter Result. Command *DT_ShapeConvertRev* differs from *DT_ShapeConvert* by converting all elementary surfaces into surfaces of revolution first. 
8892
8893 **Example:**
8894 ~~~~~
8895 DT_ShapeConvert r a 1 1 
8896 == Status: DONE1 
8897 ~~~~~
8898
8899 @subsubsection occt_draw_9_2_3 DT_ShapeDivide
8900
8901 Syntax:      
8902 ~~~~~
8903 DT_ShapeDivide <result> <shape> <tol>
8904 ~~~~~
8905
8906 Divides the shape with C1 criterion and returns the result of geometry conversion of a given shape into the shape, which is given as parameter result. This command illustrates how class *ShapeUpgrade_ShapeDivideContinuity* works. This class allows to convert geometry with a continuity less than the specified continuity to geometry with target continuity. If conversion is not possible then the geometrical object is split into several ones, which satisfy the given tolerance. It also returns the  status shape splitting: 
8907  * OK      : no splitting was done 
8908  * Done1 : Some edges were split 
8909  * Done2 : Surface was split 
8910  * Fail1    : Some errors occurred 
8911
8912 **Example:**
8913 ~~~~~
8914 DT_ShapeDivide r a 0.001 
8915 == Status: OK 
8916 ~~~~~
8917
8918 @subsubsection occt_draw_9_2_4 DT_SplitAngle
8919
8920 Syntax:      
8921 ~~~~~
8922 DT_SplitAngle <result> <shape> [MaxAngle=95]
8923 ~~~~~
8924
8925 Works with all revolved surfaces, like cylinders, surfaces of revolution, etc. This command divides given revolved surfaces into segments so that each resulting segment covers not more than the given *MaxAngle* degrees and puts the result of splitting into the shape, which is given as parameter result. Values of returned status are given above. 
8926 This command illustrates how class *ShapeUpgrade_ShapeDivideAngle* works. 
8927
8928 **Example:**
8929 ~~~~~
8930 DT_SplitAngle r a 
8931 == Status: DONE2 
8932 ~~~~~
8933
8934 @subsubsection occt_draw_9_2_5 DT_SplitCurve
8935
8936 Syntax:      
8937 ~~~~~
8938 DT_SplitCurve <curve> <tol> <split(0|1)>
8939 ~~~~~
8940
8941 Divides the 3d curve with C1 criterion and returns the result of splitting of the given curve into a new curve. If the curve had been divided by segments, then each segment is put to an individual result.  This command can correct a given curve at a knot with the given tolerance, if it is impossible, then the given surface is split at that knot. If the last parameter is 1, then 5 knots are added at the given curve, and its surface is split by segments, but this will be performed not for all parametric spaces. 
8942
8943 **Example:**
8944 ~~~~~
8945 DT_SplitCurve r c 
8946 ~~~~~
8947
8948 @subsubsection occt_draw_9_2_6 DT_SplitCurve2d
8949
8950 Syntax:      
8951 ~~~~~
8952 DT_SplitCurve2d Curve Tol Split(0/1) 
8953 ~~~~~
8954
8955 Works just as **DT_SplitCurve** (see above), only with 2d curve. 
8956
8957 **Example:**
8958 ~~~~~
8959 DT_SplitCurve2d r c 
8960 ~~~~~
8961
8962 @subsubsection occt_draw_9_2_7 DT_SplitSurface
8963
8964 Syntax:      
8965 ~~~~~
8966 DT_SplitSurface <result> <Surface|GridSurf> <tol> <split(0|1)>
8967 ~~~~~
8968
8969 Divides surface with C1 criterion and returns the result of splitting of a given surface into surface, which is given as parameter result. If the surface has been divided into segments, then each segment is put to an individual result.  This command can correct a given C0 surface at a knot with a given tolerance, if it is impossible, then the given surface is split at that knot. If the last parameter is 1, then 5 knots are added to the given surface, and its surface is split by segments, but this will be performed not for all parametric spaces. 
8970
8971 **Example:** 
8972 ~~~~~    
8973
8974 ~~~~~
8975 # split surface with name "su"
8976 DT_SplitSurface res su 0.1 1 
8977 ==> single surf 
8978 ==> appel a SplitSurface::Init 
8979 ==> appel a SplitSurface::Build 
8980 ==> appel a SplitSurface::GlobalU/VKnots 
8981 ==> nb GlobalU;nb GlobalV=7 2 0 1 2 3 4 5 6.2831853072 0 1 
8982 ==> appel a Surfaces 
8983 ==> transfert resultat 
8984 ==> res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1 
8985 ~~~~~
8986 ~~~~~
8987
8988 @subsubsection occt_draw_9_2_8 DT_ToBspl
8989
8990 Syntax:      
8991 ~~~~~
8992 DT_ToBspl <result> <shape>
8993 ~~~~~
8994
8995 Converts a surface of linear extrusion, revolution and offset surfaces into BSpline surfaces. Returns the result into the shape, which is given as parameter result. 
8996
8997 **Example:** 
8998 ~~~~~    
8999 DT_ToBspl res sh 
9000 == error = 5.20375663162094e-08   spans = 10 
9001 ==  Surface is aproximated with continuity 2 
9002 ~~~~~
9003
9004 @section occt_draw_10 Performance evaluation commands
9005
9006
9007 @subsection occt_draw_10_1 VDrawSphere
9008
9009 Syntax:      
9010 ~~~~~
9011 vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToEnableVBO=1] [NumberOfViewerUpdate=1] [ToShowEdges=0] 
9012 ~~~~~
9013
9014 Calculates and displays in a given number of steps a sphere with given coordinates, radius and fineness. Returns the information about the properties of the sphere, the time and the amount of memory required to build it. 
9015
9016 This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter. 
9017
9018 **Example:** 
9019 ~~~~~
9020 vdrawsphere s 200 1 1 1 500 1 
9021 == Compute Triangulation... 
9022 == NumberOfPoints: 39602 
9023 == NumberOfTriangles: 79200 
9024 == Amount of memory required for PolyTriangulation without Normals: 2 Mb 
9025 == Amount of memory for colors: 0 Mb 
9026 == Amount of memory for PolyConnect: 1 Mb 
9027 == Amount of graphic card memory required: 2 Mb 
9028 == Number of scene redrawings: 1 
9029 == CPU user time: 15.6000999999998950 msec 
9030 == CPU system time: 0.0000000000000000 msec 
9031 == CPU average time of scene redrawing: 15.6000999999998950 msec 
9032 ~~~~~
9033
9034
9035 @section occt_draw_11 Extending Test Harness with custom commands
9036
9037
9038 The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism. 
9039
9040
9041 @subsection occt_draw_11_1 Custom command implementation
9042
9043 Custom command implementation has not undergone any changes since the introduction of the plug-in mechanism. The syntax of every command should still be like in the following example. 
9044
9045 **Example:** 
9046 ~~~~~
9047 static Standard_Integer myadvcurve(Draw_Interpretor& di, Standard_Integer n, char** a) 
9048
9049 ... 
9050
9051 ~~~~~
9052
9053 For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx). 
9054
9055
9056 @subsection occt_draw_11_2 Registration of commands in Test Harness
9057
9058 To become available in the Test Harness the custom command must be registered in it. This should be done as follows. 
9059
9060 **Example:** 
9061 ~~~~~
9062 void MyPack::CurveCommands(Draw_Interpretor& theCommands) 
9063
9064 ... 
9065 char* g = "Advanced curves creation"; 
9066
9067 theCommands.Add ( "myadvcurve", "myadvcurve name p1 p2 p3 – Creates my advanced curve from points", 
9068                   __FILE__, myadvcurve, g ); 
9069 ... 
9070
9071 ~~~~~
9072
9073 @subsection occt_draw_11_3 Creating a toolkit (library) as a plug-in
9074
9075 All custom commands are compiled and linked into a dynamic library (.dll on Windows, or .so on Unix/Linux). To make Test Harness recognize it as a plug-in it must respect certain conventions. Namely, it must export function *PLUGINFACTORY()* accepting the Test Harness interpreter object (*Draw_Interpretor*). This function will be called when the library is dynamically loaded during the Test Harness session. 
9076
9077 This exported function *PLUGINFACTORY()* must be implemented only once per library. 
9078
9079 For convenience the *DPLUGIN* macro (defined in the *Draw_PluginMacro.hxx* file) has been provided. It implements the *PLUGINFACTORY()* function as a call to the *Package::Factory()* method and accepts *Package* as an argument. Respectively, this *Package::Factory()* method must be implemented in the library and activate all implemented commands. 
9080
9081 **Example:** 
9082 ~~~~~
9083 #include <Draw_PluginMacro.hxx>
9084
9085 void MyPack::Factory(Draw_Interpretor& theDI)
9086 {
9087 ...
9088 // 
9089 MyPack::CurveCommands(theDI);
9090 ...
9091 }
9092
9093 // Declare entry point PLUGINFACTORY
9094 DPLUGIN(MyPack)
9095 ~~~~~
9096
9097 @subsection occt_draw_11_4 Creation of the plug-in resource file
9098
9099 As mentioned above, the plug-in resource file must be compliant with Open CASCADE Technology requirements (see *Resource_Manager.cdl* file for details). In particular, it should contain keys separated from their values by a colon (;:;). 
9100 For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name. 
9101 Thus, the resource file must contain a line mapping this name (key) to the library name. The latter should be without file extension (.dll on Windows, .so on Unix/Linux) and without the ;lib; prefix on Unix/Linux. 
9102 For several plug-ins one resource file can be created. In such case, keys denoting plug-ins can be combined into groups, these groups - into their groups and so on (thereby creating some hierarchy). Any new parent key must have its value as a sequence of child keys separated by spaces, tabs or commas. Keys should form a tree without cyclic dependencies. 
9103
9104 **Examples** (file MyDrawPlugin): 
9105 ~~~~~
9106 ! Hierarchy of plug-ins 
9107 ALL                : ADVMODELING, MESHING 
9108 DEFAULT            : MESHING 
9109 ADVMODELING        : ADVSURF, ADVCURV 
9110
9111 ! Mapping from naming to toolkits (libraries) 
9112 ADVSURF            : TKMyAdvSurf 
9113 ADVCURV            : TKMyAdvCurv 
9114 MESHING            : TKMyMesh 
9115 ~~~~~
9116
9117 For other examples of the plug-in resource file refer to the <a href="#occt_draw_1_3_2">Plug-in resource file</a> chapter above or to the <i>$CASROOT/src/DrawPlugin</i> file shipped with Open CASCADE Technology. 
9118
9119
9120 @subsection occt_draw_11_5 Dynamic loading and activation
9121
9122 Loading a plug-in and activating its commands is described in the <a href="#occt_draw_1_3_3">Activation of the commands implemented in the plug-in</a> chapter. 
9123
9124 The procedure consists in defining the system variables and using the pload commands in the Test Harness session. 
9125
9126 **Example:** 
9127 ~~~~
9128 Draw[]> set env(CSF_MyDrawPluginDefaults) /users/test
9129 Draw[]> pload -MyDrawPlugin ALL
9130 ~~~~
9131