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