0031939: Coding - correction of spelling errors in comments [part 3]
[occt.git] / dox / user_guides / draw_test_harness / draw_test_harness.md
CommitLineData
d1775ee9 1Draw Test Harness {#occt_user_guides__test_harness}
72b7576f 2===============================
e5bd0d98 3
4@tableofcontents
72b7576f 5
e5bd0d98 6@section occt_draw_1 Introduction
72b7576f 7
18006a0f 8This manual explains how to use Draw, the test harness for Open CASCADE Technology (**OCCT**).
72b7576f 9Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
10
e5bd0d98 11@subsection occt_draw_1_1 Overview
72b7576f 12
13Draw is a test harness for Open CASCADE Technology. It provides a flexible and easy to use means of testing and demonstrating the OCCT modeling libraries.
14
15Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
16
a25d5aaa 17Scripts may be written to customize Draw and perform tests.
18New types of objects and new commands may be added using the C++ programming language.
72b7576f 19
20Draw consists of:
21
22 * A command interpreter based on the TCL command language.
23 * A 3d graphic viewer based on the X system.
24 * A basic set of commands covering scripts, variables and graphics.
25 * 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.
26 * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
27
28
29There is also a set of commands for each delivery unit in the modeling libraries:
30
e5bd0d98 31 * GEOMETRY,
32 * TOPOLOGY,
33 * ADVALGOS,
34 * GRAPHIC,
35 * PRESENTATION.
72b7576f 36
37
e5bd0d98 38@subsection occt_draw_1_2 Contents of this documentation
72b7576f 39
40This documentation describes:
41
42 * The command language.
43 * The basic set of commands.
44 * The graphical commands.
45 * The Geometry set of commands.
46 * The Topology set of commands.
472634fa 47 * OCAF commands.
48 * Data Exchange commands
49 * Shape Healing commands
72b7576f 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
3f812249 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 setup (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
04c2daa4 84The format of the file is compliant with standard Open CASCADE Technology resource files (see the *Resource_Manager.hxx* 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
3f812249 108* <i>-PluginFileName</i> -- defines the name of a plug-in resource file (prefix "-" is mandatory) described above. If this parameter is omitted then the default name *DrawPlugin* is used.
109* *Key* -- defines the key(s) enumerating plug-ins to be loaded. If no keys are specified then the key named *DEFAULT* is used (if there is no such key in the file then no plug-ins are loaded).
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
a25d5aaa 157Variable substitution is triggered by the $ character (as with csh), the content of the variable is substituted; { } may be used as in csh to enclose the name of the variable.
e5bd0d98 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
d5cdd12a 208# because while argument is ;0 < 3;
209while ;$x < 3; {set x [expr $x+1]}
72b7576f 210# this will terminate as expected because
d5cdd12a 211# while argument is {$x < 3}
212while {$x < 3} {set x [expr $x+1]}
72b7576f 213# this can be written also
d5cdd12a 214while {$x < 3} {
72b7576f 215set x [expr $x+1]
216}
217# the following cannot be written
218# because while requires two arguments
d5cdd12a 219while {$x < 3}
72b7576f 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
472634fa 330@subsubsection occt_draw_2_3_3 del, dall
331
332Syntax:
333~~~~~
334del varname_pattern [varname_pattern ...]
335dall
336~~~~~
337
338*del* command does the same thing as *unset*, but it deletes the variables matched by the pattern.
339
340*dall* command deletes all variables in the session.
72b7576f 341
e5bd0d98 342@subsection occt_draw_2_4 lists
72b7576f 343
344TCL uses lists. A list is a string containing elements separated by spaces or tabs. If the string contains braces, the braced part accounts as one element.
345
346This allows you to insert lists within lists.
e5bd0d98 347
348**Example:**
72b7576f 349~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
350# a list of 3 strings
351;a b c;
352
353# a list of two strings the first is a list of 2
354;{a b} c;
355~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 356
e5bd0d98 357Many TCL commands return lists and **foreach** is a useful way to create loops on list elements.
358
359@subsubsection occt_draw_2_5 Control Structures
72b7576f 360
361TCL allows looping using control structures. The control structures are implemented by commands and their syntax is very similar to that of their C counterparts (**if**, **while**, **switch**, etc.). In this case, there are two main differences between TCL and C:
362
e5bd0d98 363* You use braces instead of parentheses to enclose conditions.
364* You do not start the script on the next line of your command.
365
366
367@subsubsection occt_draw_2_5_1 if
368
369Syntax
370
371~~~~~
372if condition script [elseif script .... else script]
373~~~~~
72b7576f 374
e5bd0d98 375**If** evaluates the condition and the script to see whether the condition is true.
72b7576f 376
72b7576f 377
72b7576f 378
e5bd0d98 379**Example:**
72b7576f 380~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
d5cdd12a 381if {$x > 0} {
72b7576f 382puts ;positive;
383} elseif {$x == 0} {
384puts ;null;
385} else {
386puts ;negative;
387}
388~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
389
e5bd0d98 390@subsubsection occt_draw_2_5_2 while, for, foreach
72b7576f 391
e5bd0d98 392Syntax:
393
394
cdec5927 395~~~~~
e5bd0d98 396while condition script
72b7576f 397for init condition reinit script
398foreach varname list script
e5bd0d98 399~~~~~
400
401The 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 402
e5bd0d98 403**Example:**
72b7576f 404~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
405# while example
406dset x 1.1
d5cdd12a 407while {[dval x] < 100} {
72b7576f 408 circle c 0 0 x
409 dset x x*x
410}
411# for example
412# incr var d, increments a variable of d (default 1)
d5cdd12a 413for {set i 0} {$i < 10} {incr i} {
72b7576f 414 dset angle $i*pi/10
415 point p$i cos(angle0 sin(angle) 0
416}
417# foreach example
418foreach object {crapo tomson lucas} {display $object}
419~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 420
e5bd0d98 421@subsubsection occt_draw_2_5_3 break, continue
72b7576f 422
e5bd0d98 423Syntax:
72b7576f 424
e5bd0d98 425~~~~~
426break
72b7576f 427continue
e5bd0d98 428~~~~~
72b7576f 429
e5bd0d98 430Within loops, the **break** and **continue** commands have the same effect as in C.
72b7576f 431
e5bd0d98 432**break** interrupts the innermost loop and **continue** jumps to the next iteration.
433
434**Example:**
72b7576f 435~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
436# search the index for which t$i has value ;secret;
d5cdd12a 437for {set i 1} {$i <= 100} {incr i} {
72b7576f 438 if {[set t$i] == ;secret;} break;
439}
440~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 441
e5bd0d98 442@subsection occt_draw_2_6 Procedures
443
444TCL 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 445
446The only problematic aspect of procedures is that variables are strictly local, and as they are implicitly created when used, it may be difficult to detect errors.
447
e5bd0d98 448There are two means of accessing a variable outside the scope of the current procedures: **global** declares a global variable (a variable outside all procedures); **upvar** accesses a variable in the scope of the caller. Since arguments in TCL are always string values, the only way to pass Draw variables is by reference, i.e. passing the name of the variable and using the **upvar** command as in the following examples.
449
450As 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 451
72b7576f 452
e5bd0d98 453@subsubsection occt_draw_2_6_1 proc
72b7576f 454
e5bd0d98 455Syntax:
72b7576f 456
e5bd0d98 457~~~~~
458proc argumentlist script
459~~~~~
72b7576f 460
e5bd0d98 461**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 462
e5bd0d98 463**return** gives a return value to the procedure.
464
465**Example:**
72b7576f 466~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
467# simple procedure
468proc hello {} {
469 puts ;hello world;
470}
471# procedure with arguments and default values
472proc distance {x1 y1 {x2 0} {y2 0}} {
473 set d [expr (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)]
474 return [expr sqrt(d)]
475}
476proc fact n {
477 if {$n == 0} {return 1} else {
478 return [expr n*[fact [expr n -1]]]
479 }
480}
481~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 482
483
e5bd0d98 484@subsubsection occt_draw_2_6_2 global, upvar
485
486Syntax:
72b7576f 487
e5bd0d98 488~~~~~
489global varname [varname ...]
72b7576f 490upvar varname localname [varname localname ...]
e5bd0d98 491~~~~~
72b7576f 492
72b7576f 493
e5bd0d98 494**global** accesses high level variables. Unlike C, global variables are not visible in procedures.
72b7576f 495
e5bd0d98 496**upvar** gives a local name to a variable in the caller scope. This is useful when an argument is the name of a variable instead of a value. This is a call by reference and is the only way to use Draw variables as arguments.
497
498**Note** that in the following examples the \$ character is always necessarily used to access the arguments.
499
500**Example:**
72b7576f 501~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
502# convert degree to radian
503# pi is a global variable
504proc deg2rad (degree} {
505 return [dval pi*$degree/2.]
506}
507# create line with a point and an angle
508proc linang {linename x y angle} {
509 upvar linename l
510 line l $x $y cos($angle) sin($angle)
511}
512~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
513
e5bd0d98 514@section occt_draw_3 Basic Commands
72b7576f 515
516This chapter describes all the commands defined in the basic Draw package. Some are TCL commands, but most of them have been formulated in Draw. These commands are found in all Draw applications. The commands are grouped into four sections:
517
518 * General commands, which are used for Draw and TCL management.
519 * Variable commands, which are used to manage Draw variables such as storing and dumping.
520 * Graphic commands, which are used to manage the graphic system, and so pertain to views.
521 * Variable display commands, which are used to manage the display of objects within given views.
522
e5bd0d98 523Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands
72b7576f 524
525
e5bd0d98 526@subsection occt_draw_3_1 General commands
72b7576f 527
e5bd0d98 528This section describes several useful commands:
72b7576f 529
e5bd0d98 530 * **help** to get information,
531 * **source** to eval a script from a file,
532 * **spy** to capture the commands in a file,
533 * **cpulimit** to limit the process cpu time,
534 * **wait** to waste some time,
535 * **chrono** to time commands.
72b7576f 536
e5bd0d98 537@subsubsection occt_draw_3_1_1 help
72b7576f 538
e5bd0d98 539Syntax:
72b7576f 540
e5bd0d98 541~~~~~
542help [command [helpstring group]]
543~~~~~
72b7576f 544
545Provides help or modifies the help information.
546
e5bd0d98 547**help** without arguments lists all groups and the commands in each group.
72b7576f 548
e5bd0d98 549Specifying 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.
550
551**Example:**
72b7576f 552~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
553# Gives help on all commands starting with *a*
554~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 555
72b7576f 556
e5bd0d98 557@subsubsection occt_draw_3_1_2 source
558
559Syntax:
560
561~~~~~
562source filename
563~~~~~
72b7576f 564Executes a file.
565
e5bd0d98 566The **exit** command will terminate the file.
72b7576f 567
e5bd0d98 568@subsubsection occt_draw_3_1_3 spy
72b7576f 569
e5bd0d98 570Syntax:
72b7576f 571
e5bd0d98 572~~~~~
573spy [filename]
574~~~~~
72b7576f 575
e5bd0d98 576Saves 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 577
72b7576f 578If a command returns an error it is saved with a comment mark.
579
e5bd0d98 580The file created by **spy** can be executed with the **source** command.
581
582**Example:**
72b7576f 583~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
584# all commands will be saved in the file ;session;
585spy session
586# the file ;session; is closed and commands are not saved
587spy
588~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 589
590
72b7576f 591
e5bd0d98 592@subsubsection occt_draw_3_1_4 cpulimit
593
594Syntax:
72b7576f 595
e5bd0d98 596~~~~~
597cpulimit [nbseconds]
598~~~~~
599
600**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.
601
602**Example:**
72b7576f 603~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
604#limit cpu to one hour
605cpulimit 3600
606~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
607
e5bd0d98 608@subsubsection occt_draw_3_1_5 wait
72b7576f 609
e5bd0d98 610Syntax:
611~~~~~
612wait [nbseconds]
613~~~~~
72b7576f 614Suspends 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.
615
e5bd0d98 616~~~~~
72b7576f 617# You have ten seconds ...
618wait
e5bd0d98 619~~~~~
72b7576f 620
e5bd0d98 621@subsubsection occt_draw_3_1_6 chrono
72b7576f 622
e5bd0d98 623Syntax:
72b7576f 624
e5bd0d98 625~~~~~
44fae8b1 626chrono [ name start/stop/reset/show/restart/[counter text]]
e5bd0d98 627~~~~~
72b7576f 628
e5bd0d98 629Without arguments, **chrono** activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed.
72b7576f 630
e5bd0d98 631With arguments, **chrono** is used to manage activated chronometers. You can perform the following actions with a chronometer.
72b7576f 632 * run the chronometer (start).
633 * stop the chronometer (stop).
634 * reset the chronometer to 0 (reset).
44fae8b1 635 * restart the chronometer (restart).
72b7576f 636 * display the current time (show).
44fae8b1 637 * display the current time with specified text (output example - *COUNTER text: N*), command <i>testdiff</i> will compare such outputs between two test runs (counter).
72b7576f 638
e5bd0d98 639**Example:**
72b7576f 640~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
641chrono
642==Chronometers activated.
643ptorus t 20 5
644==Elapsed time: 0 Hours 0 Minutes 0.0318 Seconds
645==CPU user time: 0.01 seconds
646==CPU system time: 0 seconds
647~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
648
e5bd0d98 649@subsection occt_draw_3_2 Variable management commands
72b7576f 650
e5bd0d98 651@subsubsection occt_draw_3_2_1 isdraw, directory
72b7576f 652
e5bd0d98 653Syntax:
654~~~~~
655isdraw varname
72b7576f 656directory [pattern]
e5bd0d98 657~~~~~
658
659**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 660
e5bd0d98 661Use **directory** to return a list of all Draw global variables matching a pattern.
72b7576f 662
e5bd0d98 663**Example:**
72b7576f 664~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
665set a 1
666isdraw a
667=== 0
668
669dset a 1
670isdraw a
671=== 1
672
673circle c 0 0 1 0 5
674isdraw c
675=== 1
676
677# to destroy all Draw objects with name containing curve
678foreach var [directory *curve*] {unset $var}
679~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 680
681
e5bd0d98 682@subsubsection occt_draw_3_2_2 whatis, dump
72b7576f 683
e5bd0d98 684Syntax:
685
686~~~~~
687whatis varname [varname ...]
72b7576f 688dump varname [varname ...]
e5bd0d98 689~~~~~
72b7576f 690
e5bd0d98 691**whatis** returns short information about a Draw variable. This is usually the type name.
72b7576f 692
e5bd0d98 693**dump** returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable.
72b7576f 694
e5bd0d98 695**Example:**
72b7576f 696~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
697circle c 0 0 1 0 5
698whatis c
699c is a 2d curve
700
701dump c
702
703***** Dump of c *****
704Circle
705Center :0, 0
706XAxis :1, 0
707YAxis :-0, 1
708Radius :5
709~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 710
711**Note** The behavior of *whatis* on other variables (not Draw) is not excellent.
72b7576f 712
713
472634fa 714@subsubsection occt_draw_3_2_3 renamevar, copy
72b7576f 715
e5bd0d98 716Syntax:
717~~~~~
472634fa 718renamevar varname tovarname [varname tovarname ...]
72b7576f 719copy varname tovarname [varname tovarname ...]
e5bd0d98 720~~~~~
72b7576f 721
472634fa 722 * **renamevar** changes the name of a Draw variable. The original variable will no longer exist. Note that the content is not modified. Only the name is changed.
e5bd0d98 723 * **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 724
e5bd0d98 725**Example:**
72b7576f 726~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
727circle c1 0 0 1 0 5
472634fa 728renamevar c1 c2
72b7576f 729
730# curves are copied, c2 will not be modified
731copy c2 c3
732~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
733
e5bd0d98 734@subsubsection occt_draw_3_2_4 datadir, save, restore
72b7576f 735
e5bd0d98 736Syntax:
737~~~~~
738datadir [directory]
72b7576f 739save variable [filename]
740restore filename [variablename]
e5bd0d98 741~~~~~
72b7576f 742
e5bd0d98 743 * **datadir** without arguments prints the path of the current data directory.
744 * **datadir** with an argument sets the data directory path. \
72b7576f 745
e5bd0d98 746If the path starts with a dot (.) only the last directory name will be changed in the path.
72b7576f 747
e5bd0d98 748 * **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.
749 * **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 750
751The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent.
e5bd0d98 752
753**Example:**
72b7576f 754~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
755# note how TCL accesses shell environment variables
756# using $env()
757datadir
758==.
759
760datadir $env(WBCONTAINER)/data/default
761==/adv_20/BAG/data/default
762
763box b 10 20 30
764save b theBox
765==/adv_20/BAG/data/default/theBox
766
767# when TCL does not find a command it tries a shell command
768ls [datadir]
769== theBox
770
771restore theBox
772== theBox
773~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 774
e5bd0d98 775@subsection occt_draw_3_3 User defined commands
72b7576f 776
bf62b306 777*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 778
bf62b306 779*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 780
e5bd0d98 781@subsubsection occt_draw_3_3_1 set
782
783#### In *DrawTrSurf* package:
72b7576f 784
e5bd0d98 785~~~~~
bf62b306 786void Set(Standard_CString& Name,const gp_Pnt& G) ;
787void Set(Standard_CString& Name,const gp_Pnt2d& G) ;
788void Set(Standard_CString& Name,
789const Handle(Geom_Geometry)& G) ;
790void Set(Standard_CString& Name,
791const Handle(Geom2d_Curve)& C) ;
792void Set(Standard_CString& Name,
793const Handle(Poly_Triangulation)& T) ;
794void Set(Standard_CString& Name,
795const Handle(Poly_Polygon3D)& P) ;
796void Set(Standard_CString& Name,
797const Handle(Poly_Polygon2D)& P) ;
e5bd0d98 798~~~~~
72b7576f 799
e5bd0d98 800#### In *DBRep* package:
72b7576f 801
e5bd0d98 802~~~~~
72b7576f 803void Set(const Standard_CString Name,
bf62b306 804const TopoDS_Shape& S) ;
e5bd0d98 805~~~~~
72b7576f 806
e5bd0d98 807Example of *DrawTrSurf*
72b7576f 808
e5bd0d98 809~~~~~
72b7576f 810Handle(Geom2d_Circle) C1 = new Geom2d_Circle
811(gce_MakeCirc2d (gp_Pnt2d(50,0,) 25));
812DrawTrSurf::Set(char*, C1);
e5bd0d98 813~~~~~
72b7576f 814
e5bd0d98 815Example of *DBRep*
72b7576f 816
e5bd0d98 817~~~~~
72b7576f 818TopoDS_Solid B;
819B = BRepPrimAPI_MakeBox (10,10,10);
820DBRep::Set(char*,B);
e5bd0d98 821~~~~~
72b7576f 822
e5bd0d98 823@subsubsection occt_draw_3_3_2 get
72b7576f 824
e5bd0d98 825#### In *DrawTrSurf* package:
826
827~~~~~
bf62b306 828Handle_Geom_Geometry Get(Standard_CString& Name) ;
e5bd0d98 829~~~~~
72b7576f 830
e5bd0d98 831#### In *DBRep* package:
72b7576f 832
e5bd0d98 833~~~~~
bf62b306 834TopoDS_Shape Get(Standard_CString& Name,
72b7576f 835const TopAbs_ShapeEnum Typ = TopAbs_SHAPE,
836const Standard_Boolean Complain
837= Standard_True) ;
e5bd0d98 838~~~~~
72b7576f 839
e5bd0d98 840Example of *DrawTrSurf*
841
842~~~~~
72b7576f 843Standard_Integer MyCommand
bf62b306 844(Draw_Interpretor& theCommands,
72b7576f 845Standard_Integer argc, char** argv)
846{......
847// Creation of a Geom_Geometry from a Draw geometric
848// name
849Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]);
850}
e5bd0d98 851~~~~~
72b7576f 852
e5bd0d98 853Example of *DBRep*
72b7576f 854
e5bd0d98 855~~~~~
72b7576f 856Standard_Integer MyCommand
bf62b306 857(Draw_Interpretor& theCommands,
72b7576f 858Standard_Integer argc, char** argv)
859{......
860// Creation of a TopoDS_Shape from a Draw topological
861// name
862TopoDS_Solid B = DBRep::Get(argv[1]);
863}
e5bd0d98 864~~~~~
72b7576f 865
e5bd0d98 866@section occt_draw_4 Graphic Commands
72b7576f 867
3f812249 868Graphic 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.
72b7576f 869
e5bd0d98 870@subsection occt_draw_4_1 Axonometric viewer
72b7576f 871
e5bd0d98 872@subsubsection occt_draw_4_1_1 view, delete
72b7576f 873
e5bd0d98 874Syntax:
875~~~~~
876view index type [X Y W H]
72b7576f 877delete [index]
e5bd0d98 878~~~~~
72b7576f 879
e5bd0d98 880**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 881
e5bd0d98 882As 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 883
e5bd0d98 884**delete** deletes a view. If no index is given, all the views are deleted.
72b7576f 885
886Type selects from the following range:
887
e5bd0d98 888 * *AXON* : Axonometric view
889 * *PERS* : Perspective view
bf62b306 890 * <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.
891 * <i>-2D-</i> : 2d view
72b7576f 892
893The index, the type, the current zoom are displayed in the window title .
e5bd0d98 894
895**Example:**
72b7576f 896~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
897# this is the content of the mu4 procedure
898proc mu4 {} {
899delete
900view 1 +X+Z 320 20 400 400
901view 2 +X+Y 320 450 400 400
902view 3 +Y+Z 728 20 400 400
903view 4 AXON 728 450 400 400
904}
905~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 906
72b7576f 907See also: **axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview**
908
e5bd0d98 909@subsubsection occt_draw_4_1_2 axo, pers, top, ...
910
911Syntax:
72b7576f 912
e5bd0d98 913~~~~~
914axo
72b7576f 915pers
916...
917smallview type
e5bd0d98 918~~~~~
72b7576f 919
920All these commands are procedures used to define standard screen layout. They delete all existing views and create new ones. The layout usually complies with the European convention, i.e. a top view is under a front view.
921
e5bd0d98 922 * **axo** creates a large window axonometric view;
923 * **pers** creates a large window perspective view;
924 * **top**, **bottom**, **left**, **right**, **front**, **back** create a large window axis view;
925 * **mu4** creates four small window views: front, left, top and axo.
926 * **v2d** creates a large window 2d view.
927 * **av2d** creates two small window views, one 2d and one axo
928 * **smallview** creates a view at the bottom right of the screen of the given type.
72b7576f 929
930See also: **view**, **delete**
931
e5bd0d98 932@subsubsection occt_draw_4_1_3 mu, md, 2dmu, 2dmd, zoom, 2dzoom
72b7576f 933
e5bd0d98 934Syntax:
72b7576f 935
e5bd0d98 936~~~~~
937 mu [index] value
938 2dmu [index] value
939 zoom [index] value
940 wzoom
941~~~~~
72b7576f 942
e5bd0d98 943* **mu** (magnify up) increases the zoom in one or several views by a factor of 10%.
944* **md** (magnify down) decreases the zoom by the inverse factor. **2dmu** and **2dmd**
72b7576f 945perform the same on one or all 2d views.
e5bd0d98 946* **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.
947* **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 948
e5bd0d98 949**Example:**
72b7576f 950~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
e5bd0d98 951 # set a zoom of 2.5
952 zoom 2.5
72b7576f 953
e5bd0d98 954 # magnify by 10%
955 mu 1
72b7576f 956
e5bd0d98 957 # magnify by 20%
72b7576f 958~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
959See also: **fit**, **2dfit**
960
961
e5bd0d98 962@subsubsection occt_draw_4_14 pu, pd, pl, pr, 2dpu, 2dpd, 2dpl, 2dpr
72b7576f 963
bf62b306 964Syntax:
965
966~~~~~
967pu [index]
72b7576f 968pd [index]
bf62b306 969~~~~~
72b7576f 970
bf62b306 971The <i>p_</i> commands are used to pan. **pu** and **pd** pan up and down respectively; **pl** and **pr** pan to the left and to the right respectively. Each time the view is displaced by 40 pixels. When no index is given, all views will pan in the direction specified.
972~~~~~
973# you have selected one anonometric view
974pu
975# or
976pu 1
72b7576f 977
bf62b306 978# you have selected an mu4 view; the object in the third view will pan up
979pu 3
980~~~~~
72b7576f 981See also: **fit**, **2dfit**
982
983
e5bd0d98 984@subsubsection occt_draw_4_1_5 fit, 2dfit
985
986Syntax:
72b7576f 987
e5bd0d98 988~~~~~
989fit [index]
72b7576f 9902dfit [index]
e5bd0d98 991~~~~~
72b7576f 992
e5bd0d98 993**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 994
995When fitting all views a unique zoom is computed for all the views. All views are on the same scale.
996
e5bd0d98 997**Example:**
72b7576f 998~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
999# fit only view 1
1000fit 1
1001# fit all 2d views
10022dfit
1003~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1004See also: **zoom**, **mu**, **pu**
1005
1006
e5bd0d98 1007@subsubsection occt_draw_4_1_6 u, d, l, r
72b7576f 1008
e5bd0d98 1009Syntax:
1010
1011~~~~~
1012u [index]
72b7576f 1013d [index]
1014l [index]
1015r [index]
e5bd0d98 1016~~~~~
72b7576f 1017
e5bd0d98 1018**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 1019
e5bd0d98 1020**Example:**
72b7576f 1021~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1022# rotate the view up
1023u
1024~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1025
e5bd0d98 1026@subsubsection occt_draw_4_1_7 focal, fu, fd
72b7576f 1027
e5bd0d98 1028Syntax:
1029~~~~~
1030focal [f]
72b7576f 1031fu [index]
1032fd [index]
e5bd0d98 1033~~~~~
1034
1035* **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.
1036* **fu** and **fd** increase or decrease the focal value by 10%. **fd** makes the eye closer to the object.
72b7576f 1037
e5bd0d98 1038**Example:**
72b7576f 1039~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1040pers
1041repeat 10 fd
1042~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 1043
1044**Note**: Do not use a negative or null focal value.
72b7576f 1045
1046See also: **pers**
1047
e5bd0d98 1048@subsubsection occt_draw_4_1_8 color
1049
1050Syntax:
72b7576f 1051
e5bd0d98 1052~~~~~
1053color index name
1054~~~~~
72b7576f 1055
e5bd0d98 1056**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 1057
e5bd0d98 1058The 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 1059
e5bd0d98 1060**Example:**
72b7576f 1061~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1062# change the value of blue
e5bd0d98 1063color 3 "navy blue"
72b7576f 1064~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1065
1066
e5bd0d98 1067**Note** that the color change will be visible on the next redraw of the views, for example, after *fit* or *mu*, etc.
1068
1069@subsubsection occt_draw_4_1_9 dtext
72b7576f 1070
e5bd0d98 1071Syntax:
1072~~~~~
1073dtext [x y [z]] string
1074~~~~~
72b7576f 1075
e5bd0d98 1076**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 1077
1078The coordinates are real space coordinates.
1079
e5bd0d98 1080**Example:**
72b7576f 1081~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1082# mark the origins
1083dtext 0 0 bebop
1084dtext 0 0 0 bebop
1085~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1086
e5bd0d98 1087@subsubsection occt_draw_4_1_10 hardcopy, hcolor, xwd
72b7576f 1088
e5bd0d98 1089Syntax:
1090~~~~~
1091hardcopy [index]
72b7576f 1092hcolor index width gray
1093xwd [index] filename
e5bd0d98 1094~~~~~
72b7576f 1095
e5bd0d98 1096* **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.
1097* **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.
1098* **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 1099
e5bd0d98 1100**Example:**
72b7576f 1101~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1102# all blue lines (color 3)
1103# will be half-width and gray
1104hcolor 3 0.5
1105
1106# make a postscript file and print it
1107hardcopy
1108lpr a4.ps
1109
1110# make an xwd file and display it
1111xwd theview
1112xwud -in theview
1113~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e5bd0d98 1114
1115**Note:** When more than one view is present, specify the index of the view.
1116
1117Only use a postscript printer to print postscript files.
72b7576f 1118
1119See also: **color**
1120
1121
e5bd0d98 1122@subsubsection occt_draw_4_1_11 wclick, pick
72b7576f 1123
e5bd0d98 1124Syntax:
1125~~~~~
1126wclick
72b7576f 1127pick index X Y Z b [nowait]
e5bd0d98 1128~~~~~
72b7576f 1129
e5bd0d98 1130**wclick** defers an event until the mouse button is clicked. The message <code>just click</code> is displayed.
72b7576f 1131
e5bd0d98 1132Use the **pick** command to get graphic input. The arguments must be names for variables where the results are stored.
72b7576f 1133 * index: index of the view where the input was made.
1134 * X,Y,Z: 3d coordinates in real world.
1135 * b: b is the mouse button 1,2 or 3.
1136
1137When there is an extra argument, its value is not used and the command does not wait for a click; the value of b may then be 0 if there has not been a click.
1138
1139This option is useful for tracking the pointer.
1140
e5bd0d98 1141**Note** that the results are stored in Draw numeric variables.
1142
1143**Example:**
72b7576f 1144~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1145# make a circle at mouse location
1146pick index x y z b
1147circle c x y z 0 0 1 1 0 0 0 30
1148
1149# make a dynamic circle at mouse location
1150# stop when a button is clicked
1151# (see the repaint command)
1152
1153dset b 0
1154while {[dval b] == 0} {
1155pick index x y z b nowait
1156circle c x y z 0 0 1 1 0 0 0 30
1157repaint
1158}
1159~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1160See also: **repaint**
1161
1162
e5bd0d98 1163Draw provides commands to manage the display of objects.
1164* **display**, **donly** are used to display,
1165* **erase**, **clear**, **2dclear** to erase.
1166* **autodisplay** command is used to check whether variables are displayed when created.
72b7576f 1167
e5bd0d98 1168The 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 1169 * 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.
1170 * 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 1171 * If you do not see what you expected while executing loops or sourcing files, use the **repaint** and **dflush** commands.
72b7576f 1172
e5bd0d98 1173**Example:**
72b7576f 1174~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1175# OK use dot to dump an object on the screen
1176dump .
1177
1178point . x y z
1179
1180#Not OK. display points on a curve c
1181# with dot no variables are created
d5cdd12a 1182for {set i 0} {$i <= 10} {incr i} {
72b7576f 1183cvalue c $i/10 x y z
1184point . x y z
1185}
1186
1187# point p x y z
1188# would have displayed only one point
1189# because the precedent variable content is erased
1190
1191# point p$i x y z
1192# is an other solution, creating variables
1193# p0, p1, p2, ....
1194
1195# give a name to a graphic object
472634fa 1196renamevar . x
72b7576f 1197~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1198
72b7576f 1199
e5bd0d98 1200@subsubsection occt_draw_4_1_12 autodisplay
72b7576f 1201
e5bd0d98 1202Syntax:
1203
1204~~~~~
1205autodisplay [0/1]
1206~~~~~
1207
1208By default, Draw automatically displays any graphic object as soon as it is created. This behavior known as autodisplay can be removed with the command **autodisplay**. Without arguments, **autodisplay** toggles the autodisplay mode. The command always returns the current mode.
1209
1210When **autodisplay** is off, using the dot return argument is ineffective.
1211
1212**Example:**
72b7576f 1213~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1214# c is displayed
1215circle c 0 0 1 0 5
1216
1217# toggle the mode
1218autodisplay
1219== 0
1220circle c 0 0 1 0 5
1221
1222# c is erased, but not displayed
1223display c
1224~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1225
e5bd0d98 1226@subsubsection occt_draw_4_1_13 display, donly
72b7576f 1227
e5bd0d98 1228Syntax:
1229~~~~~
1230display varname [varname ...]
72b7576f 1231donly varname [varname ...]
e5bd0d98 1232~~~~~
72b7576f 1233
e5bd0d98 1234* **display** makes objects visible.
1235* **donly** *display only* makes objects visible and erases all other objects. It is very useful to extract one object from a messy screen.
72b7576f 1236
e5bd0d98 1237**Example:**
72b7576f 1238~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
e5bd0d98 1239\# to see all objects
72b7576f 1240foreach var [directory] {display $var}
1241
e5bd0d98 1242\# to select two objects and erase the other ones
72b7576f 1243donly . .
1244~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1245
1246
e5bd0d98 1247@subsubsection occt_draw_4_1_14 erase, clear, 2dclear
1248
1249Syntax:
72b7576f 1250
e5bd0d98 1251~~~~~
1252erase [varname varname ...]
72b7576f 1253clear
12542dclear
e5bd0d98 1255~~~~~
72b7576f 1256
e5bd0d98 1257**erase** removes objects from all views. **erase** without arguments erases everything in 2d and 3d.
72b7576f 1258
e5bd0d98 1259**clear** erases only 3d objects and **2dclear** only 2d objects. **erase** without arguments is similar to **clear; 2dclear**.
1260
1261
1262**Example:**
72b7576f 1263~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1264# erase eveerything with a name starting with c_
1265foreach var [directory c_*] {erase $var}
1266
1267# clear 2d views
ca0f3082 12682dclear
72b7576f 1269~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1270
472634fa 1271@subsubsection occt_draw_4_1_14_1 disp, don, era
1272
a25d5aaa 1273These commands have the same meaning as correspondingly display, donly and erase, but with the difference that they evaluate the arguments using glob pattern rules.
1274For example, to display all objects with names d_1, d_2, d_3, etc. it is enough to run the command:
472634fa 1275~~~~~{.cpp}
1276disp d_*
1277~~~~~
1278
e5bd0d98 1279@subsubsection occt_draw_4_1_15 repaint, dflush
72b7576f 1280
72b7576f 1281
e5bd0d98 1282Syntax:
1283
1284~~~~~
1285repaint
1286dflush
1287~~~~~
1288
1289* **repaint** forces repainting of views.
1290* **dflush** flushes the graphic buffers.
72b7576f 1291
1292These commands are useful within loops or in scripts.
1293
e5bd0d98 1294When 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.
1295
1296Graphic 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 1297
67d7f07f 1298See also: @ref occt_draw_4_1_11 "pick" command.
72b7576f 1299
3f812249 1300@subsection occt_draw_4_2 AIS viewer -- view commands
72b7576f 1301
e5bd0d98 1302@subsubsection occt_draw_4_2_1 vinit
72b7576f 1303
e5bd0d98 1304Syntax:
1305~~~~~
1306vinit
1307~~~~~
251a7984 1308Creates a new View window with the specified *view_name*.
1309By default the view is created in the viewer and in the graphic driver shared with the active view.
1310
1311~~~~
1312name = {driverName/viewerName/viewName | viewerName/viewName | viewName}
1313~~~~
1314
1315If *driverName* is not specified the driver will be shared with the active view.
1316If *viewerName* is not specified the viewer will be shared with the active view.
72b7576f 1317
e5bd0d98 1318@subsubsection occt_draw_4_2_2 vhelp
72b7576f 1319
e5bd0d98 1320Syntax:
1321~~~~~
1322vhelp
1323~~~~~
72b7576f 1324Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities.
1325
e5bd0d98 1326@subsubsection occt_draw_4_2_3 vtop
72b7576f 1327
e5bd0d98 1328Syntax:
1329~~~~~
1330vtop
1331~~~~~
72b7576f 1332
faea8b40 1333Displays top view in the 3D viewer window. Orientation +X+Y.
e5bd0d98 1334
1335**Example:**
72b7576f 1336~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1337vinit
1338box b 10 10 10
1339vdisplay b
1340vfit
1341vtop
1342~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1343
e5bd0d98 1344@subsubsection occt_draw_4_2_4 vaxo
1345
1346Syntax:
1347~~~~~
1348vaxo
1349~~~~~
72b7576f 1350
faea8b40 1351Displays axonometric view in the 3D viewer window. Orientation +X-Y+Z.
e5bd0d98 1352
1353**Example:**
72b7576f 1354~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
1355vinit
1356box b 10 10 10
1357vdisplay b
1358vfit
1359vaxo
1360~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72b7576f 1361
e5bd0d98 1362@subsubsection occt_draw_4_2_5 vsetbg
72b7576f 1363
e5bd0d98 1364Syntax:
1365~~~~~
1366vsetbg imagefile [filltype]
1367~~~~~
72b7576f 1368
e5bd0d98 1369Loads image file as background. *filltype* must be NONE, CENTERED, TILED or STRETCH.
1370
1371**Example:**
1372~~~~~
72b7576f 1373vinit
1374vsetbg myimage.brep CENTERED
e5bd0d98 1375~~~~~
72b7576f 1376
e5bd0d98 1377@subsubsection occt_draw_4_2_6 vclear
72b7576f 1378
e5bd0d98 1379Syntax:
1380~~~~~
1381vclear
1382~~~~~
72b7576f 1383Removes all objects from the viewer.
1384
e5bd0d98 1385@subsubsection occt_draw_4_2_7 vrepaint
72b7576f 1386
e5bd0d98 1387Syntax:
1388~~~~~
1389vrepaint
1390~~~~~
251a7984 1391Forcibly redisplays the shape in the 3D viewer window.
72b7576f 1392
e5bd0d98 1393@subsubsection occt_draw_4_2_8 vfit
72b7576f 1394
e5bd0d98 1395Syntax:
1396~~~~~
1397vfit
1398~~~~~
72b7576f 1399Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface.
1400
e5bd0d98 1401@subsubsection occt_draw_4_2_9 vzfit
72b7576f 1402
e5bd0d98 1403Syntax:
1404~~~~~
1405vzfit
1406~~~~~
72b7576f 1407
1408Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space.
1409
e5bd0d98 1410@subsubsection occt_draw_4_2_10 vreadpixel
72b7576f 1411
e5bd0d98 1412Syntax:
1413~~~~~
1414vreadpixel xPixel yPixel [{rgb|rgba|depth|hls|rgbf|rgbaf}=rgba] [name]
1415~~~~~
1416Read pixel value for active view.
72b7576f 1417
72b7576f 1418
e5bd0d98 1419@subsubsection occt_draw_4_2_11 vselect
1420
1421Syntax:
1422~~~~~
faea8b40 1423vselect x1 y1 [x2 y2 [x3 y3 ... xn yn]] [-allowoverlap 0|1] [shift_selection = 0|1]
e5bd0d98 1424~~~~~
1425
1426Emulates different types of selection:
1427
1428 * single mouse click selection
bf62b306 1429 * selection with a rectangle having the upper left and bottom right corners in <i>(x1,y1)</i> and <i>(x2,y2)</i> respectively
1430 * selection with a polygon having the corners in pixel positions <i>(x1,y1), (x2,y2),…, (xn,yn)</i>
251a7984 1431 * <i> -allowoverlap </i> manages overlap and inclusion detection in rectangular selection. If the flag is set to 1, both sensitives that were included completely and overlapped partially by defined rectangle will be detected, otherwise algorithm will chose only fully included sensitives. Default behavior is to detect only full inclusion.
e5bd0d98 1432 * any of these selections if shift_selection is set to 1.
1433
1434@subsubsection occt_draw_4_2_12 vmoveto
1435
1436Syntax:
1437
1438~~~~~
1439vmoveto x y
1440~~~~~
1441Emulates cursor movement to pixel position (x,y).
1442
1443@subsubsection occt_draw_4_2_13 vviewparams
1444
1445Syntax:
1446~~~~~
faea8b40 1447vviewparams [-scale [s]] [-eye [x y z]] [-at [x y z]] [-up [x y z]] [-proj [x y z]] [-center x y] [-size sx]
e5bd0d98 1448~~~~~
251a7984 1449Gets or sets the current view parameters.
faea8b40 1450* If called without arguments, all view parameters are printed.
1451* The options are:
251a7984 1452* -scale [s] : prints or sets the relative scale of viewport.
1453* -eye [x y z] : prints or sets the eye location.
1454* -at [x y z] : prints or sets the view center.
1455* -up [x y z] : prints or sets the up vector direction.
1456* -proj [x y z] : prints or sets the view direction.
1457* -center x y : sets the screen center location in pixels.
faea8b40 1458* -size [sx] : prints viewport projection width and height sizes or changes the size of its maximum dimension.
e5bd0d98 1459
1460@subsubsection occt_draw_4_2_14 vchangeselected
1461
1462Syntax:
1463~~~~~
1464vchangeselected shape
1465~~~~~
1466Adds a shape to selection or removes one from it.
1467
1468@subsubsection occt_draw_4_2_15 vzclipping
1469
1470Syntax:
1471~~~~~
1472vzclipping [mode] [depth width]
1473~~~~~
1474Gets or sets ZClipping mode, width and depth, where
1475 - *mode = OFF|BACK|FRONT|SLICE*
1476 - *depth* is a real value from segment [0,1]
1477 - *width* is a real value from segment [0,1]
1478
1479@subsubsection occt_draw_4_2_16 vnbselected
1480
1481Syntax:
1482~~~~~
1483vnbselected
1484~~~~~
1485Returns the number of selected objects in the interactive context.
1486
e5bd0d98 1487@subsubsection occt_draw_4_2_18 vpurgedisplay
1488
1489Syntax:
1490~~~~~
1491vpurgedisplay [CollectorToo = 0|1]
1492~~~~~
1493Removes structures which do not belong to objects displayed in neutral point.
1494
1495@subsubsection occt_draw_4_2_19 vhlr
1496
1497Syntax:
1498~~~~~
faea8b40 1499vhlr is_enabled={on|off} [show_hidden={1|0}]
e5bd0d98 1500~~~~~
faea8b40 1501Hidden line removal algorithm:
251a7984 1502 * <i>is_enabled</i> applies HLR algorithm.
1503 * <i>show_hidden</i> if equals to 1, hidden lines are drawn as dotted ones.
e5bd0d98 1504
1505@subsubsection occt_draw_4_2_20 vhlrtype
1506
1507Syntax:
1508~~~~~
1509vhlrtype algo_type={algo|polyalgo} [shape_1 ... shape_n]
1510~~~~~
1511
1512Changes the type of HLR algorithm used for shapes.
1513If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes.
1514
a25d5aaa 1515If no shape is specified through the command arguments, the given HLR algorithm_type is applied to all *AIS_Shape* instances in the current context, and the command also changes the default HLR algorithm type.
e5bd0d98 1516
1517**Note** that this command works with instances of *AIS_Shape* or derived classes only, other interactive object types are ignored.
1518
18006a0f 1519@subsubsection occt_draw_4_2_21 vcamera
1520
1521Syntax:
1522~~~~~
faea8b40 1523vcamera [-ortho] [-projtype]
1524 [-persp]
1525 [-fovy [Angle]] [-distance [Distance]]
1526 [-stereo] [-leftEye] [-rightEye]
1527 [-iod [Distance]] [-iodType [absolute|relative]]
1528 [-zfocus [Value]] [-zfocusType [absolute|relative]]
1529~~~~~
1530
251a7984 1531Manages camera parameters.
1532Prints the current value when the option is called without argument.
1533
faea8b40 1534Orthographic camera:
251a7984 1535 * -ortho -- activates orthographic projection.
1536
faea8b40 1537Perspective camera:
251a7984 1538 * -persp -- activated perspective projection (mono);
1539 * -fovy -- field of view in y axis, in degrees;
1540 * -distance -- distance of eye from the camera center.
1541
faea8b40 1542Stereoscopic camera:
251a7984 1543 * -stereo -- perspective projection (stereo);
1544 * -leftEye -- perspective projection (left eye);
1545 * -rightEye -- perspective projection (right eye);
1546 * -iod -- intraocular distance value;
1547 * -iodType -- distance type, absolute or relative;
1548 * -zfocus -- stereographic focus value;
1549 * -zfocusType -- focus type, absolute or relative.
18006a0f 1550
1551**Example:**
1552~~~~~
1553vinit
1554box b 10 10 10
1555vdisplay b
1556vfit
1557vcamera -persp
1558~~~~~
1559
1560@subsubsection occt_draw_4_2_22 vstereo
1561
1562Syntax:
1563~~~~~
faea8b40 1564vstereo [0|1] [-mode Mode] [-reverse {0|1}] [-anaglyph Filter]
18006a0f 1565~~~~~
1566
251a7984 1567Defines the stereo output mode. The following modes are available:
1568 * quadBuffer -- OpenGL QuadBuffer stereo, requires driver support. Should be called BEFORE *vinit*!
1569 * anaglyph -- Anaglyph glasses;
1570 * rowInterlaced -- row-interlaced display;
1571 * columnInterlaced -- column-interlaced display;
1572 * chessBoard -- chess-board output;
1573 * sideBySide -- horizontal pair;
1574 * overUnder -- vertical pair;
faea8b40 1575Available Anaglyph filters for -anaglyph:
251a7984 1576 * redCyan, redCyanSimple, yellowBlue, yellowBlueSimple, greenMagentaSimple.
18006a0f 1577
1578**Example:**
1579~~~~~
1580vinit
1581box b 10 10 10
1582vdisplay b
1583vstereo 1
1584vfit
1585vcamera -stereo -iod 1
1586vcamera -lefteye
1587vcamera -righteye
1588~~~~~
1589
1590@subsubsection occt_draw_4_2_23 vfrustumculling
1591
1592Syntax:
1593~~~~~
1594vfrustumculling [toEnable]
1595~~~~~
1596
1597Enables/disables objects clipping.
1598
e5bd0d98 1599
3f812249 1600@subsection occt_draw_4_3 AIS viewer -- display commands
e5bd0d98 1601
1602@subsubsection occt_draw_4_3_1 vdisplay
1603
bf62b306 1604Syntax:
1605~~~~~
faea8b40 1606vdisplay [-noupdate|-update] [-local] [-mutable] [-neutral]
1607 [-trsfPers {pan|zoom|rotate|trihedron|full|none}=none] [-trsfPersPos X Y [Z]] [-3d|-2d|-2dTopDown]
1608 [-dispMode mode] [-highMode mode]
1609 [-layer index] [-top|-topmost|-overlay|-underlay]
1610 [-redisplay]
1611 name1 [name2] ... [name n]
1612~~~~~
1613
1614Displays named objects.
251a7984 1615Option <i>-local</i> enables display of objects in the local selection context.
faea8b40 1616Local selection context will be opened if there is not any.
1617
1618* *noupdate* suppresses viewer redraw call.
251a7984 1619* *mutable* enables optimization for mutable objects.
1620* *neutral* draws objects in the main viewer.
1621* *layer* sets z-layer for objects. It can use <i>-overlay|-underlay|-top|-topmost</i> instead of <i>-layer index</i> for the default z-layers.
1622* *top* draws objects on top of main presentations but below the topmost level.
faea8b40 1623* *topmost* draws in overlay for 3D presentations with independent Depth.
1624* *overlay* draws objects in overlay for 2D presentations (On-Screen-Display).
1625* *underlay* draws objects in underlay for 2D presentations (On-Screen-Display).
1626* *selectable|-noselect* controls selection of objects.
251a7984 1627* *trsfPers* sets transform persistence flags. Flag *full* allows to pan, zoom and rotate.
faea8b40 1628* *trsfPersPos* sets an anchor point for transform persistence.
1629* *2d|-2dTopDown* displays object in screen coordinates.
1630* *dispmode* sets display mode for objects.
3f812249 1631* *highmode* sets highlight mode for objects.
faea8b40 1632* *redisplay* recomputes presentation of objects.
72b7576f 1633
668c2575 1634**Example:**
bf62b306 1635~~~~~
72b7576f 1636vinit
1637box b 40 40 40 10 10 10
1638psphere s 20
1639vdisplay s b
1640vfit
bf62b306 1641~~~~~
72b7576f 1642
668c2575 1643@subsubsection occt_draw_4_3_2 vdonly
72b7576f 1644
668c2575 1645Syntax:
1646~~~~~
faea8b40 1647vdonly [-noupdate|-update] [name1] ... [name n]
bf62b306 1648~~~~~
1649
72b7576f 1650Displays only selected or named objects. If there are no selected or named objects, nothing is done.
72b7576f 1651
668c2575 1652**Example:**
bf62b306 1653~~~~~
72b7576f 1654vinit
1655box b 40 40 40 10 10 10
1656psphere s 20
1657vdonly b
bf62b306 1658vfit
1659~~~~~
1660
668c2575 1661@subsubsection occt_draw_4_3_3 vdisplayall
72b7576f 1662
668c2575 1663Syntax:
bf62b306 1664~~~~~
faea8b40 1665vdisplayall [-local]
bf62b306 1666~~~~~
72b7576f 1667
faea8b40 1668Displays all erased interactive objects (see vdir and vstate).
251a7984 1669Option <i>-local</i> enables displaying objects in the local selection context.
668c2575 1670
1671**Example:**
bf62b306 1672~~~~~
72b7576f 1673vinit
1674box b 40 40 40 10 10 10
1675psphere s 20
1676vdisplayall
1677vfit
bf62b306 1678~~~~~
72b7576f 1679
668c2575 1680@subsubsection occt_draw_4_3_4 verase
1681
bf62b306 1682Syntax:
668c2575 1683~~~~~
bf62b306 1684verase [name1] [name2] … [name n]
1685~~~~~
72b7576f 1686
1687Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
72b7576f 1688
668c2575 1689**Example:**
1690~~~~~
72b7576f 1691vinit
1692box b1 40 40 40 10 10 10
1693box b2 -40 -40 -40 10 10 10
1694psphere s 20
1695vdisplayall
1696vfit
bf62b306 1697# erase only first box
72b7576f 1698verase b1
bf62b306 1699# erase second box and sphere
1700verase
1701~~~~~
72b7576f 1702
668c2575 1703@subsubsection occt_draw_4_3_5 veraseall
72b7576f 1704
668c2575 1705Syntax:
1706~~~~~
bf62b306 1707veraseall
1708~~~~~
668c2575 1709
bf62b306 1710Erases all objects displayed in the viewer.
668c2575 1711
bf62b306 1712**Example:**
1713~~~~~
72b7576f 1714vinit
1715box b1 40 40 40 10 10 10
1716box b2 -40 -40 -40 10 10 10
1717psphere s 20
1718vdisplayall
1719vfit
bf62b306 1720# erase only first box
72b7576f 1721verase b1
bf62b306 1722# erase second box and sphere
1723verseall
1724~~~~~
72b7576f 1725
668c2575 1726@subsubsection occt_draw_4_3_6 vsetdispmode
1727
1728Syntax:
668c2575 1729~~~~~
bf62b306 1730vsetdispmode [name] mode(0,1,2,3)
1731~~~~~
72b7576f 1732
bf62b306 1733Sets display mode for all, selected or named objects.
1734* *0* (*WireFrame*),
1735* *1* (*Shading*),
1736* *2* (*Quick HideLineremoval*),
1737* *3* (*Exact HideLineremoval*).
72b7576f 1738
e5bd0d98 1739**Example:**
668c2575 1740~~~~~
72b7576f 1741vinit
1742box b 10 10 10
1743vdisplay b
1744vsetdispmode 1
bf62b306 1745vfit
668c2575 1746~~~~~
bf62b306 1747
668c2575 1748@subsubsection occt_draw_4_3_7 vdisplaytype
1749
1750Syntax:
1751~~~~~
bf62b306 1752vdisplaytype type
1753~~~~~
668c2575 1754
bf62b306 1755Displays all objects of a given type.
1756The following types are possible: *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
668c2575 1757
1758@subsubsection occt_draw_4_3_8 verasetype
72b7576f 1759
bf62b306 1760Syntax:
1761~~~~~
1762verasetype type
1763~~~~~
72b7576f 1764
1765Erases all objects of a given type.
bf62b306 1766Possible type is *Point*, *Axis*, *Trihedron*, *PlaneTrihedron*, *Line*, *Circle*, *Plane*, *Shape*, *ConnectedShape*, *MultiConn.Shape*, *ConnectedInter.*, *MultiConn.*, *Constraint* and *Dimension*.
72b7576f 1767
bf62b306 1768@subsubsection occt_draw_4_3_9 vtypes
72b7576f 1769
bf62b306 1770Syntax:
1771~~~~~
1772vtypes
1773~~~~~
72b7576f 1774
bf62b306 1775Makes a list of known types and signatures in AIS.
72b7576f 1776
18006a0f 1777@subsubsection occt_draw_4_3_10 vaspects
72b7576f 1778
18006a0f 1779Syntax:
bf62b306 1780~~~~~
faea8b40 1781vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]
1782 [-setVisibility 0|1]
1783 [-setColor ColorName] [-setcolor R G B] [-unsetColor]
1784 [-setMaterial MatName] [-unsetMaterial]
1785 [-setTransparency Transp] [-unsetTransparency]
1786 [-setWidth LineWidth] [-unsetWidth]
1787 [-setLineType {solid|dash|dot|dotDash}] [-unsetLineType]
1788 [-freeBoundary {off/on | 0/1}]
1789 [-setFreeBoundaryWidth Width] [-unsetFreeBoundaryWidth]
1790 [-setFreeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]
18006a0f 1791 [-subshapes subname1 [subname2 [...]]]
faea8b40 1792 [-isoontriangulation 0|1]
1793 [-setMaxParamValue {value}]
72b7576f 1794
18006a0f 1795~~~~~
72b7576f 1796
251a7984 1797Manages presentation properties of all, selected or named objects.
1798* *-subshapes* -- assigns presentation properties to the specified sub-shapes.
1799* *-defaults* -- assigns presentation properties to all objects that do not have their own specified properties and to all objects to be displayed in the future.
1800If *-defaults* option is used there should not be any names of objects and *-subshapes* specifier.
faea8b40 1801
18006a0f 1802Aliases:
1803~~~~~
faea8b40 1804vsetcolor [-noupdate|-update] [name] ColorName
72b7576f 1805
bf62b306 1806~~~~~
72b7576f 1807
72b7576f 1808
18006a0f 1809Manages presentation properties (color, material, transparency) of all objects, selected or named.
bf62b306 1810
18006a0f 1811**Color**. The *ColorName* can be: *BLACK*, *MATRAGRAY*, *MATRABLUE*, *ALICEBLUE*, *ANTIQUEWHITE*, *ANTIQUEWHITE1*, *ANTIQUEWHITE2*, *ANTIQUEWHITE3*, *ANTIQUEWHITE4*, *AQUAMARINE1*, *AQUAMARINE2*, *AQUAMARINE4*, *AZURE*, *AZURE2*, *AZURE3*, *AZURE4*, *BEIGE*, *BISQUE*, *BISQUE2*, *BISQUE3*, *BISQUE4*, *BLANCHEDALMOND*, *BLUE1*, *BLUE2*, *BLUE3*, *BLUE4*, *BLUEVIOLET*, *BROWN*, *BROWN1*, *BROWN2*, *BROWN3*, *BROWN4*, *BURLYWOOD*, *BURLYWOOD1*, *BURLYWOOD2*, *BURLYWOOD3*, *BURLYWOOD4*, *CADETBLUE*, *CADETBLUE1*, *CADETBLUE2*, *CADETBLUE3*, *CADETBLUE4*, *CHARTREUSE*, *CHARTREUSE1*, *CHARTREUSE2*, *CHARTREUSE3*, *CHARTREUSE4*, *CHOCOLATE*, *CHOCOLATE1*, *CHOCOLATE2*, *CHOCOLATE3*, *CHOCOLATE4*, *CORAL*, *CORAL1*, *CORAL2*, *CORAL3*, *CORAL4*, *CORNFLOWERBLUE*, *CORNSILK1*, *CORNSILK2*, *CORNSILK3*, *CORNSILK4*, *CYAN1*, *CYAN2*, *CYAN3*, *CYAN4*, *DARKGOLDENROD*, *DARKGOLDENROD1*, *DARKGOLDENROD2*, *DARKGOLDENROD3*, *DARKGOLDENROD4*, *DARKGREEN*, *DARKKHAKI*, *DARKOLIVEGREEN*, *DARKOLIVEGREEN1*, *DARKOLIVEGREEN2*, *DARKOLIVEGREEN3*, *DARKOLIVEGREEN4*, *DARKORANGE*, *DARKORANGE1*, *DARKORANGE2*, *DARKORANGE3*, *DARKORANGE4*, *DARKORCHID*, *DARKORCHID1*, *DARKORCHID2*, *DARKORCHID3*, *DARKORCHID4*, *DARKSALMON*, *DARKSEAGREEN*, *DARKSEAGREEN1*, *DARKSEAGREEN2*, *DARKSEAGREEN3*, *DARKSEAGREEN4*, *DARKSLATEBLUE*, *DARKSLATEGRAY1*, *DARKSLATEGRAY2*, *DARKSLATEGRAY3*, *DARKSLATEGRAY4*, *DARKSLATEGRAY*, *DARKTURQUOISE*, *DARKVIOLET*, *DEEPPINK*, *DEEPPINK2*, *DEEPPINK3*, *DEEPPINK4*, *DEEPSKYBLUE1*, *DEEPSKYBLUE2*, *DEEPSKYBLUE3*, *DEEPSKYBLUE4*, *DODGERBLUE1*, *DODGERBLUE2*, *DODGERBLUE3*, *DODGERBLUE4*, *FIREBRICK*, *FIREBRICK1*, *FIREBRICK2*, *FIREBRICK3*, *FIREBRICK4*, *FLORALWHITE*, *FORESTGREEN*, *GAINSBORO*, *GHOSTWHITE*, *GOLD*, *GOLD1*, *GOLD2*, *GOLD3*, *GOLD4*, *GOLDENROD*, *GOLDENROD1*, *GOLDENROD2*, *GOLDENROD3*, *GOLDENROD4*, *GRAY*, *GRAY0*, *GRAY1*, *GRAY10*, *GRAY11*, *GRAY12*, *GRAY13*, *GRAY14*, *GRAY15*, *GRAY16*, *GRAY17*, *GRAY18*, *GRAY19*, *GRAY2*, *GRAY20*, *GRAY21*, *GRAY22*, *GRAY23*, *GRAY24*, *GRAY25*, *GRAY26*, *GRAY27*, *GRAY28*, *GRAY29*, *GRAY3*, *GRAY30*, *GRAY31*, *GRAY32*, *GRAY33*, *GRAY34*, *GRAY35*, *GRAY36*, *GRAY37*, *GRAY38*, *GRAY39*, *GRAY4*, *GRAY40*, *GRAY41*, *GRAY42*, *GRAY43*, *GRAY44*, *GRAY45*, *GRAY46*, *GRAY47*, *GRAY48*, *GRAY49*, *GRAY5*, *GRAY50*, *GRAY51*, *GRAY52*, *GRAY53*, *GRAY54*, *GRAY55*, *GRAY56*, *GRAY57*, *GRAY58*, *GRAY59*, *GRAY6*, *GRAY60*, *GRAY61*, *GRAY62*, *GRAY63*, *GRAY64*, *GRAY65*, *GRAY66*, *GRAY67*, *GRAY68*, *GRAY69*, *GRAY7*, *GRAY70*, *GRAY71*, *GRAY72*, *GRAY73*, *GRAY74*, *GRAY75*, *GRAY76*, *GRAY77*, *GRAY78*, *GRAY79*, *GRAY8*, *GRAY80*, *GRAY81*, *GRAY82*, *GRAY83*, *GRAY85*, *GRAY86*, *GRAY87*, *GRAY88*, *GRAY89*, *GRAY9*, *GRAY90*, *GRAY91*, *GRAY92*, *GRAY93*, *GRAY94*, *GRAY95*, *GREEN*, *GREEN1*, *GREEN2*, *GREEN3*, *GREEN4*, *GREENYELLOW*, *GRAY97*, *GRAY98*, *GRAY99*, *HONEYDEW*, *HONEYDEW2*, *HONEYDEW3*, *HONEYDEW4*, *HOTPINK*, *HOTPINK1*, *HOTPINK2*, *HOTPINK3*, *HOTPINK4*, *INDIANRED*, *INDIANRED1*, *INDIANRED2*, *INDIANRED3*, *INDIANRED4*, *IVORY*, *IVORY2*, *IVORY3*, *IVORY4*, *KHAKI*, *KHAKI1*, *KHAKI2*, *KHAKI3*, *KHAKI4*, *LAVENDER*, *LAVENDERBLUSH1*, *LAVENDERBLUSH2*, *LAVENDERBLUSH3*, *LAVENDERBLUSH4*, *LAWNGREEN*, *LEMONCHIFFON1*, *LEMONCHIFFON2*, *LEMONCHIFFON3*, *LEMONCHIFFON4*, *LIGHTBLUE*, *LIGHTBLUE1*, *LIGHTBLUE2*, *LIGHTBLUE3*, *LIGHTBLUE4*, *LIGHTCORAL*, *LIGHTCYAN1*, *LIGHTCYAN2*, *LIGHTCYAN3*, *LIGHTCYAN4*, *LIGHTGOLDENROD*, *LIGHTGOLDENROD1*, *LIGHTGOLDENROD2*, *LIGHTGOLDENROD3*, *LIGHTGOLDENROD4*, *LIGHTGOLDENRODYELLOW*, *LIGHTGRAY*, *LIGHTPINK*, *LIGHTPINK1*, *LIGHTPINK2*, *LIGHTPINK3*, *LIGHTPINK4*, *LIGHTSALMON1*, *LIGHTSALMON2*, *LIGHTSALMON3*, *LIGHTSALMON4*, *LIGHTSEAGREEN*, *LIGHTSKYBLUE*, *LIGHTSKYBLUE1*, *LIGHTSKYBLUE2*, *LIGHTSKYBLUE3*, *LIGHTSKYBLUE4*, *LIGHTSLATEBLUE*, *LIGHTSLATEGRAY*, *LIGHTSTEELBLUE*, *LIGHTSTEELBLUE1*, *LIGHTSTEELBLUE2*, *LIGHTSTEELBLUE3*, *LIGHTSTEELBLUE4*, *LIGHTYELLOW*, *LIGHTYELLOW2*, *LIGHTYELLOW3*, *LIGHTYELLOW4*, *LIMEGREEN*, *LINEN*, *MAGENTA1*, *MAGENTA2*, *MAGENTA3*, *MAGENTA4*, *MAROON*, *MAROON1*, *MAROON2*, *MAROON3*, *MAROON4*, *MEDIUMAQUAMARINE*, *MEDIUMORCHID*, *MEDIUMORCHID1*, *MEDIUMORCHID2*, *MEDIUMORCHID3*, *MEDIUMORCHID4*, *MEDIUMPURPLE*, *MEDIUMPURPLE1*, *MEDIUMPURPLE2*, *MEDIUMPURPLE3*, *MEDIUMPURPLE4*, *MEDIUMSEAGREEN*, *MEDIUMSLATEBLUE*, *MEDIUMSPRINGGREEN*, *MEDIUMTURQUOISE*, *MEDIUMVIOLETRED*, *MIDNIGHTBLUE*, *MINTCREAM*, *MISTYROSE*, *MISTYROSE2*, *MISTYROSE3*, *MISTYROSE4*, *MOCCASIN*, *NAVAJOWHITE1*, *NAVAJOWHITE2*, *NAVAJOWHITE3*, *NAVAJOWHITE4*, *NAVYBLUE*, *OLDLACE*, *OLIVEDRAB*, *OLIVEDRAB1*, *OLIVEDRAB2*, *OLIVEDRAB3*, *OLIVEDRAB4*, *ORANGE*, *ORANGE1*, *ORANGE2*, *ORANGE3*, *ORANGE4*, *ORANGERED*, *ORANGERED1*, *ORANGERED2*, *ORANGERED3*, *ORANGERED4*, *ORCHID*, *ORCHID1*, *ORCHID2*, *ORCHID3*, *ORCHID4*, *PALEGOLDENROD*, *PALEGREEN*, *PALEGREEN1*, *PALEGREEN2*, *PALEGREEN3*, *PALEGREEN4*, *PALETURQUOISE*, *PALETURQUOISE1*, *PALETURQUOISE2*, *PALETURQUOISE3*, *PALETURQUOISE4*, *PALEVIOLETRED*, *PALEVIOLETRED1*, *PALEVIOLETRED2*, *PALEVIOLETRED3*, *PALEVIOLETRED4*, *PAPAYAWHIP*, *PEACHPUFF*, *PEACHPUFF2*, *PEACHPUFF3*, *PEACHPUFF4*, *PERU*, *PINK*, *PINK1*, *PINK2*, *PINK3*, *PINK4*, *PLUM*, *PLUM1*, *PLUM2*, *PLUM3*, *PLUM4*, *POWDERBLUE*, *PURPLE*, *PURPLE1*, *PURPLE2*, *PURPLE3*, *PURPLE4*, *RED*, *RED1*, *RED2*, *RED3*, *RED4*, *ROSYBROWN*, *ROSYBROWN1*, *ROSYBROWN2*, *ROSYBROWN3*, *ROSYBROWN4*, *ROYALBLUE*, *ROYALBLUE1*, *ROYALBLUE2*, *ROYALBLUE3*, *ROYALBLUE4*, *SADDLEBROWN*, *SALMON*, *SALMON1*, *SALMON2*, *SALMON3*, *SALMON4*, *SANDYBROWN*, *SEAGREEN*, *SEAGREEN1*, *SEAGREEN2*, *SEAGREEN3*, *SEAGREEN4*, *SEASHELL*, *SEASHELL2*, *SEASHELL3*, *SEASHELL4*, *BEET*, *TEAL*, *SIENNA*, *SIENNA1*, *SIENNA2*, *SIENNA3*, *SIENNA4*, *SKYBLUE*, *SKYBLUE1*, *SKYBLUE2*, *SKYBLUE3*, *SKYBLUE4*, *SLATEBLUE*, *SLATEBLUE1*, *SLATEBLUE2*, *SLATEBLUE3*, *SLATEBLUE4*, *SLATEGRAY1*, *SLATEGRAY2*, *SLATEGRAY3*, *SLATEGRAY4*, *SLATEGRAY*, *SNOW*, *SNOW2*, *SNOW3*, *SNOW4*, *SPRINGGREEN*, *SPRINGGREEN2*, *SPRINGGREEN3*, *SPRINGGREEN4*, *STEELBLUE*, *STEELBLUE1*, *STEELBLUE2*, *STEELBLUE3*, *STEELBLUE4*, *TAN*, *TAN1*, *TAN2*, *TAN3*, *TAN4*, *THISTLE*, *THISTLE1*, *THISTLE2*, *THISTLE3*, *THISTLE4*, *TOMATO*, *TOMATO1*, *TOMATO2*, *TOMATO3*, *TOMATO4*, *TURQUOISE*, *TURQUOISE1*, *TURQUOISE2*, *TURQUOISE3*, *TURQUOISE4*, *VIOLET*, *VIOLETRED*, *VIOLETRED1*, *VIOLETRED2*, *VIOLETRED3*, *VIOLETRED4*, *WHEAT*, *WHEAT1*, *WHEAT2*, *WHEAT3*, *WHEAT4*, *WHITE*, *WHITESMOKE*, *YELLOW*, *YELLOW1*, *YELLOW2*, *YELLOW3*, *YELLOW4* and *YELLOWGREEN*.
1812~~~~~
1813vaspects [name] [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]
1814vsetcolor [name] ColorName
1815vunsetcolor [name]
bf62b306 1816~~~~~
72b7576f 1817
18006a0f 1818**Transparency. The *Transp* may be between 0.0 (opaque) and 1.0 (fully transparent).
bf62b306 1819**Warning**: at 1.0 the shape becomes invisible.
bf62b306 1820~~~~~
18006a0f 1821vaspects [name] [-settransparency Transp] [-unsettransparency]
1822vsettransparency [name] Transp
1823vunsettransparency [name]
bf62b306 1824~~~~~
72b7576f 1825
18006a0f 1826**Material**. The *MatName* can be *BRASS*, *BRONZE*, *COPPER*, *GOLD*, *PEWTER*, *PLASTER*, *PLASTIC*, *SILVER*, *STEEL*, *STONE*, *SHINY_PLASTIC*, *SATIN*, *METALIZED*, *NEON_GNC*, *CHROME*, *ALUMINIUM*, *OBSIDIAN*, *NEON_PHC*, *JADE*, *WATER*, *GLASS*, *DIAMOND* or *CHARCOAL*.
1827~~~~~
1828vaspects [name] [-setmaterial MatName] [-unsetmaterial]
1829vsetmaterial [name] MatName
1830vunsetmaterial [name]
bf62b306 1831~~~~~
72b7576f 1832
18006a0f 1833**Line width**. Specifies width of the edges. The *LineWidth* may be between 0.0 and 10.0.
bf62b306 1834~~~~~
18006a0f 1835vaspects [name] [-setwidth LineWidth] [-unsetwidth]
1836vsetwidth [name] LineWidth
1837vunsetwidth [name]
bf62b306 1838~~~~~
72b7576f 1839
18006a0f 1840**Example:**
bf62b306 1841~~~~~
18006a0f 1842vinit
1843box b 10 10 10
1844vdisplay b
1845vfit
72b7576f 1846
18006a0f 1847vsetdispmode b 1
1848vaspects -setcolor red -settransparency 0.2
1849vrotate 10 10 10
bf62b306 1850~~~~~
72b7576f 1851
72b7576f 1852
72b7576f 1853
72b7576f 1854
72b7576f 1855
18006a0f 1856
1857@subsubsection occt_draw_4_3_11 vsetshading
72b7576f 1858
bf62b306 1859Syntax:
1860~~~~~
1861vsetshading shapename [coefficient]
1862~~~~~
72b7576f 1863
1864Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
72b7576f 1865
bf62b306 1866**Example:**
1867~~~~~
72b7576f 1868vinit
1869psphere s 20
1870vdisplay s
1871vfit
1872vsetdispmode 1
bf62b306 1873vsetshading s 0.005
1874~~~~~
1875
18006a0f 1876@subsubsection occt_draw_4_3_12 vunsetshading
72b7576f 1877
bf62b306 1878Syntax:
1879~~~~~
1880vunsetshading [shapename]
1881~~~~~
72b7576f 1882
faea8b40 1883Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode.
72b7576f 1884
18006a0f 1885@subsubsection occt_draw_4_3_13 vsetam
72b7576f 1886
bf62b306 1887Syntax:
1888~~~~~
1889vsetam [shapename] mode
1890~~~~~
1891
1892Activates selection mode for all selected or named shapes:
1893* *0* for *shape* itself,
1894* *1* (*vertices*),
1895* *2* (*edges*),
1896* *3* (*wires*),
1897* *4* (*faces*),
1898* *5* (*shells*),
1899* *6* (*solids*),
1900* *7* (*compounds*).
1901
e5bd0d98 1902**Example:**
bf62b306 1903~~~~~
72b7576f 1904vinit
1905box b 10 10 10
1906vdisplay b
1907vfit
bf62b306 1908vsetam b 2
1909~~~~~
1910
18006a0f 1911@subsubsection occt_draw_4_3_14 vunsetam
72b7576f 1912
bf62b306 1913Syntax:
1914~~~~~
1915vunsetam
1916~~~~~
72b7576f 1917
1918Deactivates all selection modes for all shapes.
1919
18006a0f 1920@subsubsection occt_draw_4_3_15 vdump
72b7576f 1921
bf62b306 1922Syntax:
1923~~~~~
faea8b40 1924vdump <filename>.{png|bmp|jpg|gif} [-width Width -height Height]
1925 [-buffer rgb|rgba|depth=rgb]
1926 [-stereo mono|left|right|blend|sideBySide|overUnder=mono]
1927
bf62b306 1928~~~~~
72b7576f 1929
18006a0f 1930Extracts the contents of the viewer window to a image file.
72b7576f 1931
18006a0f 1932@subsubsection occt_draw_4_3_16 vdir
72b7576f 1933
bf62b306 1934Syntax:
1935~~~~~
1936vdir
1937~~~~~
72b7576f 1938
1939Displays the list of displayed objects.
1940
18006a0f 1941@subsubsection occt_draw_4_3_17 vsub
72b7576f 1942
bf62b306 1943Syntax:
1944~~~~~
1945vsub 0/1(on/off)[shapename]
1946~~~~~
72b7576f 1947
bf62b306 1948Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
1949
e5bd0d98 1950**Example:**
bf62b306 1951~~~~~
72b7576f 1952vinit
1953box b 10 10 10
1954psphere s 20
1955vdisplay b s
1956vfit
1957vsetdispmode 1
bf62b306 1958vsub b 1
1959~~~~~
72b7576f 1960
18006a0f 1961@subsubsection occt_draw_4_3_20 vsensdis
72b7576f 1962
bf62b306 1963Syntax:
1964~~~~~
1965vsensdis
1966~~~~~
72b7576f 1967
1968Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes).
1969
1970Standard entity types are those defined in Select3D package:
1971 * sensitive box
1972 * sensitive face
1973 * sensitive curve
1974 * sensitive segment
1975 * sensitive circle
1976 * sensitive point
1977 * sensitive triangulation
1978 * sensitive triangle
1979Custom (application-defined) sensitive entity types are not processed by this command.
1980
18006a0f 1981@subsubsection occt_draw_4_3_21 vsensera
72b7576f 1982
bf62b306 1983Syntax:
1984~~~~~
1985vsensera
1986~~~~~
72b7576f 1987
1988Erases active entities.
1989
18006a0f 1990@subsubsection occt_draw_4_3_23 vr
72b7576f 1991
bf62b306 1992Syntax:
1993~~~~~
1994vr filename
1995~~~~~
72b7576f 1996
1997Reads shape from BREP-format file and displays it in the viewer.
72b7576f 1998
bf62b306 1999**Example:**
2000~~~~~
72b7576f 2001vinit
bf62b306 2002vr myshape.brep
2003~~~~~
2004
18006a0f 2005@subsubsection occt_draw_4_3_24 vstate
72b7576f 2006
bf62b306 2007Syntax:
2008~~~~~
faea8b40 2009vstate [-entities] [-hasSelected] [name1] ... [nameN]
bf62b306 2010~~~~~
72b7576f 2011
251a7984 2012Reports show/hidden state for selected or named objects:
3f812249 2013 * *entities* -- prints low-level information about detected entities;
2014 * *hasSelected* -- prints 1 if the context has a selected shape and 0 otherwise.
72b7576f 2015
18006a0f 2016@subsubsection occt_draw_4_3_25 vraytrace
2017
2018Syntax:
2019~~~~~
2020vraytrace [0/1]
2021~~~~~
2022
2023Turns on/off ray tracing renderer.
2024
2025@subsubsection occt_draw_4_3_26 vrenderparams
2026
2027Syntax:
2028~~~~~
faea8b40 2029vrenderparams [-rayTrace|-raster] [-rayDepth 0..10] [-shadows {on|off}]
2030 [-reflections {on|off}] [-fsaa {on|off}] [-gleam {on|off}]
2031 [-gi {on|off}] [-brng {on|off}] [-env {on|off}]
2032 [-shadin {color|flat|gouraud|phong}]
18006a0f 2033~~~~~
2034
2035Manages rendering parameters:
3f812249 2036* rayTrace -- Enables GPU ray-tracing
2037* raster -- Disables GPU ray-tracing
2038* rayDepth -- Defines maximum ray-tracing depth
2039* shadows -- Enables/disables shadows rendering
2040* reflections -- Enables/disables specular reflections
2041* fsaa -- Enables/disables adaptive anti-aliasing
2042* gleam -- Enables/disables transparency shadow effects
2043* gi -- Enables/disables global illumination effects
2044* brng -- Enables/disables blocked RNG (fast coherent PT)
2045* env -- Enables/disables environment map background
2046* shadingModel -- Controls shading model from enumeration color, flat, gouraud, phong
faea8b40 2047
251a7984 2048Unlike *vcaps*, these parameters dramatically change visual properties.
2049The command is intended to control presentation quality depending on hardware capabilities and performance.
18006a0f 2050
2051**Example:**
2052~~~~~
2053vinit
2054box b 10 10 10
2055vdisplay b
2056vfit
2057vraytrace 1
2058vrenderparams -shadows 1 -reflections 1 -fsaa 1
2059~~~~~
2060@subsubsection occt_draw_4_3_27 vshaderprog
2061
2062Syntax:
2063~~~~~
faea8b40 2064 'vshaderprog [name] pathToVertexShader pathToFragmentShader'
2065or 'vshaderprog [name] off' to disable GLSL program
2066or 'vshaderprog [name] phong' to enable per-pixel lighting calculations
18006a0f 2067~~~~~
2068
2069Enables rendering using a shader program.
2070
2071@subsubsection occt_draw_4_3_28 vsetcolorbg
2072
2073Syntax:
2074~~~~~
2075vsetcolorbg r g b
2076~~~~~
2077
2078Sets background color.
2079
2080**Example:**
2081~~~~~
2082vinit
2083vsetcolorbg 200 0 200
2084~~~~~
72b7576f 2085
3f812249 2086@subsection occt_draw_4_4 AIS viewer -- object commands
72b7576f 2087
bf62b306 2088@subsubsection occt_draw_4_4_1 vtrihedron
72b7576f 2089
bf62b306 2090Syntax:
2091~~~~~
bc001a40 2092vtrihedron name [-dispMode {wf|sh|wireframe|shading}]
2093 [-origin x y z ]
2094 [-zaxis u v w -xaxis u v w ]
2095 [-drawaxes {X|Y|Z|XY|YZ|XZ|XYZ}]
2096 [-hidelabels {on|off}]"
2097 [-label {XAxis|YAxis|ZAxis} value]"
2098 [-attribute {XAxisLength|YAxisLength|ZAxisLength
2099 |TubeRadiusPercent|ConeRadiusPercent"
2100 |ConeLengthPercent|OriginRadiusPercent"
2101 |ShadingNumberOfFacettes} value]"
2102 [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis"
2103 |XOZAxis|Whole} {r g b | colorName}]"
2104 [-textcolor {r g b | colorName}]"
2105 [-arrowscolor {r g b | colorName}]"
2106 [-priority {Origin|XAxis|YAxis|ZAxis|XArrow"
2107 |YArrow|ZArrow|XOYAxis|YOZAxis"
2108 |XOZAxis|Whole} value]
2109
bf62b306 2110~~~~~
72b7576f 2111
bc001a40 2112Creates a new *AIS_Trihedron* object or changes existing trihedron. If no argument is set, the default trihedron (0XYZ) is created.
2113
e5bd0d98 2114**Example:**
bf62b306 2115~~~~~
72b7576f 2116vinit
bc001a40 2117vtrihedron tr1
2118
2119vtrihedron t2 -dispmode shading -origin -200 -200 -300
2120vtrihedron t2 -color XAxis Quantity_NOC_RED
2121vtrihedron t2 -color YAxis Quantity_NOC_GREEN
2122vtrihedron t2 -color ZAxis|Origin Quantity_NOC_BLUE1
bf62b306 2123~~~~~
72b7576f 2124
bf62b306 2125@subsubsection occt_draw_4_4_2 vplanetri
72b7576f 2126
bf62b306 2127Syntax:
2128~~~~~
2129vplanetri name
2130~~~~~
72b7576f 2131
251a7984 2132Creates a plane from a trihedron selection. If no arguments are set, the default plane is created.
72b7576f 2133
2134
bf62b306 2135@subsubsection occt_draw_4_4_3 vsize
72b7576f 2136
bf62b306 2137Syntax:
2138~~~~~
2139vsize [name] [size]
2140~~~~~
72b7576f 2141
bf62b306 2142Changes 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.
2143
e5bd0d98 2144**Example:**
bf62b306 2145~~~~~
72b7576f 2146vinit
2147vtrihedron tr1
2148vtrihedron tr2 0 0 0 1 0 0 1 0 0
bf62b306 2149vsize tr2 400
2150~~~~~
72b7576f 2151
bf62b306 2152@subsubsection occt_draw_4_4_4 vaxis
72b7576f 2153
bf62b306 2154Syntax:
2155~~~~~
2156vaxis name [Xa Ya Za Xb Yb Zb]
2157~~~~~
72b7576f 2158
bf62b306 2159Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
2160
e5bd0d98 2161**Example:**
bf62b306 2162~~~~~
72b7576f 2163vinit
2164vtrihedron tr
2165vaxis axe1 0 0 0 1 0 0
bf62b306 2166~~~~~
72b7576f 2167
bf62b306 2168@subsubsection occt_draw_4_4_5 vaxispara
72b7576f 2169
bf62b306 2170Syntax:
2171~~~~~
faea8b40 2172vaxispara name
bf62b306 2173~~~~~
72b7576f 2174
2175Creates an axis by interactive selection of an edge and a vertex.
2176
bf62b306 2177@subsubsection occt_draw_4_4_6 vaxisortho
72b7576f 2178
bf62b306 2179Syntax:
2180~~~~~
2181vaxisotrho name
2182~~~~~
72b7576f 2183
2184Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
2185
bf62b306 2186@subsubsection occt_draw_4_4_7 vpoint
72b7576f 2187
bf62b306 2188Syntax:
2189~~~~~
2190vpoint name [Xa Ya Za]
2191~~~~~
72b7576f 2192
2193Creates 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 2194
bf62b306 2195**Example:**
2196~~~~~
72b7576f 2197vinit
2198vpoint p 0 0 0
bf62b306 2199~~~~~
72b7576f 2200
bf62b306 2201@subsubsection occt_draw_4_4_8 vplane
72b7576f 2202
bf62b306 2203Syntax:
2204~~~~~
2205vplane name [AxisName] [PointName]
2206vplane name [PointName] [PointName] [PointName]
2207vplane name [PlaneName] [PointName]
2208~~~~~
72b7576f 2209
bf62b306 2210Creates a plane from named or interactively selected entities.
faea8b40 2211TypeOfSensitivity:
3f812249 2212 * 0 -- Interior
2213 * 1 -- Boundary
faea8b40 2214
e5bd0d98 2215**Example:**
bf62b306 2216~~~~~
72b7576f 2217vinit
2218vpoint p1 0 50 0
2219vaxis axe1 0 0 0 0 0 1
2220vtrihedron tr
2221vplane plane1 axe1 p1
bf62b306 2222~~~~~
72b7576f 2223
bf62b306 2224@subsubsection occt_draw_4_4_9 vplanepara
72b7576f 2225
bf62b306 2226Syntax:
2227~~~~~
2228vplanepara name
2229~~~~~
72b7576f 2230
2231Creates a plane from interactively selected vertex and face.
2232
bf62b306 2233@subsubsection occt_draw_4_4_10 vplaneortho
72b7576f 2234
bf62b306 2235Syntax:
2236~~~~~
2237vplaneortho name
2238~~~~~
72b7576f 2239
2240Creates a plane from interactive selected face and coplanar edge.
2241
bf62b306 2242@subsubsection occt_draw_4_4_11 vline
72b7576f 2243
bf62b306 2244Syntax:
2245~~~~~
2246vline name [PointName] [PointName]
2247vline name [Xa Ya Za Xb Yb Zb]
2248~~~~~
72b7576f 2249
2250Creates a line from coordinates, named or interactively selected vertices.
72b7576f 2251
bf62b306 2252**Example:**
2253~~~~~
72b7576f 2254vinit
2255vtrihedron tr
2256vpoint p1 0 50 0
2257vpoint p2 50 0 0
2258vline line1 p1 p2
2259vline line2 0 0 0 50 0 1
bf62b306 2260~~~~~
72b7576f 2261
bf62b306 2262@subsubsection occt_draw_4_4_12 vcircle
72b7576f 2263
bf62b306 2264Syntax:
2265~~~~~
2266vcircle name [PointName PointName PointName IsFilled]
72b7576f 2267vcircle name [PlaneName PointName Radius IsFilled]
bf62b306 2268~~~~~
72b7576f 2269
bf62b306 2270Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
2271
e5bd0d98 2272**Example:**
bf62b306 2273~~~~~
72b7576f 2274vinit
2275vtrihedron tr
2276vpoint p1 0 50 0
2277vpoint p2 50 0 0
2278vpoint p3 0 0 0
bf62b306 2279vcircle circle1 p1 p2 p3 1
2280~~~~~
72b7576f 2281
bf62b306 2282@subsubsection occt_draw_4_4_13 vtri2d
72b7576f 2283
bf62b306 2284Syntax:
2285~~~~~
2286vtri2d name
2287~~~~~
72b7576f 2288
2289Creates a plane with a 2D trihedron from an interactively selected face.
2290
bf62b306 2291@subsubsection occt_draw_4_4_14 vselmode
72b7576f 2292
bf62b306 2293Syntax:
2294~~~~~
faea8b40 2295vselmode [object] mode_number is_turned_on=(1|0)
bf62b306 2296~~~~~
72b7576f 2297
2298Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
251a7984 2299*Mode_number* is a non-negative integer encoding different interactive object classes.
faea8b40 2300For shapes the following *mode_number* values are allowed:
3f812249 2301 * 0 -- shape
2302 * 1 -- vertex
2303 * 2 -- edge
2304 * 3 -- wire
2305 * 4 -- face
2306 * 5 -- shell
2307 * 6 -- solid
2308 * 7 -- compsolid
2309 * 8 -- compound
faea8b40 2310*is_turned_on* is:
2311 * 1 if mode is to be switched on
2312 * 0 if mode is to be switched off
72b7576f 2313
bf62b306 2314**Example:**
2315~~~~~
72b7576f 2316vinit
2317vpoint p1 0 0 0
2318vpoint p2 50 0 0
2319vpoint p3 25 40 0
2320vtriangle triangle1 p1 p2 p3
bf62b306 2321~~~~~
2322
faea8b40 2323@subsubsection occt_draw_4_4_15 vconnect
72b7576f 2324
bf62b306 2325Syntax:
2326~~~~~
faea8b40 2327vconnect vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
bf62b306 2328~~~~~
72b7576f 2329
251a7984 2330Creates *AIS_ConnectedInteractive* object from the input object and location and displays it.
72b7576f 2331
bf62b306 2332**Example:**
2333~~~~~
73ddbb9a 2334vinit
72b7576f 2335vpoint p1 0 0 0
2336vpoint p2 50 0 0
2337vsegment segment p1 p2
2338restore CrankArm.brep obj
2339vdisplay obj
faea8b40 2340vconnect new obj 100100100 1 0 0 0 0 1
bf62b306 2341~~~~~
72b7576f 2342
bf62b306 2343@subsubsection occt_draw_4_4_16 vtriangle
72b7576f 2344
bf62b306 2345Syntax:
2346~~~~~
2347vtriangle name PointName PointName PointName
2348~~~~~
72b7576f 2349
2350Creates and displays a filled triangle from named points.
72b7576f 2351
bf62b306 2352**Example:**
2353~~~~~
72b7576f 2354vinit
2355vpoint p1 0 0 0
2356vpoint p2 50 0 0
2357vpoint p3 25 40 0
bf62b306 2358vtriangle triangle1 p1 p2 p3
2359~~~~~
72b7576f 2360
bf62b306 2361@subsubsection occt_draw_4_4_17 vsegment
72b7576f 2362
bf62b306 2363Syntax:
2364~~~~~
2365vsegment name PointName PointName
2366~~~~~
72b7576f 2367
2368Creates and displays a segment from named points.
72b7576f 2369
bf62b306 2370**Example:**
2371~~~~~
72b7576f 2372Vinit
2373vpoint p1 0 0 0
2374vpoint p2 50 0 0
2375vsegment segment p1 p2
bf62b306 2376~~~~~
72b7576f 2377
18006a0f 2378@subsubsection occt_draw_4_4_18 vpointcloud
2379
2380Syntax:
2381~~~~~
faea8b40 2382vpointcloud name shape [-randColor] [-normals] [-noNormals]
18006a0f 2383~~~~~
2384
251a7984 2385Creates an interactive object for an arbitrary set of points from the triangulated shape.
faea8b40 2386Additional options:
251a7984 2387 * *randColor* -- generates a random color per point;
2388 * *normals* -- generates a normal per point (default);
2389 * *noNormals* -- does not generate a normal per point.
18006a0f 2390
2391~~~~~
faea8b40 2392vpointcloud name x y z r npts {surface|volume} [-randColor] [-normals] [-noNormals]
18006a0f 2393~~~~~
2394Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r).
faea8b40 2395Additional options:
251a7984 2396 * *randColor* -- generates a random color per point;
2397 * *normals* -- generates a normal per point (default);
2398 * *noNormals* -- does not generate a normal per point.
18006a0f 2399
2400**Example:**
2401~~~~~
2402vinit
2403vpointcloud pc 0 0 0 100 100000 surface -randColor
2404vfit
2405~~~~~
2406
2407@subsubsection occt_draw_4_4_19 vclipplane
2408
2409Syntax:
2410~~~~~
3f812249 2411vclipplane maxplanes <view_name> -- gets plane limit for the view.
2412vclipplane create <plane_name> -- creates a new plane.
2413vclipplane delete <plane_name> -- deletes a plane.
2414vclipplane clone <source_plane> <plane_name> -- clones the plane definition.
2415vclipplane set/unset <plane_name> object <object list> -- sets/unsets the plane for an IO.
2416vclipplane set/unset <plane_name> view <view list> -- sets/unsets plane for a view.
2417vclipplane change <plane_name> on/off -- turns clipping on/off.
2418vclipplane change <plane_name> equation <a> <b> <c> <d> -- changes plane equation.
2419vclipplane change <plane_name> capping on/off -- turns capping on/off.
2420vclipplane change <plane_name> capping color <r> <g> <b> -- sets color.
2421vclipplane change <plane name> capping texname <texture> -- sets texture.
2422vclipplane change <plane_name> capping texscale <sx> <sy> -- sets texture scale.
2423vclipplane change <plane_name> capping texorigin <tx> <ty> -- sets texture origin.
2424vclipplane change <plane_name> capping texrotate <angle> -- sets texture rotation.
2425vclipplane change <plane_name> capping hatch on/off/<id> -- sets hatching mask.
18006a0f 2426~~~~~
2427
2428Manages clipping planes
2429
2430**Example:**
2431~~~~~
2432vinit
2433vclipplane create pln1
2434vclipplane change pln1 equation 1 0 0 -0.1
2435vclipplane set pln1 view Driver1/Viewer1/View1
2436box b 100 100 100
2437vdisplay b
2438vsetdispmode 1
2439vfit
2440vrotate 10 10 10
2441vselect 100 100
2442~~~~~
2443
2444@subsubsection occt_draw_4_4_20 vdimension
2445
2446Syntax:
2447~~~~~
2448vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]
2449 [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2450 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2451 [-arrow external|internal|fit] [{-arrowlength|-arlen} RealArrowLength]
2452 [{-arrowangle|-arangle} ArrowAngle(degrees)] [-plane xoy|yoz|zox]
73ddbb9a 2453 [-flyout FloatValue -extension FloatValue]
d5cdd12a 2454 [-autovalue] [-value CustomRealValue] [-textvalue CustomTextValue]
73ddbb9a 2455 [-dispunits DisplayUnitsString]
2456 [-modelunits ModelUnitsString] [-showunits | -hideunits]
18006a0f 2457~~~~~
2458
2459Builds angle, length, radius or diameter dimension interactive object **name**.
2460
a110c4a3 2461**Attention:** length dimension can't be built without working plane.
18006a0f 2462
2463**Example:**
2464~~~~~
73ddbb9a 2465vinit
18006a0f 2466vpoint p1 0 0 0
2467vpoint p2 50 50 0
2468vdimension dim1 -length -plane xoy -shapes p1 p2
2469
2470vpoint p3 100 0 0
2471vdimension dim2 -angle -shapes p1 p2 p3
2472
2473vcircle circle p1 p2 p3 0
2474vdimension dim3 -radius -shapes circle
2475vfit
2476~~~~~
2477
2478@subsubsection occt_draw_4_4_21 vdimparam
2479
2480Syntax:
2481~~~~~
2482vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2483 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2484 [-arrow external|internal|fit]
2485 [{-arrowlength|-arlen} RealArrowLength]
2486 [{-arrowangle|-arangle} ArrowAngle(degrees)]
2487 [-plane xoy|yoz|zox]
2488 [-flyout FloatValue -extension FloatValue]
73ddbb9a 2489 [-autovalue]
2490 [-value CustomRealValue]
2491 [-textvalue CustomTextValue]
18006a0f 2492 [-dispunits DisplayUnitsString]
2493 [-modelunits ModelUnitsString]
2494 [-showunits | -hideunits]
2495~~~~~
2496
2497Sets parameters for angle, length, radius and diameter dimension **name**.
2498
2499**Example:**
2500~~~~~
73ddbb9a 2501vinit
18006a0f 2502vpoint p1 0 0 0
2503vpoint p2 50 50 0
2504vdimension dim1 -length -plane xoy -shapes p1 p2
2505vdimparam dim1 -flyout -15 -arrowlength 4 -showunits -value 10
73ddbb9a 2506vfit
2507vdimparam dim1 -textvalue "w_1"
2508vdimparam dim1 -autovalue
18006a0f 2509~~~~~
2510
948c552a 2511@subsubsection occt_draw_4_4_22 vangleparam
ee905e84 2512
2513Syntax:
2514~~~~~
2515vangleparam name [-type interior|exterior]
2516 [-showarrow first|second|both|none]
2517~~~~~
2518
2519Sets parameters for angle dimension **name**.
2520
2521**Example:**
2522~~~~~
2523vinit
2524vpoint p1 0 0 0
2525vpoint p2 10 0 0
2526vpoint p3 10 5 0
2527vdimension dim1 -angle -plane xoy -shapes p1 p2 p3
2528vfit
2529vangleparam dim1 -type exterior -showarrow first
2530~~~~~
2531
948c552a 2532@subsubsection occt_draw_4_4_23 vlengthparam
2533
2534Syntax:
2535~~~~~
2536vlengthparam name [-type interior|exterior]
2537 [-showarrow first|second|both|none]
2538~~~~~
2539
2540Sets parameters for length dimension **name**.
2541
2542**Example:**
2543~~~~~
2544vinit
2545vpoint p1 20 20 0
2546vpoint p2 80 80 0
2547vdimension dim1 -length -plane xoy -shapes p1 p2
2548vtop
2549vfit
2550vzoom 0.5
2551vlengthparam dim1 -direction ox
2552~~~~~
2553
2554@subsubsection occt_draw_4_4_24 vmovedim
18006a0f 2555
2556Syntax:
2557~~~~~
2558vmovedim [name] [x y z]
2559~~~~~
2560
2561Moves picked or named (if **name** parameter is defined) dimension
2562to picked mouse position or input point with coordinates **x**,**y**,**z**.
2563Text label of dimension **name** is moved to position, another parts of dimension
2564are adjusted.
2565
2566**Example:**
2567~~~~~
73ddbb9a 2568vinit
18006a0f 2569vpoint p1 0 0 0
2570vpoint p2 50 50 0
2571vdimension dim1 -length -plane xoy -shapes p1 p2
2572vmovedim dim1 -10 30 0
2573~~~~~
2574
2575
3f812249 2576@subsection occt_draw_4_5 AIS viewer -- Mesh Visualization Service
72b7576f 2577
bf62b306 2578**MeshVS** (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
72b7576f 2579
bf62b306 2580@subsubsection occt_draw_4_5_1 meshfromstl
72b7576f 2581
bf62b306 2582Syntax:
2583~~~~~
2584meshfromstl meshname file
2585~~~~~
2586
2587Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately.
2588
2589**Example:**
2590~~~~~
2591meshfromstl mesh myfile.stl
2592~~~~~
72b7576f 2593
bf62b306 2594@subsubsection occt_draw_4_5_2 meshdispmode
72b7576f 2595
bf62b306 2596Syntax:
2597~~~~~
2598meshdispmode meshname displaymode
2599~~~~~
72b7576f 2600
bf62b306 2601Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
2602* *1* for *wireframe*,
2603* *2* for *shading* mode, or
2604* *3* for *shrink* mode.
72b7576f 2605
e5bd0d98 2606**Example:**
bf62b306 2607~~~~~
2608vinit
72b7576f 2609meshfromstl mesh myfile.stl
bf62b306 2610meshdispmode mesh 2
2611~~~~~
72b7576f 2612
bf62b306 2613@subsubsection occt_draw_4_5_3 meshselmode
72b7576f 2614
bf62b306 2615Syntax:
2616~~~~~
2617meshselmode meshname selectionmode
2618~~~~~
72b7576f 2619
bf62b306 2620Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
3f812249 2621* *1* -- node selection;
2622* *2* -- 0D elements (not supported in STL);
2623* *4* -- links (not supported in STL);
2624* *8* -- faces.
bf62b306 2625
e5bd0d98 2626**Example:**
bf62b306 2627~~~~~
72b7576f 2628vinit
2629meshfromstl mesh myfile.stl
bf62b306 2630meshselmode mesh 1
2631~~~~~
72b7576f 2632
bf62b306 2633@subsubsection occt_draw_4_5_4 meshshadcolor
72b7576f 2634
bf62b306 2635Syntax:
2636~~~~~
2637meshshadcolor meshname red green blue
2638~~~~~
72b7576f 2639
ca0f3082 2640Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
bf62b306 2641
e5bd0d98 2642**Example:**
bf62b306 2643~~~~~
72b7576f 2644vinit
2645meshfromstl mesh myfile.stl
bf62b306 2646meshshadcolormode mesh 0.5 0.5 0.5
2647~~~~~
72b7576f 2648
bf62b306 2649@subsubsection occt_draw_4_5_5 meshlinkcolor
72b7576f 2650
bf62b306 2651Syntax:
2652~~~~~
2653meshlinkcolor meshname red green blue
2654~~~~~
72b7576f 2655
bf62b306 2656Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2657
e5bd0d98 2658**Example:**
bf62b306 2659~~~~~
72b7576f 2660vinit
2661meshfromstl mesh myfile.stl
bf62b306 2662meshlinkcolormode mesh 0.5 0.5 0.5
2663~~~~~
72b7576f 2664
bf62b306 2665@subsubsection occt_draw_4_5_6 meshmat
72b7576f 2666
bf62b306 2667Syntax:
2668~~~~~
2669meshmat meshname material
2670~~~~~
2671
2672Changes the material of object **meshname**.
2673
2674*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
3f812249 2675* *0 -- BRASS,*
2676* *1 -- BRONZE,*
2677* *2 -- COPPER,*
2678* *3 -- GOLD,*
2679* *4 -- PEWTER,*
2680* *5 -- PLASTER,*
2681* *6 -- PLASTIC,*
2682* *7 -- SILVER,*
2683* *8 -- STEEL,*
2684* *9 -- STONE,*
2685* *10 -- SHINY_PLASTIC,*
2686* *11 -- SATIN,*
2687* *12 -- METALIZED,*
2688* *13 -- NEON_GNC,*
2689* *14 -- CHROME,*
2690* *15 -- ALUMINIUM,*
2691* *16 -- OBSIDIAN,*
2692* *17 -- NEON_PHC,*
2693* *18 -- JADE,*
2694* *19 -- DEFAULT,*
2695* *20 -- UserDefined*
bf62b306 2696
e5bd0d98 2697**Example:**
bf62b306 2698~~~~~
72b7576f 2699vinit
2700meshfromstl mesh myfile.stl
2701meshmat mesh JADE
bf62b306 2702~~~~~
72b7576f 2703
bf62b306 2704@subsubsection occt_draw_4_5_7 meshshrcoef
72b7576f 2705
bf62b306 2706Syntax:
2707~~~~~
2708meshshrcoef meshname shrinkcoefficient
2709~~~~~
72b7576f 2710
bf62b306 2711Changes 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.
2712
e5bd0d98 2713**Example:**
bf62b306 2714~~~~~
72b7576f 2715vinit
2716meshfromstl mesh myfile.stl
bf62b306 2717meshshrcoef mesh 0.05
2718~~~~~
72b7576f 2719
bf62b306 2720@subsubsection occt_draw_4_5_8 meshshow
72b7576f 2721
bf62b306 2722Syntax:
2723~~~~~
2724meshshow meshname
2725~~~~~
72b7576f 2726
bf62b306 2727Displays **meshname** in the viewer (if it is erased).
2728
e5bd0d98 2729**Example:**
bf62b306 2730~~~~~
72b7576f 2731vinit
2732meshfromstl mesh myfile.stl
bf62b306 2733meshshow mesh
2734~~~~~
72b7576f 2735
bf62b306 2736@subsubsection occt_draw_4_5_9 meshhide
72b7576f 2737
bf62b306 2738Syntax:
2739~~~~~
2740meshhide meshname
2741~~~~~
72b7576f 2742
2743Hides **meshname** in the viewer.
72b7576f 2744
bf62b306 2745**Example:**
2746~~~~~
72b7576f 2747vinit
2748meshfromstl mesh myfile.stl
bf62b306 2749meshhide mesh
2750~~~~~
72b7576f 2751
bf62b306 2752@subsubsection occt_draw_4_5_10 meshhidesel
72b7576f 2753
bf62b306 2754Syntax:
2755~~~~~
2756meshhidesel meshname
2757~~~~~
72b7576f 2758
2759Hides only selected entities. The other part of **meshname** remains visible.
2760
bf62b306 2761@subsubsection occt_draw_4_5_11 meshshowsel
72b7576f 2762
bf62b306 2763Syntax:
2764~~~~~
2765meshshowsel meshname
2766~~~~~
72b7576f 2767
2768Shows only selected entities. The other part of **meshname** becomes invisible.
2769
bf62b306 2770@subsubsection occt_draw_4_5_12 meshshowall
72b7576f 2771
bf62b306 2772Syntax:
2773~~~~~
2774meshshowall meshname
2775~~~~~
72b7576f 2776
2777Changes the state of all entities to visible for **meshname**.
2778
bf62b306 2779@subsubsection occt_draw_4_5_13 meshdelete
72b7576f 2780
bf62b306 2781Syntax:
2782~~~~~
2783meshdelete meshname
2784~~~~~
72b7576f 2785
2786Deletes MeshVS_Mesh object **meshname**.
72b7576f 2787
bf62b306 2788**Example:**
2789~~~~~
72b7576f 2790vinit
2791meshfromstl mesh myfile.stl
2792meshdelete mesh
bf62b306 2793~~~~~
72b7576f 2794
18006a0f 2795@subsection occt_draw_4_6 VIS Viewer commands
2796
2797A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness:
2798
2799~~~~
2800\> pload VIS
2801~~~~
2802
2803@subsubsection occt_draw_4_6_1 ivtkinit
2804
2805Syntax:
2806~~~~~
2807ivtkinit
2808~~~~~
2809
2810Creates a window for VTK viewer.
2811
d6b4d3d0 2812@figure{/user_guides/draw_test_harness/images/draw_image001.png,"",225}
18006a0f 2813
bfa7a685 2814@subsubsection occt_draw_4_6_2 ivtkdisplay
18006a0f 2815
2816Syntax:
2817~~~~~
2818ivtkdisplay name1 [name2] …[name n]
2819~~~~~
2820
2821Displays named objects.
2822
2823**Example:**
2824~~~~~
2825ivtkinit
2826# create cone
2827pcone c 5 0 10
2828ivtkdisplay c
2829~~~~~
2830
d6b4d3d0 2831@figure{/user_guides/draw_test_harness/images/draw_image002.png,"",261}
2832
18006a0f 2833
bfa7a685 2834@subsubsection occt_draw_4_6_3 ivtkerase
18006a0f 2835
2836Syntax:
2837~~~~~
2838ivtkerase [name1] [name2] … [name n]
2839~~~~~
2840
2841Erases named objects. If no arguments are passed, erases all displayed objects.
2842
2843**Example:**
2844~~~~~
2845ivtkinit
2846# create a sphere
2847psphere s 10
2848# create a cone
2849pcone c 5 0 10
2850# create a cylinder
2851pcylinder cy 5 10
2852# display objects
2853ivtkdisplay s c cy
2854# erase only the cylinder
2855ivtkerase cy
2856# erase the sphere and the cone
2857ivtkerase s c
2858~~~~~
2859
bfa7a685 2860@subsubsection occt_draw_4_6_4 ivtkfit
18006a0f 2861
2862Syntax:
2863~~~~~
2864ivtkfit
2865~~~~~
2866
2867Automatic zoom/panning.
2868
bfa7a685 2869@subsubsection occt_draw_4_6_5 ivtkdispmode
18006a0f 2870
2871Syntax:
2872~~~~~
2873ivtksetdispmode [name] {0|1}
2874~~~~~
2875
2876Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects
2877The possible modes are: 0 (WireFrame) and 1 (Shading).
2878
2879**Example:**
2880~~~~~
2881ivtkinit
2882# create a cone
2883pcone c 5 0 10
2884# display the cone
2885ivtkdisplay c
2886# set shading mode for the cone
2887ivtksetdispmode c 1
2888~~~~~
2889
d6b4d3d0 2890@figure{/user_guides/draw_test_harness/images/draw_image003.png,"",262}
2891
bfa7a685 2892@subsubsection occt_draw_4_6_6 ivtksetselmode
18006a0f 2893
2894Syntax:
2895~~~~~
2896ivtksetselmode [name] mode {0|1}
2897~~~~~
2898
2899Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects.
2900
2901**Example:**
2902~~~~~
2903ivtkinit
2904# load a shape from file
2905restore CrankArm.brep a
2906# display the loaded shape
2907ivtkdisplay a
2908# set the face selection mode
2909ivtksetselmode a 4 1
2910~~~~~
2911
d6b4d3d0 2912@figure{/user_guides/draw_test_harness/images/draw_image004.png,"",291}
18006a0f 2913
bfa7a685 2914@subsubsection occt_draw_4_6_7 ivtkmoveto
18006a0f 2915
2916Syntax:
2917~~~~~
2918ivtkmoveto x y
2919~~~~~
2920
2921Imitates mouse cursor moving to point with the given display coordinates **x**,**y**.
2922
2923**Example:**
2924~~~~~
2925ivtkinit
2926pcone c 5 0 10
2927ivtkdisplay c
2928ivtkmoveto 40 50
2929~~~~~
2930
bfa7a685 2931@subsubsection occt_draw_4_6_8 ivtkselect
18006a0f 2932
2933Syntax:
2934~~~~~
2935ivtkselect x y
2936~~~~~
2937
2938Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
2939
2940**Example:**
2941~~~~~
2942ivtkinit
2943pcone c 5 0 10
2944ivtkdisplay c
2945ivtkselect 40 50
2946~~~~~
2947
bfa7a685 2948@subsubsection occt_draw_4_6_9 ivtkdump
18006a0f 2949
2950Syntax:
2951~~~~~
2952ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}]
2953~~~~~
2954
2955Dumps the contents of VTK viewer to image. It supports:
2956* dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM.
2957* dumping of different buffers: RGB, RGBA or depth buffer.
2958* defining of image sizes (width and height in pixels).
2959* dumping of stereo projections (left or right).
2960
2961**Example:**
2962~~~~~
2963ivtkinit
2964pcone c 5 0 10
2965ivtkdisplay c
2966ivtkdump D:/ConeSnapshot.png rgb 768 768
2967~~~~~
2968
bfa7a685 2969@subsubsection occt_draw_4_6_10 ivtkbgcolor
18006a0f 2970
2971
2972Syntax:
2973~~~~~
2974ivtkbgcolor r g b [r2 g2 b2]
2975~~~~~
2976
2977Sets uniform background color or gradient background if second triple of parameters is set. Color parameters r,g,b have to be chosen in the interval [0..255].
2978
2979**Example:**
2980~~~~~
2981ivtkinit
2982ivtkbgcolor 200 220 250
2983~~~~~
2984
d6b4d3d0 2985@figure{/user_guides/draw_test_harness/images/draw_image005.png,"",196}
18006a0f 2986
2987~~~~~
2988ivtkbgcolor 10 30 80 255 255 255
2989~~~~~
2990
d6b4d3d0 2991@figure{/user_guides/draw_test_harness/images/draw_image006.png,"",190}
18006a0f 2992
bf62b306 2993@section occt_draw_5 OCAF commands
72b7576f 2994
72b7576f 2995This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
2996
2997
bf62b306 2998@subsection occt_draw_5_1 Application commands
72b7576f 2999
3000
bf62b306 3001@subsubsection occt_draw_5_1_1 NewDocument
72b7576f 3002
bf62b306 3003Syntax:
3004~~~~~
3005NewDocument docname [format]
3006~~~~~
72b7576f 3007
3008Creates a new **docname** document with MDTV-Standard or described format.
72b7576f 3009
bf62b306 3010**Example:**
3011~~~~~
72b7576f 3012# Create new document with default (MDTV-Standard) format
3013NewDocument D
3014
3015# Create new document with BinOcaf format
3016NewDocument D2 BinOcaf
bf62b306 3017~~~~~
72b7576f 3018
bf62b306 3019@subsubsection occt_draw_5_1_2 IsInSession
72b7576f 3020
bf62b306 3021Syntax:
3022~~~~~
3023IsInSession path
3024~~~~~
72b7576f 3025
3f812249 3026Returns *0*, if **path** document is managed by the application session, *1* -- otherwise.
72b7576f 3027
bf62b306 3028**Example:**
3029~~~~~
72b7576f 3030IsInSession /myPath/myFile.std
bf62b306 3031~~~~~
72b7576f 3032
bf62b306 3033@subsubsection occt_draw_5_1_3 ListDocuments
72b7576f 3034
bf62b306 3035Syntax:
3036~~~~~
3037ListDocuments
3038~~~~~
72b7576f 3039
3040Makes a list of documents handled during the session of the application.
3041
3042
bf62b306 3043@subsubsection occt_draw_5_1_4 Open
72b7576f 3044
bf62b306 3045Syntax:
3046~~~~~
4ff92abe 3047Open path docname [-stream]
bf62b306 3048~~~~~
72b7576f 3049
3050Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session.
72b7576f 3051
4ff92abe 3052option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
3053
bf62b306 3054**Example:**
3055~~~~~
3056Open /myPath/myFile.std D
3057~~~~~
72b7576f 3058
bf62b306 3059@subsubsection occt_draw_5_1_5 Close
72b7576f 3060
bf62b306 3061Syntax:
3062~~~~~
3063Close docname
3064~~~~~
72b7576f 3065
3066Closes **docname** document. The document is no longer handled by the applicative session.
72b7576f 3067
bf62b306 3068**Example:**
3069~~~~~
72b7576f 3070Close D
bf62b306 3071~~~~~
72b7576f 3072
bf62b306 3073@subsubsection occt_draw_5_1_6 Save
72b7576f 3074
bf62b306 3075Syntax:
3076~~~~~
3077Save docname
3078~~~~~
72b7576f 3079
3080Saves **docname** active document.
72b7576f 3081
bf62b306 3082**Example:**
3083~~~~~
72b7576f 3084Save D
bf62b306 3085~~~~~
72b7576f 3086
bf62b306 3087@subsubsection occt_draw_5_1_7 SaveAs
72b7576f 3088
bf62b306 3089Syntax:
3090~~~~~
4ff92abe 3091SaveAs docname path [-stream]
bf62b306 3092~~~~~
72b7576f 3093
4ff92abe 3094Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists.
3095
3096option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
72b7576f 3097
bf62b306 3098**Example:**
3099~~~~~
3100SaveAs D /myPath/myFile.std
3101~~~~~
72b7576f 3102
ba06f8bb 3103@subsection occt_draw_5_2 Basic commands
72b7576f 3104
ba06f8bb 3105@subsubsection occt_draw_5_2_1 Label
72b7576f 3106
ba06f8bb 3107Syntax:
72b7576f 3108
bf62b306 3109~~~~~
3110Label docname entry
3111~~~~~
72b7576f 3112
ba06f8bb 3113Creates the label expressed by <i>\<entry\></i> if it does not exist.
72b7576f 3114
bf62b306 3115Example
3116~~~~~
3117Label D 0:2
3118~~~~~
72b7576f 3119
ba06f8bb 3120@subsubsection occt_draw_5_2_2 NewChild
72b7576f 3121
ba06f8bb 3122Syntax:
72b7576f 3123
bf62b306 3124~~~~~
3125NewChild docname [taggerlabel = Root label]
3126~~~~~
ba06f8bb 3127Finds (or creates) a *TagSource* attribute located at father label of <i>\<taggerlabel\></i> and makes a new child label.
72b7576f 3128
bf62b306 3129Example
3130~~~~~
3131# Create new child of root label
3132NewChild D
72b7576f 3133
bf62b306 3134# Create new child of existing label
3135Label D 0:2
3136NewChild D 0:2
3137~~~~~
72b7576f 3138
ba06f8bb 3139@subsubsection occt_draw_5_2_3 Children
72b7576f 3140
ba06f8bb 3141Syntax:
bf62b306 3142~~~~~
3143Children docname label
3144~~~~~
3145Returns the list of attributes of label.
72b7576f 3146
bf62b306 3147Example
3148~~~~~
3149Children D 0:2
3150~~~~~
72b7576f 3151
ba06f8bb 3152@subsubsection occt_draw_5_2_4 ForgetAll
72b7576f 3153
ba06f8bb 3154Syntax:
bf62b306 3155~~~~~
3156ForgetAll docname label
3157~~~~~
3158Forgets all attributes of the label.
72b7576f 3159
bf62b306 3160Example
3161~~~~~
3162ForgetAll D 0:2
3163~~~~~
72b7576f 3164
72b7576f 3165
bf62b306 3166@subsubsection occt_draw_5_3 Application commands
72b7576f 3167
bf62b306 3168@subsubsection occt_draw_5_3_1 Main
72b7576f 3169
bf62b306 3170Syntax:
3171~~~~~
3172Main docname
3173~~~~~
72b7576f 3174
3175Returns the main label of the framework.
72b7576f 3176
bf62b306 3177**Example:**
3178~~~~~
72b7576f 3179Main D
bf62b306 3180~~~~~
72b7576f 3181
bf62b306 3182@subsubsection occt_draw_5_3_2 UndoLimit
72b7576f 3183
bf62b306 3184Syntax:
3185~~~~~
3186UndoLimit docname [value=0]
3187~~~~~
72b7576f 3188
3189
bf62b306 3190Sets 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 3191
bf62b306 3192**Example:**
3193~~~~~
72b7576f 3194UndoLimit D 100
bf62b306 3195~~~~~
72b7576f 3196
bf62b306 3197@subsubsection occt_draw_5_3_3 Undo
72b7576f 3198
bf62b306 3199Syntax:
3200~~~~~
3201Undo docname [value=1]
3202~~~~~
72b7576f 3203
3204Undoes **value** steps.
72b7576f 3205
bf62b306 3206**Example:**
3207~~~~~
72b7576f 3208Undo D
bf62b306 3209~~~~~
72b7576f 3210
bf62b306 3211@subsubsection occt_draw_5_3_4 Redo
72b7576f 3212
bf62b306 3213Syntax:
3214~~~~~
3215Redo docname [value=1]
3216~~~~~
72b7576f 3217
bf62b306 3218Redoes **value** steps.
3219
e5bd0d98 3220**Example:**
bf62b306 3221~~~~~
72b7576f 3222Redo D
bf62b306 3223~~~~~
72b7576f 3224
bf62b306 3225@subsubsection occt_draw_5_3_5 OpenCommand
72b7576f 3226
bf62b306 3227Syntax:
3228~~~~~
3229OpenCommand docname
3230~~~~~
72b7576f 3231
3232Opens a new command transaction.
72b7576f 3233
bf62b306 3234**Example:**
3235~~~~~
3236OpenCommand D
3237~~~~~
72b7576f 3238
bf62b306 3239@subsubsection occt_draw_5_3_6 CommitCommand
72b7576f 3240
bf62b306 3241Syntax:
3242~~~~~
3243CommitCommand docname
3244~~~~~
72b7576f 3245
3246Commits the Command transaction.
72b7576f 3247
bf62b306 3248**Example:**
3249~~~~~
3250CommitCommand D
3251~~~~~
72b7576f 3252
bf62b306 3253@subsubsection occt_draw_5_3_7 NewCommand
72b7576f 3254
bf62b306 3255Syntax:
3256~~~~~
3257NewCommand docname
3258~~~~~
72b7576f 3259
3f812249 3260This is a shortcut for Commit and Open transaction.
72b7576f 3261
bf62b306 3262**Example:**
3263~~~~~
72b7576f 3264NewCommand D
bf62b306 3265~~~~~
72b7576f 3266
bf62b306 3267@subsubsection occt_draw_5_3_8 AbortCommand
72b7576f 3268
bf62b306 3269Syntax:
3270~~~~~
3271AbortCommand docname
3272~~~~~
72b7576f 3273
3274Aborts the Command transaction.
72b7576f 3275
bf62b306 3276**Example:**
3277~~~~~
72b7576f 3278AbortCommand D
bf62b306 3279~~~~~
3280
3281@subsubsection occt_draw_5_3_9 Copy
72b7576f 3282
bf62b306 3283Syntax:
3284~~~~~
3285Copy docname entry Xdocname Xentry
3286~~~~~
72b7576f 3287
bf62b306 3288Copies the contents of *entry* to *Xentry*. No links are registered.
72b7576f 3289
e5bd0d98 3290**Example:**
bf62b306 3291~~~~~
72b7576f 3292Copy D1 0:2 D2 0:4
bf62b306 3293~~~~~
72b7576f 3294
bf62b306 3295@subsubsection occt_draw_5_3_10 UpdateLink
72b7576f 3296
bf62b306 3297Syntax:
3298~~~~~
3299UpdateLink docname [entry]
3300~~~~~
72b7576f 3301
bf62b306 3302Updates external reference set at *entry*.
72b7576f 3303
bf62b306 3304**Example:**
3305~~~~~
72b7576f 3306UpdateLink D
bf62b306 3307~~~~~
72b7576f 3308
bf62b306 3309@subsubsection occt_draw_5_3_11 CopyWithLink
72b7576f 3310
bf62b306 3311Syntax:
3312~~~~~
3313CopyWithLink docname entry Xdocname Xentry
3314~~~~~
72b7576f 3315
3316Aborts the Command transaction.
bf62b306 3317Copies the content of *entry* to *Xentry*. The link is registered with an *Xlink* attribute at *Xentry* label.
3318
e5bd0d98 3319**Example:**
bf62b306 3320~~~~~
3321CopyWithLink D1 0:2 D2 0:4
3322~~~~~
72b7576f 3323
bf62b306 3324@subsubsection occt_draw_5_3_12 UpdateXLinks
72b7576f 3325
bf62b306 3326Syntax:
3327~~~~~
3328UpdateXLinks docname entry
3329~~~~~
72b7576f 3330
bf62b306 3331Sets modifications on labels impacted by external references to the *entry*. The *document* becomes invalid and must be recomputed
72b7576f 3332
e5bd0d98 3333**Example:**
bf62b306 3334~~~~~
72b7576f 3335UpdateXLinks D 0:2
bf62b306 3336~~~~~
72b7576f 3337
bf62b306 3338@subsubsection occt_draw_5_3_13 DumpDocument
72b7576f 3339
bf62b306 3340Syntax:
3341~~~~~
3342DumpDocument docname
3343~~~~~
72b7576f 3344
bf62b306 3345Displays parameters of *docname* document.
72b7576f 3346
bf62b306 3347**Example:**
3348~~~~~
72b7576f 3349DumpDocument D
bf62b306 3350~~~~~
3351
72b7576f 3352
bf62b306 3353@subsection occt_draw_5_4 Data Framework commands
72b7576f 3354
3355
bf62b306 3356@subsubsection occt_draw_5_4_1 MakeDF
72b7576f 3357
bf62b306 3358Syntax:
3359~~~~~
3360MakeDF dfname
3361~~~~~
72b7576f 3362
3363Creates a new data framework.
72b7576f 3364
bf62b306 3365**Example:**
3366~~~~~
72b7576f 3367MakeDF D
bf62b306 3368~~~~~
72b7576f 3369
bf62b306 3370@subsubsection occt_draw_5_4_2 ClearDF
72b7576f 3371
bf62b306 3372Syntax:
3373~~~~~
3374ClearDF dfname
3375~~~~~
72b7576f 3376
3377Clears a data framework.
72b7576f 3378
bf62b306 3379**Example:**
3380~~~~~
72b7576f 3381ClearDF D
bf62b306 3382~~~~~
72b7576f 3383
bf62b306 3384@subsubsection occt_draw_5_4_3 CopyDF
72b7576f 3385
bf62b306 3386Syntax:
3387~~~~~
3388CopyDF dfname1 entry1 [dfname2] entry2
3389~~~~~
72b7576f 3390
3391Copies a data framework.
72b7576f 3392
bf62b306 3393**Example:**
3394~~~~~
72b7576f 3395CopyDF D 0:2 0:4
bf62b306 3396~~~~~
72b7576f 3397
bf62b306 3398@subsubsection occt_draw_5_4_4 CopyLabel
72b7576f 3399
bf62b306 3400Syntax:
3401~~~~~
3402CopyLabel dfname fromlabel tolablel
3403~~~~~
72b7576f 3404
3405Copies a label.
72b7576f 3406
bf62b306 3407**Example:**
3408~~~~~
72b7576f 3409CopyLabel D1 0:2 0:4
bf62b306 3410~~~~~
72b7576f 3411
bf62b306 3412@subsubsection occt_draw_5_4_5 MiniDumpDF
72b7576f 3413
bf62b306 3414Syntax:
3415~~~~~
3416MiniDumpDF dfname
3417~~~~~
72b7576f 3418
3419Makes a mini-dump of a data framework.
72b7576f 3420
bf62b306 3421**Example:**
3422~~~~~
72b7576f 3423MiniDumpDF D
bf62b306 3424~~~~~
72b7576f 3425
bf62b306 3426@subsubsection occt_draw_5_4_6 XDumpDF
72b7576f 3427
bf62b306 3428Syntax:
3429~~~~~
3430XDumpDF dfname
3431~~~~~
72b7576f 3432
3433Makes an extended dump of a data framework.
bf62b306 3434
e5bd0d98 3435**Example:**
bf62b306 3436~~~~~
3437XDumpDF D
3438~~~~~
72b7576f 3439
bf62b306 3440@subsection occt_draw_5_5 General attributes commands
72b7576f 3441
72b7576f 3442
bf62b306 3443@subsubsection occt_draw_5_5_1 SetInteger
72b7576f 3444
bf62b306 3445Syntax:
3446~~~~~
3447SetInteger dfname entry value
3448~~~~~
72b7576f 3449
bf62b306 3450Finds or creates an Integer attribute at *entry* label and sets *value*.
72b7576f 3451
e5bd0d98 3452**Example:**
bf62b306 3453~~~~~
72b7576f 3454SetInteger D 0:2 100
bf62b306 3455~~~~~
3456
3457@subsubsection occt_draw_5_5_2 GetInteger
72b7576f 3458
bf62b306 3459Syntax:
3460~~~~~
3461GetInteger dfname entry [drawname]
3462~~~~~
72b7576f 3463
bf62b306 3464Gets a value of an Integer attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3465
e5bd0d98 3466**Example:**
bf62b306 3467~~~~~
72b7576f 3468GetInteger D 0:2 Int1
bf62b306 3469~~~~~
72b7576f 3470
bf62b306 3471@subsubsection occt_draw_5_5_3 SetReal
72b7576f 3472
bf62b306 3473Syntax:
3474~~~~~
3475SetReal dfname entry value
3476~~~~~
72b7576f 3477
bf62b306 3478Finds or creates a Real attribute at *entry* label and sets *value*.
72b7576f 3479
bf62b306 3480**Example:**
3481~~~~~
72b7576f 3482SetReal D 0:2 100.
bf62b306 3483~~~~~
72b7576f 3484
bf62b306 3485@subsubsection occt_draw_5_5_4 GetReal
72b7576f 3486
bf62b306 3487Syntax:
3488~~~~~
3489GetReal dfname entry [drawname]
3490~~~~~
72b7576f 3491
bf62b306 3492Gets a value of a Real attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3493
bf62b306 3494**Example:**
3495~~~~~
72b7576f 3496GetReal D 0:2 Real1
bf62b306 3497~~~~~
72b7576f 3498
bf62b306 3499@subsubsection occt_draw_5_5_5 SetIntArray
3500
3501Syntax:
3502~~~~~
3503SetIntArray dfname entry lower upper value1 value2 …
3504~~~~~
72b7576f 3505
bf62b306 3506Finds or creates an IntegerArray attribute at *entry* label with lower and upper bounds and sets **value1*, *value2*...
72b7576f 3507
e5bd0d98 3508**Example:**
bf62b306 3509~~~~~
3510SetIntArray D 0:2 1 4 100 200 300 400
3511~~~~~
72b7576f 3512
bf62b306 3513@subsubsection occt_draw_5_5_6 GetIntArray
72b7576f 3514
bf62b306 3515Syntax:
3516~~~~~
3517GetIntArray dfname entry
3518~~~~~
72b7576f 3519
bf62b306 3520Gets a value of an *IntegerArray* attribute at *entry* label.
72b7576f 3521
e5bd0d98 3522**Example:**
bf62b306 3523~~~~~
3524GetIntArray D 0:2
3525~~~~~
72b7576f 3526
bf62b306 3527@subsubsection occt_draw_5_5_7 SetRealArray
72b7576f 3528
bf62b306 3529Syntax:
3530~~~~~
3531SetRealArray dfname entry lower upper value1 value2 …
3532~~~~~
72b7576f 3533
bf62b306 3534Finds or creates a RealArray attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
72b7576f 3535
e5bd0d98 3536**Example:**
bf62b306 3537~~~~~
72b7576f 3538GetRealArray D 0:2 1 4 100. 200. 300. 400.
bf62b306 3539~~~~~
3540
3541@subsubsection occt_draw_5_5_8 GetRealArray
72b7576f 3542
bf62b306 3543Syntax:
3544~~~~~
3545GetRealArray dfname entry
3546~~~~~
72b7576f 3547
bf62b306 3548Gets a value of a RealArray attribute at *entry* label.
72b7576f 3549
e5bd0d98 3550**Example:**
bf62b306 3551~~~~~
72b7576f 3552GetRealArray D 0:2
bf62b306 3553~~~~~
72b7576f 3554
bf62b306 3555@subsubsection occt_draw_5_5_9 SetComment
72b7576f 3556
bf62b306 3557Syntax:
3558~~~~~
3559SetComment dfname entry value
3560~~~~~
3561
3562Finds or creates a Comment attribute at *entry* label and sets *value*.
72b7576f 3563
e5bd0d98 3564**Example:**
bf62b306 3565~~~~~
3566SetComment D 0:2 "My comment"
3567~~~~~
72b7576f 3568
bf62b306 3569@subsubsection occt_draw_5_5_10 GetComment
72b7576f 3570
bf62b306 3571Syntax:
3572~~~~~
3573GetComment dfname entry
3574~~~~~
72b7576f 3575
bf62b306 3576Gets a value of a Comment attribute at *entry* label.
72b7576f 3577
e5bd0d98 3578**Example:**
bf62b306 3579~~~~~
3580GetComment D 0:2
3581~~~~~
72b7576f 3582
bf62b306 3583@subsubsection occt_draw_5_5_11 SetExtStringArray
72b7576f 3584
bf62b306 3585Syntax:
3586~~~~~
3587SetExtStringArray dfname entry lower upper value1 value2 …
3588~~~~~
72b7576f 3589
bf62b306 3590Finds or creates an *ExtStringArray* attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
72b7576f 3591
e5bd0d98 3592**Example:**
bf62b306 3593~~~~~
3594SetExtStringArray D 0:2 1 3 *string1* *string2* *string3*
3595~~~~~
72b7576f 3596
bf62b306 3597@subsubsection occt_draw_5_5_12 GetExtStringArray
72b7576f 3598
bf62b306 3599Syntax:
3600~~~~~
3601GetExtStringArray dfname entry
3602~~~~~
72b7576f 3603
bf62b306 3604Gets a value of an ExtStringArray attribute at *entry* label.
72b7576f 3605
e5bd0d98 3606**Example:**
bf62b306 3607~~~~~
72b7576f 3608GetExtStringArray D 0:2
bf62b306 3609~~~~~
72b7576f 3610
bf62b306 3611@subsubsection occt_draw_5_5_13 SetName
72b7576f 3612
bf62b306 3613Syntax:
3614~~~~~
3615SetName dfname entry value
3616~~~~~
72b7576f 3617
bf62b306 3618Finds or creates a Name attribute at *entry* label and sets *value*.
72b7576f 3619
bf62b306 3620**Example:**
3621~~~~~
72b7576f 3622SetName D 0:2 *My name*
bf62b306 3623~~~~~
3624
3625@subsubsection occt_draw_5_5_14 GetName
72b7576f 3626
bf62b306 3627Syntax:
3628~~~~~
3629GetName dfname entry
3630~~~~~
72b7576f 3631
bf62b306 3632Gets a value of a Name attribute at *entry* label.
72b7576f 3633
e5bd0d98 3634**Example:**
bf62b306 3635~~~~~
72b7576f 3636GetName D 0:2
bf62b306 3637~~~~~
72b7576f 3638
bf62b306 3639@subsubsection occt_draw_5_5_15 SetReference
72b7576f 3640
bf62b306 3641Syntax:
3642~~~~~
3643SetReference dfname entry reference
3644~~~~~
72b7576f 3645
bf62b306 3646Creates a Reference attribute at *entry* label and sets *reference*.
72b7576f 3647
bf62b306 3648**Example:**
3649~~~~~
72b7576f 3650SetReference D 0:2 0:4
bf62b306 3651~~~~~
72b7576f 3652
bf62b306 3653@subsubsection occt_draw_5_5_16 GetReference
3654
3655Syntax:
3656~~~~~
3657GetReference dfname entry
3658~~~~~
72b7576f 3659
bf62b306 3660Gets a value of a Reference attribute at *entry* label.
72b7576f 3661
e5bd0d98 3662**Example:**
bf62b306 3663~~~~~
72b7576f 3664GetReference D 0:2
bf62b306 3665~~~~~
72b7576f 3666
bf62b306 3667@subsubsection occt_draw_5_5_17 SetUAttribute
72b7576f 3668
bf62b306 3669Syntax:
3670~~~~~
3671SetUAttribute dfname entry localGUID
3672~~~~~
72b7576f 3673
bf62b306 3674Creates a UAttribute attribute at *entry* label with *localGUID*.
72b7576f 3675
bf62b306 3676**Example:**
3677~~~~~
3678set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3679SetUAttribute D 0:2 ${localGUID}
bf62b306 3680~~~~~
72b7576f 3681
bf62b306 3682@subsubsection occt_draw_5_5_18 GetUAttribute
72b7576f 3683
bf62b306 3684Syntax:
3685~~~~~
3686GetUAttribute dfname entry loacalGUID
3687~~~~~
72b7576f 3688
bf62b306 3689Finds a *UAttribute* at *entry* label with *localGUID*.
72b7576f 3690
bf62b306 3691**Example:**
3692~~~~~
3693set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3694GetUAttribute D 0:2 ${localGUID}
bf62b306 3695~~~~~
72b7576f 3696
bf62b306 3697@subsubsection occt_draw_5_5_19 SetFunction
72b7576f 3698
bf62b306 3699Syntax:
3700~~~~~
3701SetFunction dfname entry ID failure
3702~~~~~
72b7576f 3703
bf62b306 3704Finds or creates a *Function* attribute at *entry* label with driver ID and *failure* index.
72b7576f 3705
bf62b306 3706**Example:**
3707~~~~~
3708set ID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3709SetFunction D 0:2 ${ID} 1
bf62b306 3710~~~~~
3711
3712@subsubsection occt_draw_5_5_20 GetFunction
72b7576f 3713
bf62b306 3714Syntax:
3715~~~~~
3716GetFunction dfname entry ID failure
3717~~~~~
72b7576f 3718
bf62b306 3719Finds a Function attribute at *entry* label and sets driver ID to *ID* variable and failure index to *failure* variable.
72b7576f 3720
e5bd0d98 3721**Example:**
bf62b306 3722~~~~~
72b7576f 3723GetFunction D 0:2 ID failure
bf62b306 3724~~~~~
72b7576f 3725
bf62b306 3726@subsubsection occt_draw_5_5_21 NewShape
72b7576f 3727
bf62b306 3728Syntax:
3729~~~~~
3730NewShape dfname entry [shape]
3731~~~~~
72b7576f 3732
bf62b306 3733Finds or creates a Shape attribute at *entry* label. Creates or updates the associated *NamedShape* attribute by *shape* if *shape* is defined.
72b7576f 3734
e5bd0d98 3735**Example:**
bf62b306 3736~~~~~
72b7576f 3737box b 10 10 10
3738NewShape D 0:2 b
bf62b306 3739~~~~~
72b7576f 3740
bf62b306 3741@subsubsection occt_draw_5_5_22 SetShape
72b7576f 3742
bf62b306 3743Syntax:
3744~~~~~
3745SetShape dfname entry shape
3746~~~~~
72b7576f 3747
bf62b306 3748Creates or updates a *NamedShape* attribute at *entry* label by *shape*.
72b7576f 3749
bf62b306 3750**Example:**
3751~~~~~
72b7576f 3752box b 10 10 10
3753SetShape D 0:2 b
bf62b306 3754~~~~~
72b7576f 3755
bf62b306 3756@subsubsection occt_draw_5_5_23 GetShape
72b7576f 3757
bf62b306 3758Syntax:
3759~~~~~
3760GetShape2 dfname entry shape
3761~~~~~
72b7576f 3762
bf62b306 3763Sets a shape from NamedShape attribute associated with *entry* label to *shape* draw variable.
72b7576f 3764
bf62b306 3765**Example:**
3766~~~~~
72b7576f 3767GetShape2 D 0:2 b
bf62b306 3768~~~~~
72b7576f 3769
bf62b306 3770@subsection occt_draw_5_6 Geometric attributes commands
72b7576f 3771
3772
bf62b306 3773@subsubsection occt_draw_5_6_1 SetPoint
72b7576f 3774
bf62b306 3775Syntax:
3776~~~~~
3777SetPoint dfname entry point
3778~~~~~
72b7576f 3779
bf62b306 3780Finds or creates a Point attribute at *entry* label and sets *point* as generated in the associated *NamedShape* attribute.
72b7576f 3781
bf62b306 3782**Example:**
3783~~~~~
72b7576f 3784point p 10 10 10
3785SetPoint D 0:2 p
bf62b306 3786~~~~~
72b7576f 3787
bf62b306 3788@subsubsection occt_draw_5_6_2 GetPoint
72b7576f 3789
bf62b306 3790Syntax:
3791~~~~~
3792GetPoint dfname entry [drawname]
3793~~~~~
72b7576f 3794
bf62b306 3795Gets a vertex from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3796
bf62b306 3797**Example:**
3798~~~~~
72b7576f 3799GetPoint D 0:2 p
bf62b306 3800~~~~~
72b7576f 3801
bf62b306 3802@subsubsection occt_draw_5_6_3 SetAxis
3803
3804Syntax:
3805~~~~~
3806SetAxis dfname entry axis
3807~~~~~
72b7576f 3808
bf62b306 3809Finds or creates an Axis attribute at *entry* label and sets *axis* as generated in the associated *NamedShape* attribute.
72b7576f 3810
e5bd0d98 3811**Example:**
bf62b306 3812~~~~~
72b7576f 3813line l 10 20 30 100 200 300
3814SetAxis D 0:2 l
bf62b306 3815~~~~~
72b7576f 3816
bf62b306 3817@subsubsection occt_draw_5_6_4 GetAxis
72b7576f 3818
bf62b306 3819Syntax:
3820~~~~~
3821GetAxis dfname entry [drawname]
3822~~~~~
72b7576f 3823
bf62b306 3824Gets a line from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3825
bf62b306 3826**Example:**
3827~~~~~
72b7576f 3828GetAxis D 0:2 l
bf62b306 3829~~~~~
72b7576f 3830
bf62b306 3831@subsubsection occt_draw_5_6_5 SetPlane
3832
3833Syntax:
3834~~~~~
3835SetPlane dfname entry plane
3836~~~~~
72b7576f 3837
bf62b306 3838Finds or creates a Plane attribute at *entry* label and sets *plane* as generated in the associated *NamedShape* attribute.
72b7576f 3839
e5bd0d98 3840**Example:**
bf62b306 3841~~~~~
3f812249 3842plane pl 10 20 30 -1 0 0
72b7576f 3843SetPlane D 0:2 pl
bf62b306 3844~~~~~
72b7576f 3845
bf62b306 3846@subsubsection occt_draw_5_6_6 GetPlane
72b7576f 3847
bf62b306 3848Syntax:
3849~~~~~
3850GetPlane dfname entry [drawname]
3851~~~~~
72b7576f 3852
bf62b306 3853Gets a plane from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3854
bf62b306 3855**Example:**
3856~~~~~
72b7576f 3857GetPlane D 0:2 pl
bf62b306 3858~~~~~
72b7576f 3859
bf62b306 3860@subsubsection occt_draw_5_6_7 SetGeometry
72b7576f 3861
bf62b306 3862Syntax:
3863~~~~~
3864SetGeometry dfname entry [type] [shape]
3865~~~~~
72b7576f 3866
bf62b306 3867Creates 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 3868
e5bd0d98 3869**Example:**
bf62b306 3870~~~~~
72b7576f 3871point p 10 10 10
3872SetGeometry D 0:2 pnt p
bf62b306 3873~~~~~
72b7576f 3874
bf62b306 3875@subsubsection occt_draw_5_6_8 GetGeometryType
72b7576f 3876
bf62b306 3877Syntax:
3878~~~~~
3879GetGeometryType dfname entry
3880~~~~~
72b7576f 3881
bf62b306 3882Gets a geometry type from Geometry attribute at *entry* label.
72b7576f 3883
bf62b306 3884**Example:**
3885~~~~~
72b7576f 3886GetGeometryType D 0:2
bf62b306 3887~~~~~
72b7576f 3888
bf62b306 3889@subsubsection occt_draw_5_6_9 SetConstraint
72b7576f 3890
bf62b306 3891Syntax:
3892~~~~~
3893SetConstraint dfname entry keyword geometrie [geometrie …]
3894SetConstraint dfname entry "plane" geometrie
3895SetConstraint dfname entry "value" value
3896~~~~~
72b7576f 3897
bf62b306 38981. Creates a Constraint attribute at *entry* label and sets *keyword* constraint between geometry(ies).
3899*keyword* must be one of the following:
3900*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 39012. Sets plane for the existing constraint.
72b7576f 39023. Sets value for the existing constraint.
bf62b306 3903
e5bd0d98 3904**Example:**
bf62b306 3905~~~~~
3906SetConstraint D 0:2 "value" 5
3907~~~~~
72b7576f 3908
bf62b306 3909@subsubsection occt_draw_5_6_10 GetConstraint
72b7576f 3910
bf62b306 3911Syntax:
3912~~~~~
3913GetConstraint dfname entry
3914~~~~~
72b7576f 3915
bf62b306 3916Dumps a Constraint attribute at *entry* label
72b7576f 3917
e5bd0d98 3918**Example:**
bf62b306 3919~~~~~
72b7576f 3920GetConstraint D 0:2
bf62b306 3921~~~~~
3922
3923@subsubsection occt_draw_5_6_11 SetVariable
72b7576f 3924
bf62b306 3925Syntax:
3926~~~~~
3927SetVariable dfname entry isconstant(0/1) units
3928~~~~~
72b7576f 3929
bf62b306 3930Creates a Variable attribute at *entry* label and sets *isconstant* flag and *units* as a string.
72b7576f 3931
e5bd0d98 3932**Example:**
bf62b306 3933~~~~~
3934SetVariable D 0:2 1 "mm"
3935~~~~~
72b7576f 3936
bf62b306 3937@subsubsection occt_draw_5_6_12 GetVariable
72b7576f 3938
bf62b306 3939Syntax:
3940~~~~~
3941GetVariable dfname entry isconstant units
3942~~~~~
72b7576f 3943
bf62b306 3944Gets an *isconstant* flag and units of a Variable attribute at *entry* label.
72b7576f 3945
e5bd0d98 3946**Example:**
bf62b306 3947~~~~~
72b7576f 3948GetVariable D 0:2 isconstant units
bf62b306 3949puts "IsConstant=${isconstant}"
3950puts "Units=${units}"
3951~~~~~
72b7576f 3952
bf62b306 3953@subsection occt_draw_5_7 Tree attributes commands
72b7576f 3954
3955
bf62b306 3956@subsubsection occt_draw_5_7_1 RootNode
72b7576f 3957
bf62b306 3958Syntax:
3959~~~~~
3960RootNode dfname treenodeentry [ID]
3961~~~~~
72b7576f 3962
bf62b306 3963Returns the ultimate father of *TreeNode* attribute identified by its *treenodeentry* and its *ID* (or default ID, if *ID* is not defined).
72b7576f 3964
3965
bf62b306 3966@subsubsection occt_draw_5_7_2 SetNode
72b7576f 3967
bf62b306 3968Syntax:
3969~~~~~
3970SetNode dfname treenodeentry [ID]
3971~~~~~
72b7576f 3972
bf62b306 3973Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* (or assigns a default ID, if the *ID* is not defined).
72b7576f 3974
3975
bf62b306 3976@subsubsection occt_draw_5_7_3 AppendNode
72b7576f 3977
bf62b306 3978Syntax:
3979~~~~~
3980AppendNode dfname fatherentry childentry [fatherID]
3981~~~~~
72b7576f 3982
3983
bf62b306 3984Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as last child of *fatherentry*.
72b7576f 3985
3986
3987
3988
bf62b306 3989@subsubsection occt_draw_5_7_4 PrependNode
72b7576f 3990
bf62b306 3991Syntax:
3992~~~~~
3993PrependNode dfname fatherentry childentry [fatherID]
3994~~~~~
72b7576f 3995
3996
bf62b306 3997Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as first child of *fatherentry*.
72b7576f 3998
3999
bf62b306 4000@subsubsection occt_draw_5_7_5 InsertNodeBefore
72b7576f 4001
bf62b306 4002Syntax:
4003~~~~~
4004InsertNodeBefore dfname treenodeentry beforetreenode [ID]
4005~~~~~
72b7576f 4006
bf62b306 4007Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *beforetreenode* before *treenodeentry*.
72b7576f 4008
4009
bf62b306 4010@subsubsection occt_draw_5_7_6 InsertNodeAfter
72b7576f 4011
bf62b306 4012Syntax:
4013~~~~~
4014InsertNodeAfter dfname treenodeentry aftertreenode [ID]
4015~~~~~
72b7576f 4016
bf62b306 4017Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *aftertreenode* after *treenodeentry*.
72b7576f 4018
4019
bf62b306 4020@subsubsection occt_draw_5_7_7 DetachNode
72b7576f 4021
bf62b306 4022Syntax:
4023~~~~~
4024DetachNode dfname treenodeentry [ID]
4025~~~~~
72b7576f 4026
bf62b306 4027Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) from *treenodeentry*.
72b7576f 4028
4029
bf62b306 4030@subsubsection occt_draw_5_7_8 ChildNodeIterate
72b7576f 4031
bf62b306 4032Syntax:
4033~~~~~
4034ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID]
4035~~~~~
72b7576f 4036
4037
bf62b306 4038Iterates 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.
4039
e5bd0d98 4040**Example:**
bf62b306 4041~~~~~
72b7576f 4042Label D 0:2
4043Label D 0:3
4044Label D 0:4
4045Label D 0:5
4046Label D 0:6
4047Label D 0:7
4048Label D 0:8
4049Label D 0:9
4050
4051# Set root node
4052SetNode D 0:2
4053
4054AppendNode D 0:2 0:4
4055AppendNode D 0:2 0:5
4056PrependNode D 0:4 0:3
4057PrependNode D 0:4 0:8
4058PrependNode D 0:4 0:9
4059
4060InsertNodeBefore D 0:5 0:6
4061InsertNodeAfter D 0:4 0:7
4062
4063DetachNode D 0:8
4064
4065
4066# List all levels
4067ChildNodeIterate D 0:2 1
4068
4069==0:4
4070==0:9
4071==0:3
4072==0:7
4073==0:6
4074==0:5
4075
4076
4077# List only first levels
4078ChildNodeIterate D 0:2 1
4079
4080==0:4
4081==0:7
4082==0:6
4083==0:5
bf62b306 4084~~~~~
4085
4086@subsubsection occt_draw_5_7_9 InitChildNodeIterator
72b7576f 4087
bf62b306 4088Syntax:
4089~~~~~
4090InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID]
4091~~~~~
72b7576f 4092
72b7576f 4093
bf62b306 4094Initializes 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 4095
e5bd0d98 4096**Example:**
bf62b306 4097~~~~~
72b7576f 4098InitChildNodeIterate D 0:5 1
4099set aChildNumber 0
d5cdd12a 4100for {set i 1} {$i < 100} {incr i} {
dba69de2 4101 if {[ChildNodeMore] == *TRUE*} {
4102 puts *Tree node = [ChildNodeValue]*
4103 incr aChildNumber
4104 ChildNodeNext
4105 }
72b7576f 4106}
bf62b306 4107puts "aChildNumber=$aChildNumber"
4108~~~~~
72b7576f 4109
bf62b306 4110@subsubsection occt_draw_5_7_10 ChildNodeMore
72b7576f 4111
bf62b306 4112Syntax:
4113~~~~~
4114ChildNodeMore
4115~~~~~
72b7576f 4116
4117Returns TRUE if there is a current item in the iteration.
4118
4119
bf62b306 4120@subsubsection occt_draw_5_7_11 ChildNodeNext
72b7576f 4121
bf62b306 4122Syntax:
4123~~~~~
4124ChildNodeNext
4125~~~~~
72b7576f 4126
4127Moves to the next Item.
4128
4129
bf62b306 4130@subsubsection occt_draw_5_7_12 ChildNodeValue
4131
4132Syntax:
4133~~~~~
4134ChildNodeValue
4135~~~~~
72b7576f 4136
bf62b306 4137Returns the current treenode of *ChildNodeIterator*.
72b7576f 4138
72b7576f 4139
bf62b306 4140@subsubsection occt_draw_5_7_13 ChildNodeNextBrother
72b7576f 4141
bf62b306 4142Syntax:
4143~~~~~
4144ChildNodeNextBrother
4145~~~~~
72b7576f 4146
bf62b306 4147Moves to the next *Brother*. If there is none, goes up. This method is interesting only with *allLevels* behavior.
72b7576f 4148
72b7576f 4149
bf62b306 4150@subsection occt_draw_5_8 Standard presentation commands
72b7576f 4151
72b7576f 4152
bf62b306 4153@subsubsection occt_draw_5_8_1 AISInitViewer
72b7576f 4154
bf62b306 4155Syntax:
4156~~~~~
4157AISInitViewer docname
4158~~~~~
72b7576f 4159
bf62b306 4160Creates and sets *AISViewer* attribute at root label, creates AIS viewer window.
72b7576f 4161
e5bd0d98 4162**Example:**
bf62b306 4163~~~~~
72b7576f 4164AISInitViewer D
bf62b306 4165~~~~~
72b7576f 4166
bf62b306 4167@subsubsection occt_draw_5_8_2 AISRepaint
72b7576f 4168
bf62b306 4169Syntax:
4170~~~~~
4171AISRepaint docname
4172~~~~~
72b7576f 4173
4174Updates the AIS viewer window.
72b7576f 4175
bf62b306 4176**Example:**
4177~~~~~
72b7576f 4178AISRepaint D
bf62b306 4179~~~~~
72b7576f 4180
bf62b306 4181@subsubsection occt_draw_5_8_3 AISDisplay
72b7576f 4182
bf62b306 4183Syntax:
4184~~~~~
4185AISDisplay docname entry [not_update]
4186~~~~~
72b7576f 4187
bf62b306 4188Displays 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 4189
e5bd0d98 4190**Example:**
bf62b306 4191~~~~~
72b7576f 4192AISDisplay D 0:5
bf62b306 4193~~~~~
72b7576f 4194
bf62b306 4195@subsubsection occt_draw_5_8_4 AISUpdate
72b7576f 4196
bf62b306 4197Syntax:
4198~~~~~
4199AISUpdate docname entry
4200~~~~~
72b7576f 4201
bf62b306 4202Recomputes a presentation of *AISobject* from *entry* label and applies the visualization setting in AIS viewer.
72b7576f 4203
bf62b306 4204**Example:**
4205~~~~~
72b7576f 4206AISUpdate D 0:5
bf62b306 4207~~~~~
72b7576f 4208
bf62b306 4209@subsubsection occt_draw_5_8_5 AISErase
4210
4211Syntax:
4212~~~~~
4213AISErase docname entry
4214~~~~~
72b7576f 4215
bf62b306 4216Erases *AISobject* of *entry* label in AIS viewer.
72b7576f 4217
e5bd0d98 4218**Example:**
bf62b306 4219~~~~~
72b7576f 4220AISErase D 0:5
bf62b306 4221~~~~~
72b7576f 4222
bf62b306 4223@subsubsection occt_draw_5_8_6 AISRemove
72b7576f 4224
bf62b306 4225Syntax:
4226~~~~~
4227AISRemove docname entry
4228~~~~~
72b7576f 4229
bf62b306 4230Erases *AISobject* of *entry* label in AIS viewer, then *AISobject* is removed from *AIS_InteractiveContext*.
72b7576f 4231
bf62b306 4232**Example:**
4233~~~~~
72b7576f 4234AISRemove D 0:5
bf62b306 4235~~~~~
72b7576f 4236
bf62b306 4237@subsubsection occt_draw_5_8_7 AISSet
72b7576f 4238
bf62b306 4239Syntax:
4240~~~~~
4241AISSet docname entry ID
4242~~~~~
72b7576f 4243
bf62b306 4244Creates *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 4245
e5bd0d98 4246**Example:**
bf62b306 4247~~~~~
72b7576f 4248AISSet D 0:5 NS
bf62b306 4249~~~~~
72b7576f 4250
bf62b306 4251@subsubsection occt_draw_5_8_8 AISDriver
72b7576f 4252
bf62b306 4253Syntax:
4254~~~~~
4255AISDriver docname entry [ID]
4256~~~~~
72b7576f 4257
bf62b306 4258Returns 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 4259
e5bd0d98 4260**Example:**
bf62b306 4261~~~~~
72b7576f 4262# Get Driver GUID
4263AISDriver D 0:5
bf62b306 4264~~~~~
72b7576f 4265
bf62b306 4266@subsubsection occt_draw_5_8_9 AISUnset
72b7576f 4267
bf62b306 4268Syntax:
4269~~~~~
4270AISUnset docname entry
4271~~~~~
72b7576f 4272
bf62b306 4273Deletes *AISPresentation* attribute (if it exists) of an *entry* label.
72b7576f 4274
bf62b306 4275**Example:**
4276~~~~~
72b7576f 4277AISUnset D 0:5
bf62b306 4278~~~~~
72b7576f 4279
bf62b306 4280@subsubsection occt_draw_5_8_10 AISTransparency
4281
4282Syntax:
4283~~~~~
4284AISTransparency docname entry [transparency]
4285~~~~~
72b7576f 4286
bf62b306 4287Sets (if *transparency* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label.
72b7576f 4288
e5bd0d98 4289**Example:**
bf62b306 4290~~~~~
72b7576f 4291AISTransparency D 0:5 0.5
bf62b306 4292~~~~~
72b7576f 4293
bf62b306 4294@subsubsection occt_draw_5_8_11 AISHasOwnTransparency
72b7576f 4295
bf62b306 4296Syntax:
4297~~~~~
4298AISHasOwnTransparency docname entry
4299~~~~~
72b7576f 4300
bf62b306 4301Tests *AISPresentation* attribute of an *entry* label by own transparency.
72b7576f 4302
bf62b306 4303**Example:**
4304~~~~~
72b7576f 4305AISHasOwnTransparency D 0:5
bf62b306 4306~~~~~
72b7576f 4307
bf62b306 4308@subsubsection occt_draw_5_8_12 AISMaterial
72b7576f 4309
bf62b306 4310Syntax:
4311~~~~~
4312AISMaterial docname entry [material]
4313~~~~~
72b7576f 4314
67d7f07f 4315Sets (if *material* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label. *material* is integer from 0 to 20 (see @ref occt_draw_4_5_6 "meshmat" command).
72b7576f 4316
e5bd0d98 4317**Example:**
bf62b306 4318~~~~~
72b7576f 4319AISMaterial D 0:5 5
bf62b306 4320~~~~~
4321
4322@subsubsection occt_draw_5_8_13 AISHasOwnMaterial
72b7576f 4323
bf62b306 4324Syntax:
4325~~~~~
4326AISHasOwnMaterial docname entry
4327~~~~~
72b7576f 4328
bf62b306 4329Tests *AISPresentation* attribute of an *entry* label by own material.
72b7576f 4330
e5bd0d98 4331**Example:**
bf62b306 4332~~~~~
72b7576f 4333AISHasOwnMaterial D 0:5
bf62b306 4334~~~~~
72b7576f 4335
bf62b306 4336@subsubsection occt_draw_5_8_14 AISColor
72b7576f 4337
bf62b306 4338Syntax:
4339~~~~~
4340AISColor docname entry [color]
4341~~~~~
72b7576f 4342
bf62b306 4343Sets (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 4344
bf62b306 4345**Example:**
4346~~~~~
72b7576f 4347AISColor D 0:5 25
bf62b306 4348~~~~~
4349
4350@subsubsection occt_draw_5_8_15 AISHasOwnColor
72b7576f 4351
bf62b306 4352Syntax:
4353~~~~~
4354AISHasOwnColor docname entry
4355~~~~~
72b7576f 4356
bf62b306 4357Tests *AISPresentation* attribute of an *entry* label by own color.
72b7576f 4358
e5bd0d98 4359**Example:**
bf62b306 4360~~~~~
72b7576f 4361AISHasOwnColor D 0:5
bf62b306 4362~~~~~
72b7576f 4363
bf62b306 4364@section occt_draw_6 Geometry commands
72b7576f 4365
bf62b306 4366@subsection occt_draw_6_1 Overview
72b7576f 4367
bf62b306 4368Draw 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 4369
4370In the context of Geometry, Draw includes the following types of variable:
4371
4372 * 2d and 3d points
bf62b306 4373 * The 2d curve, which corresponds to *Curve* in *Geom2d*.
4374 * 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 4375
bf62b306 4376Draw geometric variables never share data; the *copy* command will always make a complete copy of the content of the variable.
72b7576f 4377
4378The following topics are covered in the nine sections of this chapter:
4379
e5bd0d98 4380 * **Curve creation** deals with the various types of curves and how to create them.
4381 * **Surface creation** deals with the different types of surfaces and how to create them.
4382 * **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.
4383 * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
4384 * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
4385 * **Intersections** presents intersections of surfaces and curves.
4386 * **Approximations** deals with creating curves and surfaces from a set of points.
4387 * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
4388 * **Display** describes commands to control the display of curves and surfaces.
72b7576f 4389
bf62b306 4390Where 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 4391
bf62b306 4392Likewise, 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 4393
bf62b306 4394@subsection occt_draw_6_2 Curve creation
72b7576f 4395
4396This section deals with both points and curves. Types of curves are:
4397
4398 * Analytical curves such as lines, circles, ellipses, parabolas, and hyperbolas.
4399 * Polar curves such as bezier curves and bspline curves.
bf62b306 4400 * 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.
4401 * NURBS can be created from other curves using *convert* in the *Surface Creation* section.
4402 * Curves can be created from the isoparametric lines of surfaces by the *uiso* and *viso* commands.
4403 * 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 4404
4405Curves are displayed with an arrow showing the last parameter.
4406
4407
bf62b306 4408@subsubsection occt_draw_6_2_1 point
72b7576f 4409
bf62b306 4410Syntax:
4411~~~~~
4412point name x y [z]
4413~~~~~
e5bd0d98 4414
bf62b306 4415Creates a 2d or 3d point, depending on the number of arguments.
72b7576f 4416
bf62b306 4417**Example:**
4418~~~~~
4419# 2d point
4420point p1 1 2
72b7576f 4421
bf62b306 4422# 3d point
4423point p2 10 20 -5
4424~~~~~
e5bd0d98 4425
bf62b306 4426@subsubsection occt_draw_6_2_2 line
4427
4428Syntax:
4429~~~~~
4430line name x y [z] dx dy [dz]
4431~~~~~
72b7576f 4432
e5bd0d98 4433
bf62b306 4434Creates 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 4435
bf62b306 4436A 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 4437
bf62b306 4438**Example:**
4439~~~~~
4440# a 2d line at 45 degrees of the X axis
4441line l 2 0 1 1
72b7576f 4442
bf62b306 4443# a 3d line through the point 10 0 0 and parallel to Z
4444line l 10 0 0 0 0 1
4445~~~~~
72b7576f 4446
bf62b306 4447@subsubsection occt_draw_6_2_3 circle
72b7576f 4448
bf62b306 4449Syntax:
4450~~~~~
4451circle name x y [z [dx dy dz]] [ux uy [uz]] radius
4452~~~~~
72b7576f 4453
bf62b306 4454Creates a 2d or a 3d circle.
72b7576f 4455
bf62b306 4456In 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 4457
bf62b306 4458In 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 4459
4460The 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.
4461
e5bd0d98 4462**Example:**
bf62b306 4463~~~~~
72b7576f 4464# A 2d circle of radius 5 centered at 10,-2
4465circle c1 10 -2 5
4466
4467# another 2d circle with a user defined origin
4468# the point of parameter 0 on this circle will be
4469# 1+sqrt(2),1+sqrt(2)
4470circle c2 1 1 1 1 2
4471
4472# a 3d circle, center 10 20 -5, axis Z, radius 17
4473circle c3 10 20 -5 17
4474
4475# same 3d circle with axis Y
4476circle c4 10 20 -5 0 1 0 17
4477
4478# full 3d circle, axis X, origin on Z
4479circle c5 10 20 -5 1 0 0 0 0 1 17
bf62b306 4480~~~~~
72b7576f 4481
bf62b306 4482@subsubsection occt_draw_6_2_4 ellipse
72b7576f 4483
bf62b306 4484Syntax:
4485~~~~~
4486ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4487~~~~~
72b7576f 4488
bf62b306 4489Creates 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 4490
bf62b306 4491~~~~~
72b7576f 4492P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir
bf62b306 4493~~~~~
72b7576f 4494where:
4495
bf62b306 4496 * P is the point of parameter *u*,
4497 * *O, Xdir* and *Ydir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system.
4498
e5bd0d98 4499**Example:**
bf62b306 4500~~~~~
72b7576f 4501# default 2d ellipse
4502ellipse e1 10 5 20 10
4503
4504# 2d ellipse at angle 60 degree
4505ellipse e2 0 0 1 2 30 5
4506
4507# 3d ellipse, in the XY plane
4508ellipse e3 0 0 0 25 5
4509
4510# 3d ellipse in the X,Z plane with axis 1, 0 ,1
4511ellipse e4 0 0 0 0 1 0 1 0 1 25 5
bf62b306 4512~~~~~
72b7576f 4513
bf62b306 4514@subsubsection occt_draw_6_2_5 hyperbola
72b7576f 4515
bf62b306 4516Syntax:
4517~~~~~
4518hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4519~~~~~
72b7576f 4520
bf62b306 4521Creates 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 4522
4523The Draw hyperbola is parameterized as follows:
bf62b306 4524~~~~~
72b7576f 4525P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir
bf62b306 4526~~~~~
72b7576f 4527where:
4528
bf62b306 4529 * *P* is the point of parameter *U*,
4530 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *YDirection* of its local coordinate system.
72b7576f 4531
e5bd0d98 4532**Example:**
bf62b306 4533~~~~~
72b7576f 4534# default 2d hyperbola, with asymptotes 1,1 -1,1
4535hyperbola h1 0 0 30 30
4536
4537# 2d hyperbola at angle 60 degrees
4538hyperbola h2 0 0 1 2 20 20
4539
4540# 3d hyperbola, in the XY plane
4541hyperbola h3 0 0 0 50 50
bf62b306 4542~~~~~
72b7576f 4543
bf62b306 4544@subsubsection occt_draw_6_2_6 parabola
72b7576f 4545
bf62b306 4546Syntax:
4547~~~~~
4548parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength
4549~~~~~
72b7576f 4550
bf62b306 4551Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola.
72b7576f 4552
bf62b306 4553The *Geom_Parabola* is parameterized as follows:
72b7576f 4554
bf62b306 4555~~~~~
72b7576f 4556P(u) = O + u*u/(4.*F)*XDir + u*YDir
bf62b306 4557~~~~~
72b7576f 4558
4559where:
bf62b306 4560 * *P* is the point of parameter *u*,
4561 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system,
4562 * *F* is the focal length of the parabola.
72b7576f 4563
bf62b306 4564**Example:**
4565~~~~~
72b7576f 4566# 2d parabola
4567parabola p1 0 0 50
4568
4569# 2d parabola with convexity +Y
4570parabola p2 0 0 0 1 50
4571
4572# 3d parabola in the Y-Z plane, convexity +Z
4573parabola p3 0 0 0 1 0 0 0 0 1 50
bf62b306 4574~~~~~
72b7576f 4575
ca0f3082 4576@subsubsection occt_draw_6_2_7 beziercurve, 2dbeziercurve
72b7576f 4577
bf62b306 4578Syntax:
4579~~~~~
4580beziercurve name nbpole pole, [weight]
45812dbeziercurve name nbpole pole, [weight]
4582~~~~~
72b7576f 4583
bf62b306 4584Creates 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 4585
e5bd0d98 4586**Example:**
bf62b306 4587~~~~~
72b7576f 4588# a rational 2d bezier curve (arc of circle)
45892dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1
4590
4591# a 3d bezier curve, not rational
4592beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
bf62b306 4593~~~~~
72b7576f 4594
ca0f3082 4595@subsubsection occt_draw_6_2_8 bsplinecurve, 2dbsplinecurve, pbsplinecurve, 2dpbsplinecurve
72b7576f 4596
bf62b306 4597Syntax:
4598~~~~~
ca0f3082 4599bsplinecurve name degree nbknots knot, umult pole, weight
46002dbsplinecurve name degree nbknots knot, umult pole, weight
72b7576f 4601
ca0f3082 4602pbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
46032dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
bf62b306 4604~~~~~
72b7576f 4605
bf62b306 4606Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves.
72b7576f 4607
4608A 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.
4609
4610The table of knots is an increasing sequence of reals without repetition.
4611Multiplicities 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.
4612
4613The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be:
4614
4615 * For a non periodic curve: Sum of multiplicities - degree + 1
4616 * For a periodic curve: Sum of multiplicities - last multiplicity
72b7576f 4617
bf62b306 4618**Example:**
4619~~~~~
72b7576f 4620# a bspline curve with 4 poles and 3 knots
4621bsplinecurve bc 2 3 0 3 1 1 2 3 \
462210 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
4623# a 2d periodic circle (parameter from 0 to 2*pi !!)
4624dset h sqrt(3)/2
46252dpbsplinecurve c 2 \
46264 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \
46270 -h/3 1 \
46280.5 -h/3 0.5 \
46290.25 h/6 1 \
46300 2*h/3 0.5 \
4631-0.25 h/6 1 \
4632-0.5 -h/3 0.5 \
46330 -h/3 1
bf62b306 4634~~~~~
72b7576f 4635
bf62b306 4636**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 4637
4638
bf62b306 4639@subsubsection occt_draw_6_2_9 uiso, viso
72b7576f 4640
bf62b306 4641Syntax:
4642~~~~~
4643uiso name surface u
72b7576f 4644viso name surface u
bf62b306 4645~~~~~
72b7576f 4646
bf62b306 4647Creates a U or V isoparametric curve from a surface.
72b7576f 4648
bf62b306 4649**Example:**
4650~~~~~
72b7576f 4651# create a cylinder and extract iso curves
4652
4653cylinder c 10
4654uiso c1 c pi/6
4655viso c2 c
bf62b306 4656~~~~~
72b7576f 4657
bf62b306 4658**Note** that this cannot be done from offset surfaces.
72b7576f 4659
4660
ca0f3082 4661@subsubsection occt_draw_6_2_10 to3d, to2d
72b7576f 4662
bf62b306 4663Syntax:
4664~~~~~
4665to3d name curve2d [plane]
72b7576f 4666to2d name curve3d [plane]
bf62b306 4667~~~~~
72b7576f 4668
bf62b306 4669Create 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 4670
bf62b306 4671**Example:**
4672~~~~~
72b7576f 4673# the following commands
4674circle c 0 0 5
4675plane p -2 1 0 1 2 3
4676to3d c c p
4677
4678# will create the same circle as
4679circle c -2 1 0 1 2 3 5
bf62b306 4680~~~~~
72b7576f 4681
4682See also: **project**
4683
4684
bf62b306 4685@subsubsection occt_draw_6_2_11 project
4686
4687Syntax:
4688~~~~~
4689project name curve3d surface
4690~~~~~
72b7576f 4691
bf62b306 4692Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces.
72b7576f 4693
bf62b306 4694If 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 4695
bf62b306 4696~~~~~
72b7576f 4697cylinder c 5
4698plane p 0 0 0 0 1 1
4699intersect i c p
4700project i2d i c
bf62b306 4701~~~~~
72b7576f 4702
bf62b306 4703@subsection occt_draw_6_3 Surface creation
72b7576f 4704
bf62b306 4705The following types of surfaces exist:
4706 * Analytical surfaces: plane, cylinder, cone, sphere, torus;
4707 * Polar surfaces: bezier surfaces, bspline surfaces;
4708 * Trimmed and Offset surfaces;
4709 * Surfaces produced by Revolution and Extrusion, created from curves with the *revsurf* and *extsurf*;
72b7576f 4710 * NURBS surfaces.
4711
4712Surfaces 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.
4713
bf62b306 4714@subsubsection occt_draw_6_3_1 plane
4715
4716Syntax:
4717~~~~~
4718plane name [x y z [dx dy dz [ux uy uz]]]
4719~~~~~
4720
4721Creates an infinite plane.
72b7576f 4722
bf62b306 4723A 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 4724
bf62b306 4725The 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 4726
bf62b306 4727There 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.
4728
4729Note that this definition will be used for all analytical surfaces.
72b7576f 4730
bf62b306 4731**Example:**
4732~~~~~
72b7576f 4733# a plane through the point 10,0,0 perpendicular to X
4734# with U direction on Y
4735plane p1 10 0 0 1 0 0 0 1 0
4736
4737# an horixontal plane with origin 10, -20, -5
4738plane p2 10 -20 -5
bf62b306 4739~~~~~
72b7576f 4740
bf62b306 4741@subsubsection occt_draw_6_3_2 cylinder
72b7576f 4742
bf62b306 4743Syntax:
4744~~~~~
4745cylinder name [x y z [dx dy dz [ux uy uz]]] radius
4746~~~~~
72b7576f 4747
4748A 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 4749
bf62b306 4750**Example:**
4751~~~~~
72b7576f 4752# a cylinder on the default Z axis, radius 10
4753cylinder c1 10
4754
4755# a cylinder, also along the Z axis but with origin 5,
475610, -3
4757cylinder c2 5 10 -3 10
4758
4759# a cylinder through the origin and on a diagonal
4760# with longitude pi/3 and latitude pi/4 (euler angles)
4761dset lo pi/3. la pi/4.
4762cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo)
4763sin(la) 10
bf62b306 4764~~~~~
72b7576f 4765
bf62b306 4766@subsubsection occt_draw_6_3_3 cone
72b7576f 4767
bf62b306 4768Syntax:
4769~~~~~
4770cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius
4771~~~~~
3f812249 4772Creates 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 4773
bf62b306 4774**Example:**
4775~~~~~
72b7576f 4776# a cone at 45 degrees at the origin on Z
4777cone c1 45 0
4778
4779# a cone on axis Z with radius r1 at z1 and r2 at z2
4780cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1
bf62b306 4781~~~~~
72b7576f 4782
bf62b306 4783@subsubsection occt_draw_6_3_4 sphere
72b7576f 4784
bf62b306 4785Syntax:
4786~~~~~
4787sphere name [x y z [dx dy dz [ux uy uz]]] radius
4788~~~~~
72b7576f 4789
bf62b306 4790Creates a sphere in the local coordinate system defined in the **plane** command. The sphere is centered at the origin.
4791
4792To 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.
4793
4794**Example:**
4795~~~~~
72b7576f 4796# a sphere at the origin
4797sphere s1 10
4798# a sphere at 10 10 10, with poles on the axis 1,1,1
4799sphere s2 10 10 10 1 1 1 10
bf62b306 4800~~~~~
72b7576f 4801
bf62b306 4802@subsubsection occt_draw_6_3_5 torus
72b7576f 4803
bf62b306 4804Syntax:
4805~~~~~
4806torus name [x y z [dx dy dz [ux uy uz]]] major minor
4807~~~~~
72b7576f 4808
bf62b306 4809Creates 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 4810
bf62b306 4811To 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 4812
e5bd0d98 4813**Example:**
bf62b306 4814~~~~~
72b7576f 4815# a torus at the origin
4816torus t1 20 5
4817
4818# a torus in another coordinate system
4819torus t2 10 5 -2 2 1 0 20 5
bf62b306 4820~~~~~
72b7576f 4821
4822
bf62b306 4823@subsubsection occt_draw_6_3_6 beziersurf
72b7576f 4824
bf62b306 4825Syntax:
4826~~~~~
4827beziersurf name nbupoles nbvolpes pole, [weight]
4828~~~~~
72b7576f 4829
4830Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions.
4831
bf62b306 4832Then give the poles in the following order: *pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles)* and *pole(nbupoles, nbvpoles)*.
72b7576f 4833
4834Weights may be omitted, but if you give one weight you must give all of them.
72b7576f 4835
bf62b306 4836**Example:**
4837~~~~~
72b7576f 4838# a non-rational degree 2,3 surface
4839beziersurf s 3 4 \
48400 0 0 10 0 5 20 0 0 \
48410 10 2 10 10 3 20 10 2 \
48420 20 10 10 20 20 20 20 10 \
48430 30 0 10 30 0 20 30 0
bf62b306 4844~~~~~
72b7576f 4845
bf62b306 4846@subsubsection occt_draw_6_3_7 bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf
72b7576f 4847
bf62b306 4848Syntax:
4849~~~~~
4850bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot
72b7576f 4851vmult ... x y z w ...
4852upbsplinesurf ...
4853vpbsplinesurf ...
4854uvpbsplinesurf ...
bf62b306 4855~~~~~
72b7576f 4856
bf62b306 4857* **bsplinesurf** generates bspline surfaces;
4858* **upbsplinesurf** creates a bspline surface periodic in u;
4859* **vpbsplinesurf** creates one periodic in v;
4860* **uvpbsplinesurf** creates one periodic in uv.
72b7576f 4861
bf62b306 4862The 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.
4863
4864See *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 4865
bf62b306 4866**Example:**
4867~~~~~
72b7576f 4868# create a bspline surface of degree 1 2
4869# with two knots in U and three in V
4870bsplinesurf s \
48711 2 0 2 1 2 \
48722 3 0 3 1 1 2 3 \
48730 0 0 1 10 0 5 1 \
48740 10 2 1 10 10 3 1 \
48750 20 10 1 10 20 20 1 \
48760 30 0 1 10 30 0 1
bf62b306 4877~~~~~
72b7576f 4878
4879
bf62b306 4880@subsubsection occt_draw_6_3_8 trim, trimu, trimv
72b7576f 4881
bf62b306 4882Syntax:
4883~~~~~
c5b42a1a 4884trim newname name [u1 u2 [v1 v2] [usense vsense]]
4885trimu newname name u1 u2 [usense]
4886trimv newname name v1 v2 [vsense]
bf62b306 4887~~~~~
72b7576f 4888
bf62b306 4889The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package.
4890* *trim* creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface.
4891* *trimu* creates a u-trimmed surface,
4892* *trimv* creates a v-trimmed surface.
72b7576f 4893
bf62b306 4894After 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.
4895
4896**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.
4897
4898**Example:**
4899~~~~~
72b7576f 4900# create a 3d circle
4901circle c 0 0 0 10
4902
4903# trim it, use the same variable, the original is
4904deleted
4905trim c c 0 pi/2
4906
4907# the original can be recovered!
4908trim orc c
4909
4910# trim again
4911trim c c pi/4 pi/2
4912
4913# the original is not the trimmed curve but the basis
4914trim orc c
4915
4916# as the circle is periodic, the two following commands
4917are identical
4918trim cc c pi/2 0
4919trim cc c pi/2 2*pi
4920
4921# trim an infinite cylinder
4922cylinder cy 10
4923trimv cy cy 0 50
bf62b306 4924~~~~~
72b7576f 4925
bf62b306 4926@subsubsection occt_draw_6_3_9 offset
72b7576f 4927
bf62b306 4928Syntax:
4929~~~~~
4930offset name basename distance [dx dy dz]
4931~~~~~
72b7576f 4932
4933Creates offset curves or surfaces at a given distance from a basis curve or surface. Offset curves and surfaces are classes from the *Geom *package.
4934
bf62b306 4935The 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 4936
4937The offset curve or surface copies the basic geometry, which can be modified later.
72b7576f 4938
bf62b306 4939**Example:**
4940~~~~~
72b7576f 4941# graphic demonstration that the outline of a torus
4942# is the offset of an ellipse
4943smallview +X+Y
4944dset angle pi/6
4945torus t 0 0 0 0 cos(angle) sin(angle) 50 20
4946fit
4947ellipse e 0 0 0 50 50*sin(angle)
4948# note that the distance can be negative
4949offset l1 e 20 0 0 1
bf62b306 4950~~~~~
72b7576f 4951
bf62b306 4952@subsubsection occt_draw_6_3_10 revsurf
72b7576f 4953
bf62b306 4954Syntax:
4955~~~~~
4956revsurf name curvename x y z dx dy dz
4957~~~~~
72b7576f 4958
bf62b306 4959Creates a surface of revolution from a 3d curve.
4960
4961A 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.
4962
4963To 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.
4964
4965**Example:**
4966~~~~~
72b7576f 4967# another way of creating a torus like surface
4968circle c 50 0 0 20
4969revsurf s c 0 0 0 0 1 0
bf62b306 4970~~~~~
4971
2683e647 4972@subsubsection occt_draw_6_3_11 extsurf
bf62b306 4973
4974Syntax:
4975~~~~~
4976extsurf newname curvename dx dy dz
4977~~~~~
72b7576f 4978
bf62b306 4979Creates 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 4980
bf62b306 4981In the syntax, *dx,dy,dz* gives the direction of extrusion.
72b7576f 4982
bf62b306 4983To parameterize a surface of extrusion: *u* is the parameter along the extruded curve; the *v* parameter is along the direction of extrusion.
72b7576f 4984
e5bd0d98 4985**Example:**
bf62b306 4986~~~~~
72b7576f 4987# an elliptic cylinder
4988ellipse e 0 0 0 10 5
4989extsurf s e 0 0 1
4990# to make it finite
4991trimv s s 0 10
bf62b306 4992~~~~~
72b7576f 4993
bf62b306 4994@subsubsection occt_draw_6_3_12 convert
72b7576f 4995
bf62b306 4996Syntax:
4997~~~~~
4998convert newname name
4999~~~~~
72b7576f 5000
bf62b306 5001Creates 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.
5002
e5bd0d98 5003**Example:**
bf62b306 5004~~~~~
72b7576f 5005# turn a 2d arc of a circle into a 2d NURBS
5006circle c 0 0 5
5007trim c c 0 pi/3
5008convert c1 c
5009
5010# an easy way to make a planar bspline surface
5011plane p
5012trim p p -1 1 -1 1
5013convert p1 p
bf62b306 5014~~~~~
72b7576f 5015
bf62b306 5016**Note** that offset curves and surfaces are not processed by this command.
72b7576f 5017
bf62b306 5018@subsection occt_draw_6_4 Curve and surface modifications
72b7576f 5019
5020Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines.
5021
5022General modifications:
5023
5024 * Reversing the parametrization: **reverse**, **ureverse**, **vreverse**
5025
5026Modifications for both bezier curves and bsplines:
5027
5028 * Exchanging U and V on a surface: **exchuv**
5029 * Segmentation: **segment**, **segsur**
5030 * Increasing the degree: **incdeg**, **incudeg**, **incvdeg**
5031 * Moving poles: **cmovep**, **movep**, **movecolp**, **moverowp**
5032
5033Modifications for bezier curves:
5034
5035 * Adding and removing poles: **insertpole**, **rempole**, **remcolpole**, **remrowpole**
5036
5037Modifications for bspline:
5038
5039 * Inserting and removing knots: **insertknot**, **remknot**, **insertuknot**, **remuknot**, **insetvknot**, **remvknot**
5040 * Modifying periodic curves and surfaces: **setperiodic**, **setnotperiodic**, **setorigin**, **setuperiodic**, **setunotperiodic**, **setuorigin**, **setvperiodic**, **setvnotperiodic**, **setvorigin**
5041
5042
5043
bf62b306 5044@subsubsection occt_draw_6_4_1 reverse, ureverse, vreverse
72b7576f 5045
5046
bf62b306 5047Syntax:
5048~~~~~
5049reverse curvename
72b7576f 5050ureverse surfacename
5051vreverse surfacename
bf62b306 5052~~~~~
72b7576f 5053
bf62b306 5054The **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 5055
bf62b306 5056**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 5057
5058Reversing a parameter on an analytical surface may create an indirect coordinate system.
72b7576f 5059
bf62b306 5060**Example:**
5061~~~~~
72b7576f 5062# reverse a trimmed 2d circle
5063circle c 0 0 5
5064trim c c pi/4 pi/2
5065reverse c
5066
5067# dumping c will show that it is now trimmed between
5068# 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4
bf62b306 5069~~~~~
72b7576f 5070
bf62b306 5071@subsubsection occt_draw_6_4_2 exchuv
72b7576f 5072
bf62b306 5073Syntax:
5074~~~~~
5075exchuv surfacename
5076~~~~~
72b7576f 5077
5078For a bezier or bspline surface this command exchanges the u and v parameters.
72b7576f 5079
bf62b306 5080**Example:**
5081~~~~~
72b7576f 5082# exchanging u and v on a spline (made from a cylinder)
5083cylinder c 5
5084trimv c c 0 10
5085convert c1 c
5086exchuv c1
bf62b306 5087~~~~~
72b7576f 5088
bf62b306 5089@subsubsection occt_draw_6_4_3 segment, segsur
72b7576f 5090
bf62b306 5091Syntax:
5092~~~~~
5093segment curve Ufirst Ulast
72b7576f 5094segsur surface Ufirst Ulast Vfirst Vlast
bf62b306 5095~~~~~
72b7576f 5096
bf62b306 5097**segment** and **segsur** segment a bezier curve and a bspline curve or surface respectively.
72b7576f 5098
bf62b306 5099These 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 5100
bf62b306 5101This command must not be confused with **trim** which creates a new geometry.
72b7576f 5102
bf62b306 5103**Example:**
5104~~~~~
72b7576f 5105# segment a bezier curve in half
5106beziercurve c 3 0 0 0 10 0 0 10 10 0
5107segment c ufirst ulast
bf62b306 5108~~~~~
72b7576f 5109
bf62b306 5110@subsubsection occt_draw_6_4_4 iincudeg, incvdeg
72b7576f 5111
bf62b306 5112Syntax:
5113~~~~~
5114incudeg surfacename newdegree
72b7576f 5115incvdeg surfacename newdegree
bf62b306 5116~~~~~
72b7576f 5117
bf62b306 5118**incudeg** and **incvdeg** increase the degree in the U or V parameter of a bezier or bspline surface.
5119
e5bd0d98 5120**Example:**
bf62b306 5121~~~~~
72b7576f 5122# make a planar bspline and increase the degree to 2 3
5123plane p
5124trim p p -1 1 -1 1
5125convert p1 p
5126incudeg p1 2
5127incvdeg p1 3
bf62b306 5128~~~~~
72b7576f 5129
bf62b306 5130**Note** that the geometry is modified.
72b7576f 5131
5132
bf62b306 5133@subsubsection occt_draw_6_4_5 cmovep, movep, movecolp, moverowp
72b7576f 5134
bf62b306 5135Syntax:
5136~~~~~
5137cmovep curve index dx dy [dz]
72b7576f 5138movep surface uindex vindex dx dy dz
5139movecolp surface uindex dx dy dz
5140moverowp surface vindex dx dy dz
bf62b306 5141~~~~~
72b7576f 5142
bf62b306 5143**move** methods translate poles of a bezier curve, a bspline curve or a bspline surface.
5144* **cmovep** and **movep** translate one pole with a given index.
5145* **movecolp** and **moverowp** translate a whole column (expressed by the *uindex*) or row (expressed by the *vindex*) of poles.
72b7576f 5146
e5bd0d98 5147**Example:**
bf62b306 5148~~~~~
72b7576f 5149# start with a plane
5150# transform to bspline, raise degree and add relief
5151plane p
5152trim p p -10 10 -10 10
5153convert p1 p
5154incud p1 2
5155incvd p1 2
5156movecolp p1 2 0 0 5
5157moverowp p1 2 0 0 5
5158movep p1 2 2 0 0 5
bf62b306 5159~~~~~
72b7576f 5160
bf62b306 5161@subsubsection occt_draw_6_4_6 insertpole, rempole, remcolpole, remrowpole
72b7576f 5162
bf62b306 5163Syntax:
5164~~~~~
5165insertpole curvename index x y [z] [weight]
72b7576f 5166rempole curvename index
5167remcolpole surfacename index
bf62b306 5168remrowpole surfacename index
5169~~~~~
72b7576f 5170
bf62b306 5171**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 5172
bf62b306 5173**rempole** removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves.
72b7576f 5174
bf62b306 5175**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 5176
bf62b306 5177**Example:**
5178~~~~~
72b7576f 5179# start with a segment, insert a pole at end
5180# then remove the central pole
5181beziercurve c 2 0 0 0 10 0 0
5182insertpole c 2 10 10 0
5183rempole c 2
bf62b306 5184~~~~~
72b7576f 5185
bf62b306 5186@subsubsection occt_draw_6_4_7 insertknot, insertuknot, insertvknot
72b7576f 5187
bf62b306 5188Syntax:
5189~~~~~
5190insertknot name knot [mult = 1] [knot mult ...]
72b7576f 5191insertuknot surfacename knot mult
5192insertvknot surfacename knot mult
bf62b306 5193~~~~~
72b7576f 5194
bf62b306 5195**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 5196
bf62b306 5197**insertuknot** and **insertvknot** insert knots in a surface.
72b7576f 5198
e5bd0d98 5199**Example:**
bf62b306 5200~~~~~
72b7576f 5201# create a cylindrical surface and insert a knot
5202cylinder c 10
5203trim c c 0 pi/2 0 10
5204convert c1 c
5205insertuknot c1 pi/4 1
bf62b306 5206~~~~~
72b7576f 5207
bf62b306 5208@subsubsection occt_draw_6_4_8 remknot, remuknot, remvknot
72b7576f 5209
bf62b306 5210Syntax:
5211~~~~~
5212remknot index [mult] [tol]
72b7576f 5213remuknot index [mult] [tol]
5214remvknot index [mult] [tol]
bf62b306 5215~~~~~
72b7576f 5216
bf62b306 5217**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 5218
5219By default, if no tolerance is given, the knot will always be removed.
72b7576f 5220
bf62b306 5221**Example:**
5222~~~~~
72b7576f 5223# bspline circle, remove a knot
5224circle c 0 0 5
5225convert c1 c
5226incd c1 5
5227remknot c1 2
bf62b306 5228~~~~~
72b7576f 5229
bf62b306 5230**Note** that Curves or Surfaces may be modified.
72b7576f 5231
5232
bf62b306 5233@subsubsection occt_draw_6_4_9 setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic
72b7576f 5234
bf62b306 5235Syntax:
5236~~~~~
5237setperiodic curve
72b7576f 5238setnotperiodic curve
5239setuperiodic surface
5240setunotperiodic surface
5241setvperiodic surface
bf62b306 5242setvnotperiodic surface
5243~~~~~
72b7576f 5244
bf62b306 5245**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 5246
bf62b306 5247**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 5248
bf62b306 5249**Example:**
5250~~~~~
72b7576f 5251# a circle deperiodicized
5252circle c 0 0 5
5253convert c1 c
5254setnotperiodic c1
bf62b306 5255~~~~~
72b7576f 5256
bf62b306 5257@subsubsection occt_draw_6_4_10 setorigin, setuorigin, setvorigin
5258
5259Syntax:
5260~~~~~
5261setorigin curvename index
72b7576f 5262setuorigin surfacename index
5263setuorigin surfacename index
bf62b306 5264~~~~~
72b7576f 5265
bf62b306 5266These 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 5267
bf62b306 5268**Example:**
5269~~~~~
72b7576f 5270# a torus with new U and V origins
5271torus t 20 5
5272convert t1 t
5273setuorigin t1 2
bf62b306 5274setvorigin t1 2
5275~~~~~
72b7576f 5276
5277
bf62b306 5278@subsection occt_draw_6_5 Transformations
72b7576f 5279
5280Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling.
5281
bf62b306 5282@subsubsection occt_draw_6_5_1 translate, dtranslate
72b7576f 5283
bf62b306 5284Syntax:
5285~~~~~
5286translate name [names ...] dx dy dz
72b7576f 52872dtranslate name [names ...] dx dy
bf62b306 5288~~~~~
72b7576f 5289
bf62b306 5290The **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 5291
bf62b306 5292For 2d points or curves, use the **2dtranslate** command.
72b7576f 5293
bf62b306 5294**Example:**
5295~~~~~
a25d5aaa 5296# 3d translation
72b7576f 5297point p 10 20 30
5298circle c 10 20 30 5
5299torus t 10 20 30 5 2
bf62b306 5300translate p c t 0 0 15
5301~~~~~
5302
72b7576f 5303*NOTE*
5304*Objects are modified by this command.*
5305
bf62b306 5306@subsubsection occt_draw_6_5_2 rotate, 2drotate
5307
5308Syntax:
5309~~~~~
5310rotate name [name ...] x y z dx dy dz angle
53112drotate name [name ...] x y angle
5312~~~~~
72b7576f 5313
bf62b306 5314The **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 5315
5316For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative.
72b7576f 5317
bf62b306 5318**Example:**
5319~~~~~
d5cdd12a 5320# make a helix of circles. create a script file with
72b7576f 5321this code and execute it using **source**.
5322circle c0 10 0 0 3
d5cdd12a 5323for {set i 1} {$i <= 10} {incr i} {
72b7576f 5324copy c[expr $i-1] c$i
5325translate c$i 0 0 3
5326rotate c$i 0 0 0 0 0 1 36
5327}
bf62b306 5328~~~~~
72b7576f 5329
bf62b306 5330@subsubsection occt_draw_6_5_3 pmirror, lmirror, smirror, dpmirror, dlmirror
72b7576f 5331
bf62b306 5332Syntax:
5333~~~~~
5334pmirror name [names ...] x y z
72b7576f 5335lmirror name [names ...] x y z dx dy dz
5336smirror name [names ...] x y z dx dy dz
53372dpmirror name [names ...] x y
53382dlmirror name [names ...] x y dx dy
bf62b306 5339~~~~~
72b7576f 5340
5341The mirror commands perform a mirror transformation of 2d or 3d geometry.
5342
bf62b306 5343* **pmirror** is the point mirror, mirroring 3d curves and surfaces about a point of symmetry.
5344* **lmirror** is the line mirror commamd, mirroring 3d curves and surfaces about an axis of symmetry.
5345* **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.
5346* **2dpmirror** is the point mirror in 2D.
5347* **2dlmirror** is the axis symmetry mirror in 2D.
72b7576f 5348
e5bd0d98 5349**Example:**
bf62b306 5350~~~~~
72b7576f 5351# build 3 images of a torus
5352torus t 10 10 10 1 2 3 5 1
5353copy t t1
5354pmirror t1 0 0 0
5355copy t t2
5356lmirror t2 0 0 0 1 0 0
5357copy t t3
5358smirror t3 0 0 0 1 0 0
bf62b306 5359~~~~~
72b7576f 5360
bf62b306 5361@subsubsection occt_draw_6_5_4 pscale, dpscale
72b7576f 5362
bf62b306 5363Syntax:
5364~~~~~
5365pscale name [name ...] x y z s
72b7576f 53662dpscale name [name ...] x y s
bf62b306 5367~~~~~
72b7576f 5368
bf62b306 5369The **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**.
5370
5371
5372**Example:**
5373~~~~~
72b7576f 5374# double the size of a sphere
5375sphere s 0 0 0 10
5376pscale s 0 0 0 2
bf62b306 5377~~~~~
72b7576f 5378
bf62b306 5379@subsection occt_draw_6_6 Curve and surface analysis
72b7576f 5380
bf62b306 5381**Draw** provides methods to compute information about curves and surfaces:
72b7576f 5382
bf62b306 5383 * **coord** to find the coordinates of a point.
5384 * **cvalue** and **2dcvalue** to compute points and derivatives on curves.
5385 * **svalue** to compute points and derivatives on a surface.
5386 * **localprop** and **minmaxcurandif** to compute the curvature on a curve.
5387 * **parameters** to compute (u,v) values for a point on a surface.
5388 * **proj** and **2dproj** to project a point on a curve or a surface.
5389 * **surface_radius** to compute the curvature on a surface.
72b7576f 5390
bf62b306 5391@subsubsection occt_draw_6_6_1 coord
72b7576f 5392
bf62b306 5393Syntax:
5394~~~~~
5395coord P x y [z]
5396~~~~~
72b7576f 5397
bf62b306 5398Sets the x, y (and optionally z) coordinates of the point P.
72b7576f 5399
bf62b306 5400**Example:**
5401~~~~~
72b7576f 5402# translate a point
5403point p 10 5 5
5404translate p 5 0 0
5405coord p x y z
5406# x value is 15
bf62b306 5407~~~~~
5408
72b7576f 5409
bf62b306 5410@subsubsection occt_draw_6_6_2 cvalue, 2dcvalue
5411
5412Syntax:
5413~~~~~
5414cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]]
72b7576f 54152dcvalue curve U x y [d1x d1y [d2x d2y]]
bf62b306 5416~~~~~
5417
5418For 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 5419
e5bd0d98 5420**Example:**
72b7576f 5421
bf62b306 5422Let on a bezier curve at parameter 0 the point is the first pole; the first derivative is the vector to the second pole multiplied by the degree; the second derivative is the difference first to the second pole, second to the third pole multipied by *degree-1* :
5423
5424~~~~~
72b7576f 54252dbeziercurve c 4 0 0 1 1 2 1 3 0
54262dcvalue c 0 x y d1x d1y d2x d2y
5427
5428# values of x y d1x d1y d2x d2y
5429# are 0 0 3 3 0 -6
bf62b306 5430~~~~~
72b7576f 5431
bf62b306 5432@subsubsection occt_draw_6_6_3 svalue
72b7576f 5433
bf62b306 5434Syntax:
5435~~~~~
5436svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]]
5437~~~~~
72b7576f 5438
bf62b306 5439Computes 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 5440
e5bd0d98 5441**Example:**
bf62b306 5442~~~~~
72b7576f 5443# display points on a sphere
5444sphere s 10
d5cdd12a 5445for {dset t 0} {[dval t] <= 1} {dset t t+0.01} {
72b7576f 5446svalue s t*2*pi t*pi-pi/2 x y z
5447point . x y z
5448}
bf62b306 5449~~~~~
72b7576f 5450
bf62b306 5451@subsubsection occt_draw_6_6_4 localprop, minmaxcurandinf
72b7576f 5452
bf62b306 5453Syntax:
5454~~~~~
5455localprop curvename U
5456minmaxcurandinf curve
5457~~~~~
72b7576f 5458
bf62b306 5459**localprop** computes the curvature of a curve.
5460**minmaxcurandinf** computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve.
72b7576f 5461
e5bd0d98 5462**Example:**
bf62b306 5463~~~~~
72b7576f 5464# show curvature at the center of a bezier curve
5465beziercurve c 3 0 0 0 10 2 0 20 0 0
5466localprop c 0.5
5467== Curvature : 0.02
bf62b306 5468~~~~~
72b7576f 5469
bf62b306 5470@subsubsection occt_draw_6_6_5 parameters
72b7576f 5471
bf62b306 5472Syntax:
5473~~~~~
5474parameters surf/curve x y z U [V]
5475~~~~~
72b7576f 5476
bf62b306 5477Returns 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 5478
e5bd0d98 5479**Example:**
bf62b306 5480~~~~~
72b7576f 5481# Compute parameters on a plane
5482plane p 0 0 10 1 1 0
5483parameters p 5 5 5 u v
5484# the values of u and v are : 0 5
bf62b306 5485~~~~~
72b7576f 5486
7868210d 5487@subsubsection occt_draw_6_6_6 proj, 2dproj
72b7576f 5488
bf62b306 5489Syntax:
5490~~~~~
5491proj name x y z
72b7576f 54922dproj name xy
bf62b306 5493~~~~~
72b7576f 5494
bf62b306 5495Use **proj** to project a point on a 3d curve or a surface and **2dproj** for a 2d curve.
5496
5497The 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 5498
e5bd0d98 5499**Example:**
72b7576f 5500
bf62b306 5501Let us project a point on a torus
5502
5503~~~~~
72b7576f 5504torus t 20 5
5505proj t 30 10 7
5506== ext_1 ext_2 ext_3 ext_4
bf62b306 5507~~~~~
72b7576f 5508
bf62b306 5509@subsubsection occt_draw_6_6_7 surface_radius
72b7576f 5510
bf62b306 5511Syntax:
5512~~~~~
5513surface_radius surface u v [c1 c2]
5514~~~~~
72b7576f 5515
bf62b306 5516Computes 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 5517
e5bd0d98 5518**Example:**
72b7576f 5519
bf62b306 5520Let us compute curvatures of a cylinder:
5521
5522~~~~~
72b7576f 5523cylinder c 5
5524surface_radius c pi 3 c1 c2
5525== Min Radius of Curvature : -5
5526== Min Radius of Curvature : infinite
bf62b306 5527~~~~~
72b7576f 5528
5529
bf62b306 5530@subsection occt_draw_6_7 Intersections
72b7576f 5531
bf62b306 5532* **intersect** computes intersections of surfaces;
5533* **2dintersect** computes intersections of 2d curves.
18d8e3e7 5534* **intconcon** computes intersections of 2d conic curves.
72b7576f 5535
bf62b306 5536@subsubsection occt_draw_6_7_1 intersect
72b7576f 5537
bf62b306 5538Syntax:
5539~~~~~
5540intersect name surface1 surface2
5541~~~~~
72b7576f 5542
bf62b306 5543Intersects 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 5544
e5bd0d98 5545**Example:**
bf62b306 5546~~~~~
72b7576f 5547# create an ellipse
5548cone c 45 0
5549plane p 0 0 40 0 1 5
5550intersect e c p
bf62b306 5551~~~~~
72b7576f 5552
18d8e3e7 5553@subsubsection occt_draw_6_7_2 2dintersect
72b7576f 5554
bf62b306 5555Syntax:
5556~~~~~
4bc805bf 55572dintersect curve1 [curve2] [-tol tol] [-state]
bf62b306 5558~~~~~
72b7576f 5559
4bc805bf 5560Displays the intersection points between 2d curves.
5561Options:
5562 -tol - allows changing the intersection tolerance (default value is 1.e-3);
5563 -state - allows printing the intersection state for each point.
72b7576f 5564
e5bd0d98 5565**Example:**
bf62b306 5566~~~~~
72b7576f 5567# intersect two 2d ellipses
5568ellipse e1 0 0 5 2
5569ellipse e2 0 0 0 1 5 2
4bc805bf 55702dintersect e1 e2 -tol 1.e-10 -state
bf62b306 5571~~~~~
5572
18d8e3e7 5573@subsubsection occt_draw_6_7_3 intconcon
5574
5575Syntax:
5576~~~~~
5577intconcon curve1 curve2
5578~~~~~
5579
5580Displays the intersection points between two 2d curves.
5581Curves must be only conic sections: 2d lines, circles, ellipses,
14deaf42 5582hyperbolas, parabolas. The algorithm from *IntAna2d_AnaIntersection* is used.
18d8e3e7 5583
5584**Example:**
5585~~~~~
5586# intersect two 2d ellipses
5587ellipse e1 0 0 5 2
5588ellipse e2 0 0 0 1 5 2
5589intconcon e1 e2
5590~~~~~
5591
bf62b306 5592@subsection occt_draw_6_8 Approximations
72b7576f 5593
5594Draw provides command to create curves and surfaces by approximation.
5595
bf62b306 5596* **2dapprox** fits a curve through 2d points;
5597* **appro** fits a curve through 3d points;
d1775ee9 5598* **surfapp** and **grilapp** fit a surface through 3d points by approximation;
5599* **surfint** fit a surface through 3d points by interpolation;
64a44752 5600* **2dinterpole** interpolates a curve.
72b7576f 5601
bf62b306 5602@subsubsection occt_draw_6_8_1 appro, dapprox
72b7576f 5603
bf62b306 5604Syntax:
5605~~~~~
5606appro result nbpoint [curve]
56072dapprox result nbpoint [curve / x1 y1 x2 y2]
5608~~~~~
72b7576f 5609
5610These 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 5611
e5bd0d98 5612**Example:**
72b7576f 5613
bf62b306 5614Let us pick points and they will be fitted
72b7576f 5615
bf62b306 5616~~~~~
56172dapprox c 10
5618~~~~~
72b7576f 5619
d1775ee9 5620@subsubsection occt_draw_6_8_2 surfapp, grilapp, surfint
72b7576f 5621
5622
bf62b306 5623Syntax:
5624~~~~~
5625surfapp name nbupoints nbvpoints x y z ....
d1775ee9 5626or
5627surfapp name nbupoints nbvpoints surf [periodic_flag = 0]
72b7576f 5628grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ...
d1775ee9 5629surfint name surf nbupoints nbvpoints [periodic_flag = 0]
bf62b306 5630~~~~~
72b7576f 5631
bf62b306 5632* **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints.
5633* **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.
d1775ee9 5634* **surfapp** can take array of points from other input surface, if alternative syntax
5635**surfapp** name nbupoints nbvpoints surf [periodic_flag = 0]
5636is used.
5637Both command use for fitting approximation algorithm.
5638**surfint** uses interpolation algorithm and can take array of point only from other input surface.
5639Optional parameter **periodic_flag** allows to get correct periodical surfaces in U direction.
a25d5aaa 5640U direction of result surface corresponds columns of initial array of points.
d1775ee9 5641If **periodic_flag** = 1, algorithm uses first row of array as last row and builds periodical surface.
72b7576f 5642
e5bd0d98 5643**Example:**
bf62b306 5644~~~~~
72b7576f 5645# a surface using the same data as in the beziersurf
5646example sect 4.4
5647surfapp s 3 4 \
56480 0 0 10 0 5 20 0 0 \
56490 10 2 10 10 3 20 10 2 \
56500 20 10 10 20 20 20 20 10 \
56510 30 0 10 30 0 20 30 0
bf62b306 5652~~~~~
72b7576f 5653
7868210d 5654@subsection occt_draw_6_9 Projections
5655
5656Draw provides commands to project points/curves on curves/surfaces.
5657
5658* **proj** projects point on the curve/surface (see @ref occt_draw_6_6_6 "proj command description");
5659* **project** projects 3D curve on the surface (see @ref occt_draw_6_2_11 "project command description");
5660* **projponf** projects point on the face.
5661
5662@subsubsection occt_draw_6_9_1 projponf
5663
5664Syntax:
5665~~~~~
5666projponf face pnt [extrema flag: -min/-max/-minmax] [extrema algo: -g(grad)/-t(tree)]
5667~~~~~
5668
5669**projponf** projects point *pnt* on the face *face*.
5670You can change the Extrema options:
5671* To change the Extrema search algorithm use the following options:<br>
5672 -g - for Grad algorithm;<br>
5673 -t - for Tree algorithm;
5674* To change the Extrema search solutions use the following options:<br>
5675 -min - to look for Min solutions;<br>
5676 -max - to look for Max solutions;<br>
5677 -minmax - to look for MinMax solutions.
5678
5679**Example**
5680~~~~~
5681plane p 0 0 0 0 0 1
5682mkface f p
5683point pnt 5 5 10
5684
5685projponf f pnt
5686# proj dist = 10
5687# uvproj = 5 5
5688# pproj = 5 5 0
5689~~~~~
5690
5691@subsection occt_draw_6_10 Constraints
72b7576f 5692
bf62b306 5693* **cirtang** constructs 2d circles tangent to curves;
5694* **lintan** constructs 2d lines tangent to curves.
72b7576f 5695
5696
7868210d 5697@subsubsection occt_draw_6_10_1 cirtang
72b7576f 5698
bf62b306 5699Syntax:
5700~~~~~
894dba72 5701cirtang result [-t <Tolerance>] -c <curve> -p <point> -r <Radius>...
bf62b306 5702~~~~~
72b7576f 5703
894dba72 5704Builds all circles satisfying the condition:
57051. the circle must be tangent to every given curve;
57062. the circle must pass through every given point;
57073. the radius of the circle must be equal to the requested one.
5708
5709Only following set of input data is supported: Curve-Curve-Curve, Curve-Curve-Point, Curve-Curve-Radius, Curve-Point-Point, Curve-Point-Radius, Point-Point-Point, Point-Point-Radius. The solutions will be stored in variables *result_1*, *result_2*, etc.
72b7576f 5710
e5bd0d98 5711**Example:**
bf62b306 5712~~~~~
894dba72 5713# a point, a line and a radius. 2 solutions of type Curve-Point-Radius (C-P-R)
72b7576f 5714point p 0 0
894dba72 5715line l 10 0 -1 1
5716cirtang c -p p -c l -r 4
5717== Solution of type C-P-R is: c_1 c_2
5718~~~~~
5719
5720Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type).
5721
5722**Example:**
5723~~~~~
5724point pp 1 1
57252dbsplinecurve cc 1 2 0 2 1 2 -10 -5 1 10 -5 1
5726cirtang r -p pp -c cc
5727== Solution of type C-P is: r_1 r_2
bf62b306 5728~~~~~
72b7576f 5729
7868210d 5730@subsubsection occt_draw_6_10_2 lintan
72b7576f 5731
bf62b306 5732Syntax:
5733~~~~~
5734lintan name curve curve [angle]
5735~~~~~
72b7576f 5736
bf62b306 5737Builds 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 5738
e5bd0d98 5739**Example:**
bf62b306 5740~~~~~
72b7576f 5741# lines tangent to 2 circles, 4 solutions
5742circle c1 -10 0 10
5743circle c2 10 0 5
5744lintan l c1 c2
5745
5746# lines at 15 degrees tangent to a circle and a line, 2
5747solutions: l1_1 l1_2
5748circle c1 -10 0 1
5749line l 2 0 1 1
5750lintan l1 c1 l 15
bf62b306 5751~~~~~
72b7576f 5752
7868210d 5753@subsection occt_draw_6_11 Display
72b7576f 5754
5755Draw 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.
5756
bf62b306 5757On 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 5758
bf62b306 5759On surfaces, you can control the number of isoparametric curves displayed on the surface with the **nbiso** command.
72b7576f 5760
bf62b306 5761On bezier and bspline curve and surface you can toggle the display of the control points with the **clpoles** and **shpoles** commands.
72b7576f 5762
bf62b306 5763On bspline curves and surfaces you can toggle the display of the knots with the **shknots** and **clknots** commands.
72b7576f 5764
5765
7868210d 5766@subsubsection occt_draw_6_11_1 dmod, discr, defle
72b7576f 5767
bf62b306 5768Syntax:
5769~~~~~
5770dmode name [name ...] u/d
72b7576f 5771discr name [name ...] nbintervals
5772defle name [name ...] deflection
bf62b306 5773~~~~~
72b7576f 5774
bf62b306 5775**dmod** command allows choosing the display mode for a curve or a surface.
72b7576f 5776
bf62b306 5777In 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 5778
bf62b306 5779In *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 5780
5781If 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 5782
bf62b306 5783**Example:**
5784~~~~~
72b7576f 5785# increment the number of points on a big circle
5786circle c 0 0 50 50
5787discr 100
5788
5789# change the mode
5790dmode c u
bf62b306 5791~~~~~
72b7576f 5792
7868210d 5793@subsubsection occt_draw_6_11_2 nbiso
72b7576f 5794
bf62b306 5795Syntax:
5796~~~~~
5797nbiso name [names...] nuiso nviso
5798~~~~~
72b7576f 5799
bf62b306 5800Changes 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 5801
e5bd0d98 5802**Example:**
72b7576f 5803
bf62b306 5804Let us display 35 meridians and 15 parallels on a sphere:
5805~~~~~
72b7576f 5806sphere s 20
5807nbiso s 35 15
bf62b306 5808~~~~~
72b7576f 5809
7868210d 5810@subsubsection occt_draw_6_11_3 clpoles, shpoles
72b7576f 5811
bf62b306 5812Syntax:
5813~~~~~
5814clpoles name
72b7576f 5815shpoles name
bf62b306 5816~~~~~
5817
5818On bezier and bspline curves and surfaces, the control polygon is displayed by default: *clpoles* erases it and *shpoles* restores it.
72b7576f 5819
e5bd0d98 5820**Example:**
72b7576f 5821
bf62b306 5822Let us make a bezier curve and erase the poles
5823
5824~~~~~
72b7576f 5825beziercurve c 3 0 0 0 10 0 0 10 10 0
5826clpoles c
bf62b306 5827~~~~~
72b7576f 5828
7868210d 5829@subsubsection occt_draw_6_11_4 clknots, shknots
72b7576f 5830
bf62b306 5831Syntax:
5832~~~~~
5833clknots name
72b7576f 5834shknots name
bf62b306 5835~~~~~
72b7576f 5836
bf62b306 5837By 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 5838
bf62b306 5839**Example:**
5840~~~~~
72b7576f 5841# hide the knots on a bspline curve
5842bsplinecurve bc 2 3 0 3 1 1 2 3 \
584310 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
bf62b306 5844clknots bc
5845~~~~~
1a457208 5846
5847
bf62b306 5848@section occt_draw_7 Topology commands
72b7576f 5849
5850Draw 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.
5851
5852Topology 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.
5853
bf62b306 5854The <a href="user_guides__modeling_data.html#occt_modat_5">different topological shapes</a> include:
72b7576f 5855
bf62b306 5856 * **COMPOUND**: A group of any type of topological object.
5857 * **COMPSOLID**: A set of solids connected by their faces. This expands the notions of WIRE and SHELL to solids.
5858 * **SOLID**: A part of space limited by shells. It is three dimensional.
5859 * **SHELL**: A set of faces connected by their edges. A shell can be open or closed.
5860 * **FACE**: In 2d, a plane; in 3d, part of a surface. Its geometry is constrained (trimmed) by contours. It is two dimensional.
5861 * **WIRE**: A set of edges connected by their vertices. It can be open or closed depending on whether the edges are linked or not.
5862 * **EDGE**: A topological element corresponding to a restrained curve. An edge is generally limited by vertices. It has one dimension.
5863 * **VERTEX**: A topological element corresponding to a point. It has a zero dimension.
72b7576f 5864
bf62b306 5865Shapes 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 5866
5867The following topics are covered in the eight sections of this chapter:
5868
5869 * Basic shape commands to handle the structure of shapes and control the display.
5870 * Curve and surface topology, or methods to create topology from geometry and vice versa.
5871 * Primitive construction commands: box, cylinder, wedge etc.
5872 * Sweeping of shapes.
5873 * Transformations of shapes: translation, copy, etc.
5874 * Topological operations, or booleans.
5875 * Drafting and blending.
d9ca2e0c 5876 * Defeaturing.
53a73fc1 5877 * Making shapes periodic in 3D space.
0c09fd3c 5878 * Making shapes connected.
72b7576f 5879 * Analysis of shapes.
5880
5881
bf62b306 5882@subsection occt_draw_7_1 Basic topology
72b7576f 5883
5884The 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:
5885
bf62b306 5886 * **isos** and **discretisation** to control display of shape faces by isoparametric curves .
5887 * **orientation**, **complement** and **invert** to modify topological attributes such as orientation.
5888 * **explode**, **exwire** and **nbshapes** to analyze the structure of a shape.
5889 * **emptycopy**, **add**, **compound** to create shapes by stepwise construction.
72b7576f 5890
5891In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges:
5892
5893 * a red edge is an isolated edge, which belongs to no faces.
5894 * a green edge is a free boundary edge, which belongs to one face,
5895 * a yellow edge is a shared edge, which belongs to at least two faces.
5896
5897
bf62b306 5898@subsubsection occt_draw_7_1_1 isos, discretisation
5899
5900Syntax:
5901~~~~~
5902isos [name ...][nbisos]
5903discretisation nbpoints
5904~~~~~
5905
5906Determines or changes the number of isoparametric curves on shapes.
72b7576f 5907
bf62b306 5908The 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 5909
bf62b306 5910*discretisation* changes the default number of points used to display the curves. The default value is 30.
72b7576f 5911
e5bd0d98 5912**Example:**
bf62b306 5913~~~~~
72b7576f 5914# Display only the edges (the wireframe)
5915isos 0
bf62b306 5916~~~~~
72b7576f 5917
bf62b306 5918**Warning**: don’t confuse *isos* and *discretisation* with the geometric commands *nbisos* and *discr*.
72b7576f 5919
5920
bf62b306 5921@subsubsection occt_draw_7_1_2 orientation, complement, invert, normals, range
72b7576f 5922
bf62b306 5923Syntax:
5924~~~~~
5925orientation name [name ...] F/R/E/I
72b7576f 5926complement name [name ...]
5927invert name
5928normals s (length = 10), disp normals
5929range name value value
bf62b306 5930~~~~~
72b7576f 5931
3f812249 5932* **orientation** -- assigns the orientation of simple and complex shapes to one of the following four values: *FORWARD, REVERSED, INTERNAL, EXTERNAL*.
5933* **complement** -- changes the current orientation of shapes to its complement: *FORWARD* to *REVERSED* and *INTERNAL* to *EXTERNAL*.
5934* **invert** -- creates a copy of the original shape with a reversed orientation of all subshapes. For example, it may be useful to reverse the normals of a solid.
5935* *normals** -- returns the assignment of colors to orientation values.
5936* **range** -- defines the length of a selected edge by defining the values of a starting point and an end point.
bf62b306 5937
e5bd0d98 5938**Example:**
bf62b306 5939~~~~~
5940# to invert normals of a box
72b7576f 5941box b 10 20 30
5942normals b 5
5943invert b
5944normals b 5
5945
5946# to assign a value to an edge
5947box b1 10 20 30
5948# to define the box as edges
5949explode b1 e
5950b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12
5951# to define as an edge
5952makedge e 1
5953# to define the length of the edge as starting from 0
5954and finishing at 1
5955range e 0 1
bf62b306 5956~~~~~
72b7576f 5957
bf62b306 5958@subsubsection occt_draw_7_1_3 explode, exwire, nbshapes
72b7576f 5959
bf62b306 5960Syntax:
5961~~~~~
5962explode name [C/So/Sh/F/W/E/V]
72b7576f 5963exwire name
5964nbshapes name
bf62b306 5965~~~~~
72b7576f 5966
bf62b306 5967**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 5968
bf62b306 5969With 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 5970
bf62b306 5971**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 5972
bf62b306 5973**nbshapes** counts the number of shapes of each type in an entity.
72b7576f 5974
bf62b306 5975**Example:**
5976~~~~~
72b7576f 5977# on a box
5978box b 10 20 30
5979
5980# whatis returns the type and various information
5981whatis b
5982= b is a shape SOLID FORWARD Free Modified
5983
5984# make one shell
5985explode b
5986whatis b_1
5987= b_1 is a shape SHELL FORWARD Modified Orientable
5988Closed
5989
5990# extract the edges b_1, ... , b_12
5991explode b e
5992==b_1 ... b_12
5993
5994# count subshapes
5995nbshapes b
5996==
5997Number of shapes in b
5998VERTEX : 8
5999EDGE : 12
6000WIRE : 6
6001FACE : 6
6002SHELL : 1
6003SOLID : 1
6004COMPSOLID : 0
6005COMPOUND : 0
6006SHAPE : 34
bf62b306 6007~~~~~
72b7576f 6008
bf62b306 6009@subsubsection occt_draw_7_1_4 emptycopy, add, compound
72b7576f 6010
bf62b306 6011Syntax:
6012~~~~~
6013emptycopy [newname] name
72b7576f 6014add name toname
6015compound [name ...] compoundname
bf62b306 6016~~~~~
72b7576f 6017
3f812249 6018**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 6019
bf62b306 6020**add** inserts shape *C* into shape *S*. Verify that *C* and *S* reference compatible types of objects:
6021 * Any *Shape* can be added to a *Compound*.
6022 * Only a *Solid* can be added to a *CompSolid*.
6023 * Only a *Shell* can *Edge* or a *Vertex* can be added into a *Solid*.
6024 * Only a *Face* can be added to a *Shell*.
6025 * Only a *Wire* and *Vertex* can be added in a *Solid*.
6026 * Only an *Edge* can be added to a *Wire*.
6027 * Only a *Vertex* can be added to an *Edge*.
72b7576f 6028 * Nothing can be added to a *Vertex*.
6029
bf62b306 6030**emptycopy** and **add** should be used with care.
72b7576f 6031
bf62b306 6032On 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 6033
bf62b306 6034**Example:**
6035~~~~~
72b7576f 6036# a compound with three boxes
6037box b1 0 0 0 1 1 1
6038box b2 3 0 0 1 1 1
6039box b3 6 0 0 1 1 1
6040compound b1 b2 b3 c
bf62b306 6041~~~~~
72b7576f 6042
6043
c0a1a35f 6044@subsubsection occt_draw_7_1_5 compare
7868210d 6045
6046Syntax:
6047~~~~~
6048compare shape1 shape2
6049~~~~~
6050
6051**compare** compares the two shapes *shape1* and *shape2* using the methods *TopoDS_Shape::IsSame()* and *TopoDS_Shape::IsEqual()*.
6052
6053**Example**
6054~~~~~
6055box b1 1 1 1
6056copy b1 b2
6057compare b1 b2
6058# same shapes
6059# equal shapes
6060
6061orientation b2 R
6062compare b1 b2
6063# same shapes
6064
6065box b2 1 1 1
6066compare b1 b2
6067# shapes are not same
6068~~~~~
6069
c0a1a35f 6070@subsubsection occt_draw_7_1_6 issubshape
7868210d 6071
6072Syntax:
6073~~~~~
6074issubshape subshape shape
6075~~~~~
6076
6077**issubshape** checks if the shape *subshape* is sub-shape of the shape *shape* and gets its index in the shape.
6078
6079**Example**
6080~~~~~
6081box b 1 1 1
6082explode b f
6083issubshape b_2 b
6084# b_2 is sub-shape of b. Index in the shape: 2.
6085~~~~~
6086
72b7576f 6087
bf62b306 6088@subsection occt_draw_7_2 Curve and surface topology
72b7576f 6089
6090This group of commands is used to create topology from shapes and to extract shapes from geometry.
6091
bf62b306 6092 * To create vertices, use the **vertex** command.
6093 * To create edges use, the **edge**, **mkedge** commands.
6094 * To create wires, use the **wire**, **polyline**, **polyvertex** commands.
6095 * To create faces, use the **mkplane**, **mkface** commands.
6096 * To extract the geometry from edges or faces, use the **mkcurve** and **mkface** commands.
6097 * To extract the 2d curves from edges or faces, use the **pcurve** command.
72b7576f 6098
6099
bf62b306 6100@subsubsection occt_draw_7_2_1 vertex
72b7576f 6101
bf62b306 6102Syntax:
6103~~~~~
6104vertex name [x y z / p edge]
6105~~~~~
72b7576f 6106
6107Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge.
72b7576f 6108
bf62b306 6109**Example:**
6110~~~~~
72b7576f 6111vertex v1 10 20 30
bf62b306 6112~~~~~
72b7576f 6113
472634fa 6114@subsubsection occt_draw_7_2_1a mkpoint
6115
6116Syntax:
6117~~~~~
6118mkpoint name vertex
6119~~~~~
6120
6121Creates a point from the coordinates of a given vertex.
6122
6123**Example:**
6124~~~~~
6125mkpoint p v1
6126~~~~~
6127
bf62b306 6128@subsubsection occt_draw_7_2_2 edge, mkedge, uisoedge, visoedge
72b7576f 6129
bf62b306 6130Syntax:
6131~~~~~
6132edge name vertex1 vertex2
72b7576f 6133mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]]
6134uisoedge edge face u v1 v2
6135visoedge edge face v u1 u2
bf62b306 6136~~~~~
72b7576f 6137
bf62b306 6138* **edge** creates a straight line edge between two vertices.
6139* **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 6140
e5bd0d98 6141**Example:**
bf62b306 6142~~~~~
72b7576f 6143# straight line edge
6144vertex v1 10 0 0
6145vertex v2 10 10 0
6146edge e1 v1 v2
6147
6148# make a circular edge
6149circle c 0 0 0 5
6150mkedge e2 c 0 pi/2
6151
6152# A similar result may be achieved by trimming the curve
6153# The trimming is removed by mkedge
6154trim c c 0 pi/2
6155mkedge e2 c
bf62b306 6156~~~~~
72b7576f 6157
bf62b306 6158* **visoedge** and **uisoedge** are commands that generate a *uiso* parameter edge or a *viso* parameter edge.
72b7576f 6159
e5bd0d98 6160**Example:**
bf62b306 6161~~~~~
72b7576f 6162# to create an edge between v1 and v2 at point u
6163# to create the example plane
6164plane p
6165trim p p 0 1 0 1
6166convert p p
6167incudeg p 3
6168incvdeg p 3
6169movep p 2 2 0 0 1
6170movep p 3 3 0 0 0.5
6171mkface p p
6172# to create the edge in the plane at the u axis point
61730.5, and between the v axis points v=0.2 and v =0.8
6174uisoedge e p 0.5 0.20 0.8
bf62b306 6175~~~~~
72b7576f 6176
bf62b306 6177@subsubsection occt_draw_7_2_3 wire, polyline, polyvertex
72b7576f 6178
bf62b306 6179Syntax:
6180~~~~~
6181wire wirename e1/w1 [e2/w2 ...]
72b7576f 6182polyline name x1 y1 z1 x2 y2 z2 ...
6183polyvertex name v1 v2 ...
bf62b306 6184~~~~~
72b7576f 6185
bf62b306 6186**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 6187
bf62b306 6188**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 6189
bf62b306 6190**polyvertex** creates a polygonal wire from vertices.
72b7576f 6191
bf62b306 6192**Example:**
6193~~~~~
72b7576f 6194# create two polygonal wires
6195# glue them and define as a single wire
6196polyline w1 0 0 0 10 0 0 10 10 0
6197polyline w2 10 10 0 0 10 0 0 0 0
6198wire w w1 w2
bf62b306 6199~~~~~
72b7576f 6200
bf62b306 6201@subsubsection occt_draw_7_2_4 profile
72b7576f 6202
bf62b306 6203Syntax
6204~~~~~
6205profile name [code values] [code values] ...
6206~~~~~
72b7576f 6207
dba69de2 6208
bf62b306 6209**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 6210
72b7576f 6211
bf62b306 6212| **Code** | **Values ** | **Action** |
6213| :------------ | :------------- | :---------------- |
6214| O | X Y Z | Sets the origin of the plane |
6215| P | DX DY DZ UX UY UZ | Sets the normal and X of the plane |
6216| F | X Y | Sets the first point |
6217| X | DX | Translates a point along X |
6218| Y | DY | Translates a point along Y |
6219| L | DL | Translates a point along direction |
6220| XX | X | Sets point X coordinate |
6221| YY | Y | Sets point Y coordinate |
6222| T | DX DY | Translates a point |
6223| TT | X Y | Sets a point |
6224| R | Angle | Rotates direction |
6225| RR | Angle | Sets direction |
6226| D | DX DY | Sets direction |
6227| IX | X | Intersects with vertical |
6228| IY | Y | Intersects with horizontal |
6229| C | Radius Angle | Arc of circle tangent to direction |
72b7576f 6230
72b7576f 6231
6232Codes 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.
6233
6234The point [code values] can be repeated any number of times and in any order to create the profile contour.
6235
bf62b306 6236| Suffix | Action |
6237| :----- | :----- |
6238| No suffix | Makes a closed face |
6239| W | Make a closed wire |
6240| WW | Make an open wire |
6241
6242The profile shape definition is the suffix; no suffix produces a face, *w* is a closed wire, *ww* is an open wire.
72b7576f 6243
6244Code letters are not case-sensitive.
72b7576f 6245
bf62b306 6246**Example:**
6247~~~~~
a110c4a3 6248# to create a triangular plane using a vertex at the
72b7576f 6249origin, in the xy plane
6250profile p O 0 0 0 X 1 Y 0 x 1 y 1
bf62b306 6251~~~~~
72b7576f 6252
bf62b306 6253**Example:**
6254~~~~~
72b7576f 6255# to create a contour using the different code
6256possibilities
6257
6258# two vertices in the xy plane
6259profile p F 1 0 x 2 y 1 ww
6260
6261# to view from a point normal to the plane
6262top
6263
6264# add a circular element of 45 degrees
6265profile p F 1 0 x 2 y 1 c 1 45 ww
6266
6267# add a tangential segment with a length value 1
6268profile p F 1 0 x 2 y 1 c 1 45 l 1 ww
6269
6270# add a vertex with xy values of 1.5 and 1.5
6271profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 ww
6272
6273# add a vertex with the x value 0.2, y value is constant
6274profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 ww
6275
6276# add a vertex with the y value 2 x value is constant
6277profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 yy 2 ww
6278
6279# add a circular element with a radius value of 1 and a circular value of 290 degrees
6280profile 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
6281
6282# wire continues at a tangent to the intersection x = 0
6283profile 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
6284
6285# continue the wire at an angle of 90 degrees until it intersects the y axis at y= -o.3
6286profile 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
6287
6288#close the wire
6289profile 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
6290
6291# to create the plane with the same contour
6292profile 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 6293~~~~~
72b7576f 6294
bf62b306 6295@subsubsection occt_draw_7_2_5 bsplineprof
72b7576f 6296
bf62b306 6297Syntax:
6298~~~~~
6299bsplineprof name [S face] [W WW]
6300~~~~~
72b7576f 6301
ba06f8bb 6302* for an edge : \<digitizes\> ... <mouse button 2>
bf62b306 6303* to end profile : <mouse button 3>
72b7576f 6304
bf62b306 6305Builds a profile in the XY plane from digitizes. By default the profile is closed and a face is built.
72b7576f 6306
bf62b306 6307**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 6308
bf62b306 6309The profile shape definition is the suffix; no suffix produces a face, **w** is a closed wire, **ww** is an open wire.
72b7576f 6310
e5bd0d98 6311**Example:**
bf62b306 6312~~~~~
72b7576f 6313#to view the xy plane
6314top
6315#to create a 2d curve with the mouse
6316bsplineprof res
6317# click mb1 to start the curve
6318# click mb1 to create the second vertex
6319# click mb1 to create a curve
6320==
6321#click mb2 to finish the curve and start a new curve
6322==
6323# click mb1 to create the second curve
6324# click mb3 to create the face
bf62b306 6325~~~~~
72b7576f 6326
bf62b306 6327@subsubsection occt_draw_7_2_6 mkoffset
72b7576f 6328
9d8e0744 6329**mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurrences is not limited.
6330The offset distance defines the spacing and the positioning of the occurrences.
6331
bf62b306 6332Syntax:
6333~~~~~
9d8e0744 6334mkoffset result shape nboffset stepoffset [jointype(a/i) [alt]]
bf62b306 6335~~~~~
9d8e0744 6336where:
6337* *result* - the base name for the resulting wires. The index of the occurrence (starting with 1) will be added to this name, so the resulting wires will have the names - *result_1*, *result_2* ...;
6338* *shape* - input shape (face or compound of wires);
6339* *nboffset* - the number of the parallel occurrences;
6340* *stepoffset* - offset distance between occurrences;
6341* *jointype(a/i)* - join type (a for *arc* (default) and i for *intersection*);
6342* *alt* - altitude from the plane of the input face in relation to the normal to the face.
72b7576f 6343
72b7576f 6344
e5bd0d98 6345**Example:**
bf62b306 6346~~~~~
9d8e0744 6347# Create a box and select a face
72b7576f 6348box b 1 2 3
6349explode b f
9d8e0744 6350# Create three exterior parallel contours with an offset value of 2
72b7576f 6351mkoffset r b_1 3 2
9d8e0744 6352# wires r_1, r_2 and r_3 are created
6353
6354# Create three exterior parallel contours with an offset value of 2 without round corners
6355mkoffset r b_1 3 2 i
6356# wires r_1, r_2 and r_3 are created
6357
6358# Create one interior parallel contour with an offset value of 0.4
72b7576f 6359mkoffset r b_1 1 -0.4
bf62b306 6360~~~~~
72b7576f 6361
9d8e0744 6362**Note** that on a concave input contour for an interior step *mkoffset* command may produce several wires which will be contained in a single compound.
72b7576f 6363
bf62b306 6364**Example:**
6365~~~~~
72b7576f 6366# to create the example contour
6367profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w
9d8e0744 6368# creates an incoherent interior offset
72b7576f 6369mkoffset r p 1 -0.50
9d8e0744 6370
6371# creates two incoherent wires
6372mkoffset r p 1 -0.55
6373# r_1 is a compound of two wires
bf62b306 6374~~~~~
72b7576f 6375
bf62b306 6376@subsubsection occt_draw_7_2_7 mkplane, mkface
72b7576f 6377
bf62b306 6378Syntax:
6379~~~~~
6380mkplane name wire
72b7576f 6381mkface name surface [ufirst ulast vfirst vlast]
bf62b306 6382~~~~~
72b7576f 6383
bf62b306 6384**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 6385
bf62b306 6386**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 6387
bf62b306 6388**Example:**
6389~~~~~
72b7576f 6390# make a polygonal face
6391polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0
6392mkplane f f
6393
6394# make a cylindrical face
6395cylinder g 10
6396trim g g -pi/3 pi/2 0 15
6397mkface g g
bf62b306 6398~~~~~
72b7576f 6399
bf62b306 6400@subsubsection occt_draw_7_2_8 mkcurve, mksurface
72b7576f 6401
bf62b306 6402Syntax:
6403~~~~~
6404mkcurve curve edge
72b7576f 6405mksurface name face
bf62b306 6406~~~~~
72b7576f 6407
bf62b306 6408**mkcurve** creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries.
72b7576f 6409
bf62b306 6410**mksurface** creates a surface from a face. The surface will not be trimmed.
72b7576f 6411
bf62b306 6412**Example:**
6413~~~~~
72b7576f 6414# make a line
6415vertex v1 0 0 0
6416vertex v2 10 0 0
6417edge e v1 v2
bf62b306 6418~~~~~
72b7576f 6419
bf62b306 6420@subsubsection occt_draw_7_2_9 pcurve
6421
6422Syntax:
72b7576f 6423
bf62b306 6424~~~~~
6425pcurve [name edgename] facename
6426~~~~~
72b7576f 6427
bf62b306 6428Extracts 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 6429
e5bd0d98 6430**Example:**
bf62b306 6431~~~~~
72b7576f 6432# view the pcurves of a face
6433plane p
6434trim p p -1 1 -1 1
6435mkface p p
6436av2d; # a 2d view
6437pcurve p
64382dfit
bf62b306 6439~~~~~
72b7576f 6440
bf62b306 6441@subsubsection occt_draw_7_2_10 chfi2d
72b7576f 6442
bf62b306 6443Syntax:
6444~~~~~
6445chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) ....
6446~~~~~
72b7576f 6447
72b7576f 6448
bf62b306 6449Creates chamfers and fillets on 2D objects. Select two adjacent edges and:
72b7576f 6450 * a radius value
6451 * two respective distance values
6452 * a distance value and an angle
6453
6454The radius value produces a fillet between the two faces.
6455
6456The distance is the length value from the edge between the two selected faces in a normal direction.
6457
e5bd0d98 6458**Example:**
72b7576f 6459
bf62b306 6460Let us create a 2d fillet:
6461
6462~~~~~
72b7576f 6463top
6464profile p x 2 y 2 x -2
6465chfi2d cfr p . . F 0.3
6466==Pick an object
6467#select an edge
6468==Pick an object
6469#select an edge
bf62b306 6470~~~~~
72b7576f 6471
bf62b306 6472Let us create a 2d chamfer using two distances:
6473
6474~~~~~
72b7576f 6475profile p x 2 y 2 x -2
6476chfi2d cfr p . . CDD 0.3 0.6
6477==Pick an object
6478#select an edge
6479==Pick an object
6480#select an edge
bf62b306 6481~~~~~
6482
6483Let us create a 2d chamfer using a defined distance and angle
72b7576f 6484
bf62b306 6485~~~~~
72b7576f 6486top
6487profile p x 2 y 2 x -2
6488chfi2d cfr p . . CDA 0.3 75
6489==Pick an object
6490#select an edge
6491==Pick an object
6492#select an edge
bf62b306 6493~~~~~
72b7576f 6494
bf62b306 6495@subsubsection occt_draw_7_2_11 nproject
72b7576f 6496
bf62b306 6497Syntax:
6498~~~~~
6499nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol
72b7576f 6500[continuity [maxdeg [maxseg]]]
bf62b306 6501~~~~~
72b7576f 6502
bf62b306 6503Creates a shape projection which is normal to the target surface.
72b7576f 6504
bf62b306 6505**Example:**
6506~~~~~
72b7576f 6507# create a curved surface
6508line l 0 0 0 1 0 0
6509trim l l 0 2
6510convert l l
6511
6512incdeg l 3
6513cmovep l 1 0 0.5 0
6514cmovep l 3 0 0.5 0
6515copy l ll
6516translate ll 2 -0.5 0
6517mkedge e1 l
6518mkedge e2 ll
6519wire w e1 e2
6520prism p w 0 0 3
6521donl p
6522#display in four views
6523mu4
6524fit
6525# create the example shape
6526circle c 1.8 -0.5 1 0 1 0 1 0 0 0.4
6527mkedge e c
6528donly p e
6529# create the normal projection of the shape(circle)
6530nproject r e p
bf62b306 6531~~~~~
72b7576f 6532
6533
bf62b306 6534@subsection occt_draw_7_3 Primitives
72b7576f 6535
6536Primitive commands make it possible to create simple shapes. They include:
6537
bf62b306 6538 * **box** and **wedge** commands.
6539 * **pcylinder**, **pcone**, **psphere**, **ptorus** commands.
6540 * **halfspace** command
72b7576f 6541
6542
bf62b306 6543@subsubsection occt_draw_7_3_1 box, wedge
72b7576f 6544
bf62b306 6545Syntax:
6546~~~~~
6547box name [x y z] dx dy dz
72b7576f 6548wedge name dx dy dz ltx / xmin zmin xmax xmax
bf62b306 6549~~~~~
72b7576f 6550
bf62b306 6551**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 6552
bf62b306 6553**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 6554
bf62b306 6555The 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 6556
bf62b306 6557**Example:**
6558~~~~~
72b7576f 6559# a box at the origin
6560box b1 10 20 30
6561
6562# another box
6563box b2 30 30 40 10 20 30
6564
6565# a wedge
6566wedge w1 10 20 30 5
6567
6568# a wedge with a sharp edge (5 faces)
6569wedge w2 10 20 30 0
6570
6571# a pyramid
6572wedge w3 20 20 20 10 10 10 10
bf62b306 6573~~~~~
72b7576f 6574
bf62b306 6575@subsubsection occt_draw_7_3_2 pcylinder, pcone, psphere, ptorus
72b7576f 6576
bf62b306 6577Syntax:
6578~~~~~
6579pcylinder name [plane] radius height [angle]
72b7576f 6580pcone name [plane] radius1 radius2 height [angle]
6581pcone name [plane] radius1 radius2 height [angle]
6582psphere name [plane] radius1 [angle1 angle2] [angle]
6583ptorus name [plane] radius1 radius2 [angle1 angle2] [angle]
bf62b306 6584~~~~~
72b7576f 6585
bf62b306 6586All 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 6587
bf62b306 6588**pcylinder** creates a cylindrical block with the given radius and height.
72b7576f 6589
bf62b306 6590**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 6591
bf62b306 6592**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 6593
3f812249 6594**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 6595
bf62b306 6596**Example:**
6597~~~~~
72b7576f 6598# a can shape
6599pcylinder cy 5 10
6600
6601# a quarter of a truncated cone
6602pcone co 15 10 10 90
6603
6604# three-quarters of sphere
6605psphere sp 10 270
6606
6607# half torus
6608ptorus to 20 5 0 90
bf62b306 6609~~~~~
72b7576f 6610
bf62b306 6611@subsubsection occt_draw_7_3_3 halfspace
72b7576f 6612
bf62b306 6613Syntax:
6614~~~~~
6615halfspace result face/shell x y z
6616~~~~~
72b7576f 6617
bf62b306 6618**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.
6619
6620**Example:**
6621~~~~~
72b7576f 6622box b 0 0 0 1 2 3
6623explode b f
6624==b_1 b_2 b_3 b_4 b_5 b_6
6625halfspace hr b_3 0.5 0.5 0.5
bf62b306 6626~~~~~
72b7576f 6627
6628
bf62b306 6629@subsection occt_draw_7_4 Sweeping
72b7576f 6630
6631Sweeping creates shapes by sweeping out a shape along a defined path:
6632
3f812249 6633 * **prism** -- sweeps along a direction.
6634 * **revol** -- sweeps around an axis.
6635 * **pipe** -- sweeps along a wire.
6636 * **mksweep** and **buildsweep** -- to create sweeps by defining the arguments and algorithms.
6637 * **thrusections** -- creates a sweep from wire in different planes.
bf62b306 6638
72b7576f 6639
bf62b306 6640@subsubsection occt_draw_7_4_1 prism
72b7576f 6641
bf62b306 6642Syntax:
6643~~~~~
6644prism result base dx dy dz [Copy | Inf | SemiInf]
6645~~~~~
72b7576f 6646
bf62b306 6647Creates 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 6648
bf62b306 6649The 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 6650
e5bd0d98 6651**Example:**
bf62b306 6652~~~~~
72b7576f 6653# sweep a planar face to make a solid
6654polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0
6655mkplane f f
bf62b306 6656~~~~~
72b7576f 6657
bf62b306 6658@subsubsection occt_draw_7_4_2 revol
72b7576f 6659
bf62b306 6660Syntax:
6661~~~~~
6662revol result base x y z dx dy dz angle [Copy]
6663~~~~~
72b7576f 6664
bf62b306 6665Creates 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 6666
e5bd0d98 6667**Example:**
bf62b306 6668~~~~~
72b7576f 6669# shell by wire rotation
6670polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0
6671revol s w 20 0 0 0 1 0 90
bf62b306 6672~~~~~
72b7576f 6673
6674
bf62b306 6675@subsubsection occt_draw_7_4_3 pipe
72b7576f 6676
bf62b306 6677Syntax:
6678~~~~~
6679pipe name wire_spine Profile
6680~~~~~
72b7576f 6681
bf62b306 6682Creates a new shape by sweeping a shape known as the profile along a wire known as the spine.
72b7576f 6683
e5bd0d98 6684**Example:**
bf62b306 6685~~~~~
72b7576f 6686# sweep a circle along a bezier curve to make a solid
6687pipe
6688
6689beziercurve spine 4 0 0 0 10 0 0 10 10 0 20 10 0
6690mkedge spine spine
6691wire spine spine
6692circle profile 0 0 0 1 0 0 2
6693mkedge profile profile
6694wire profile profile
6695mkplane profile profile
6696pipe p spine profile
bf62b306 6697~~~~~
72b7576f 6698
bf62b306 6699@subsubsection occt_draw_7_4_4 mksweep, addsweep, setsweep, deletesweep, buildsweep, simulsweep
72b7576f 6700
bf62b306 6701Syntax:
6702~~~~~
6703mksweep wire
6704addsweep wire[vertex][-M][-C] [auxiilaryshape]
6705deletesweep wire
72b7576f 6706setsweep options [arg1 [arg2 [...]]]
72b7576f 6707simulsweep r [n] [option]
6708buildsweep [r] [option] [Tol]
bf62b306 6709~~~~~
72b7576f 6710
bf62b306 6711options are :
6712 * *-FR* : Tangent and Normal are defined by a Frenet trihedron
6713 * *-CF* : Tangent is given by Frenet, the Normal is computed to minimize the torsion
6714 * *-DX Surf* : Tangent and Normal are given by Darboux trihedron, surf must be a shell or a face
6715 * *-CN dx dy dz* : BiNormal is given by *dx dy dz*
6716 * *-FX Tx Ty TZ [Nx Ny Nz]* : Tangent and Normal are fixed
6717 * *-G guide*
72b7576f 6718
bf62b306 6719These 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.
3f812249 6720* **mksweep** -- initializes the sweep creation and defines the wire to be used as the spine.
6721* **addsweep** -- defines the wire to be used as the profile.
6722* **deletesweep** -- cancels the choice of profile wire, without leaving the mksweep mode. You can re-select a profile wire.
6723* **setsweep** -- commands the algorithms used for the construction of the sweep.
6724* **simulsweep** -- can be used to create a preview of the shape. [n] is the number of sections that are used to simulate the sweep.
6725* **buildsweep** -- creates the sweep using the arguments defined by all the commands.
72b7576f 6726
e5bd0d98 6727**Example:**
bf62b306 6728~~~~~
72b7576f 6729#create a sweep based on a semi-circular wire using the
6730Frenet algorithm
6731#create a circular figure
6732circle c2 0 0 0 1 0 0 10
6733trim c2 c2 -pi/2 pi/2
6734mkedge e2 c2
6735donly e2
6736wire w e2
6737whatis w
6738mksweep w
6739# to display all the options for a sweep
6740setsweep
6741#to create a sweep using the Frenet algorithm where the
6742#normal is computed to minimise the torsion
6743setsweep -CF
6744addsweep w -R
6745# to simulate the sweep with a visual approximation
6746simulsweep w 3
bf62b306 6747~~~~~
72b7576f 6748
bf62b306 6749@subsubsection occt_draw_7_4_5 thrusections
72b7576f 6750
bf62b306 6751Syntax:
6752~~~~~
6753thrusections [-N] result issolid isruled wire1 wire2 [..wire..]
6754~~~~~
72b7576f 6755
bf62b306 6756**thrusections** creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices.
6757A bezier curve is generated between the vertices of each wire. The option *[-N]* means that no check is made on wires for direction.
72b7576f 6758
e5bd0d98 6759**Example:**
bf62b306 6760~~~~~
72b7576f 6761#create three wires in three planes
6762polyline w1 0 0 0 5 0 0 5 5 0 2 3 0
6763polyline w2 0 1 3 4 1 3 4 4 3 1 3 3
6764polyline w3 0 0 5 5 0 5 5 5 5 2 3 5
6765# create the shape
6766thrusections th issolid isruled w1 w2 w3
6767==thrusections th issolid isruled w1 w2 w3
dba69de2 6768Tolerances obtenues -- 3d : 0
72b7576f 6769-- 2d : 0
bf62b306 6770~~~~~
72b7576f 6771
6772
bf62b306 6773@subsection occt_draw_7_5 Topological transformation
72b7576f 6774
bf62b306 6775Transformations 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 6776
3f812249 6777 * **tcopy** -- makes a copy of the structure of a shape.
6778 * **ttranslate**, **trotate**, **tmove** and **reset** -- move a shape.
6779 * **tmirror** and **tscale** -- always modify the shape.
72b7576f 6780
6781
bf62b306 6782@subsubsection occt_draw_7_5_1 tcopy
72b7576f 6783
bf62b306 6784Syntax:
6785~~~~~
6786tcopy name toname [name toname ...]
6787~~~~~
72b7576f 6788
6789Copies the structure of one shape, including the geometry, into another, newer shape.
72b7576f 6790
bf62b306 6791**Example:**
6792~~~~~
72b7576f 6793# create an edge from a curve and copy it
6794beziercurve c 3 0 0 0 10 0 0 20 10 0
6795mkedge e1 c
6796ttranslate e1 0 5 0
6797tcopy e1 e2
6798ttranslate e2 0 5 0
6799# now modify the curve, only e1 and e2 will be modified
bf62b306 6800~~~~~
72b7576f 6801
bf62b306 6802@subsubsection occt_draw_7_5_2 tmove, treset
72b7576f 6803
bf62b306 6804Syntax:
6805~~~~~
6806tmove name [name ...] shape
72b7576f 6807reset name [name ...]
bf62b306 6808~~~~~
72b7576f 6809
bf62b306 6810**tmove** and **reset** modify the location, or the local coordinate system of a shape.
72b7576f 6811
bf62b306 6812**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 6813
bf62b306 6814**Example:**
6815~~~~~
72b7576f 6816# create two boxes
6817box b1 10 10 10
6818box b2 20 0 0 10 10 10
6819# translate the first box
6820ttranslate b1 0 10 0
6821# and apply the same location to b2
6822tmove b2 b1
6823# return to original positions
6824reset b1 b2
bf62b306 6825~~~~~
72b7576f 6826
bf62b306 6827@subsubsection occt_draw_7_5_3 ttranslate, trotate
72b7576f 6828
bf62b306 6829Syntax:
6830~~~~~
6831ttranslate [name ...] dx dy dz
72b7576f 6832trotate [name ...] x y z dx dy dz angle
bf62b306 6833~~~~~
72b7576f 6834
bf62b306 6835**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.
6836When 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 6837
a110c4a3 6838Locations are very economic in the data structure because multiple occurrences of an object share the topological description.
bf62b306 6839
e5bd0d98 6840**Example:**
bf62b306 6841~~~~~
72b7576f 6842# make rotated copies of a sphere in between two cylinders
6843# create a file source toto.tcl
6844# toto.tcl code:
d5cdd12a 6845for {set i 0} {$i < 360} {incr i 20} {
72b7576f 6846copy s s$i
6847trotate s$i 0 0 0 0 0 1 $i
6848}
6849
6850# create two cylinders
6851pcylinder c1 30 5
6852copy c1 c2
6853ttranslate c2 0 0 20
6854
6855#create a sphere
6856psphere s 3
6857ttranslate s 25 0 12.5
6858
6859# call the source file for multiple copies
6860source toto.tcl
bf62b306 6861~~~~~
72b7576f 6862
bf62b306 6863@subsubsection occt_draw_7_5_4 tmirror, tscale
72b7576f 6864
bf62b306 6865Syntax:
6866~~~~~
6867tmirror name x y z dx dy dz
72b7576f 6868tscale name x y z scale
bf62b306 6869~~~~~
72b7576f 6870
bf62b306 6871* **tmirror** makes a mirror copy of a shape about a plane x,y,z dx,dy,dz.
6872
6873* **Tscale** applies a central homotopic mapping to a shape.
72b7576f 6874
bf62b306 6875**Example:**
6876~~~~~
72b7576f 6877# mirror a portion of cylinder about the YZ plane
6878pcylinder c1 10 10 270
6879copy c1 c2
6880tmirror c2 15 0 0 1 0 0
6881# and scale it
6882tscale c1 0 0 0 0.5
bf62b306 6883~~~~~
72b7576f 6884
6885
bf62b306 6886@subsection occt_draw_7_6 Old Topological operations
72b7576f 6887
bf62b306 6888 * **fuse**, **cut**, **common** are boolean operations.
6889 * **section**, **psection** compute sections.
6890 * **sewing** joins two or more shapes.
72b7576f 6891
6892
bf62b306 6893@subsubsection occt_draw_7_6_1 fuse, cut, common
72b7576f 6894
948fe6ca 6895These commands are no longer supported, so the result may be unpredictable.
07f2b741 6896Use the commands bfuse, bcut, bcommon instead.
948fe6ca 6897
6898Syntax:
bf62b306 6899~~~~~
6900fuse name shape1 shape2
72b7576f 6901cut name shape1 shape2
6902common name shape1 shape2
bf62b306 6903~~~~~
72b7576f 6904
bf62b306 6905**fuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
72b7576f 6906
bf62b306 6907**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 6908
bf62b306 6909**common** creates a new shape which contains only what is in common between the two original shapes in their intersection.
72b7576f 6910
bf62b306 6911**Example:**
6912~~~~~
72b7576f 6913# all four boolean operations on a box and a cylinder
6914
6915box b 0 -10 5 20 20 10
6916pcylinder c 5 20
6917
6918fuse s1 b c
6919ttranslate s1 40 0 0
6920
6921cut s2 b c
6922ttranslate s2 -40 0 0
6923
6924cut s3 c b
6925ttranslate s3 0 40 0
6926
6927common s4 b c
6928ttranslate s4 0 -40 0
bf62b306 6929~~~~~
72b7576f 6930
6931
bf62b306 6932@subsubsection occt_draw_7_6_2 section, psection
72b7576f 6933
948fe6ca 6934These commands are no longer supported, so the result may be unpredictable.
07f2b741 6935Use the command **bsection** instead.
948fe6ca 6936
bf62b306 6937Syntax:
6938~~~~~
6939section result shape1 shape2
72b7576f 6940psection name shape plane
bf62b306 6941~~~~~
72b7576f 6942
bf62b306 6943**section** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
72b7576f 6944
bf62b306 6945**psection** creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane.
72b7576f 6946
bf62b306 6947**Example:**
6948~~~~~
72b7576f 6949# section line between a cylinder and a box
6950pcylinder c 10 20
6951box b 0 0 5 15 15 15
6952trotate b 0 0 0 1 1 1 20
6953section s b c
6954
6955# planar section of a cone
6956pcone c 10 30 30
6957plane p 0 0 15 1 1 2
6958psection s c p
bf62b306 6959~~~~~
72b7576f 6960
bf62b306 6961@subsubsection occt_draw_7_6_3 sewing
72b7576f 6962
bf62b306 6963Syntax:
6964~~~~~
6965sewing result [tolerance] shape1 shape2 ...
6966~~~~~
72b7576f 6967
bf62b306 6968**Sewing** joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value.
72b7576f 6969
e5bd0d98 6970**Example:**
bf62b306 6971~~~~~
72b7576f 6972# create two adjacent boxes
6973box b 0 0 0 1 2 3
6974box b2 0 2 0 1 2 3
6975sewing sr b b2
bf62b306 6976whatis sr
6977sr is a shape COMPOUND FORWARD Free Modified
6978~~~~~
72b7576f 6979
948fe6ca 6980@subsection occt_draw_7_7 New Topological operations
72b7576f 6981
948fe6ca 6982The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old Boolean operation algorithm.
6983It also provides wider range of options and diagnostics.
e6c8fcfe 6984The algorithms of Boolean component are fully described in the @ref specification__boolean_operations "Boolean Operations" of boolean operation user guide.
72b7576f 6985
07f2b741 6986For the Draw commands to perform operations in Boolean component, read the dedicated section @ref occt_draw_bop "Boolean operations commands"
72b7576f 6987
72b7576f 6988
bf62b306 6989@subsection occt_draw_7_8 Drafting and blending
72b7576f 6990
6991Drafting is creation of a new shape by tilting faces through an angle.
6992
6993Blending is the creation of a new shape by rounding edges to create a fillet.
6994
bf62b306 6995 * Use the **depouille** command for drafting.
6996 * Use the **chamf** command to add a chamfer to an edge
6997 * Use the **blend** command for simple blending.
e45b5ff7 6998 * Use **bfuseblend** for a fusion + blending operation.
6999 * Use **bcutblend** for a cut + blending operation.
bf62b306 7000 * Use **buildevol**, **mkevol**, **updatevol** to realize varying radius blending.
72b7576f 7001
7002
bf62b306 7003@subsubsection occt_draw_7_8_1 depouille
72b7576f 7004
bf62b306 7005Syntax:
7006~~~~~
7007dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...]
7008~~~~~
72b7576f 7009
bf62b306 7010Creates a new shape by drafting one or more faces of a shape.
72b7576f 7011
7012Identify 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 7013
e5bd0d98 7014**Example:**
bf62b306 7015~~~~~
72b7576f 7016# draft a face of a box
7017box b 10 10 10
7018explode b f
7019== b_1 b_2 b_3 b_4 b_5 b_6
7020
7021dep a b 0 0 1 b_2 10 0 10 0 1 0 5
bf62b306 7022~~~~~
72b7576f 7023
bf62b306 7024@subsubsection occt_draw_7_8_2 chamf
72b7576f 7025
bf62b306 7026Syntax:
7027~~~~~
7028chamf newname shape edge face S dist
72b7576f 7029chamf newname shape edge face dist1 dist2
7030chamf newname shape edge face A dist angle
bf62b306 7031~~~~~
72b7576f 7032
bf62b306 7033Creates a chamfer along the edge between faces using:
72b7576f 7034
7035 * a equal distances from the edge
7036 * the edge, a face and distance, a second distance
7037 * the edge, a reference face and an angle
7038
7039Use the dot syntax to select the faces and edges.
72b7576f 7040
bf62b306 7041**Examples:**
7042
7043Let us create a chamfer based on equal distances from the edge (45 degree angle):
7044~~~~~
72b7576f 7045# create a box
7046box b 1 2 3
7047chamf ch b . . S 0.5
7048==Pick an object
7049# select an edge
7050==Pick an object
7051# select an adjacent face
bf62b306 7052~~~~~
72b7576f 7053
bf62b306 7054Let us create a chamfer based on different distances from the selected edge:
7055~~~~~
72b7576f 7056box b 1 2 3
7057chamf ch b . . 0.3 0.4
7058==Pick an object
7059# select an edge
7060==Pick an object
bf62b306 7061# select an adjacent face
7062~~~~~
7063
7064Let us create a chamfer based on a distance from the edge and an angle:
7065
7066~~~~~
72b7576f 7067box b 1 2 3
7068chamf ch b . . A 0.4 30
7069==Pick an object
7070# select an edge
7071==Pick an object
7072# select an adjacent face
bf62b306 7073~~~~~
72b7576f 7074
bf62b306 7075@subsubsection occt_draw_7_8_3 blend
72b7576f 7076
bf62b306 7077Syntax:
7078~~~~~
7079blend result object rad1 ed1 rad2 ed2 ... [R/Q/P]
7080~~~~~
72b7576f 7081
bf62b306 7082Creates 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 7083
e5bd0d98 7084**Example:**
bf62b306 7085~~~~~
72b7576f 7086# blend a box, click on an edge
7087box b 20 20 20
7088blend b b 2 .
7089==tolerance ang : 0.01
7090==tolerance 3d : 0.0001
7091==tolerance 2d : 1e-05
7092==fleche : 0.001
7093==tolblend 0.01 0.0001 1e-05 0.001
7094==Pick an object
7095# click on the edge you want ot fillet
7096
7097==COMPUTE: temps total 0.1s dont :
7098==- Init + ExtentAnalyse 0s
7099==- PerformSetOfSurf 0.02s
7100==- PerformFilletOnVertex 0.02s
7101==- FilDS 0s
7102==- Reconstruction 0.06s
7103==- SetRegul 0s
bf62b306 7104~~~~~
72b7576f 7105
e45b5ff7 7106@subsubsection occt_draw_7_8_4 bfuseblend
72b7576f 7107
e45b5ff7 7108Syntax:
7109~~~~~
7110bfuseblend name shape1 shape2 radius [-d]
bf62b306 7111~~~~~
bf62b306 7112
e45b5ff7 7113Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius.
7114Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
72b7576f 7115
e45b5ff7 7116**Example:**
bf62b306 7117~~~~~
e45b5ff7 7118# fuse-blend two boxes
7119box b1 20 20 5
7120copy b1 b2
7121ttranslate b2 -10 10 3
7122bfuseblend a b1 b2 1
bf62b306 7123~~~~~
72b7576f 7124
e45b5ff7 7125@subsubsection occt_draw_7_8_4a bcutblend
7126
7127Syntax:
7128~~~~~
7129bcutblend name shape1 shape2 radius [-d]
7130~~~~~
7131
7132Creates a boolean cut of two shapes and then blends (fillets) the intersection edges using the given radius.
7133Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
7134
7135**Example:**
7136~~~~~
7137# cut-blend two boxes
7138box b1 20 20 5
7139copy b1 b2
7140ttranslate b2 -10 10 3
7141bcutblend a b1 b2 1
7142~~~~~
72b7576f 7143
bf62b306 7144@subsubsection occt_draw_7_8_5 mkevol, updatevol, buildevol
72b7576f 7145
bf62b306 7146Syntax:
7147~~~~~
7148mkevol result object (then use updatevol) [R/Q/P]
72b7576f 7149updatevol edge u1 radius1 [u2 radius2 ...]
7150buildevol
bf62b306 7151~~~~~
72b7576f 7152
7153These three commands work together to create fillets with evolving radii.
7154
bf62b306 7155* **mkevol** allows specifying the shape and the name of the result. It returns the tolerances of the fillet.
7156* **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.
7157* **buildevol** produces the result described previously in **mkevol** and **updatevol**.
72b7576f 7158
e5bd0d98 7159**Example:**
bf62b306 7160~~~~~
72b7576f 7161# makes an evolved radius on a box
7162box b 10 10 10
7163mkevol b b
7164==tolerance ang : 0.01
7165==tolerance 3d : 0.0001
7166==tolerance 2d : 1e-05
7167==fleche : 0.001
7168==tolblend 0.01 0.0001 1e-05 0.001
7169
7170# click an edge
7171updatevol . 0 1 1 3 2 2
7172==Pick an object
7173
7174buildevol
7175==Dump of SweepApproximation
7176==Error 3d = 1.28548881203818e-14
7177==Error 2d = 1.3468326936926e-14 ,
7178==1.20292299999388e-14
7179==2 Segment(s) of degree 3
7180
7181==COMPUTE: temps total 0.91s dont :
7182==- Init + ExtentAnalyse 0s
7183==- PerformSetOfSurf 0.33s
7184==- PerformFilletOnVertex 0.53s
7185==- FilDS 0.01s
7186==- Reconstruction 0.04s
7187==- SetRegul 0s
bf62b306 7188~~~~~
72b7576f 7189
7190
d9ca2e0c 7191@subsection occt_draw_defeaturing Defeaturing
7192
4f7d41ea 7193Draw command **removefeatures** is intended for performing @ref occt_modalg_defeaturing "3D Model Defeaturing", i.e. it performs the removal of the requested features from the shape.
d9ca2e0c 7194
7195Syntax:
7196~~~~
7197removefeatures result shape f1 f2 ... [-nohist] [-parallel]
7198
7199Where:
7200result - result of the operation;
7201shape - the shape to remove the features from;
7202f1, f2 - features to remove from the shape;
7203
7204Options:
7205nohist - disables the history collection;
7206parallel - enables the parallel processing mode.
7207~~~~
7208
d9ca2e0c 7209
53a73fc1 7210@subsection occt_draw_makeperiodic 3D Model Periodicity
7211
7212Draw module for @ref occt_modalg_makeperiodic "making the shape periodic" includes the following commands:
7213* **makeperiodic** - makes the shape periodic in required directions;
7214* **repeatshape** - repeats the periodic shape in requested periodic direction;
7215* **periodictwins** - returns the periodic twins for the shape;
7216* **clearrepetitions** - clears all previous repetitions of the periodic shape.
7217
7218@subsubsection occt_draw_makeperiodic_makeperiodic makeperiodic
7219
7220The command makes the shape periodic in the required directions with the required period.
7221If trimming is given it trims the shape to fit the requested period.
7222
7223Syntax:
7224~~~~
7225makeperiodic result shape [-x/y/z period [-trim first]]
7226
7227Where:
7228result - resulting periodic shape;
7229shape - input shape to make it periodic:
7230-x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period;
7231-trim first - option to trim the shape to fit the required period, starting the period in first.
7232~~~~
7233
7234@subsubsection occt_draw_makeperiodic_repeatshape repeatshape
7235
7236The command repeats the periodic shape in periodic direction requested number of time.
7237The result contains the all the repeated shapes glued together.
7238The command should be called after **makeperiodic** command.
7239
7240Syntax:
7241~~~~
7242repeatshape result -x/y/z times
7243
7244Where:
7245result - resulting shape;
7246-x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
7247~~~~
7248
7249@subsubsection occt_draw_makeperiodic_periodictwins periodictwins
7250
7251For the given shape the command returns the identical shapes located on the opposite sides of the periodic direction.
7252All periodic twins should have the same geometry.
7253The command should be called after **makeperiodic** command.
7254
7255Syntax:
7256~~~~
7257periodictwins twins shape
7258
7259Where:
7260twins - periodic twins for the given shape
7261shape - shape to find the twins for
7262~~~~
7263
7264@subsubsection occt_draw_makeperiodic_clearrepetitions clearrepetitions
7265
7266The command clears all previous repetitions of the periodic shape allowing to start the repetitions over.
7267No arguments are needed for the command.
7268
7269
0c09fd3c 7270@subsection occt_draw_makeconnected Making the touching shapes connected
7271
7272Draw module for @ref occt_modalg_makeconnected "making the touching same-dimensional shapes connected" includes the following commands:
7273* **makeconnected** - make the input shapes connected or glued, performs material associations;
7274* **cmaterialson** - returns the materials located on the requested side of a shape;
7275* **cmakeperiodic** - makes the connected shape periodic in requested directions;
7276* **crepeatshape** - repeats the periodic connected shape in requested directions requested number of times;
7277* **cperiodictwins** - returns all periodic twins for the shape;
7278* **cclearrepetitions** - clears all previous repetitions of the periodic shape, keeping the shape periodic.
7279
7280@subsubsection occt_draw_makeconnected_makeconnected makeconnected
7281
7282The command makes the input touching shapes connected.
7283
7284Syntax:
7285~~~~
7286makeconnected result shape1 shape2 ...
7287
7288Where:
7289result - resulting connected shape.
7290shape1 shape2 ... - shapes to be made connected.
7291~~~~
7292
7293@subsubsection occt_draw_makeconnected_cmaterialson cmaterialson
7294
7295The command returns the materials located on the requested side of the shape.
7296The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**.
7297
7298Syntax:
7299~~~~
7300cmaterialson result +/- shape
7301
7302Where:
7303result - material shapes
7304shape - shape for which the materials are needed
7305+/- - side of a given shape ('+' for positive side, '-' - for negative).
7306~~~~
7307
7308@subsubsection occt_draw_makeconnected_cmakeperiodic cmakeperiodic
7309
7310The command makes the connected shape periodic in the required directions with the required period.
7311The command should be called after the shapes have been made connected, i.e. after the command **makeconnected**.
7312
7313Syntax:
7314~~~~
7315cmakeperiodic result [-x/y/z period [-trim first]]
7316
7317Where:
7318result - resulting periodic shape;
7319shape - input shape to make it periodic:
7320-x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period;
7321-trim first - option to trim the shape to fit the required period, starting the period in first.
7322~~~~
7323
7324@subsubsection occt_draw_makeconnected_crepeatshape crepeatshape
7325
7326The command repeats the connected periodic shape in the required periodic directions required number of times.
7327The command should be called after the shapes have been made connected and periodic, i.e. after the commands **makeconnected** and **cmakeperiodic**.
7328
7329Syntax:
7330~~~~
7331crepeatshape result -x/y/z times
7332
7333Where:
7334result - resulting shape;
7335-x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
7336~~~~
7337
7338@subsubsection occt_draw_makeconnected_cperiodictwins cperiodictwins
7339
7340The command returns all periodic twins for the shape.
7341The command should be called after the shapes have been made connected and periodic, i.e. after the commands **makeconnected** and **cmakeperiodic**.
7342
7343Syntax:
7344~~~~
7345cperiodictwins twins shape
7346
7347Where:
7348twins - periodic twins of a shape.
7349shape - input shape.
7350~~~~
7351
7352@subsubsection occt_draw_makeconnected_cclearrepetitions cclearrepetitions
7353
7354The command clears all previous repetitions of the periodic shape keeping the shape periodic.
7355The command should be called after the shapes have been made connected, periodic and the repetitions have been applied to the periodic shape, i.e. after the commands **makeconnected**, **cmakeperiodic** and **crepeatshape**.
7356Otherwise the command will have no effect.
7357
7358Syntax:
7359~~~~
7360cclearrepetitions [result]
7361~~~~
7362
7363
ae3eaf7b 7364@subsection occt_draw_7_9 Analysis of topology and geometry
72b7576f 7365
c0a1a35f 7366Analysis of shapes includes commands to compute length, area, volumes and inertial properties, as well as to compute some aspects impacting shape validity.
72b7576f 7367
bf62b306 7368 * Use **lprops**, **sprops**, **vprops** to compute integral properties.
1a0339b4 7369 * Use **bounding** to compute and to display the bounding box of a shape.
bf62b306 7370 * Use **distmini** to calculate the minimum distance between two shapes.
1a0339b4 7371 * Use **isbbinterf** to check if the two shapes are interfered by their bounding boxes.
ae3eaf7b 7372 * Use **xdistef**, **xdistcs**, **xdistcc**, **xdistc2dc2dss**, **xdistcc2ds** to check the distance between two objects on even grid.
c0a1a35f 7373 * Use **checkshape** to check validity of the shape.
7374 * Use **tolsphere** to see the tolerance spheres of all vertices in the shape.
7375 * Use **validrange** to check range of an edge not covered by vertices.
72b7576f 7376
7377
bf62b306 7378@subsubsection occt_draw_7_9_1 lprops, sprops, vprops
72b7576f 7379
bf62b306 7380Syntax:
7381~~~~~
4b114473 7382lprops shape [x y z] [-skip] [-full] [-tri]
7383sprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]
7384vprops shape [epsilon] [c[losed]] [x y z] [-skip] [-full] [-tri]
bf62b306 7385~~~~~
72b7576f 7386
bf62b306 7387* **lprops** computes the mass properties of all edges in the shape with a linear density of 1;
7388* **sprops** of all faces with a surface density of 1;
7389* **vprops** of all solids with a density of 1.
72b7576f 7390
a25d5aaa 7391For computation of properties of the shape, exact geometry (curves, surfaces) or
4b114473 7392some discrete data (polygons, triangulations) can be used for calculations.
7393The epsilon, if given, defines relative precision of computation.
7394The **closed** flag, if present, forces computation only closed shells of the shape.
7395The centroid coordinates will be put to DRAW variables x y z (if given).
7396Shared entities will be taken in account only one time in the **skip** mode.
7397All values are output with the full precision in the **full** mode.
7398Preferable source of geometry data are triangulations in case if it exists,
7399if the **-tri** key is used, otherwise preferable data is exact geometry.
7400If epsilon is given, exact geometry (curves, surfaces) are used for calculations independently of using key **-tri**.
7401
72b7576f 7402All 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 7403
bf62b306 7404**Example:**
7405~~~~~
72b7576f 7406# volume of a cylinder
7407pcylinder c 10 20
7408vprops c
7409== results
7410Mass : 6283.18529981086
7411
7412Center of gravity :
7413X = 4.1004749224903e-06
7414Y = -2.03392858349861e-16
7415Z = 9.9999999941362
7416
7417Matrix of Inertia :
dba69de2 7418366519.141445068 5.71451850691484e-12
72b7576f 74190.257640437382627
dba69de2 74205.71451850691484e-12 366519.141444962
74212.26823064169991e-10 0.257640437382627
74222.26823064169991e-10 314159.265358863
72b7576f 7423
7424Moments :
7425IX = 366519.141446336
7426IY = 366519.141444962
7427I.Z = 314159.265357595
bf62b306 7428~~~~~
72b7576f 7429
7430
bf62b306 7431@subsubsection occt_draw_7_9_2 bounding
72b7576f 7432
bf62b306 7433Syntax:
7434~~~~~
1a0339b4 7435bounding {-s shape | -c xmin ymin zmin xmax ymax zmax} [-obb] [-shape name] [-dump] [-notriangulation] [-perfmeter name NbIters] [-save xmin ymin zmin xmax ymax zmax] [-nodraw] [-optimal] [-exttoler]
bf62b306 7436~~~~~
72b7576f 7437
14deaf42 7438Computes and displays the bounding box (BndBox) of a shape. The bounding box is a cuboid that circumscribes the source shape.
a25d5aaa 7439Generally, bounding boxes can be divided into two main types:
14deaf42 7440 - axis-aligned BndBox (AABB). I.e. the box whose edges are parallel to an axis of World Coordinate System (WCS);
1a0339b4 7441 - oriented BndBox (OBB). I.e. not AABB.
72b7576f 7442
a25d5aaa 7443Detailed information about this command is available in DRAW help-system (enter "help bounding" in DRAW application).
1a0339b4 7444
7445**Example 1: Creation of AABB with given corners**
7446~~~~~
7447bounding -c 50 100 30 180 200 100 -shape result
7448# look at the box
7449vdisplay result
7450vfit
7451vsetdispmode 1
bf62b306 7452~~~~~
1a0339b4 7453
7454**Example 2: Compare AABB and OBB**
7455~~~~~
7456# Create a torus and rotate it
72b7576f 7457ptorus t 20 5
1a0339b4 7458trotate t 5 10 15 1 1 1 28
7459
7460# Create AABB from the torus
7461bounding -s t -shape ra -dump -save x1 y1 z1 x2 y2 z2
7462==Axes-aligned bounding box
7463==X-range: -26.888704600189307 23.007685197265488
7464==Y-range: -22.237699567214314 27.658690230240481
7465==Z-range: -13.813966507560762 12.273995247458407
7466
7467# Obtain the boundaries
7468dump x1 y1 z1 x2 y2 z2
7469==*********** Dump of x1 *************
7470==-26.8887046001893
7471
7472==*********** Dump of y1 *************
7473==-22.2376995672143
7474
7475==*********** Dump of z1 *************
7476==-13.8139665075608
7477
7478==*********** Dump of x2 *************
7479==23.0076851972655
7480
7481==*********** Dump of y2 *************
7482==27.6586902302405
7483
7484==*********** Dump of z2 *************
7485==12.2739952474584
7486
7487# Compute the volume of AABB
7488vprops ra 1.0e-12
7489==Mass : 64949.9
7490
7491# Let us check this value
7492dval (x2-x1)*(y2-y1)*(z2-z1)
7493==64949.886543606823
7494~~~~~
7495
7496The same result is obtained.
7497
7498~~~~~
7499# Create OBB from the torus
7500bounding -s t -shape ro -dump -obb
7501==Oriented bounding box
7502==Center: -1.9405097014619073 2.7104953315130857 -0.76998563005117782
7503==X-axis: 0.31006700219833244 -0.23203206410428409 0.9219650619059514
7504==Y-axis: 0.098302309139513336 -0.95673739537318336 -0.27384340837854165
7505==Z-axis: 0.94561890324040099 0.17554109923901748 -0.27384340837854493
7506==Half X: 5.0000002000000077
7507==Half Y: 26.783728747002169
7508==Half Z: 26.783728747002165
7509
7510# Compute the volume of OBB
7511vprops ro 1.0e-12
7512==Mass : 28694.7
7513~~~~~
7514
7515As we can see, the volume of OBB is significantly less than the volume of AABB.
7516
7517@subsubsection occt_draw_7_9_2a isbbinterf
7518
7519Syntax:
7520~~~~~
7521isbbinterf shape1 shape2 [-o]
7522~~~~~
7523
14deaf42 7524Checks whether the bounding boxes created from the given shapes are interfered. If "-o"-option is switched on then the oriented boxes will be checked. Otherwise, axis-aligned boxes will be checked.
1a0339b4 7525
7526**Example 1: Not interfered AABB**
7527~~~~~
7528box b1 100 60 140 20 10 80
7529box b2 210 200 80 120 60 90
7530isbbinterf b1 b2
7531==The shapes are NOT interfered by AABB.
7532~~~~~
7533
7534**Example 2: Interfered AABB**
7535~~~~~
7536box b1 300 300 300
7537box b2 100 100 100 50 50 50
7538isbbinterf b1 b2
7539==The shapes are interfered by AABB.
7540~~~~~
7541
7542**Example 3: Not interfered OBB**
7543~~~~~
7544box b1 100 150 200
7545copy b1 b2
7546trotate b1 -150 -150 -150 1 2 3 -40
7547trotate b2 -150 -150 -150 1 5 2 60
7548
7549# Check of interference
7550isbbinterf b1 b2 -o
7551==The shapes are NOT interfered by OBB.
7552~~~~~
7553
7554**Example 4: Interfered OBB**
7555~~~~~
7556box b1 100 150 200
7557copy b1 b2
7558trotate b1 -50 -50 -50 1 1 1 -40
7559trotate b2 -50 -50 -50 1 1 1 60
7560
7561# Check of interference
7562isbbinterf b1 b2 -o
7563==The shapes are interfered by OBB.
bf62b306 7564~~~~~
72b7576f 7565
bf62b306 7566@subsubsection occt_draw_7_9_3 distmini
72b7576f 7567
bf62b306 7568Syntax:
7569~~~~~
7570distmini name Shape1 Shape2
7571~~~~~
72b7576f 7572
14deaf42 7573Calculates 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 in red and the results are listed in the shell window. The *distmini* lines are considered as shapes which have a value v.
72b7576f 7574
e5bd0d98 7575**Example:**
bf62b306 7576~~~~~
72b7576f 7577box b 0 0 0 10 20 30
7578box b2 30 30 0 10 20 30
7579distmini d1 b b2
7580==the distance value is : 22.3606797749979
7581==the number of solutions is :2
7582
7583==solution number 1
7584==the type of the solution on the first shape is 0
7585==the type of the solution on the second shape is 0
7586==the coordinates of the point on the first shape are:
7587==X=10 Y=20 Z=30
7588==the coordinates of the point on the second shape
7589are:
7590==X=30 Y=30 Z=30
7591
7592==solution number 2:
7593==the type of the solution on the first shape is 0
7594==the type of the solution on the second shape is 0
7595==the coordinates of the point on the first shape are:
7596==X=10 Y=20 Z=0
7597==the coordinates of the point on the second shape
7598are:
7599==X=30 Y=30 Z=0
7600
7601==d1_val d1 d12
bf62b306 7602~~~~~
72b7576f 7603
ae3eaf7b 7604@subsubsection occt_draw_7_9_4 xdistef, xdistcs, xdistcc, xdistc2dc2dss, xdistcc2ds
7605
7606Syntax:
7607~~~~~
7608xdistef edge face
7609xdistcs curve surface firstParam lastParam [NumberOfSamplePoints]
7610xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints]
7611xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints]
7612xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints]
7613~~~~~
7614
7615It is assumed that curves have the same parametrization range and *startParam* is less than *finishParam*.
7616
7617Commands with prefix *xdist* allow checking the distance between two objects on even grid:
3f812249 7618 * **xdistef** -- distance between edge and face;
7619 * **xdistcs** -- distance between curve and surface. This means that the projection of each sample point to the surface is computed;
7620 * **xdistcc** -- distance between two 3D curves;
7621 * **xdistcc2ds** -- distance between 3d curve and 2d curve on surface;
7622 * **xdistc2dc2dss** -- distance between two 2d curves on surface.
ae3eaf7b 7623
7624**Examples**
7625~~~~~
7626bopcurves b1 b2 -2d
7627mksurf s1 b1
7628mksurf s2 b2
7629xdistcs c_1 s1 0 1 100
7630xdistcc2ds c_1 c2d2_1 s2 0 1
7631xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
7632~~~~~
7633
c0a1a35f 7634@subsubsection occt_draw_7_9_5 checkshape
7635
7636Syntax:
7637~~~~~
7638checkshape [-top] shape [result] [-short]
7639~~~~~
7640
7641Where:
7642* *top* -- optional parameter, which allows checking only topological validity of a shape.
14deaf42 7643* *shape* -- the only required parameter, defines the name of the shape to check.
7644* *result* -- optional parameter, defines custom prefix for the output shape names.
c0a1a35f 7645* *short* -- a short description of the check.
7646
7647**checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape.
7648
7649**Example:**
7650~~~~~
7651# checkshape returns a comment valid or invalid
7652box b1 0 0 0 1 1 1
7653checkshape b1
7654# returns the comment
7655this shape seems to be valid
7656~~~~~
7657
7658@subsubsection occt_draw_7_9_6 tolsphere
7659
7660Syntax:
7661~~~~~
7662tolsphere shape
7663~~~~~
7664
7665Where:
7666* *shape* -- the name of the shape to process.
7667
7668**tolsphere** shows vertex tolerances by drawing spheres around each vertex in the shape. Each sphere is assigned a name of the shape with suffix "_vXXX", where XXX is the number of the vertex in the shape.
7669
7670**Example:**
7671~~~~~
7672# tolsphere returns all names of created spheres.
7673box b1 0 0 0 1 1 1
7674settolerance b1 0.05
7675tolsphere b1
7676# creates spheres and returns the names
7677b1_v1 b1_v2 b1_v3 b1_v4 b1_v5 b1_v6 b1_v7 b1_v8
7678~~~~~
7679
7680@subsubsection occt_draw_7_9_7 validrange
7681
7682Syntax:
7683~~~~~
7684validrange edge [(out) u1 u2]
7685~~~~~
7686
7687Where:
7688* *edge* -- the name of the edge to analyze.
14deaf42 7689* *u1*, *u2* -- optional names of variables to put into the range.
c0a1a35f 7690
14deaf42 7691**validrange** computes valid range of the edge. If *u1* and *u2* are not given, it returns the first and the last parameters. Otherwise, it sets variables *u1* and *u2*.
c0a1a35f 7692
7693**Example:**
7694~~~~~
7695circle c 0 0 0 10
7696mkedge e c
7697mkedge e c 0 pi
7698validrange e
7699# returns the range
77001.9884375000000002e-008 3.1415926337054181
7701validrange e u1 u2
7702dval u1
77031.9884375000000002e-008
7704dval u2
77053.1415926337054181
7706~~~~~
7707
ae3eaf7b 7708
bf62b306 7709@subsection occt_draw_7_10 Surface creation
72b7576f 7710
7711Surface creation commands include surfaces created from boundaries and from spaces between shapes.
bf62b306 7712 * **gplate** creates a surface from a boundary definition.
7713 * **filling** creates a surface from a group of surfaces.
72b7576f 7714
bf62b306 7715@subsubsection occt_draw_7_10_1 gplate,
72b7576f 7716
bf62b306 7717Syntax:
7718~~~~~
7719gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ...
7720~~~~~
72b7576f 7721
bf62b306 7722Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces.
72b7576f 7723
e5bd0d98 7724**Example:**
bf62b306 7725~~~~~
72b7576f 7726plane p
7727trim p p -1 3 -1 3
7728mkface p p
7729
7730beziercurve c1 3 0 0 0 1 0 1 2 0 0
7731mkedge e1 c1
7732tcopy e1 e2
7733tcopy e1 e3
7734
7735ttranslate e2 0 2 0
7736trotate e3 0 0 0 0 0 1 90
7737tcopy e3 e4
7738ttranslate e4 2 0 0
7739# create the surface
7740gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0
7741==
7742======== Results ===========
7743DistMax=8.50014503228635e-16
7744* GEOMPLATE END*
7745Calculation time: 0.33
7746Loop number: 1
7747Approximation results
7748Approximation error : 2.06274907619957e-13
7749Criterium error : 4.97600631215754e-14
7750
7751#to create a surface defined by edges and passing through a point
7752# to define the border edges and the point
7753plane p
7754trim p p -1 3 -1 3
7755mkface p p
7756
7757beziercurve c1 3 0 0 0 1 0 1 2 0 0
7758mkedge e1 c1
7759tcopy e1 e2
7760tcopy e1 e3
7761
7762ttranslate e2 0 2 0
7763trotate e3 0 0 0 0 0 1 90
7764tcopy e3 e4
7765ttranslate e4 2 0 0
7766# to create a point
7767point pp 1 1 0
7768# to create the surface
7769gplate r2 4 1 p e1 0 e2 0 e3 0 e4 0 pp
7770==
7771======== Results ===========
7772DistMax=3.65622157610934e-06
7773* GEOMPLATE END*
7774Calculculation time: 0.27
7775Loop number: 1
7776Approximation results
7777Approximation error : 0.000422195884750181
7778Criterium error : 3.43709808053967e-05
bf62b306 7779~~~~~
72b7576f 7780
bf62b306 7781@subsubsection occt_draw_7_10_2 filling, fillingparam
72b7576f 7782
bf62b306 7783Syntax:
7784~~~~~
7785filling result nbB nbC nbP [SurfInit] [edge][face]order...
72b7576f 7786edge[face]order... point/u v face order...
bf62b306 7787~~~~~
72b7576f 7788
bf62b306 7789Creates 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 7790
7791To define the surface border:
7792
7793 * enter the number of edges, constraints, and points
7794 * enumerate the edges, constraints and points
7795
7796The surface can pass through other points. These are defined after the border definition.
7797
bf62b306 7798You can use the *fillingparam* command to access the filling parameters.
72b7576f 7799
7800The options are:
7801
bf62b306 7802 * <i>-l</i> : to list current values
7803 * <i>-i</i> : to set default values
7804 * <i>-rdeg nbPonC nbIt anis </i> : to set filling options
7805 * <i>-c t2d t3d tang tcur </i> : to set tolerances
7806 * <i>-a maxdeg maxseg </i> : Approximation option
72b7576f 7807
e5bd0d98 7808**Example:**
bf62b306 7809~~~~~
72b7576f 7810# to create four curved survaces and a point
7811plane p
7812trim p p -1 3 -1 3
7813mkface p p
7814
7815beziercurve c1 3 0 0 0 1 0 1 2 0 0
7816mkedge e1 c1
7817tcopy e1 e2
7818tcopy e1 e3
7819
7820ttranslate e2 0 2 0
7821trotate e3 0 0 0 0 0 1 90
7822tcopy e3 e4
7823ttranslate e4 2 0 0
7824
7825point pp 1 1 0
7826
7827prism f1 e1 0 -1 0
7828prism f2 e2 0 1 0
7829prism f3 e3 -1 0 0
7830prism f4 e4 1 0 0
7831
7832# to create a tangential surface
7833filling r1 4 0 0 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1
7834# to create a tangential surface passing through point pp
7835filling r2 4 0 1 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 pp#
7836# to visualise the surface in detail
7837isos r2 40
7838# to display the current filling parameters
7839fillingparam -l
7840==
7841Degree = 3
7842NbPtsOnCur = 10
7843NbIter = 3
7844Anisotropie = 0
7845Tol2d = 1e-05
7846Tol3d = 0.0001
7847TolAng = 0.01
7848TolCurv = 0.1
7849
7850MaxDeg = 8
7851MaxSegments = 9
bf62b306 7852~~~~~
72b7576f 7853
7854
bf62b306 7855@subsection occt_draw_7_11 Complex Topology
72b7576f 7856
7857Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling.
7858
7859
bf62b306 7860@subsubsection occt_draw_7_11_1 offsetshape, offsetcompshape
72b7576f 7861
bf62b306 7862Syntax:
7863~~~~~
7864offsetshape r shape offset [tol] [face ...]
72b7576f 7865offsetcompshape r shape offset [face ...]
bf62b306 7866~~~~~
72b7576f 7867
bf62b306 7868**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 7869
bf62b306 7870The 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 7871
bf62b306 7872In 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 7873
7874The opening between the object interior and exterior is defined by the argument face or faces.
72b7576f 7875
e5bd0d98 7876**Example:**
bf62b306 7877~~~~~
72b7576f 7878box b1 10 20 30
7879explode b1 f
7880== b1_1 b1_2 b1_3 b1_4 b1_5 b1_6
bf62b306 7881offsetcompshape r b1 -1 b1_3
7882~~~~~
72b7576f 7883
bf62b306 7884@subsubsection occt_draw_7_11_2 featprism, featdprism, featrevol, featlf, featrf
72b7576f 7885
bf62b306 7886Syntax:
7887~~~~~
7888featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)
72b7576f 7889featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)
7890featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)
7891featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)
7892featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)
7893featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]
7894featperformval prism/revol/dprism/lf result value
bf62b306 7895~~~~~
72b7576f 7896
bf62b306 7897**featprism** loads the arguments for a prism with contiguous sides normal to the face.
72b7576f 7898
bf62b306 7899**featdprism** loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle.
72b7576f 7900
bf62b306 7901**featrevol** loads the arguments for a prism with a circular evolution.
72b7576f 7902
bf62b306 7903**featlf** loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline.
72b7576f 7904
bf62b306 7905**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 7906
bf62b306 7907**featperform** loads the arguments to create the feature.
72b7576f 7908
bf62b306 7909**featperformval** uses the defined arguments to create a feature with a limiting value.
72b7576f 7910
7911All 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 7912
bf62b306 7913**Examples:**
7914
7915Let us create a feature prism with a draft angle and a normal direction :
7916
7917~~~~~
72b7576f 7918# create a box with a wire contour on the upper face
7919box b 1 1 1
7920profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7921explode b f
7922# loads the feature arguments defining the draft angle
7923featdprism b f b_6 5 1 0
7924# create the feature
7925featperformval dprism r 1
7926==BRepFeat_MakeDPrism::Perform(Height)
7927BRepFeat_Form::GlobalPerform ()
ba06f8bb 7928 Gluer
7929 still Gluer
7930 Gluer result
bf62b306 7931~~~~~
72b7576f 7932
bf62b306 7933Let us create a feature prism with circular direction :
7934
7935~~~~~
72b7576f 7936# create a box with a wire contour on the upper face
7937box b 1 1 1
7938profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7939explode b f
7940# loads the feature arguments defining a rotation axis
7941featrevol b f b_6 1 0 1 0 1 0 1 0
7942featperformval revol r 45
7943==BRepFeat_MakeRevol::Perform(Angle)
7944BRepFeat_Form::GlobalPerform ()
ba06f8bb 7945 Gluer
7946 still Gluer
7947 Gluer result
bf62b306 7948~~~~~
7949
72b7576f 7950
bf62b306 7951Let us create a slot using the linear feature :
7952
7953~~~~~
72b7576f 7954#create the base model using the multi viewer
7955mu4
7956profile 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
7957prism pr p 0 0 1
7958# create the contour for the linear feature
7959vertex v1 -0.2 4 0.3
7960vertex v2 0.2 4 0.3
7961vertex v3 0.2 0.2 0.3
7962vertex v4 4 0.2 0.3
7963vertex v5 4 -0.2 0.3
7964edge e1 v1 v2
7965edge e2 v2 v3
7966edge e3 v3 v4
7967edge e4 v4 v5
7968wire w e1 e2 e3 e4
7969# define a plane
7970plane pl 0.2 0.2 0.3 0 0 1
7971# loads the linear feature arguments
7972featlf pr w pl 0 0 0.3 0 0 0 0 1
7973featperform lf result
bf62b306 7974~~~~~
7975
7976Let us create a rib using the revolution feature :
72b7576f 7977
bf62b306 7978~~~~~
72b7576f 7979#create the base model using the multi viewer
7980mu4
7981pcylinder c1 3 5
7982# create the contour for the revolution feature
7983profile w c 1 190 WW
7984trotate w 0 0 0 1 0 0 90
7985ttranslate w -3 0 1
7986trotate w -3 0 1.5 0 0 1 180
7987plane pl -3 0 1.5 0 1 0
7988# loads the revolution feature arguments
7989featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1
7990featperform rf result
bf62b306 7991~~~~~
72b7576f 7992
bf62b306 7993@subsubsection occt_draw_7_11_3 draft
72b7576f 7994
bf62b306 7995Syntax:
7996~~~~~
7997draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal]
7998~~~~~
72b7576f 7999
bf62b306 8000Computes 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 8001
8002 * The draft angle is measured in radians.
8003 * The draft direction is determined by the argument -INTERNAL
a110c4a3 8004 * The argument Ri/Ro deftermines whether the corner edges of the draft surfaces are angular or rounded.
72b7576f 8005 * Arguments that can be used to define the surface distance are:
ba06f8bb 8006 * length, a defined distance
8007 * shape, until the surface contacts a shape
8008 * surface, until the surface contacts a surface.
72b7576f 8009
bf62b306 8010**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 8011
e5bd0d98 8012**Example:**
bf62b306 8013~~~~~
72b7576f 8014# to create a simple profile
8015profile p F 0 0 x 2 y 4 tt 0 4 w
8016# creates a draft with rounded angles
8017draft res p 0 0 1 3 1 -Ro
8018# to create a profile with an internal angle
8019profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w
8020# creates a draft with rounded external angles
8021draft res p 0 0 1 3 1 -Ro
bf62b306 8022~~~~~
72b7576f 8023
bf62b306 8024@subsubsection occt_draw_7_11_4 deform
72b7576f 8025
bf62b306 8026Syntax:
8027~~~~~
8028deform newname name CoeffX CoeffY CoeffZ
8029~~~~~
72b7576f 8030
bf62b306 8031Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions.
8032
e5bd0d98 8033**Example:**
bf62b306 8034~~~~~
72b7576f 8035pcylinder c 20 20
8036deform a c 1 3 5
8037# the conversion to bspline is followed by the
8038deformation
bf62b306 8039~~~~~
8040
72b7576f 8041
bf62b306 8042@subsubsection occt_draw_7_11_5 nurbsconvert
72b7576f 8043
bf62b306 8044Syntax:
8045
8046~~~~~
8047nurbsconvert result name [result name]
8048~~~~~
72b7576f 8049
a25d5aaa 8050Changes the NURBS curve definition of a shape to a Bspline curve definition.
8051This conversion is required for asymmetric deformation and prepares the arguments for other commands such as **deform**.
8052The conversion can be necessary when transferring shape data to other applications.
bf62b306 8053
8054
e6ae74fd 8055@subsubsection occt_draw_7_11_6 edgestofaces
8056
8057**edgestofaces** - The command allows building planar faces from the planar edges randomly located in 3D space.
8058
8059It has the following syntax:
8060~~~~
8061edgestofaces r_faces edges [-a AngTol -s Shared(0/1)]
8062~~~~
8063Options:
8064 * -a AngTol - angular tolerance used for distinguishing the planar faces;
8065 * -s Shared(0/1) - boolean flag which defines whether the input edges are already shared or have to be intersected.
8066
4f7d41ea 8067@subsection occt_draw_hist History commands
8068
14deaf42 8069Draw module for @ref occt_modalg_hist "History Information support" includes the command to save history of modifications performed by Boolean operation or sibling commands into a drawable object and the actual history commands:
4f7d41ea 8070
948fe6ca 8071* **setfillhistory**;
8072* **savehistory**;
8073* **isdeleted**;
8074* **modified**;
8075* **generated**.
8076
8077@subsubsection occt_draw_hist_set setfillhistory
8078
8079*setfillhistory* command controls if the history is needed to be filled in the supported algorithms and saved into the session after the algorithm is done.
8080By default it is TRUE, i.e. the history is filled and saved.
8081
8082Syntax:
8083~~~~
8084setfillhistory : Controls the history collection by the algorithms and its saving into the session after algorithm is done.
8085 Usage: setfillhistory [flag]
8086 w/o arguments prints the current state of the option;
8087 flag == 0 - history will not be collected and saved;
8088 flag != 0 - history will be collected and saved into the session (default).
8089~~~~
8090
8091Example:
8092~~~~
8093box b1 10 10 10
8094box b2 10 10 10
8095setfillhistory 0
8096bfuse r b1 b2
8097savehistory h
8098# No history has been prepared yet.
8099setfillhistory 1
8100bfuse r b1 b2
8101savehistory h
8102dump h
8103# *********** Dump of h *************
8104# History contains:
8105# - 2 Deleted shapes;
8106# - 52 Modified shapes;
8107# - 0 Generated shapes.
8108~~~~
4f7d41ea 8109
8110@subsubsection occt_draw_hist_save savehistory
8111
8112*savehistory* command saves the history from the session into a drawable object with the given name.
8113
8114Syntax:
8115~~~~
8116savehistory : savehistory name
8117~~~~
8118
14deaf42 8119If the history of shape modifications performed during an operation is needed, the *savehistory* command should be called after the command performing the operation.
8120If another operation supporting history will be performed before the history of the first operation is saved it will be overwritten with the new history.
4f7d41ea 8121
8122Example:
8123~~~~
8124box b1 10 10 10
8125box b2 5 0 0 10 10 15
8126bfuse r b1 b2
8127savehistory fuse_hist
8128
8129dump fuse_hist
8130#*********** Dump of fuse_hist *************
8131# History contains:
8132# - 4 Deleted shapes;
8133# - 20 Modified shapes;
8134# - 6 Generated shapes.
8135
8136unifysamedom ru r
8137savehistory usd_hist
8138dump usd_hist
8139#*********** Dump of usd_hist *************
8140#History contains:
8141# - 14 Deleted shapes;
8142# - 28 Modified shapes;
8143# - 0 Generated shapes.
8144~~~~
8145
8146@subsubsection occt_draw_hist_isdel isdeleted
8147
8148*isdeleted* command checks if the given shape has been deleted in the given history.
8149
8150Syntax:
8151~~~~
8152isdeleted : isdeleted history shape
8153~~~~
8154
8155Example:
8156~~~~
8157box b1 4 4 4 2 2 2
8158box b2 10 10 10
8159bcommon r b1 b2
8160
8161savehistory com_hist
8162# all vertices, edges and faces of the b2 are deleted
8163foreach s [join [list [explode b2 v] [explode b2 e] [explode b2 f] ] ] {
8164 isdeleted com_hist $s
8165 # Deleted
8166}
8167~~~~
8168
8169@subsubsection occt_draw_hist_mod modified
8170
14deaf42 8171*modified* command returns the shapes Modified from the given shape in the given history. All modified shapes are put into a compound. If the shape has not been modified, the resulting compound will be empty. Note that if the shape has been modified into a single shape only, it will be returned without enclosure into the compound.
4f7d41ea 8172
8173Syntax:
8174~~~~
8175modified : modified modified_shapes history shape
8176~~~~
8177
8178Example:
8179~~~~
8180box b 10 10 10
8181explode b e
8182fillet r b 2 b_1
8183
8184savehistory fillet_hist
8185
8186explode b f
8187
8188modified m3 fillet_hist b_3
8189modified m5 fillet_hist b_5
8190~~~~
8191
8192@subsubsection occt_draw_hist_gen generated
8193
14deaf42 8194*generated* command returns the shapes Generated from the given shape in the given history. All generated shapes are put into a compound. If no shapes have been generated from the shape, the resulting compound will be empty. Note that; if the shape has generated a single shape only, it will be returned without enclosure into the compound.
4f7d41ea 8195
8196Syntax:
8197~~~~
8198generated : generated generated_shapes history shape
8199~~~~
8200
8201Example:
8202~~~~
8203polyline w1 0 0 0 10 0 0 10 10 0
8204polyline w2 5 1 10 9 1 10 9 5 10
8205
8206thrusections r 0 0 w1 w2
8207
8208savehistory loft_hist
8209
8210explode w1 e
8211explode w2 e
8212
8213generated g11 loft_hist w1_1
8214generated g12 loft_hist w1_2
8215generated g21 loft_hist w2_1
8216generated g22 loft_hist w2_2
8217
8218compare g11 g21
8219# equal shapes
8220
8221compare g12 g22
8222# equal shapes
8223~~~~
8224
8225@subsubsection occt_draw_hist_extension Enabling Draw history support for the algorithms
8226
8227Draw History mechanism allows fast and easy enabling of the Draw history support for the OCCT algorithms supporting standard history methods.
8228To enable History commands for the algorithm it is necessary to save the history of the algorithm into the session.
8229For that, it is necessary to put the following code into the command implementation just after the command is done:
8230~~~~
8231BRepTest_Objects::SetHistory(ListOfArguments, Algorithm);
8232~~~~
8233
8234Here is the example of how it is done in the command performing Split operation (see implementation of the *bapisplit* command):
8235~~~~
8236BRepAlgoAPI_Splitter aSplitter;
8237// setting arguments
8238aSplitter.SetArguments(BOPTest_Objects::Shapes());
8239// setting tools
8240aSplitter.SetTools(BOPTest_Objects::Tools());
8241
8242// setting options
8243aSplitter.SetRunParallel(BOPTest_Objects::RunParallel());
8244aSplitter.SetFuzzyValue(BOPTest_Objects::FuzzyValue());
8245aSplitter.SetNonDestructive(BOPTest_Objects::NonDestructive());
8246aSplitter.SetGlue(BOPTest_Objects::Glue());
8247aSplitter.SetCheckInverted(BOPTest_Objects::CheckInverted());
8248aSplitter.SetUseOBB(BOPTest_Objects::UseOBB());
948fe6ca 8249aSplitter.SetToFillHistory(BRepTest_Objects::IsHistoryNeeded());
4f7d41ea 8250
8251// performing operation
8252aSplitter.Build();
8253
948fe6ca 8254if (BRepTest_Objects::IsHistoryNeeded())
8255{
8256 // Store the history for the Objects (overwrites the history in the session)
8257 BRepTest_Objects::SetHistory(BOPTest_Objects::Shapes(), aSplitter);
8258 // Add the history for the Tools
8259 BRepTest_Objects::AddHistory(BOPTest_Objects::Tools(), aSplitter);
8260}
4f7d41ea 8261~~~~
e6ae74fd 8262
948fe6ca 8263The method *BRepTest_Objects::IsHistoryNeeded()* controls if the history is needed to be filled in the algorithm and saved into the session after the algorithm is done (*setfillhistory* command controls this option in DRAW).
8264
8265
bf62b306 8266@subsection occt_draw_7_12 Texture Mapping to a Shape
72b7576f 8267
8268Texture 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.
8269
bf62b306 8270@subsubsection occt_draw_7_12_1 vtexture
72b7576f 8271
bf62b306 8272Syntax:
8273~~~~~
8274vtexture NameOfShape TextureFile
72b7576f 8275vtexture NameOfShape
8276vtexture NameOfShape ?
8277vtexture NameOfShape IdOfTexture
bf62b306 8278~~~~~
72b7576f 8279
bf62b306 8280**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 8281
bf62b306 8282@subsubsection occt_draw_7_12_2 vtexscale
72b7576f 8283
bf62b306 8284Syntax:
8285~~~~~
8286vtexscale NameOfShape ScaleU ScaleV
72b7576f 8287vtexscale NameOfShape ScaleUV
8288vtexscale NameOfShape
bf62b306 8289~~~~~
72b7576f 8290
bf62b306 8291*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 8292
bf62b306 8293The syntax without *ScaleU*, *ScaleV* or *ScaleUV* disables texture scaling.
72b7576f 8294
bf62b306 8295@subsubsection occt_draw_7_12_3 vtexorigin
8296
8297Syntax:
8298~~~~~
8299vtexorigin NameOfShape UOrigin VOrigin
72b7576f 8300vtexorigin NameOfShape UVOrigin
8301vtexorigin NameOfShape
bf62b306 8302~~~~~
8303
8304*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 8305
bf62b306 8306The syntax without *UOrigin*, *VOrigin* or *UVOrigin* disables origin positioning.
72b7576f 8307
bf62b306 8308@subsubsection occt_draw_7_12_4 vtexrepeat
72b7576f 8309
bf62b306 8310Syntax:
8311~~~~~
8312vtexrepeat NameOfShape URepeat VRepeat
72b7576f 8313vtexrepeat NameOfShape UVRepeat
8314vtexrepeat NameOfShape
bf62b306 8315~~~~~
72b7576f 8316
bf62b306 8317*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 8318
bf62b306 8319The same syntax without *URepeat*, *VRepeat* or *UVRepeat* disables texture repetition.
72b7576f 8320
bf62b306 8321@subsubsection occt_draw_7_12_5 vtexdefault
8322
8323Syntax:
8324~~~~~
8325vtexdefault NameOfShape
8326~~~~~
72b7576f 8327
bf62b306 8328*Vtexdefault* sets or resets the texture mapping default parameters.
72b7576f 8329
8330The defaults are:
8331
bf62b306 8332 * *URepeat = VRepeat = 1* no repetition
8333 * *UOrigin = VOrigin = 1* origin set at (0,0)
8334 * *UScale = VScale = 1* texture covers 100% of the face
1a457208 8335
8336
948fe6ca 8337@section occt_draw_bop Boolean Operations Commands
1a457208 8338
948fe6ca 8339This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for performing, analyzing, debugging the algorithm in Boolean Component.
6b6d06fa 8340See @ref specification__boolean_operations "Boolean operations" user's guide for the description of these algorithms.
1a457208 8341
948fe6ca 8342@subsection occt_draw_bop_two Boolean Operations on two operands
8343
8344All commands in this section perform Boolean operations on two shapes. One of them is considered as object, and the other as a tool.
8345
8346@subsubsection occt_draw_bop_two_bop bop, bopfuse, bopcut, boptuc, bopcommon, bopsection
8347
8348These commands perform Boolean operations on two shapes:
8349* **bop** performs intersection of given shapes and stores the intersection results into internal Data Structure.
8350* **bopfuse** creates a new shape representing the union of two shapes.
8351* **bopcut** creates a new shape representing a subtraction of a second argument from the first one.
8352* **boptuc** creates a new shape representing a subtraction of a first argument from the second one.
8353* **bopcommon** creates a new shape representing the intersection of two shapes.
8354* **bopsection** creates a new shape representing the intersection edges and vertices between shapes.
8355
8356These commands allow intersecting the shapes only once for building all types of Boolean operations. After *bop* command is done, the other commands in this category use the intersection results prepared by *bop*.
8357It may be very useful as the intersection part is usually most time-consuming part of the operation.
8358
8359Syntax:
8360~~~~~
8361bop shape1 shape2
8362bopcommon result
8363bopfuse result
8364bopcut result
8365boptuc result
8366~~~~~
8367
8368**Example:**
8369
8370Let's produce all four boolean operations on a box and a cylinder performing intersection only once:
8371~~~~~
8372box b 0 -10 5 20 20 10
8373pcylinder c 5 20
8374
8375# intersect the shape, storing results into data structure
8376bop b c
8377
8378# fuse operation
8379bopfuse s1
8380
8381# cut operation
8382bopcut s2
8383
8384# opposite cut operation
8385boptuc s3
8386
8387# common operation
8388bopcommon s4
8389
8390# section operation
8391bopsection s5
8392~~~~~
8393
8394
8395@subsubsection occt_draw_bop_two_bapi bfuse, bcut, btuc, bcommon, bsection
8396
8397These commands also perform Boolean operations on two shapes. These are the short variants of the bop* commands.
8398Each of these commands performs both intersection and building the result and may be useful if you need only the result of a single boolean operation.
8399
8400Syntax:
8401~~~~~
8402bcommon result shape1 shape2
8403bfuse result shape1 shape2
8404bcut result shape1 shape2
8405btuc result shape1 shape2
8406~~~~~
8407
8408**bection** command has some additional options for faces intersection:
8409~~~~
8410bsection result shape1 shape2 [-n2d/-n2d1/-n2d2] [-na]
8411
8412Where:
8413result - result of the operation
8414shape1, shape2 - arguments of the operation
8415-n2d - disables PCurve construction on both objects
8416-n2d1 - disables PCurve construction on first object
8417-n2d2 - disables PCurve construction on second object
8418-na - disables approximation of the section curves
8419~~~~
8420
8421@subsection occt_draw_bop_multi Boolean Operations on multiple arguments
8422
8423The modern Boolean Operations algorithm available in Open CASCADE Technology is capable of performing a Boolean Operations not only on two shapes, but on arbitrary number of shapes.
8424In terms of Boolean Operations these arguments are divided on two groups **Objects** and **Tools**. The meaning of these groups is similar to the single object and tool of Boolean Operations on two shapes.
8425
6b6d06fa 8426The Boolean operations are based on the General Fuse operation (see @ref specification__boolean_7 "General Fuse algorithm") which splits all input shapes basing on the intersection results.
948fe6ca 8427Depending on the type of Boolean operation the BOP algorithm choses the necessary splits of the arguments.
8428
8429@subsection occt_draw_bop_general_com General commands for working with multiple arguments
8430
8431The algorithms based on General Fuse operation are using the same commands for adding and clearing the arguments list and for performing intersection of these arguments.
8432
8433@subsubsection occt_draw_bop_general_com_add Adding arguments of operation
8434
8435The following commands are used to add the objects and tools for Boolean operations:
8436* **baddobjects** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Objects;
8437* **baddtools** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Tools;
8438
8439The following commands are used to clear the objects and tools:
8440* **bclearobjects** -- clears the list of Objects;
8441* **bcleartools** -- clears the list of Tools;
8442
8443So, when running subsequent operation in one Draw session, make sure you cleared the Objects and Tools from previous operation. Otherwise, the new arguments will be added to the current ones.
8444
8445@subsubsection occt_draw_bop_general_com_fill Intersection of the arguments
8446
8447The command **bfillds** performs intersection of the arguments (**Objects** and **Tools**) and stores the intersection results into internal Data Structure.
8448
8449
8450@subsection occt_draw_bop_build Building the result of operations
8451
8452@subsubsection occt_draw_bop_build_BOP Boolean operation
8453
8454The command **bbop** is used for building the result of Boolean Operation. It has to be used after **bfillds** command.
8455
8456Syntax:
8457~~~~
8458bbop result iOp
8459
8460Where:
8461result - result of the operation
8462iOp - type of Boolean Operation. It could have the following values:
84630 - COMMON operation
84641 - FUSE operation
84652 - CUT operation
84663 - CUT21 (opposite CUT, i.e. objects and tools are swapped) operation
84674 - SECTION operation
8468~~~~
8469
8470**Example**
8471~~~~
8472box b1 10 10 10
8473box b2 5 5 5 10 10 10
8474box b3 -5 -5 -5 10 10 10
8475
8476# Clear objects and tools from previous runs
8477bclearobjects
8478bcleartools
8479# add b1 as object
8480baddobjects b1
8481# add b2 and b3 as tools
8482baddtools b2 b3
8483# perform intersection
8484bfillds
8485# build result
8486bbop rcom 0
8487bbop rfuse 1
8488bbop rcut 2
8489bbop rtuc 3
8490bbop rsec 4
8491~~~~
8492
8493@subsubsection occt_draw_bop_build_GF General Fuse operation
8494
8495The command **bbuild** is used for building the result of General Fuse Operation. It has to be used after **bfillds** command.
8496General Fuse operation does not make the difference between Objects and Tools considering both as objects.
8497
8498Syntax:
8499~~~~
8500bbuild result
8501~~~~
8502**Example**
8503~~~~
8504box b1 10 10 10
8505box b2 5 5 5 10 10 10
8506box b3 -5 -5 -5 10 10 10
8507
8508# Clear objects and tools from previous runs
8509bclearobjects
8510bcleartools
8511# add b1 as object
8512baddobjects b1
8513# add b2 and b3 as tools
8514baddtools b2 b3
8515# perform intersection
8516bfillds
8517# build result
8518bbuild result
8519~~~~
8520
8521@subsubsection occt_draw_bop_build_Split Split operation
8522
8523Split operation splits the **Objects** by the **Tools**.
8524The command **bsplit** is used for building the result of Split operation. It has to be used after **bfillds** command.
8525
8526**Example**
8527~~~~
8528box b1 10 10 10
8529box b2 5 5 5 10 10 10
8530box b3 -5 -5 -5 10 10 10
8531
8532# Clear objects and tools from previous runs
8533bclearobjects
8534bcleartools
8535# add b1 as object
8536baddobjects b1
8537# add b2 and b3 as tools
8538baddtools b2 b3
8539# perform intersection
8540bfillds
8541# build result
8542bsplit result
8543~~~~
8544
13c0e402 8545@subsubsection occt_draw_bop_build_BOP_opensolids Alternative command for BOP
8546
8547There is an alternative way to build the result of Boolean operation using the **buildbop** command, which should be run after any other building command, such as **bbuild** or **bbop** or **bsplit**.
8548The command has the following features:
6b6d06fa 8549* It is designed to work on open solids and thus uses the alternative approach for building the results (see @ref specification__boolean_bop_on_opensolids "BOP on open solids" chapter of Boolean operations user guide).
13c0e402 8550* It allows changing the groups of Objects and Tools of the operation (even excluding some of the arguments is possible).
8551* History information for solids will be lost.
8552
8553Syntax:
8554~~~~
8555buildbop result -o s1 [s2 ...] -t s3 [s4 ...] -op operation (common/fuse/cut/tuc)
8556Where:
8557result - result shape of the operation
8558s1 s2 s3 s4 - arguments (solids) of the GF operation
8559operation - type of boolean operation
8560~~~~
8561
8562**Example**
8563~~~~
8564box b1 10 10 10
8565box b2 5 5 5 10 10 10
8566box b3 -5 -5 -5 10 10 10
8567
8568bclearobjects
8569bcleartools
8570baddobjects b1 b2 b3
8571bfillds
8572bbuild r
8573
8574# bbop command will not be available as the tools are not set
8575# but buildbop is available
8576
8577# fuse of two
8578buildbop r1 -o b1 -t b2 -op fuse
8579buildbop r2 -o b2 -t b3 -op fuse
8580
8581# fuse of all - it does not matter how the groups are formed
8582buildbop r3 -o b1 b2 -t b3 -op fuse
8583buildbop r4 -o b2 -t b1 b3 -op fuse
8584buildbop r5 -o b1 b2 b3 -op fuse
8585buildbop r6 -t b1 b2 b3 -op fuse
8586
8587# common of two
8588buildbop r7 -o b2 -t b1 -op common
8589buildbop r8 -o b1 -t b3 -op common
8590
8591# common
8592buildbop r9 -o b1 -t b2 b3 -op common
8593
8594# cut
8595buildbop r10 -o b1 -t b2 b3 -op cut
8596
8597# opposite cut
8598buildbop r11 -o b1 -t b2 b3 -op tuc
8599~~~~
8600
948fe6ca 8601@subsubsection occt_draw_bop_build_CB Cells Builder
8602
6b6d06fa 8603See the @ref specification__boolean_10c_Cells_1 "Cells Builder Usage" for the Draw usage of Cells Builder algorithm.
948fe6ca 8604
8605
8606@subsubsection occt_draw_bop_build_API Building result through API
8607
8608The following commands are used to perform the operation using API implementation of the algorithms:
8609* **bapibuild** -- to perform API general fuse operation.
8610* **bapibop** -- to perform API Boolean operation.
8611* **bapisplit** -- to perform API Split operation.
8612
8613These commands have the same syntax as the analogical commands described above.
8614
8615
8616@subsection occt_draw_bop_options Setting options for the operation
8617
8618The algorithms in Boolean component have a wide range of options.
8619To see the current state of all option the command **boptions** should be used.
8620It has the following syntax:
8621~~~~
8622boptions [-default]
8623
8624-default - allows to set all options to default state.
8625~~~~
8626
8627To have an effect the options should be set before the operation (before *bfillds* command).
8628
8629@subsubsection occt_draw_bop_options_par Parallel processing mode
8630
8631**brunparallel** command enables/disables the parallel processing mode of the operation.
8632
8633Syntax:
8634~~~~
8635brunparallel flag
8636
8637Where:
8638flag is the boolean flag controlling the mode:
8639flag == 0 - parallel processing mode is off.
8640flag != 0 - parallel processing mode is on.
8641~~~~
8642
8643The command is applicable for all commands in the component.
8644
8645@subsubsection occt_draw_bop_options_safe Safe processing mode
8646
8647**bnondestructive** command enables/disables the safe processing mode in which the input arguments are protected from modification.
8648
8649Syntax:
8650~~~~
8651bnondestructive flag
8652
8653Where:
8654flag is the boolean flag controlling the mode:
8655flag == 0 - safe processing mode is off.
8656flag != 0 - safe processing mode is on.
8657~~~~
8658
8659The command is applicable for all commands in the component.
1a457208 8660
948fe6ca 8661@subsubsection occt_draw_bop_options_fuzzy Fuzzy option
8662
8663**bfuzzyvalue** command sets the additional tolerance for operations.
8664
8665Syntax:
8666~~~~
8667bfuzzyvalue value
8668~~~~
8669
8670The command is applicable for all commands in the component.
8671
8672@subsubsection occt_draw_bop_options_glue Gluing option
8673
8674**bglue** command sets the gluing mode for the BOP algorithms.
8675
8676Syntax:
8677~~~~
8678bglue 0/1/2
8679
8680Where:
86810 - disables gluing mode.
86821 - enables the Shift gluing mode.
86832 - enables the Full gluing mode.
8684~~~~
8685
8686The command is applicable for all commands in the component.
8687
8688@subsubsection occt_draw_bop_options_checkinv Check inversion of input solids
8689
8690**bcheckinverted** command enables/disables the check of the input solids on inverted status in BOP algorithms.
8691
8692Syntax:
8693~~~~
8694bcheckinverted 0 (off) / 1 (on)
8695~~~~
8696
8697The command is applicable for all commands in the component.
8698
8699@subsubsection occt_draw_bop_options_obb OBB usage
8700
a25d5aaa 8701**buseobb** command enables/disables the usage of OBB in BOP algorithms.
948fe6ca 8702
8703Syntax:
8704~~~~
8705buseobb 0 (off) / 1 (on)
8706~~~~
8707
8708The command is applicable for all commands in the component.
8709
8710@subsubsection occt_draw_bop_options_simplify Result simplification
8711
8712**bsimplify** command enables/disables the result simplification after BOP. The command is applicable only to the API variants of GF, BOP and Split operations.
8713
8714Syntax:
8715~~~~
8716bsimplify [-e 0/1] [-f 0/1] [-a tol]
8717
8718Where:
8719-e 0/1 - enables/disables edges unification
8720-f 0/1 - enables/disables faces unification
8721-a tol - changes default angular tolerance of unification algo.
8722~~~~
8723
8724@subsubsection occt_draw_bop_options_warn Drawing warning shapes
8725
53a73fc1 8726**bdrawwarnshapes** command enables/disables drawing of warning shapes of BOP algorithms.
948fe6ca 8727
8728Syntax:
8729~~~~
8730bdrawwarnshapes 0 (do not draw) / 1 (draw warning shapes)
8731~~~~
8732
8733The command is applicable for all commands in the component.
8734
8735
8736@subsection occt_draw_bop_check Check commands
8737
8738The following commands are analyzing the given shape on the validity of Boolean operation.
8739
8740@subsubsection occt_draw_bop_check_1 bopcheck
8741
8742Syntax:
8743~~~~
8744bopcheck shape [level of check: 0 - 9]
8745~~~~
8746
8747It checks the given shape for self-interference. The optional level of check allows limiting the check to certain intersection types. Here are the types of interferences that will be checked for given level of check:
8748* 0 - only V/V;
8749* 1 - V/V and V/E;
8750* 2 - V/V, V/E and E/E;
8751* 3 - V/V, V/E, E/E and V/F;
8752* 4 - V/V, V/E, E/E, V/F and E/F;
8753* 5 - V/V, V/E, E/E, V/F, E/F and F/F;
8754* 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;
8755* 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;
8756* 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;
8757* 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
8758
8759**Example:**
8760~~~~
8761box b1 10 10 10
8762box b2 3 3 3 4 4 4
8763compound b1 b2 c
8764bopcheck c
8765~~~~
8766
8767In this example one box is completely included into other box. So the output shows that all sub-shapes of b2 interfering with the solid b1.
8768**bopcheck** command does not modifies the input shape, thus can be safely used.
8769
8770
8771@subsubsection occt_draw_bop_check_2 bopargcheck
8772
8773**bopargcheck** syntax:
8774~~~~
8775bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF]
8776
8777 -<Boolean Operation>
8778 F (fuse)
8779 O (common)
8780 C (cut)
8781 T (cut21)
8782 S (section)
8783 U (unknown)
8784 For example: "bopargcheck s1 s2 -F" enables checking for Fuse operation
8785 default - section
8786
8787 /<Test Options>
8788 R (disable small edges (shrank range) test)
8789 F (disable faces verification test)
8790 T (disable tangent faces searching test)
8791 V (disable test possibility to merge vertices)
8792 E (disable test possibility to merge edges)
8793 I (disable self-interference test)
8794 P (disable shape type test)
8795 C (disable test for shape continuity)
8796 S (disable curve on surface check)
8797 For example: "bopargcheck s1 s2 /RI" disables small edge detection and self-intersection detection
8798 default - all options are enabled
8799
8800 #<Additional Test Options>
8801 B (stop test on first faulty found); default OFF
8802 F (full output for faulty shapes); default - output in a short format
8803
8804 NOTE: <Boolean Operation> and <Test Options> are used only for couple of argument shapes, except I and P options that are always used for couple of shapes as well as for single shape test.
8805~~~~
8806
8807As you can see *bopargcheck* performs more extended check of the given shapes than *bopcheck*.
8808
8809**Example:**
8810Let's make an edge with big vertices:
8811~~~~
8812vertex v1 0 0 0
8813settolerance v1 0.5
8814vertex v2 1 0 0
8815settolerance v2 0.5
8816edge e v1 v2
8817top; don e; fit
8818tolsphere e
8819
8820bopargcheck e
8821~~~~
8822Here is the output of this command:
8823~~~~
8824Made faulty shape: s1si_1
8825Made faulty shape: s1se_1
8826Faulties for FIRST shape found : 2
8827---------------------------------
8828Shapes are not suppotrted by BOP: NO
8829Self-Intersections : YES Cases(1) Total shapes(2)
8830Check for SI has been aborted : NO
8831Too small edges : YES Cases(1) Total shapes(1)
8832Bad faces : NO
8833Too close vertices : DISABLED
8834Too close edges : DISABLED
8835Shapes with Continuity C0 : NO
8836Invalid Curve on Surface : NO
8837
8838Faulties for SECOND shape found : 0
8839~~~~
8840
8841@subsection occt_draw_bop_debug Debug commands
8842
8843The following terms and definitions are used in this chapter:
3f812249 8844* **DS** -- internal data structure used by the algorithm (*BOPDS_DS* object).
8845* **PaveFiller** -- intersection part of the algorithm (*BOPAlgo_PaveFiller* object).
8846* **Builder** -- builder part of the algorithm (*BOPAlgo_Builder* object).
8847* **IDS Index** -- the index of the vector *myLines*.
1a457208 8848
948fe6ca 8849@subsubsection occt_draw_bop_debug_int Intersection Part commands
1a457208 8850
8851All commands listed below are available when the Intersection Part of the algorithm is done (i.e. after the command *bfillds*).
8852
948fe6ca 8853**bopds**
1a457208 8854
8855Syntax:
8856~~~~
3f812249 8857bopds -v [e, f]
1a457208 8858~~~~
8859
8860Displays:
8861* all BRep shapes of arguments that are in the DS [default];
3f812249 8862* <i>-v</i> : only vertices of arguments that are in the DS;
8863* <i>-e</i> : only edges of arguments that are in the DS;
8864* <i>-f</i> : only faces of arguments that are in the DS.
1a457208 8865
948fe6ca 8866**bopdsdump**
1a457208 8867
8868Prints contents of the DS.
8869
8870Example:
1a457208 8871~~~~
8872 Draw[28]> bopdsdump
8873 *** DS ***
8874 Ranges:2 number of ranges
8875 range: 0 33 indices for range 1
8876 range: 34 67 indices for range 2
8877 Shapes:68 total number of source shapes
8878 0 : SOLID { 1 }
8879 1 : SHELL { 2 12 22 26 30 32 }
8880 2 : FACE { 4 5 6 7 8 9 10 11 }
8881 3 : WIRE { 4 7 9 11 }
8882 4 : EDGE { 5 6 }
8883 5 : VERTEX { }
8884 6 : VERTEX { }
8885 7 : EDGE { 8 5 }
8886 8 : VERTEX { }
8887~~~~
8888
8889@code 0 : SOLID { 1 } @endcode has the following meaning:
3f812249 8890* *0* -- index in the DS;
8891* *SOLID* -- type of the shape;
8892* <i>{ 1 }</i> -- a DS index of the successors.
1a457208 8893
948fe6ca 8894
8895**bopindex**
1a457208 8896
8897Syntax:
8898~~~~
8899bopindex S
8900~~~~
8901Prints DS index of shape *S*.
8902
948fe6ca 8903
8904**bopiterator**
1a457208 8905
8906Syntax:
8907~~~~~
8908bopiterator [t1 t2]
8909~~~~~
8910
8911Prints pairs of DS indices of source shapes that are intersected in terms of bounding boxes.
8912
8913<i>[t1 t2]</i> are types of the shapes:
3f812249 8914* *7* -- vertex;
8915* *6* -- edge;
8916* *4* -- face.
1a457208 8917
8918Example:
8919~~~~
8920 Draw[104]> bopiterator 6 4
8921 EF: ( z58 z12 )
8922 EF: ( z17 z56 )
8923 EF: ( z19 z64 )
8924 EF: ( z45 z26 )
8925 EF: ( z29 z36 )
8926 EF: ( z38 z32 )
8927~~~~
8928
8929* *bopiterator 6 4* prints pairs of indices for types: edge/face;
3f812249 8930* *z58 z12* -- DS indices of intersecting edge and face.
1a457208 8931
8932
948fe6ca 8933**bopinterf**
1a457208 8934
8935Syntax:
8936~~~~
8937bopinterf t
8938~~~~
8939
8940Prints contents of *myInterfTB* for the type of interference *t*:
8941* *t=0* : vertex/vertex;
8942* *t=1* : vertex/edge;
8943* *t=2* : edge/edge;
8944* *t=3* : vertex/face;
8945* *t=4* : edge/face.
8946
8947Example:
8948~~~~
8949 Draw[108]> bopinterf 4
8950 EF: (58, 12, 68), (17, 56, 69), (19, 64, 70), (45, 26, 71), (29, 36, 72), (38, 32, 73), 6 EF found.
8951~~~~
8952
8953Here, record <i>(58, 12, 68)</i> means:
3f812249 8954* *58* -- a DS index of the edge;
8955* *12* -- a DS index of the face;
8956* *68* -- a DS index of the new vertex.
1a457208 8957
948fe6ca 8958
8959**bopsp**
1a457208 8960
8961Displays split edges.
8962
8963Example:
8964~~~~
8965 Draw[33]> bopsp
8966 edge 58 : z58_74 z58_75
8967 edge 17 : z17_76 z17_77
8968 edge 19 : z19_78 z19_79
8969 edge 45 : z45_80 z45_81
8970 edge 29 : z29_82 z29_83
8971 edge 38 : z38_84 z38_85
8972~~~~
8973
3f812249 8974* *edge 58* -- 58 is a DS index of the original edge.
8975* *z58_74 z58_75* -- split edges, where 74, 75 are DS indices of the split edges.
1a457208 8976
948fe6ca 8977**bopcb**
72b7576f 8978
1a457208 8979Syntax:
8980~~~~
8981bopcb [nE]
8982~~~~
8983
8984Prints Common Blocks for:
8985* all source edges (by default);
8986* the source edge with the specified index *nE*.
8987
8988Example:
8989~~~~
8990 Draw[43]> bopcb 17
8991 -- CB:
8992 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
8993 Faces: 36
8994~~~~
8995
8996This command dumps common blocks for the source edge with index 17.
3f812249 8997* *PB* -- information about the Pave Block;
8998 * *71* -- a DS index of the split edge
8999 * *17* -- a DS index of the original edge
9000* <i>Pave1 : { 68 3.000 }</i> -- information about the Pave:
9001 * *68* -- a DS index of the vertex of the pave
9002 * *3.000* -- a parameter of vertex 68 on edge 17
9003* *Faces: 36* -- 36 is a DS index of the face the common block belongs to.
1a457208 9004
9005
948fe6ca 9006**bopfin**
1a457208 9007
9008Syntax:
1a457208 9009~~~~
9010bopfin nF
9011~~~~
9012Prints Face Info about IN-parts for the face with DS index *nF*.
9013
9014Example:
9015~~~~
9016 Draw[47]> bopfin 36
9017 pave blocks In:
9018 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
9019 PB:{ E:75 orE:19 Pave1: { 69 3.000 } Pave2: { 18 10.000 } }
9020 vrts In:
9021 18
9022~~~~
9023
9024
3f812249 9025* <i>PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }</i> -- information about the Pave Block;
9026* <i>vrts In ... 18 </i> -- a DS index of the vertex IN the face.
1a457208 9027
948fe6ca 9028**bopfon**
1a457208 9029
9030Syntax:
9031~~~~
9032bopfon nF
9033~~~~
9034Print Face Info about ON-parts for the face with DS index *nF*.
9035
9036Example:
9037~~~~
9038 Draw[58]> bopfon 36
9039 pave blocks On:
9040 PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }
9041 PB:{ E:76 orE:45 Pave1: { 69 0.000 } Pave2: { 71 10.000 } }
9042 PB:{ E:78 orE:43 Pave1: { 71 0.000 } Pave2: { 70 10.000 } }
9043 PB:{ E:74 orE:41 Pave1: { 68 0.000 } Pave2: { 70 10.000 } }
9044 vrts On:
9045 68 69 70 71
9046~~~~
9047
3f812249 9048* <i>PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }</i> -- information about the Pave Block;
9049* <i>vrts On: ... 68 69 70 71</i> -- DS indices of the vertices ON the face.
1a457208 9050
948fe6ca 9051**bopwho**
1a457208 9052
9053Syntax:
9054~~~~
9055bopwho nS
9056~~~~
9057
9058Prints the information about the shape with DS index *nF*.
9059
9060Example:
9061~~~~
9062 Draw[116]> bopwho 5
9063 rank: 0
9064~~~~
9065
3f812249 9066* *rank: 0* -- means that shape 5 results from the Argument with index 0.
1a457208 9067
9068Example:
9069~~~~
9070 Draw[118]> bopwho 68
9071 the shape is new
9072 EF: (58, 12),
9073 FF curves: (12, 56),
9074 FF curves: (12, 64),
9075~~~~
9076
9077This means that shape 68 is a result of the following interferences:
3f812249 9078* *EF: (58, 12)* -- edge 58 / face 12
9079* *FF curves: (12, 56)* -- edge from the intersection curve between faces 12 and 56
9080* *FF curves: (12, 64)* -- edge from the intersection curve between faces 12 and 64
1a457208 9081
948fe6ca 9082**bopnews**
1a457208 9083
9084Syntax:
9085~~~~
9086bopnews -v [-e]
9087~~~~
9088
3f812249 9089* <i>-v</i> -- displays all new vertices produced during the operation;
9090* <i>-e</i> -- displays all new edges produced during the operation.
1a457208 9091
948fe6ca 9092@subsubsection occt_draw_bop_debug_build Building Part commands
1a457208 9093
9094The commands listed below are available when the Building Part of the algorithm is done (i.e. after the command *bbuild*).
9095
948fe6ca 9096**bopim**
1a457208 9097
9098Syntax:
1a457208 9099~~~~
9100bopim S
9101~~~~
9102Shows the compound of shapes that are images of shape *S* from the argument.
9103
9104
bf62b306 9105@section occt_draw_8 Data Exchange commands
72b7576f 9106
1a457208 9107This chapter presents some general information about Data Exchange (DE) operations.
72b7576f 9108
9109DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.)
9110
bf62b306 9111This 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
9112* for <a href="user_guides__step.html#occt_step_1">STEP format</a> and
9113* for <a href="user_guides__iges.html#occt_iges_1">IGES format</a>.
72b7576f 9114
bf62b306 9115Each Draw session has an interface model, which is a structure for keeping various information.
72b7576f 9116
bf62b306 9117The first step of translation is loading information from a file into a model.
9118The second step is creation of an OpenCASCADE shape from this model.
72b7576f 9119
bf62b306 9120Each 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 9121
bf62b306 9122The model and the map are used for working with most of DE commands.
72b7576f 9123
bf62b306 9124@subsection occt_draw_8_1 IGES commands
72b7576f 9125
bf62b306 9126@subsubsection occt_draw_8_1_1 igesread
9127
9128Syntax:
9129~~~~~
9130igesread <file_name> <result_shape_name> [<selection>]
9131~~~~~
9132
9133Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted.
72b7576f 9134
bf62b306 9135
ba06f8bb 9136| N | Mode | Description |
bf62b306 9137| :-- | :-- | :---------- |
ba06f8bb 9138| 0 | End | finish conversion and exit igesbrep |
9139| 1 | Visible roots | convert only visible roots |
9140| 2 | All roots | convert all roots |
9141| 3 | One entity | convert entity with number provided by the user |
9142| 4 | Selection | convert only entities contained in selection |
72b7576f 9143
9144
9145After 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 9146
bf62b306 9147The 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*.
9148
ba06f8bb 9149<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 9150
9151See also the detailed description of <a href="user_guides__iges.html#occt_iges_2_3_4">Selecting IGES entities</a>.
9152
9153**Example:**
9154~~~~~
72b7576f 9155# translation all roots from file
9156igesread /disk01/files/model.igs a *
bf62b306 9157~~~~~
72b7576f 9158
bf62b306 9159@subsubsection occt_draw_8_1_2 tplosttrim
72b7576f 9160
bf62b306 9161Syntax:
9162~~~~~
9163tplosttrim [<IGES_type>]
9164~~~~~
72b7576f 9165
9166Sometimes 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.
9167It 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 9168Optional parameter <i>\<IGES_type\></i> can be *0TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces.
72b7576f 9169
bf62b306 9170**Example:**
9171~~~~~
72b7576f 9172tplosttrim TrimmedSurface
bf62b306 9173~~~~~
72b7576f 9174
bf62b306 9175@subsubsection occt_draw_8_1_3 brepiges
72b7576f 9176
bf62b306 9177Syntax:
9178~~~~~
9179brepiges <shape_name> <filename.igs>
9180~~~~~
72b7576f 9181
9182Writes an OCCT shape to an IGES file.
bf62b306 9183
e5bd0d98 9184**Example:**
bf62b306 9185~~~~~
72b7576f 9186# write shape with name aa to IGES file
9187brepiges aa /disk1/tmp/aaa.igs
9188== unit (write) : MM
dba69de2 9189== mode write : Faces
a25d5aaa 9190== To modify : command param
72b7576f 9191== 1 Shapes written, giving 345 Entities
dba69de2 9192== Now, to write a file, command : writeall filename
9193== Output on file : /disk1/tmp/aaa.igs
9194== Write OK
bf62b306 9195~~~~~
72b7576f 9196
bf62b306 9197@subsection occt_draw_8_2 STEP commands
72b7576f 9198
9199These commands are used during the translation of STEP models.
9200
9201
bf62b306 9202@subsubsection occt_draw_8_2_1 stepread
72b7576f 9203
bf62b306 9204Syntax:
9205~~~~~
9206stepread file_name result_shape_name [selection]
9207~~~~~
72b7576f 9208
9209Read a STEP file to an OCCT shape.
9210This command will interactively ask the user to select a set of entities to be converted:
9211
bf62b306 9212| N | Mode | Description |
9213| :---- | :---- | :---- |
ba06f8bb 9214| 0 | End | Finish transfer and exit stepread |
9215| 1 | root with rank 1 | Transfer first root |
9216| 2 | root by its rank | Transfer root specified by its rank |
9217| 3 | One entity | Transfer entity with a number provided by the user |
9218| 4 | Selection | Transfer only entities contained in selection |
72b7576f 9219
9220After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes.
bf62b306 9221The 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 9222<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 9223
bf62b306 9224See also the detailed description of <a href="user_guides__step.html#occt_step_2_3_6">Selecting STEP entities</a>.
9225
9226**Example:**
9227~~~~~
72b7576f 9228# translation all roots from file
9229stepread /disk01/files/model.stp a *
bf62b306 9230~~~~~
9231
9232@subsubsection occt_draw_8_2_2 stepwrite
9233
9234Syntax:
9235~~~~~
9236stepwrite mode shape_name file_name
9237~~~~~
72b7576f 9238
bf62b306 9239Writes an OCCT shape to a STEP file.
72b7576f 9240
bf62b306 9241The following modes are available :
3f812249 9242 * *a* -- as is -- the mode is selected automatically depending on the type & geometry of the shape;
9243 * *m* -- *manifold_solid_brep* or *brep_with_voids*
9244 * *f* -- *faceted_brep*
9245 * *w* -- *geometric_curve_set*
9246 * *s* -- *shell_based_surface_model*
ba06f8bb 9247
bf62b306 9248For further information see <a href="#user_guides__step.html#occt_step_6_5">Writing a STEP file</a>.
72b7576f 9249
e5bd0d98 9250**Example:**
72b7576f 9251
bf62b306 9252Let us write shape *a* to a STEP file in mode *0*.
9253
9254~~~~~
72b7576f 9255stepwrite 0 a /disk1/tmp/aaa.igs
bf62b306 9256~~~~~
72b7576f 9257
9258
bf62b306 9259@subsection occt_draw_8_3 General commands
72b7576f 9260
bf62b306 9261These are auxilary commands used for the analysis of result of translation of IGES and STEP files.
72b7576f 9262
bf62b306 9263@subsubsection occt_draw_8_3_1 count
72b7576f 9264
bf62b306 9265Syntax:
9266~~~~~
9267count <counter> [<selection>]
9268~~~~~
72b7576f 9269
bf62b306 9270Calculates statistics on the entities in the model and outputs a count of entities.
72b7576f 9271
bf62b306 9272The 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 9273
ba06f8bb 9274| Counter | Operation |
bf62b306 9275| :-------- | :-------- |
ba06f8bb 9276| xst-types | Calculates how many entities of each OCCT type exist |
9277| step214-types | Calculates how many entities of each STEP type exist |
72b7576f 9278
bf62b306 9279**Example:**
9280~~~~~
72b7576f 9281count xst-types
bf62b306 9282~~~~~
9283
9284@subsubsection occt_draw_8_3_2 data
72b7576f 9285
bf62b306 9286Syntax:
9287~~~~~
9288data <symbol>
9289~~~~~
72b7576f 9290
bf62b306 9291Obtains general statistics on the loaded data.
9292The information printed by this command depends on the symbol specified.
72b7576f 9293
e5bd0d98 9294**Example:**
bf62b306 9295~~~~~
72b7576f 9296# print full information about warnings and fails
9297data c
bf62b306 9298~~~~~
9299
ba06f8bb 9300| Symbol | Output |
bf62b306 9301| :------ | :------ |
ba06f8bb 9302| g | Prints the information contained in the header of the file |
9303| 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) |
9304| t | The same as c or f, with a list of failed or warned entities |
bf62b306 9305| m or l | The same as t but also prints a status for each entity |
9306| e | Lists all entities of the model with their numbers, types, validity status etc. |
ba06f8bb 9307| R | The same as e but lists only root entities |
bf62b306 9308
72b7576f 9309
72b7576f 9310
bf62b306 9311@subsubsection occt_draw_8_3_3 elabel
9312
9313Syntax:
9314~~~~~
9315elabel <num>
9316~~~~~
72b7576f 9317
9318Entities 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 9319
bf62b306 9320**Example:**
9321~~~~~
72b7576f 9322elabel 84
bf62b306 9323~~~~~
72b7576f 9324
bf62b306 9325@subsubsection occt_draw_8_3_4 entity
72b7576f 9326
bf62b306 9327Syntax:
9328~~~~~
9329entity <#(D)>_or_<num> <level_of_information>
9330~~~~~
72b7576f 9331
9332The content of an IGES or STEP entity can be obtained by using this command.
9333Entity can be determined by its number or label.
ba06f8bb 9334<i>\<level_of_information\></i> has range [0-6]. You can get more information about this level using this command without parameters.
72b7576f 9335
bf62b306 9336**Example:**
9337~~~~~
72b7576f 9338# full information for STEP entity with label 84
9339entity #84 6
bf62b306 9340~~~~~
72b7576f 9341
bf62b306 9342@subsubsection occt_draw_8_3_5 enum
72b7576f 9343
bf62b306 9344Syntax:
9345~~~~~
9346enum <#(D)>
9347~~~~~
72b7576f 9348
9349Prints a number for the entity with a given label.
72b7576f 9350
bf62b306 9351**Example:**
9352~~~~~
72b7576f 9353# give a number for IGES entity with label 21
9354enum D21
bf62b306 9355~~~~~
72b7576f 9356
bf62b306 9357@subsubsection occt_draw_8_3_6 estatus
72b7576f 9358
bf62b306 9359Syntax:
9360~~~~~
9361estatus <#(D)>_or_<num>
9362~~~~~
72b7576f 9363
9364The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command.
72b7576f 9365
bf62b306 9366**Example:**
9367~~~~~
72b7576f 9368estatus #315
bf62b306 9369~~~~~
9370
9371@subsubsection occt_draw_8_3_7 fromshape
72b7576f 9372
bf62b306 9373Syntax:
9374~~~~~
9375fromshape <shape_name>
9376~~~~~
72b7576f 9377
bf62b306 9378Gives 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 9379
e5bd0d98 9380**Example:**
bf62b306 9381~~~~~
72b7576f 9382fromshape a_1_23
bf62b306 9383~~~~~
72b7576f 9384
bf62b306 9385@subsubsection occt_draw_8_3_8 givecount
72b7576f 9386
ba06f8bb 9387Syntax:
bf62b306 9388~~~~~
9389givecount <selection_name> [<selection_name>]
9390~~~~~
72b7576f 9391
72b7576f 9392
bf62b306 9393Prints a number of loaded entities defined by the selection argument.
ba06f8bb 9394Possible values of \<selection_name\> you can find in the “IGES FORMAT Users’s Guide”.
bf62b306 9395
9396**Example:**
9397~~~~~
72b7576f 9398givecount xst-model-roots
bf62b306 9399~~~~~
72b7576f 9400
bf62b306 9401@subsubsection occt_draw_8_3_9 givelist
72b7576f 9402
bf62b306 9403Syntax:
9404~~~~~
9405givelist <selection_name>
9406~~~~~
72b7576f 9407
9408Prints a list of a subset of loaded entities defined by the selection argument:
ba06f8bb 9409| Selection | Description |
9410| :-------- | :----------- |
9411| xst-model-all | all entities of the model |
9412| xst-model-roots | all roots |
9413| xst-pointed | (Interactively) pointed entities (not used in DRAW) |
9414| xst-transferrable-all | all transferable (recognized) entities |
9415| xst-transferrable-roots | Transferable roots |
72b7576f 9416
72b7576f 9417
bf62b306 9418**Example:**
9419~~~~~
72b7576f 9420# give a list of all entities of the model
9421givelist xst-model-all
bf62b306 9422~~~~~
72b7576f 9423
bf62b306 9424@subsubsection occt_draw_8_3_10 listcount
72b7576f 9425
ba06f8bb 9426Syntax: listcount \<counter\> [\<selection\> ...]
72b7576f 9427
9428Prints a list of entities per each type matching the criteria defined by arguments.
ba06f8bb 9429Optional <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 9430
ba06f8bb 9431| Counter | Operation |
9432| :----- | :------ |
9433| xst-types | Calculates how many entities of each OCCT type exist |
9434| iges-types | Calculates how many entities of each IGES type and form exist |
9435| iges-levels | Calculates how many entities lie in different IGES levels |
72b7576f 9436
bf62b306 9437**Example:**
9438~~~~~
72b7576f 9439listcount xst-types
bf62b306 9440~~~~~
72b7576f 9441
bf62b306 9442@subsubsection occt_draw_8_3_11 listitems
72b7576f 9443
bf62b306 9444Syntax:
9445~~~~~
9446listitems
9447~~~~~
72b7576f 9448
9449This command prints a list of objects (counters, selections etc.) defined in the current session.
72b7576f 9450
72b7576f 9451
bf62b306 9452@subsubsection occt_draw_8_3_12 listtypes
72b7576f 9453
bf62b306 9454Syntax:
9455~~~~~
9456listtypes [<selection_name> ...]
9457~~~~~
72b7576f 9458
9459Gives 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 9460
72b7576f 9461
bf62b306 9462@subsubsection occt_draw_8_3_13 newmodel
72b7576f 9463
bf62b306 9464Syntax:
9465~~~~~
9466newmodel
9467~~~~~
72b7576f 9468
9469Clears the current model.
72b7576f 9470
72b7576f 9471
bf62b306 9472@subsubsection occt_draw_8_3_14 param
72b7576f 9473
bf62b306 9474Syntax:
9475~~~~~
9476param [<parameter>] [<value>]
9477~~~~~
72b7576f 9478
9479This command is used to manage translation parameters.
bf62b306 9480Command without arguments gives a full list of parameters with current values.
ba06f8bb 9481Command 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 9482
e5bd0d98 9483**Example:**
72b7576f 9484
bf62b306 9485Let us get the information about possible schemes for writing STEP file :
9486
9487~~~~~
72b7576f 9488param write.step.schema
bf62b306 9489~~~~~
72b7576f 9490
bf62b306 9491@subsubsection occt_draw_8_3_15 sumcount
72b7576f 9492
bf62b306 9493Syntax:
9494~~~~~
9495sumcount <counter> [<selection> ...]
9496~~~~~
72b7576f 9497
9498Prints only a number of entities per each type matching the criteria defined by arguments.
72b7576f 9499
bf62b306 9500**Example:**
9501~~~~~
72b7576f 9502sumcount xst-types
bf62b306 9503~~~~~
72b7576f 9504
bf62b306 9505@subsubsection occt_draw_8_3_16 tpclear
72b7576f 9506
bf62b306 9507Syntax:
9508~~~~~
9509tpclear
9510~~~~~
72b7576f 9511
9512Clears the map of correspondences between IGES or STEP entities and OCCT shapes.
72b7576f 9513
72b7576f 9514
72b7576f 9515
bf62b306 9516@subsubsection occt_draw_8_3_17 tpdraw
72b7576f 9517
bf62b306 9518Syntax:
9519~~~~~
9520tpdraw <#(D)>_or_<num>
9521~~~~~
72b7576f 9522
bf62b306 9523**Example:**
9524~~~~~
72b7576f 9525tpdraw 57
bf62b306 9526~~~~~
72b7576f 9527
bf62b306 9528@subsubsection occt_draw_8_3_18 tpent
9529
9530Syntax:
9531~~~~~
9532tpent <#(D)>_or_<num>
9533~~~~~
72b7576f 9534
bf62b306 9535Get information about the result of translation of the given IGES or STEP entity.
72b7576f 9536
e5bd0d98 9537**Example:**
bf62b306 9538~~~~~
9539tpent \#23
9540~~~~~
9541
9542@subsubsection occt_draw_8_3_19 tpstat
9543
9544Syntax:
9545~~~~~
9546tpstat [*|?]<symbol> [<selection>]
9547~~~~~
72b7576f 9548
72b7576f 9549
ba06f8bb 9550Provides 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 9551
3f812249 9552* *g* -- General statistics (a list of results and messages)
9553* *c* -- Count of all warning and fail messages
9554* *C* -- List of all warning and fail messages
9555* *f* -- Count of all fail messages
9556* *F* -- List of all fail messages
9557* *n* -- List of all transferred roots
9558* *s* -- The same, with types of source entity and the type of result
9559* *b* -- The same, with messages
9560* *t* -- Count of roots for geometrical types
9561* *r* -- Count of roots for topological types
9562* *l* -- The same, with the type of the source entity
72b7576f 9563
bf62b306 9564The sign \* before parameters *n, s, b, t, r* makes it work on all entities (not only on roots).
72b7576f 9565
bf62b306 9566The sign ? before *n, s, b, t* limits the scope of information to invalid entities.
72b7576f 9567
bf62b306 9568Optional argument \<selection\> can limit the action of the command to the selection, not to all entities.
72b7576f 9569
bf62b306 9570To get help, run this command without arguments.
9571
9572**Example:**
9573~~~~~
72b7576f 9574# translation ratio on IGES faces
9575tpstat *l iges-faces
bf62b306 9576~~~~~
72b7576f 9577
bf62b306 9578@subsubsection occt_draw_8_3_20 xload
72b7576f 9579
bf62b306 9580Syntax:
9581~~~~~
9582xload <file_name>
9583~~~~~
72b7576f 9584
9585This 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 9586
bf62b306 9587**Example:**
9588~~~~~
72b7576f 9589xload /disk1/tmp/aaa.stp
bf62b306 9590~~~~~
72b7576f 9591
9592
bf62b306 9593@subsection occt_draw_8_4 Overview of XDE commands
72b7576f 9594
3f812249 9595These 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 9596 * XDE translation commands
9597 * XDE general commands
9598 * XDE shape’s commands
9599 * XDE color’s commands
9600 * XDE layer’s commands
9601 * XDE property’s commands
72b7576f 9602
67d7f07f 9603Reminding: All operations of translation are performed with parameters managed by command @ref occt_draw_8_3_14 "param".
72b7576f 9604
bf62b306 9605@subsubsection occt_draw_8_4_1 ReadIges
72b7576f 9606
bf62b306 9607Syntax:
9608~~~~~
9609ReadIges document file_name
9610~~~~~
72b7576f 9611
9612Reads information from an IGES file to an XCAF document.
72b7576f 9613
bf62b306 9614**Example:**
9615~~~~~
72b7576f 9616ReadIges D /disk1/tmp/aaa.igs
bf62b306 9617==> Document saved with name D
9618~~~~~
72b7576f 9619
bf62b306 9620@subsubsection occt_draw_8_4_2 ReadStep
72b7576f 9621
bf62b306 9622Syntax:
9623~~~~~
9624ReadStep <document> <file_name>
9625~~~~~
72b7576f 9626
9627Reads information from a STEP file to an XCAF document.
72b7576f 9628
bf62b306 9629**Example:**
9630~~~~~
72b7576f 9631ReadStep D /disk1/tmp/aaa.stp
9632== Document saved with name D
bf62b306 9633~~~~~
72b7576f 9634
bf62b306 9635@subsubsection occt_draw_8_4_3 WriteIges
72b7576f 9636
bf62b306 9637Syntax:
9638~~~~~
9639WriteIges <document> <file_name>
9640~~~~~
72b7576f 9641
e5bd0d98 9642**Example:**
bf62b306 9643~~~~~
72b7576f 9644WriteIges D /disk1/tmp/aaa.igs
bf62b306 9645~~~~~
72b7576f 9646
bf62b306 9647@subsubsection occt_draw_8_4_4 WriteStep
72b7576f 9648
bf62b306 9649Syntax:
9650~~~~~
9651WriteStep <document> <file_name>
9652~~~~~
72b7576f 9653
9654Writes information from an XCAF document to a STEP file.
72b7576f 9655
bf62b306 9656**Example:**
9657~~~~~
72b7576f 9658WriteStep D /disk1/tmp/aaa.stp
bf62b306 9659~~~~~
72b7576f 9660
bf62b306 9661@subsubsection occt_draw_8_4_5 XFileCur
72b7576f 9662
bf62b306 9663Syntax:
9664~~~~~
9665XFileCur
9666~~~~~
72b7576f 9667
9668Returns the name of file which is set as the current one in the Draw session.
72b7576f 9669
bf62b306 9670**Example:**
9671~~~~~
72b7576f 9672XFileCur
9673== *as1-ct-203.stp*
bf62b306 9674~~~~~
72b7576f 9675
bf62b306 9676@subsubsection occt_draw_8_4_6 XFileList
72b7576f 9677
bf62b306 9678Syntax:
9679~~~~~
9680XFileList
9681~~~~~
72b7576f 9682
dba69de2 9683Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file.
72b7576f 9684
bf62b306 9685**Example:**
9686~~~~~
72b7576f 9687XFileList
bf62b306 9688==> *as1-ct-Bolt.stp*
9689==> *as1-ct-L-Bracktet.stp*
9690==> *as1-ct-LBA.stp*
9691==> *as1-ct-NBA.stp*
9692==> …
9693~~~~~
72b7576f 9694
bf62b306 9695@subsubsection occt_draw_8_4_7 XFileSet
72b7576f 9696
bf62b306 9697Syntax:
9698~~~~~
9699XFileSet <filename>
9700~~~~~
72b7576f 9701
9702Sets the current file taking it from the components list of the assemble file.
72b7576f 9703
bf62b306 9704**Example:**
9705~~~~~
72b7576f 9706XFileSet as1-ct-NBA.stp
bf62b306 9707~~~~~
72b7576f 9708
bf62b306 9709@subsubsection occt_draw_8_4_8 XFromShape
72b7576f 9710
bf62b306 9711Syntax:
9712~~~~~
9713XFromShape <shape>
9714~~~~~
72b7576f 9715
67d7f07f 9716This command is similar to the command @ref occt_draw_8_3_7 "fromshape", but gives additional information about the file name. It is useful if a shape was translated from several files.
72b7576f 9717
bf62b306 9718**Example:**
9719~~~~~
72b7576f 9720XFromShape a
bf62b306 9721==> Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp
9722~~~~~
72b7576f 9723
bf62b306 9724@subsection occt_draw_8_5 XDE general commands
72b7576f 9725
bf62b306 9726@subsubsection occt_draw_8_5_1 XNewDoc
72b7576f 9727
bf62b306 9728Syntax:
9729~~~~~
9730XNewDoc <document>
9731~~~~~
72b7576f 9732
9733Creates a new XCAF document.
72b7576f 9734
bf62b306 9735**Example:**
9736~~~~~
72b7576f 9737XNewDoc D
bf62b306 9738~~~~~
72b7576f 9739
bf62b306 9740@subsubsection occt_draw_8_5_2 XShow
72b7576f 9741
bf62b306 9742Syntax:
9743~~~~~
9744XShow <document> [ <label1> … ]
9745~~~~~
72b7576f 9746
3f812249 9747Shows a shape from a given label in the 3D viewer. If the label is not given -- shows all shapes from the document.
72b7576f 9748
bf62b306 9749**Example:**
9750~~~~~
72b7576f 9751# show shape from label 0:1:1:4 from document D
9752XShow D 0:1:1:4
bf62b306 9753~~~~~
72b7576f 9754
bf62b306 9755@subsubsection occt_draw_8_5_3 XStat
72b7576f 9756
bf62b306 9757Syntax:
9758~~~~~
9759XStat <document>
9760~~~~~
72b7576f 9761
9762Prints common information from an XCAF document.
72b7576f 9763
bf62b306 9764**Example:**
9765~~~~~
72b7576f 9766XStat D
bf62b306 9767==>Statistis of shapes in the document:
9768==>level N 0 : 9
9769==>level N 1 : 18
9770==>level N 2 : 5
9771==>Total number of labels for shapes in the document = 32
9772==>Number of labels with name = 27
9773==>Number of labels with color link = 3
72b7576f 9774==Number of labels with layer link = 0
bf62b306 9775==>Statistis of Props in the document:
9776==>Number of Centroid Props = 5
9777==>Number of Volume Props = 5
9778==>Number of Area Props = 5
9779==>Number of colors = 4
9780==>BLUE1 RED YELLOW BLUE2
9781==>Number of layers = 0
9782~~~~~
72b7576f 9783
bf62b306 9784@subsubsection occt_draw_8_5_4 XWdump
72b7576f 9785
bf62b306 9786Syntax:
9787~~~~~
9788XWdump <document> <filename>
9789~~~~~
72b7576f 9790
9791Saves the contents of the viewer window as an image (XWD, png or BMP file).
a25d5aaa 9792<i>\<filename\></i> must have a corresponding extension.
72b7576f 9793
bf62b306 9794**Example:**
9795~~~~~
72b7576f 9796XWdump D /disk1/tmp/image.png
bf62b306 9797~~~~~
72b7576f 9798
bf62b306 9799@subsubsection occt_draw_8_5_5 Xdump
72b7576f 9800
bf62b306 9801Syntax:
9802~~~~~
9803Xdump <document> [int deep {0|1}]
9804~~~~~
72b7576f 9805
9806Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes.
72b7576f 9807
bf62b306 9808**Example:**
9809~~~~~
72b7576f 9810Xdump D 1
bf62b306 9811==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
9812==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
9813==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
9814==> ASSEMBLY 0:1:1:4 PLATE(0xe8387780)
9815==> ASSEMBLY 0:1:1:5 ROD(0xe8475418)
9816==> ASSEMBLY 0:1:1:6 AS1(0xe8476968)
9817==> ASSEMBLY 0:1:1:7 L-BRACKET-ASSEMBLY(0xe8476230)
9818==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
9819==> ASSEMBLY 0:1:1:8 NUT-BOLT-ASSEMBLY(0xe8475ec0)
9820==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
9821==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
72b7576f 9822etc.
bf62b306 9823~~~~~
72b7576f 9824
bf62b306 9825@subsection occt_draw_8_6 XDE shape commands
72b7576f 9826
bf62b306 9827@subsubsection occt_draw_8_6_1 XAddComponent
72b7576f 9828
bf62b306 9829Syntax:
9830~~~~~
9831XAddComponent <document> <label> <shape>
9832~~~~~
72b7576f 9833
9834Adds a component shape to assembly.
bf62b306 9835
e5bd0d98 9836**Example:**
72b7576f 9837
bf62b306 9838Let us add shape b as component shape to assembly shape from label *0:1:1:1*
9839
9840~~~~~
72b7576f 9841XAddComponent D 0:1:1:1 b
bf62b306 9842~~~~~
72b7576f 9843
bf62b306 9844@subsubsection occt_draw_8_6_2 XAddShape
72b7576f 9845
bf62b306 9846Syntax:
9847~~~~~
9848XAddShape <document> <shape> [makeassembly=1]
9849~~~~~
72b7576f 9850
9851Adds 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 9852
bf62b306 9853**Example:**
9854~~~~~
72b7576f 9855# add shape b to document D
9856XAddShape D b 0
9857== 0:1:1:10
9858# if pointed shape is compound and last parameter in
9859# XAddShape command is used by default (1), then for
9860# each subshapes new label is created
bf62b306 9861~~~~~
72b7576f 9862
bf62b306 9863@subsubsection occt_draw_8_6_3 XFindComponent
72b7576f 9864
bf62b306 9865Syntax:
9866~~~~~
9867XFindComponent <document> <shape>
9868~~~~~
72b7576f 9869
9870Prints a sequence of labels of the assembly path.
72b7576f 9871
bf62b306 9872**Example:**
9873~~~~~
72b7576f 9874XFindComponent D b
bf62b306 9875~~~~~
72b7576f 9876
bf62b306 9877@subsubsection occt_draw_8_6_4 XFindShape
72b7576f 9878
bf62b306 9879Syntax:
9880~~~~~
9881XFindShape <document> <shape>
9882~~~~~
72b7576f 9883
9884Finds and prints a label with an indicated top-level shape.
72b7576f 9885
bf62b306 9886**Example:**
9887~~~~~
72b7576f 9888XFindShape D a
bf62b306 9889~~~~~
72b7576f 9890
bf62b306 9891@subsubsection occt_draw_8_6_5 XGetFreeShapes
72b7576f 9892
bf62b306 9893Syntax:
9894~~~~~
9895XGetFreeShapes <document> [shape_prefix]
9896~~~~~
72b7576f 9897
9898Print labels or create DRAW shapes for all free shapes in the document.
3f812249 9899If *shape_prefix* is absent -- prints labels, else -- creates DRAW shapes with names
bf62b306 9900<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 9901
bf62b306 9902**Note**: a free shape is a shape to which no other shape refers to.
9903
9904**Example:**
9905~~~~~
72b7576f 9906XGetFreeShapes D
9907== 0:1:1:6 0:1:1:10 0:1:1:12 0:1:1:13
9908
9909XGetFreeShapes D sh
9910== sh_1 sh_2 sh_3 sh_4
bf62b306 9911~~~~~
72b7576f 9912
bf62b306 9913@subsubsection occt_draw_8_6_6 XGetOneShape
72b7576f 9914
bf62b306 9915Syntax:
9916~~~~~
9917XGetOneShape <shape> <document>
9918~~~~~
72b7576f 9919
9920Creates one DRAW shape for all free shapes from a document.
72b7576f 9921
bf62b306 9922**Example:**
9923~~~~~
72b7576f 9924XGetOneShape a D
bf62b306 9925~~~~~
72b7576f 9926
bf62b306 9927@subsubsection occt_draw_8_6_7 XGetReferredShape
72b7576f 9928
bf62b306 9929Syntax:
9930~~~~~
9931XGetReferredShape <document> <label>
9932~~~~~
72b7576f 9933
9934Prints a label that contains a top-level shape that corresponds to a shape at a given label.
72b7576f 9935
bf62b306 9936**Example:**
9937~~~~~
72b7576f 9938XGetReferredShape D 0:1:1:1:1
bf62b306 9939~~~~~
72b7576f 9940
bf62b306 9941@subsubsection occt_draw_8_6_8 XGetShape
72b7576f 9942
bf62b306 9943Syntax:
9944~~~~~
9945XGetShape <result> <document> <label>
9946~~~~~
72b7576f 9947
9948Puts a shape from the indicated label in document to result.
72b7576f 9949
bf62b306 9950**Example:**
9951~~~~~
72b7576f 9952XGetShape b D 0:1:1:3
bf62b306 9953~~~~~
72b7576f 9954
bf62b306 9955@subsubsection occt_draw_8_6_9 XGetTopLevelShapes
72b7576f 9956
bf62b306 9957Syntax:
9958~~~~~
9959XGetTopLevelShapes <document>
9960~~~~~
72b7576f 9961
9962Prints labels that contain top-level shapes.
72b7576f 9963
bf62b306 9964**Example:**
9965~~~~~
72b7576f 9966XGetTopLevelShapes D
9967== 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
99680:1:1:8 0:1:1:9
bf62b306 9969~~~~~
72b7576f 9970
bf62b306 9971@subsubsection occt_draw_8_6_10 XLabelInfo
72b7576f 9972
bf62b306 9973Syntax:
9974~~~~~
9975XLabelInfo <document> <label>
9976~~~~~
72b7576f 9977
9978Prints information about a shape, stored at an indicated label.
bf62b306 9979
e5bd0d98 9980**Example:**
bf62b306 9981~~~~~
72b7576f 9982XLabelInfo D 0:1:1:6
bf62b306 9983==> There are TopLevel shapes. There is an Assembly. This Shape is not used.
9984~~~~~
72b7576f 9985
bf62b306 9986@subsubsection occt_draw_8_6_11 XNewShape
72b7576f 9987
bf62b306 9988Syntax:
9989~~~~~
9990XNewShape <document>
9991~~~~~
72b7576f 9992
9993Creates a new empty top-level shape.
72b7576f 9994
bf62b306 9995**Example:**
9996~~~~~
72b7576f 9997XNewShape D
bf62b306 9998~~~~~
72b7576f 9999
bf62b306 10000@subsubsection occt_draw_8_6_12 XRemoveComponent
72b7576f 10001
bf62b306 10002Syntax:
10003~~~~~
10004XRemoveComponent <document> <label>
10005~~~~~
72b7576f 10006
10007Removes a component from the components label.
72b7576f 10008
bf62b306 10009**Example:**
10010~~~~~
72b7576f 10011XRemoveComponent D 0:1:1:1:1
bf62b306 10012~~~~~
72b7576f 10013
bf62b306 10014@subsubsection occt_draw_8_6_13 XRemoveShape
72b7576f 10015
bf62b306 10016Syntax:
10017~~~~~
10018XRemoveShape <document> <label>
10019~~~~~
72b7576f 10020
10021Removes a shape from a document (by it’s label).
72b7576f 10022
bf62b306 10023**Example:**
10024~~~~~
72b7576f 10025XRemoveShape D 0:1:1:2
bf62b306 10026~~~~~
72b7576f 10027
bf62b306 10028@subsubsection occt_draw_8_6_14 XSetShape
72b7576f 10029
bf62b306 10030Syntax:
10031~~~~~
10032XSetShape <document> <label> <shape>
10033~~~~~
72b7576f 10034
10035Sets a shape at the indicated label.
72b7576f 10036
bf62b306 10037**Example:**
10038~~~~~
72b7576f 10039XSetShape D 0:1:1:3 b
bf62b306 10040~~~~~
72b7576f 10041
acc909a8 10042@subsubsection occt_draw_8_6_15 XUpdateAssemblies
10043
10044Syntax:
10045~~~~~
10046XUpdateAssemblies <document>
10047~~~~~
10048
10049Updates all assembly compounds in the XDE document.
10050
10051**Example:**
10052~~~~~
10053XUpdateAssemblies D
10054~~~~~
72b7576f 10055
bf62b306 10056@subsection occt_draw_8_7_ XDE color commands
72b7576f 10057
bf62b306 10058@subsubsection occt_draw_8_7_1 XAddColor
72b7576f 10059
bf62b306 10060Syntax:
10061~~~~~
10062XAddColor <document> <R> <G> <B>
10063~~~~~
72b7576f 10064
10065Adds color in document to the color table. Parameters R,G,B are real.
72b7576f 10066
bf62b306 10067**Example:**
10068~~~~~
72b7576f 10069XAddColor D 0.5 0.25 0.25
bf62b306 10070~~~~~
72b7576f 10071
bf62b306 10072@subsubsection occt_draw_8_7_2 XFindColor
72b7576f 10073
bf62b306 10074Syntax:
10075~~~~~
10076XFindColor <document> <R> <G> <B>
10077~~~~~
72b7576f 10078
10079Finds a label where the indicated color is situated.
72b7576f 10080
bf62b306 10081**Example:**
10082~~~~~
72b7576f 10083XFindColor D 0.25 0.25 0.5
bf62b306 10084==> 0:1:2:2
10085~~~~~
72b7576f 10086
bf62b306 10087@subsubsection occt_draw_8_7_3 XGetAllColors
72b7576f 10088
bf62b306 10089Syntax:
10090~~~~~
10091XGetAllColors <document>
10092~~~~~
72b7576f 10093
10094Prints all colors that are defined in the document.
72b7576f 10095
bf62b306 10096**Example:**
10097~~~~~
72b7576f 10098XGetAllColors D
bf62b306 10099==> RED DARKORANGE BLUE1 GREEN YELLOW3
10100~~~~~
72b7576f 10101
bf62b306 10102@subsubsection occt_draw_8_7_4 XGetColor
72b7576f 10103
bf62b306 10104Syntax:
10105~~~~~
10106XGetColor <document> <label>
10107~~~~~
72b7576f 10108
10109Returns a color defined at the indicated label from the color table.
72b7576f 10110
bf62b306 10111**Example:**
10112~~~~~
72b7576f 10113XGetColor D 0:1:2:3
10114== BLUE1
bf62b306 10115~~~~~
72b7576f 10116
bf62b306 10117@subsubsection occt_draw_8_7_5 XGetObjVisibility
72b7576f 10118
bf62b306 10119Syntax:
10120~~~~~
10121XGetObjVisibility <document> {<label>|<shape>}
10122~~~~~
72b7576f 10123
10124Returns the visibility of a shape.
72b7576f 10125
bf62b306 10126**Example:**
10127~~~~~
72b7576f 10128XGetObjVisibility D 0:1:1:4
bf62b306 10129~~~~~
72b7576f 10130
bf62b306 10131@subsubsection occt_draw_8_7_6 XGetShapeColor
72b7576f 10132
bf62b306 10133Syntax:
10134~~~~~
10135XGetShapeColor <document> <label> <colortype(s|c)>
10136~~~~~
72b7576f 10137
3f812249 10138Returns the color defined by label. If <i>colortype</i>=’s’ -- returns surface color, else -- returns curve color.
72b7576f 10139
bf62b306 10140**Example:**
10141~~~~~
72b7576f 10142XGetShapeColor D 0:1:1:4 c
bf62b306 10143~~~~~
72b7576f 10144
bf62b306 10145@subsubsection occt_draw_8_7_7 XRemoveColor
72b7576f 10146
bf62b306 10147Syntax:
10148~~~~~
10149XRemoveColor <document> <label>
10150~~~~~
72b7576f 10151
10152Removes a color from the color table in a document.
72b7576f 10153
bf62b306 10154**Example:**
10155~~~~~
72b7576f 10156XRemoveColor D 0:1:2:1
bf62b306 10157~~~~~
72b7576f 10158
bf62b306 10159@subsubsection occt_draw_8_7_8 XSetColor
72b7576f 10160
bf62b306 10161Syntax:
10162~~~~~
10163XSetColor <document> {<label>|<shape>} <R> <G> <B>
10164~~~~~
72b7576f 10165
10166Sets an RGB color to a shape given by label.
72b7576f 10167
bf62b306 10168**Example:**
10169~~~~~
72b7576f 10170XsetColor D 0:1:1:4 0.5 0.5 0.
bf62b306 10171~~~~~
72b7576f 10172
bf62b306 10173@subsubsection occt_draw_8_7_9 XSetObjVisibility
72b7576f 10174
bf62b306 10175Syntax:
10176~~~~~
10177XSetObjVisibility <document> {<label>|<shape>} {0|1}
10178~~~~~
72b7576f 10179
10180Sets the visibility of a shape.
72b7576f 10181
bf62b306 10182**Example:**
10183~~~~~
72b7576f 10184# set shape from label 0:1:1:4 as invisible
10185XSetObjVisibility D 0:1:1:4 0
bf62b306 10186~~~~~
72b7576f 10187
bf62b306 10188@subsubsection occt_draw_8_7_10 XUnsetColor
72b7576f 10189
bf62b306 10190Syntax:
10191~~~~~
10192XUnsetColor <document> {<label>|<shape>} <colortype>
10193~~~~~
72b7576f 10194
bf62b306 10195Unset a color given type (‘s’ or ‘c’) for the indicated shape.
72b7576f 10196
bf62b306 10197**Example:**
10198~~~~~
72b7576f 10199XUnsetColor D 0:1:1:4 s
bf62b306 10200~~~~~
10201
72b7576f 10202
bf62b306 10203@subsection occt_draw_8_8_ XDE layer commands
72b7576f 10204
bf62b306 10205@subsubsection occt_draw_8_8_1 XAddLayer
72b7576f 10206
bf62b306 10207Syntax:
10208~~~~~
10209XAddLayer <document> <layer>
10210~~~~~
72b7576f 10211
bf62b306 10212Adds a new layer in an XCAF document.
72b7576f 10213
e5bd0d98 10214**Example:**
bf62b306 10215~~~~~
72b7576f 10216XAddLayer D layer2
bf62b306 10217~~~~~
72b7576f 10218
bf62b306 10219@subsubsection occt_draw_8_8_2 XFindLayer
72b7576f 10220
bf62b306 10221Syntax:
10222~~~~~
10223XFindLayer <document> <layer>
10224~~~~~
72b7576f 10225
10226Prints a label where a layer is situated.
72b7576f 10227
bf62b306 10228**Example:**
10229~~~~~
72b7576f 10230XFindLayer D Bolt
10231== 0:1:3:2
bf62b306 10232~~~~~
72b7576f 10233
bf62b306 10234@subsubsection occt_draw_8_8_3 XGetAllLayers
72b7576f 10235
bf62b306 10236Syntax:
10237~~~~~
10238XGetAllLayers <document>
10239~~~~~
72b7576f 10240
10241Prints all layers in an XCAF document.
72b7576f 10242
bf62b306 10243**Example:**
10244~~~~~
72b7576f 10245XGetAllLayers D
10246== *0:1:1:3* *Bolt* *0:1:1:9*
bf62b306 10247~~~~~
72b7576f 10248
bf62b306 10249@subsubsection occt_draw_8_8_4 XGetLayers
72b7576f 10250
bf62b306 10251Syntax:
10252~~~~~
10253XGetLayers <document> {<shape>|<label>}
10254~~~~~
72b7576f 10255
10256Returns names of layers, which are pointed to by links of an indicated shape.
72b7576f 10257
bf62b306 10258**Example:**
10259~~~~~
72b7576f 10260XGetLayers D 0:1:1:3
10261== *bolt* *123*
bf62b306 10262~~~~~
72b7576f 10263
bf62b306 10264@subsubsection occt_draw_8_8_5 XGetOneLayer
72b7576f 10265
bf62b306 10266Syntax:
10267~~~~~
10268XGetOneLayer <document> <label>
10269~~~~~
72b7576f 10270
10271Prints the name of a layer at a given label.
72b7576f 10272
bf62b306 10273**Example:**
10274~~~~~
72b7576f 10275XGetOneLayer D 0:1:3:2
bf62b306 10276~~~~~
72b7576f 10277
bf62b306 10278@subsubsection occt_draw_8_8_6 XIsVisible
72b7576f 10279
bf62b306 10280Syntax:
10281~~~~~
10282XIsVisible <document> {<label>|<layer>}
10283~~~~~
72b7576f 10284
10285Returns 1 if the indicated layer is visible, else returns 0.
72b7576f 10286
bf62b306 10287**Example:**
10288~~~~~
72b7576f 10289XIsVisible D 0:1:3:1
bf62b306 10290~~~~~
72b7576f 10291
bf62b306 10292@subsubsection occt_draw_8_8_7 XRemoveAllLayers
72b7576f 10293
bf62b306 10294Syntax:
10295~~~~~
10296XRemoveAllLayers <document>
10297~~~~~
72b7576f 10298
10299Removes all layers from an XCAF document.
72b7576f 10300
bf62b306 10301**Example:**
10302~~~~~
72b7576f 10303XRemoveAllLayers D
bf62b306 10304~~~~~
72b7576f 10305
bf62b306 10306@subsubsection occt_draw_8_8_8 XRemoveLayer
72b7576f 10307
bf62b306 10308Syntax:
10309~~~~~
10310XRemoveLayer <document> {<label>|<layer>}
10311~~~~~
72b7576f 10312
10313Removes the indicated layer from an XCAF document.
72b7576f 10314
bf62b306 10315**Example:**
10316~~~~~
72b7576f 10317XRemoveLayer D layer2
bf62b306 10318~~~~~
72b7576f 10319
bf62b306 10320@subsubsection occt_draw_8_8_9 XSetLayer
72b7576f 10321
bf62b306 10322Syntax:
10323~~~~~
10324XSetLayer XSetLayer <document> {<shape>|<label>} <layer> [shape_in_one_layer {0|1}]
72b7576f 10325
bf62b306 10326~~~~~
10327
72b7576f 10328Sets a reference between a shape and a layer (adds a layer if it is necessary).
ba06f8bb 10329Parameter <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 10330
bf62b306 10331**Example:**
10332~~~~~
72b7576f 10333XSetLayer D 0:1:1:2 layer2
bf62b306 10334~~~~~
72b7576f 10335
bf62b306 10336@subsubsection occt_draw_8_8_10 XSetVisibility
72b7576f 10337
bf62b306 10338Syntax:
10339~~~~~
10340XSetVisibility <document> {<label>|<layer>} <isvisible {0|1}>
10341~~~~~
72b7576f 10342
10343Sets the visibility of a layer.
72b7576f 10344
bf62b306 10345**Example:**
10346~~~~~
72b7576f 10347# set layer at label 0:1:3:2 as invisible
10348XSetVisibility D 0:1:3:2 0
bf62b306 10349~~~~~
72b7576f 10350
bf62b306 10351@subsubsection occt_draw_8_8_11 XUnSetAllLayers
72b7576f 10352
bf62b306 10353Syntax:
10354~~~~~
10355XUnSetAllLayers <document> {<label>|<shape>}
10356~~~~~
72b7576f 10357
10358Unsets a shape from all layers.
72b7576f 10359
bf62b306 10360**Example:**
10361~~~~~
72b7576f 10362XUnSetAllLayers D 0:1:1:2
bf62b306 10363~~~~~
72b7576f 10364
bf62b306 10365@subsubsection occt_draw_8_8_12 XUnSetLayer
72b7576f 10366
bf62b306 10367Syntax:
10368~~~~~
10369XUnSetLayer <document> {<label>|<shape>} <layer>
10370~~~~~
72b7576f 10371
10372Unsets a shape from the indicated layer.
72b7576f 10373
bf62b306 10374**Example:**
10375~~~~~
72b7576f 10376XUnSetLayer D 0:1:1:2 layer1
bf62b306 10377~~~~~
72b7576f 10378
bf62b306 10379@subsection occt_draw_8_9 XDE property commands
72b7576f 10380
bf62b306 10381@subsubsection occt_draw_8_9_1 XCheckProps
72b7576f 10382
bf62b306 10383Syntax:
10384~~~~~
10385XCheckProps <document> [ {0|deflection} [<shape>|<label>] ]
10386~~~~~
72b7576f 10387
3f812249 10388Gets 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 10389
e5bd0d98 10390**Example:**
bf62b306 10391~~~~~
72b7576f 10392# check properties for shapes at label 0:1:1:1 from
10393# document using standard Open CASCADE Technology tools
10394XCheckProps D 0 0:1:1:1
dba69de2 10395== Label 0:1:1:1 ;L-BRACKET*
10396== Area defect: -0.0 ( 0%)
10397== Volume defect: 0.0 ( 0%)
10398== CG defect: dX=-0.000, dY=0.000, dZ=0.000
bf62b306 10399~~~~~
72b7576f 10400
bf62b306 10401@subsubsection occt_draw_8_9_2 XGetArea
72b7576f 10402
bf62b306 10403Syntax:
10404~~~~~
10405XGetArea <document> {<shape>|<label>}
10406~~~~~
72b7576f 10407
10408Returns the area of a given shape.
72b7576f 10409
bf62b306 10410**Example:**
10411~~~~~
72b7576f 10412XGetArea D 0:1:1:1
10413== 24628.31815094999
bf62b306 10414~~~~~
72b7576f 10415
bf62b306 10416@subsubsection occt_draw_8_9_3 XGetCentroid
72b7576f 10417
bf62b306 10418Syntax:
10419~~~~~
10420XGetCentroid <document> {<shape>|<label>}
10421~~~~~
72b7576f 10422
10423Returns the center of gravity coordinates of a given shape.
72b7576f 10424
bf62b306 10425**Example:**
10426~~~~~
72b7576f 10427XGetCentroid D 0:1:1:1
bf62b306 10428~~~~~
72b7576f 10429
bf62b306 10430@subsubsection occt_draw_8_9_4 XGetVolume
72b7576f 10431
bf62b306 10432Syntax:
10433~~~~~
10434XGetVolume <document> {<shape>|<label>}
10435~~~~~
72b7576f 10436
10437Returns the volume of a given shape.
72b7576f 10438
bf62b306 10439**Example:**
10440~~~~~
72b7576f 10441XGetVolume D 0:1:1:1
bf62b306 10442~~~~~
72b7576f 10443
bf62b306 10444@subsubsection occt_draw_8_9_5 XSetArea
72b7576f 10445
bf62b306 10446Syntax:
10447~~~~~
10448XSetArea <document> {<shape>|<label>} <area>
10449~~~~~
72b7576f 10450
10451Sets new area to attribute list ??? given shape.
72b7576f 10452
bf62b306 10453**Example:**
10454~~~~~
72b7576f 10455XSetArea D 0:1:1:1 2233.99
bf62b306 10456~~~~~
72b7576f 10457
bf62b306 10458@subsubsection occt_draw_8_9_6 XSetCentroid
10459
10460Syntax:
10461~~~~~
10462XSetCentroid <document> {<shape>|<label>} <x> <y> <z>
10463~~~~~
72b7576f 10464
bf62b306 10465Sets new center of gravity to the attribute list given shape.
72b7576f 10466
e5bd0d98 10467**Example:**
bf62b306 10468~~~~~
72b7576f 10469XSetCentroid D 0:1:1:1 0. 0. 100.
bf62b306 10470~~~~~
72b7576f 10471
bf62b306 10472@subsubsection occt_draw_8_9_7 XSetMaterial
72b7576f 10473
bf62b306 10474Syntax:
10475~~~~~
10476XSetMaterial <document> {<shape>|<label>} <name> <density(g/cu sm)>
10477~~~~~
72b7576f 10478
bf62b306 10479Adds 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 10480
bf62b306 10481**Example:**
10482~~~~~
72b7576f 10483XSetMaterial D 0:1:1:1 Titanium 8899.77
bf62b306 10484~~~~~
72b7576f 10485
bf62b306 10486@subsubsection occt_draw_8_9_8 XSetVolume
72b7576f 10487
bf62b306 10488Syntax:
10489~~~~~
10490XSetVolume <document> {<shape>|<label>} <volume>
10491~~~~~
72b7576f 10492
10493Sets new volume to the attribute list ??? given shape.
72b7576f 10494
bf62b306 10495**Example:**
10496~~~~~
72b7576f 10497XSetVolume D 0:1:1:1 444555.33
bf62b306 10498~~~~~
72b7576f 10499
bf62b306 10500@subsubsection occt_draw_8_9_9 XShapeMassProps
72b7576f 10501
bf62b306 10502Syntax:
10503~~~~~
10504XShapeMassProps <document> [ <deflection> [{<shape>|<label>}] ]
10505~~~~~
72b7576f 10506
3f812249 10507Computes 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 10508
bf62b306 10509**Example:**
10510~~~~~
72b7576f 10511XShapeMassProps D
10512== Shape from label : 0:1:1:1
10513== Mass = 193.71681469282299
10514== CenterOfGravity X = 14.594564763807696,Y =
dba69de2 10515 20.20271885211281,Z = 49.999999385313245
72b7576f 10516== Shape from label : 0:1:1:2 not have a mass
10517etc.
bf62b306 10518~~~~~
72b7576f 10519
bf62b306 10520@subsubsection occt_draw_8_9_10 XShapeVolume
72b7576f 10521
bf62b306 10522Syntax:
10523~~~~~
10524XShapeVolume <shape> <deflection>
10525~~~~~
72b7576f 10526
10527Calculates the real volume of a pointed shape with a given deflection.
72b7576f 10528
bf62b306 10529**Example:**
10530~~~~~
72b7576f 10531XShapeVolume a 0
bf62b306 10532~~~~~
72b7576f 10533
bf62b306 10534@section occt_draw_9 Shape Healing commands
72b7576f 10535
10536
10537
bf62b306 10538@subsection occt_draw_9_1 General commands
72b7576f 10539
bf62b306 10540@subsubsection occt_draw_9_1_1 bsplres
72b7576f 10541
bf62b306 10542Syntax:
10543~~~~~
10544bsplres <result> <shape> <tol3d> <tol2d< <reqdegree> <reqnbsegments> <continuity3d> <continuity2d> <PriorDeg> <RationalConvert>
10545~~~~~
72b7576f 10546
bf62b306 10547Performs 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 10548
bf62b306 10549@subsubsection occt_draw_9_1_2 checkfclass2d
72b7576f 10550
bf62b306 10551Syntax:
10552~~~~~
10553checkfclass2d <face> <ucoord> <vcoord>
10554~~~~~
72b7576f 10555
3f812249 10556Shows where a point which is given by coordinates is located in relation to a given face -- outbound, inside or at the bounds.
72b7576f 10557
bf62b306 10558**Example:**
10559~~~~~
72b7576f 10560checkfclass2d f 10.5 1.1
10561== Point is OUT
bf62b306 10562~~~~~
72b7576f 10563
bf62b306 10564@subsubsection occt_draw_9_1_3 checkoverlapedges
10565
10566Syntax:
10567~~~~~
10568checkoverlapedges <edge1> <edge2> [<toler> <domaindist>]
10569~~~~~
72b7576f 10570
ba06f8bb 10571Checks 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 10572
e5bd0d98 10573**Example:**
bf62b306 10574~~~~~
72b7576f 10575checkoverlapedges e1 e2
bf62b306 10576~~~~~
72b7576f 10577
bf62b306 10578@subsubsection occt_draw_9_1_4 comtol
72b7576f 10579
bf62b306 10580Syntax:
10581~~~~~
10582comptol <shape> [nbpoints] [prefix]
10583~~~~~
72b7576f 10584
10585Compares 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 10586
e5bd0d98 10587**Example:**
bf62b306 10588~~~~~
72b7576f 10589comptol h 871 t
10590
bf62b306 10591==> Edges tolerance computed by 871 points:
10592==> MAX=8.0001130696523449e-008 AVG=6.349346868091096e-009 MIN=0
10593==> Relation real tolerance / tolerance set in edge
10594==> MAX=0.80001130696523448 AVG=0.06349345591805905 MIN=0
10595==> Edge with max tolerance saved to t_edge_tol
10596==> Concerned faces saved to shapes t_1, t_2
10597~~~~~
72b7576f 10598
bf62b306 10599@subsubsection occt_draw_9_1_5 convtorevol
72b7576f 10600
bf62b306 10601Syntax:
10602~~~~~
10603convtorevol <result> <shape>
10604~~~~~
72b7576f 10605
10606Converts all elementary surfaces of a given shape into surfaces of revolution.
ba06f8bb 10607Results are put into the shape, which is given as the <i>\<result\></i> parameter.
72b7576f 10608
bf62b306 10609**Example:**
10610~~~~~
72b7576f 10611convtorevol r a
bf62b306 10612~~~~~
72b7576f 10613
bf62b306 10614@subsubsection occt_draw_9_1_6 directfaces
72b7576f 10615
bf62b306 10616Syntax:
10617~~~~~
10618directfaces <result> <shape>
10619~~~~~
72b7576f 10620
10621Converts indirect surfaces and returns the results into the shape, which is given as the result parameter.
72b7576f 10622
bf62b306 10623**Example:**
10624~~~~~
72b7576f 10625directfaces r a
bf62b306 10626~~~~~
72b7576f 10627
bf62b306 10628@subsubsection occt_draw_9_1_7 expshape
72b7576f 10629
bf62b306 10630Syntax:
10631~~~~~
10632expshape <shape> <maxdegree> <maxseg>
10633~~~~~
72b7576f 10634
10635Gives statistics for a given shape. This test command is working with Bezier and BSpline entities.
72b7576f 10636
bf62b306 10637**Example:**
10638~~~~~
72b7576f 10639expshape a 10 10
bf62b306 10640==> Number of Rational Bspline curves 128
10641==> Number of Rational Bspline pcurves 48
10642~~~~~
72b7576f 10643
bf62b306 10644@subsubsection occt_draw_9_1_8 fixsmall
72b7576f 10645
bf62b306 10646Syntax:
10647~~~~~
10648fixsmall <result> <shape> [<toler>=1.]
10649~~~~~
72b7576f 10650
10651Fixes 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 10652
bf62b306 10653**Example:**
10654~~~~~
72b7576f 10655fixsmall r a 0.1
bf62b306 10656~~~~~
72b7576f 10657
bf62b306 10658@subsubsection occt_draw_9_1_9 fixsmalledges
10659
10660Syntax:
10661~~~~~
10662fixsmalledges <result> <shape> [<toler> <mode> <maxangle>]
10663~~~~~
72b7576f 10664
ba06f8bb 10665Searches 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 10666
e5bd0d98 10667**Example:**
bf62b306 10668~~~~~
72b7576f 10669fixsmalledges r a 0.1 1
bf62b306 10670~~~~~
10671
10672@subsubsection occt_draw_9_1_10 fixshape
72b7576f 10673
bf62b306 10674Syntax:
10675~~~~~
10676fixshape <result> <shape> [<preci> [<maxpreci>]] [{switches}]
10677~~~~~
10678
ba06f8bb 10679Performs 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 10680
10681The following syntax is used:
ba06f8bb 10682* <i>\<symbol\></i> may be
10683 * "-" to set parameter off,
10684 * "+" to set on or
10685 * "*" to set default
10686* <i>\<parameter\></i> is identified by letters:
3f812249 10687 * l -- FixLackingMode
10688 * o -- FixOrientationMode
10689 * h -- FixShiftedMode
10690 * m -- FixMissingSeamMode
10691 * d -- FixDegeneratedMode
10692 * s -- FixSmallMode
10693 * i -- FixSelfIntersectionMode
10694 * n -- FixNotchedEdgesMode
72b7576f 10695For enhanced message output, use switch '+?'
72b7576f 10696
bf62b306 10697**Example:**
10698~~~~~
72b7576f 10699fixshape r a 0.001
bf62b306 10700~~~~~
72b7576f 10701
bf62b306 10702@subsubsection occt_draw_9_1_11 fixwgaps
72b7576f 10703
bf62b306 10704Syntax:
10705~~~~~
10706fixwgaps <result> <shape> [<toler>=0]
10707~~~~~
72b7576f 10708
10709Fixes 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 10710
bf62b306 10711**Example:**
10712~~~~~
72b7576f 10713fixwgaps r a
bf62b306 10714~~~~~
10715
10716@subsubsection occt_draw_9_1_12 offsetcurve, offset2dcurve
72b7576f 10717
bf62b306 10718Syntax:
10719~~~~~
10720offsetcurve <result> <curve> <offset> <direction(as point)>
10721offset2dcurve <result> <curve> <offset>
10722~~~~~
72b7576f 10723
bf62b306 10724**offsetcurve** works with the curve in 3d space, **offset2dcurve** in 2d space.
72b7576f 10725
ba06f8bb 10726Both 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 10727
bf62b306 10728**Example:**
10729~~~~~
72b7576f 10730point pp 10 10 10
10731offsetcurve r c 20 pp
bf62b306 10732~~~~~
10733
10734@subsubsection occt_draw_9_1_13 projcurve
72b7576f 10735
bf62b306 10736Syntax:
10737~~~~~
10738projcurve <edge>|<curve3d>|<curve3d first last> <X> <Y> <Z>
10739~~~~~
72b7576f 10740
bf62b306 10741**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 10742
e5bd0d98 10743**Example:**
bf62b306 10744~~~~~
72b7576f 10745projcurve k_1 0 1 5
10746==Edge k_1 Params from 0 to 1.3
dba69de2 10747==Precision (BRepBuilderAPI) : 9.9999999999999995e-008 ==Projection : 0 1 5
10748==Result : 0 1.1000000000000001 0
10749==Param = -0.20000000000000001 Gap = 5.0009999000199947
bf62b306 10750~~~~~
72b7576f 10751
f6b08ecf 10752@subsubsection occt_draw_9_1_14 projpcurve
10753
10754Syntax:
10755~~~~~
10756projpcurve <edge> <face> <Tol> <X> <Y> <Z> [<start_param>]
10757~~~~~
10758
a110c4a3 10759**projpcurve** returns the projection of a given point on a given curve on surface.
10760The curve on surface is defined by giving the edge and face names.
a25d5aaa 10761Edge must have curve 2D representation on the face.
a110c4a3 10762Optional parameter <i>\<start_param\></i> is any parameter of pcurve, which is used by algorithm as start point for searching projection of given point with help of local Extrema algorithm.
10763If this parameter is not set, algorithm uses whole parametric interval of pcurve for searching projection.
f6b08ecf 10764
10765**Example:**
21b1980f 10766
f6b08ecf 10767~~~~~
21b1980f 10768# Using global searching
f6b08ecf 10769projpcurve f_1 f 1.e-7 0.877 0 0.479
10770==Point: 0.87762772831890712 0 0.47934285275342808
10771==Param: 0.49990578239977856
10772==Dist: 0.0007152557954264938
10773~~~~~
21b1980f 10774
10775~~~~~
10776# Using starting parameter on edge
f6b08ecf 10777projpcurve f_1 f 1.e-7 0.877 0 0.479 .6
10778==Point: 0.87762772831890712 0 0.47934285275342808
10779==Param: 0.49990578239977856
10780==Dist: 0.0007152557954264938
10781~~~~~
10782
10783@subsubsection occt_draw_9_1_15 projface
72b7576f 10784
bf62b306 10785Syntax:
10786~~~~~
10787projface <face> <X> <Y> [<Z>]
10788~~~~~
72b7576f 10789
10790Returns 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 10791
bf62b306 10792**Example:**
10793~~~~~
72b7576f 10794projface a_1 10.0 0.0
dba69de2 10795== Point UV U = 10 V = 0
10796== = proj X = -116 Y = -45 Z = 0
bf62b306 10797~~~~~
72b7576f 10798
f6b08ecf 10799@subsubsection occt_draw_9_1_16 scaleshape
72b7576f 10800
bf62b306 10801Syntax:
10802~~~~~
10803scaleshape <result> <shape> <scale>
10804~~~~~
72b7576f 10805
ba06f8bb 10806Returns 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 10807
bf62b306 10808**Example:**
10809~~~~~
72b7576f 10810scaleshape r a_1 0.8
bf62b306 10811~~~~~
72b7576f 10812
f6b08ecf 10813@subsubsection occt_draw_9_1_17 settolerance
bf62b306 10814
10815Syntax:
10816~~~~~
10817settolerance <shape> [<mode>=v-e-w-f-a] <val>(fix value) or
10818 <tolmin> <tolmax>
10819~~~~~
72b7576f 10820
bf62b306 10821Sets 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 10822
e5bd0d98 10823**Example:**
bf62b306 10824~~~~~
72b7576f 10825settolerance a 0.001
bf62b306 10826~~~~~
72b7576f 10827
f6b08ecf 10828@subsubsection occt_draw_9_1_18 splitface
72b7576f 10829
bf62b306 10830Syntax:
10831~~~~~
10832splitface <result> <face> [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]
10833~~~~~
72b7576f 10834
ba06f8bb 10835Splits a given face in parametric space and puts the result into the given parameter <i>\<result\></i>.
72b7576f 10836Returns the status of split face.
72b7576f 10837
bf62b306 10838**Example:**
10839~~~~~
72b7576f 10840# split face f by parameter u = 5
10841splitface r f u 5
bf62b306 10842==> Splitting by U: ,5
10843==> Status: DONE1
10844~~~~~
72b7576f 10845
f6b08ecf 10846@subsubsection occt_draw_9_1_19 statshape
72b7576f 10847
bf62b306 10848Syntax:
10849~~~~~
10850statshape <shape> [particul]
10851~~~~~
72b7576f 10852
bf62b306 10853Returns 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
10854surfaces. The last parameter becomes out of date.
72b7576f 10855
e5bd0d98 10856**Example:**
bf62b306 10857~~~~~
10858statshape a
10859==> Count Item
10860==> ----- ----
10861==> 402 Edge (oriented)
10862==> 402 Edge (Shared)
10863==> 74 Face
10864==> 74 Face (Free)
10865==> 804 Vertex (Oriented)
10866==> 402 Vertex (Shared)
10867==> 78 Wire
10868==> 4 Face with more than one wire
10869==> 34 bspsur: BSplineSurface
10870~~~~~
10871
f6b08ecf 10872@subsubsection occt_draw_9_1_20 tolerance
bf62b306 10873
ba06f8bb 10874Syntax:
bf62b306 10875~~~~~
10876tolerance <shape> [<mode>:D v e f c] [<tolmin> <tolmax>:real]
10877~~~~~
72b7576f 10878
ba06f8bb 10879Returns 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 10880
10881**Example:**
10882~~~~~
72b7576f 10883tolerance a
bf62b306 10884==> Tolerance MAX=0.31512672416608001 AVG=0.14901359484722074 MIN=9.9999999999999995e-08
10885==> FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
10886==> EDGE : MAX=0.31512672416608001 AVG=0.098691334511810405 MIN=9.9999999999999995e-08
10887==> VERTEX : MAX=0.31512672416608001 AVG=0.189076074499648 MIN=9.9999999999999995e-08
72b7576f 10888
10889tolerance a v 0.1 0.001
bf62b306 10890==> Analysing Vertices gives 6 Shapes between tol1=0.10000000000000001 and tol2=0.001 , named tol_1 to tol_6
10891~~~~~
72b7576f 10892
10893
bf62b306 10894@subsection occt_draw_9_2 Conversion commands
72b7576f 10895
bf62b306 10896@subsubsection occt_draw_9_2_1 DT_ClosedSplit
72b7576f 10897
bf62b306 10898Syntax:
10899~~~~~
10900DT_ClosedSplit <result> <shape>
10901~~~~~
72b7576f 10902
10903Divides 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.
3f812249 10904Note: A closed face is a face with one or more seam.
72b7576f 10905
bf62b306 10906**Example:**
10907~~~~~
72b7576f 10908DT_ClosetSplit r a
bf62b306 10909~~~~~
72b7576f 10910
bf62b306 10911@subsubsection occt_draw_9_2_2 DT_ShapeConvert, DT_ShapeConvertRev
72b7576f 10912
bf62b306 10913Syntax:
10914~~~~~
10915DT_ShapeConvert <result> <shape> <convert2d> <convert3d>
10916DT_ShapeConvertRev <result> <shape> <convert2d> <convert3d>
10917~~~~~
10918
10919Both 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 10920
e5bd0d98 10921**Example:**
bf62b306 10922~~~~~
72b7576f 10923DT_ShapeConvert r a 1 1
10924== Status: DONE1
bf62b306 10925~~~~~
10926
10927@subsubsection occt_draw_9_2_3 DT_ShapeDivide
72b7576f 10928
bf62b306 10929Syntax:
10930~~~~~
10931DT_ShapeDivide <result> <shape> <tol>
10932~~~~~
72b7576f 10933
bf62b306 10934Divides 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:
10935 * OK : no splitting was done
10936 * Done1 : Some edges were split
10937 * Done2 : Surface was split
10938 * Fail1 : Some errors occurred
72b7576f 10939
e5bd0d98 10940**Example:**
bf62b306 10941~~~~~
72b7576f 10942DT_ShapeDivide r a 0.001
10943== Status: OK
bf62b306 10944~~~~~
72b7576f 10945
bf62b306 10946@subsubsection occt_draw_9_2_4 DT_SplitAngle
10947
10948Syntax:
10949~~~~~
10950DT_SplitAngle <result> <shape> [MaxAngle=95]
10951~~~~~
72b7576f 10952
bf62b306 10953Works 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.
10954This command illustrates how class *ShapeUpgrade_ShapeDivideAngle* works.
72b7576f 10955
e5bd0d98 10956**Example:**
bf62b306 10957~~~~~
72b7576f 10958DT_SplitAngle r a
10959== Status: DONE2
bf62b306 10960~~~~~
72b7576f 10961
bf62b306 10962@subsubsection occt_draw_9_2_5 DT_SplitCurve
72b7576f 10963
bf62b306 10964Syntax:
10965~~~~~
10966DT_SplitCurve <curve> <tol> <split(0|1)>
10967~~~~~
72b7576f 10968
dba69de2 10969Divides 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 10970
bf62b306 10971**Example:**
10972~~~~~
72b7576f 10973DT_SplitCurve r c
bf62b306 10974~~~~~
72b7576f 10975
bf62b306 10976@subsubsection occt_draw_9_2_6 DT_SplitCurve2d
72b7576f 10977
bf62b306 10978Syntax:
10979~~~~~
10980DT_SplitCurve2d Curve Tol Split(0/1)
10981~~~~~
72b7576f 10982
bf62b306 10983Works just as **DT_SplitCurve** (see above), only with 2d curve.
72b7576f 10984
bf62b306 10985**Example:**
10986~~~~~
72b7576f 10987DT_SplitCurve2d r c
bf62b306 10988~~~~~
72b7576f 10989
bf62b306 10990@subsubsection occt_draw_9_2_7 DT_SplitSurface
72b7576f 10991
bf62b306 10992Syntax:
10993~~~~~
10994DT_SplitSurface <result> <Surface|GridSurf> <tol> <split(0|1)>
10995~~~~~
72b7576f 10996
dba69de2 10997Divides 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 10998
e5bd0d98 10999**Example:**
79d580f2 11000~~~~~
11001# split surface with name "su"
72b7576f 11002DT_SplitSurface res su 0.1 1
bf62b306 11003==> single surf
11004==> appel a SplitSurface::Init
11005==> appel a SplitSurface::Build
11006==> appel a SplitSurface::GlobalU/VKnots
11007==> nb GlobalU;nb GlobalV=7 2 0 1 2 3 4 5 6.2831853072 0 1
11008==> appel a Surfaces
11009==> transfert resultat
11010==> res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1
11011~~~~~
72b7576f 11012
bf62b306 11013@subsubsection occt_draw_9_2_8 DT_ToBspl
72b7576f 11014
ba06f8bb 11015Syntax:
bf62b306 11016~~~~~
11017DT_ToBspl <result> <shape>
11018~~~~~
72b7576f 11019
11020Converts 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 11021
e5bd0d98 11022**Example:**
bf62b306 11023~~~~~
72b7576f 11024DT_ToBspl res sh
dba69de2 11025== error = 5.20375663162094e-08 spans = 10
11026== Surface is aproximated with continuity 2
bf62b306 11027~~~~~
72b7576f 11028
bf62b306 11029@section occt_draw_10 Performance evaluation commands
72b7576f 11030
11031
bf62b306 11032@subsection occt_draw_10_1 VDrawSphere
72b7576f 11033
bf62b306 11034Syntax:
11035~~~~~
11036vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToEnableVBO=1] [NumberOfViewerUpdate=1] [ToShowEdges=0]
11037~~~~~
72b7576f 11038
11039Calculates 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.
11040
11041This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter.
72b7576f 11042
bf62b306 11043**Example:**
11044~~~~~
11045vdrawsphere s 200 1 1 1 500 1
11046== Compute Triangulation...
11047== NumberOfPoints: 39602
11048== NumberOfTriangles: 79200
11049== Amount of memory required for PolyTriangulation without Normals: 2 Mb
11050== Amount of memory for colors: 0 Mb
11051== Amount of memory for PolyConnect: 1 Mb
11052== Amount of graphic card memory required: 2 Mb
11053== Number of scene redrawings: 1
11054== CPU user time: 15.6000999999998950 msec
11055== CPU system time: 0.0000000000000000 msec
11056== CPU average time of scene redrawing: 15.6000999999998950 msec
11057~~~~~
72b7576f 11058
11059
472634fa 11060@section occt_draw_12 Simple vector algebra and measurements
11061
11062This section contains description of auxiliary commands that can be useful for simple calculations and manipulations needed when analyzing complex models.
11063
11064@subsection occt_draw_12_1 Vector algebra commands
11065
11066This section describes commands providing simple calculations with 2D and 3D vectors. The vector is represented by a TCL list of double values (coordinates). The commands get input vector coordinates from the command line as distinct values. So, if you have a vector stored in a variable you need to use *eval* command as a prefix, for example, to compute the magnitude of cross products of two vectors given by 3 points the following commands can be used:
11067~~~~~{.cpp}
11068Draw[10]> set vec1 [vec 12 28 99 12 58 99]
110690 30 0
11070Draw[13]> set vec2 [vec 12 28 99 16 21 89]
110714 -7 -10
11072Draw[14]> set cross [eval cross $vec1 $vec2]
11073-300 0 -120
11074Draw[15]> eval module $cross
11075323.10988842807024
11076~~~~~
11077
11078@subsubsection occt_draw_12_1_1 vec
11079
11080Syntax:
11081~~~~~
11082vec <x1> <y1> <z1> <x2> <y2> <z2>
11083~~~~~
11084
11085Returns coordinates of vector between two 3D points.
11086
11087Example:
11088~~~~~{.cpp}
11089vec 1 2 3 6 5 4
11090~~~~~
11091
11092@subsubsection occt_draw_12_1_2 2dvec
11093
11094Syntax:
11095~~~~~
110962dvec <x1> <y1> <x2> <y2>
11097~~~~~
11098
11099Returns coordinates of vector between two 2D points.
11100
11101Example:
11102~~~~~{.cpp}
111032dvec 1 2 4 3
11104~~~~~
11105
11106@subsubsection occt_draw_12_1_3 pln
11107
11108Syntax:
11109~~~~~
11110pln <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
11111~~~~~
11112
11113Returns plane built on three points. A plane is represented by 6 double values: coordinates of the origin point and the normal directoin.
11114
11115Example:
11116~~~~~{.cpp}
11117pln 1 2 3 6 5 4 9 8 7
11118~~~~~
11119
11120@subsubsection occt_draw_12_1_4 module
11121
11122Syntax:
11123~~~~~
11124module <x> <y> <z>
11125~~~~~
11126
11127Returns module of a vector.
11128
11129Example:
11130~~~~~{.cpp}
11131module 1 2 3
11132~~~~~
11133
11134@subsubsection occt_draw_12_1_5 2dmodule
11135
11136Syntax:
11137~~~~~
111382dmodule <x> <y>
11139~~~~~
11140
11141Returns module of a 2D vector.
11142
11143Example:
11144~~~~~{.cpp}
111452dmodule 1 2
11146~~~~~
11147
11148@subsubsection occt_draw_12_1_6 norm
11149
11150Syntax:
11151~~~~~
11152norm <x> <y> <z>
11153~~~~~
11154
11155Returns unified vector from a given 3D vector.
11156
11157Example:
11158~~~~~{.cpp}
11159norm 1 2 3
11160~~~~~
11161
11162@subsubsection occt_draw_12_1_7 2dnorm
11163
11164Syntax:
11165~~~~~
111662dnorm <x> <y>
11167~~~~~
11168
11169Returns unified vector from a given 2D vector.
11170
11171Example:
11172~~~~~{.cpp}
111732dnorm 1 2
11174~~~~~
11175
11176@subsubsection occt_draw_12_1_8 inverse
11177
11178Syntax:
11179~~~~~
11180inverse <x> <y> <z>
11181~~~~~
11182
11183Returns inversed 3D vector.
11184
11185Example:
11186~~~~~{.cpp}
11187inverse 1 2 3
11188~~~~~
11189
11190@subsubsection occt_draw_12_1_9 2dinverse
11191
11192Syntax:
11193~~~~~
111942dinverse <x> <y>
11195~~~~~
11196
11197Returns inversed 2D vector.
11198
11199Example:
11200~~~~~{.cpp}
112012dinverse 1 2
11202~~~~~
11203
11204@subsubsection occt_draw_12_1_10 2dort
11205
11206Syntax:
11207~~~~~
112082dort <x> <y>
11209~~~~~
11210
11211Returns 2D vector rotated on 90 degrees.
11212
11213Example:
11214~~~~~{.cpp}
112152dort 1 2
11216~~~~~
11217
11218@subsubsection occt_draw_12_1_11 distpp
11219
11220Syntax:
11221~~~~~
11222distpp <x1> <y1> <z1> <x2> <y2> <z2>
11223~~~~~
11224
11225Returns distance between two 3D points.
11226
11227Example:
11228~~~~~{.cpp}
11229distpp 1 2 3 4 5 6
11230~~~~~
11231
11232@subsubsection occt_draw_12_1_12 2ddistpp
11233
11234Syntax:
11235~~~~~
112362ddistpp <x1> <y1> <x2> <y2>
11237~~~~~
11238
11239Returns distance between two 2D points.
11240
11241Example:
11242~~~~~{.cpp}
112432ddistpp 1 2 3 4
11244~~~~~
11245
11246@subsubsection occt_draw_12_1_13 distplp
11247
11248Syntax:
11249~~~~~
11250distplp <x0> <y0> <z0> <nx> <ny> <nz> <xp> <yp> <zp>
11251~~~~~
11252
11253Returns distance between plane defined by point and normal direction and another point.
11254
11255Example:
11256~~~~~{.cpp}
11257distplp 0 0 0 0 0 1 5 6 7
11258~~~~~
11259
11260@subsubsection occt_draw_12_1_14 distlp
11261
11262Syntax:
11263~~~~~
11264distlp <x0> <y0> <z0> <dx> <dy> <dz> <xp> <yp> <zp>
11265~~~~~
11266
11267Returns distance between 3D line defined by point and direction and another point.
11268
11269Example:
11270~~~~~{.cpp}
11271distlp 0 0 0 1 0 0 5 6 7
11272~~~~~
11273
11274@subsubsection occt_draw_12_1_15 2ddistlp
11275
11276Syntax:
11277~~~~~
112782ddistlp <x0> <y0> <dx> <dy> <xp> <yp>
11279~~~~~
11280
11281Returns distance between 2D line defined by point and direction and another point.
11282
11283Example:
11284~~~~~{.cpp}
112852ddistlp 0 0 1 0 5 6
11286~~~~~
11287
11288@subsubsection occt_draw_12_1_16 distppp
11289
11290Syntax:
11291~~~~~
11292distppp <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
11293~~~~~
11294
11295Returns deviation of point (x2,y2,z2) from segment defined by points (x1,y1,z1) and (x3,y3,z3).
11296
11297Example:
11298~~~~~{.cpp}
11299distppp 0 0 0 1 1 0 2 0 0
11300~~~~~
11301
11302@subsubsection occt_draw_12_1_17 2ddistppp
11303
11304Syntax:
11305~~~~~
113062ddistppp <x1> <y1> <x2> <y2> <x3> <y3>
11307~~~~~
11308
11309Returns deviation of point (x2,y2) from segment defined by points (x1,y1) and (x3,y3). The result is a signed value. It is positive if the point (x2,y2) is on the left side of the segment, and negative otherwise.
11310
11311Example:
11312~~~~~{.cpp}
113132ddistppp 0 0 1 -1 2 0
11314~~~~~
11315
11316@subsubsection occt_draw_12_1_18 barycen
11317
11318Syntax:
11319~~~~~
11320barycen <x1> <y1> <z1> <x2> <y2> <z2> <par>
11321~~~~~
11322
11323Returns point of a given parameter between two 3D points.
11324
11325Example:
11326~~~~~{.cpp}
11327barycen 0 0 0 1 1 1 0.3
11328~~~~~
11329
11330@subsubsection occt_draw_12_1_19 2dbarycen
11331
11332Syntax:
11333~~~~~
113342dbarycen <x1> <y1> <x2> <y2> <par>
11335~~~~~
11336
11337Returns point of a given parameter between two 2D points.
11338
11339Example:
11340~~~~~{.cpp}
113412dbarycen 0 0 1 1 0.3
11342~~~~~
11343
11344@subsubsection occt_draw_12_1_20 cross
11345
11346Syntax:
11347~~~~~
11348cross <x1> <y1> <z1> <x2> <y2> <z2>
11349~~~~~
11350
11351Returns cross product of two 3D vectors.
11352
11353Example:
11354~~~~~{.cpp}
11355cross 1 0 0 0 1 0
11356~~~~~
11357
11358@subsubsection occt_draw_12_1_21 2dcross
11359
11360Syntax:
11361~~~~~
113622dcross <x1> <y1> <x2> <y2>
11363~~~~~
11364
11365Returns cross product of two 2D vectors.
11366
11367Example:
11368~~~~~{.cpp}
113692dcross 1 0 0 1
11370~~~~~
11371
11372@subsubsection occt_draw_12_1_22 dot
11373
11374Syntax:
11375~~~~~
11376dot <x1> <y1> <z1> <x2> <y2> <z2>
11377~~~~~
11378
11379Returns scalar product of two 3D vectors.
11380
11381Example:
11382~~~~~{.cpp}
11383dot 1 0 0 0 1 0
11384~~~~~
11385
11386@subsubsection occt_draw_12_1_23 2ddot
11387
11388Syntax:
11389~~~~~
113902ddot <x1> <y1> <x2> <y2>
11391~~~~~
11392
11393Returns scalar product of two 2D vectors.
11394
11395Example:
11396~~~~~{.cpp}
113972ddot 1 0 0 1
11398~~~~~
11399
97f3782b 11400@subsubsection occt_draw_12_1_24 scale
472634fa 11401
11402Syntax:
11403~~~~~
11404scale <x> <y> <z> <factor>
11405~~~~~
11406
11407Returns 3D vector multiplied by scalar.
11408
11409Example:
11410~~~~~{.cpp}
11411scale 1 0 0 5
11412~~~~~
11413
97f3782b 11414@subsubsection occt_draw_12_1_25 2dscale
472634fa 11415
11416Syntax:
11417~~~~~
114182dscale <x> <y> <factor>
11419~~~~~
11420
11421Returns 2D vector multiplied by scalar.
11422
11423Example:
11424~~~~~{.cpp}
114252dscale 1 0 5
11426~~~~~
11427
11428@subsection occt_draw_12_2 Measurements commands
11429
11430This section describes commands that make possible to provide measurements on a model.
11431
11432@subsubsection occt_draw_12_2_1 pnt
11433
11434Syntax:
11435~~~~~
11436pnt <object>
11437~~~~~
11438
11439Returns coordinates of point in the given Draw variable. Object can be of type point or vertex. Actually this command is built up from the commands @ref occt_draw_7_2_1a "mkpoint" and @ref occt_draw_6_6_1 "coord".
11440
11441Example:
11442~~~~~{.cpp}
11443vertex v 0 1 0
11444pnt v
11445~~~~~
11446
11447@subsubsection occt_draw_12_2_2 pntc
11448
11449Syntax:
11450~~~~~
11451pntc <curv> <par>
11452~~~~~
11453
11454Returns coordinates of point on 3D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "cvalue".
11455
11456Example:
11457~~~~~{.cpp}
11458circle c 0 0 0 10
11459pntc c [dval pi/2]
11460~~~~~
11461
11462@subsubsection occt_draw_12_2_3 2dpntc
11463
11464Syntax:
11465~~~~~
114662dpntc <curv2d> <par>
11467~~~~~
11468
11469Returns coordinates of point on 2D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "2dcvalue".
11470
11471Example:
11472~~~~~{.cpp}
11473circle c 0 0 10
114742dpntc c [dval pi/2]
11475~~~~~
11476
11477@subsubsection occt_draw_12_2_4 pntsu
11478
11479Syntax:
11480~~~~~
11481pntsu <surf> <u> <v>
11482~~~~~
11483
11484Returns coordinates of point on surface with given parameters. Actually this command is based on the command @ref occt_draw_6_6_3 "svalue".
11485
11486Example:
11487~~~~~{.cpp}
11488cylinder s 10
11489pntsu s [dval pi/2] 5
11490~~~~~
11491
11492@subsubsection occt_draw_12_2_5 pntcons
11493
11494Syntax:
11495~~~~~
11496pntcons <curv2d> <surf> <par>
11497~~~~~
11498
11499Returns coordinates of point on surface defined by point on 2D curve with given parameter. Actually this command is based on the commands @ref occt_draw_6_6_2 "2dcvalue" and @ref occt_draw_6_6_3 "svalue".
11500
11501Example:
11502~~~~~{.cpp}
11503line c 0 0 1 0
11504cylinder s 10
11505pntcons c s [dval pi/2]
11506~~~~~
11507
11508@subsubsection occt_draw_12_2_6 drseg
11509
11510Syntax:
11511~~~~~
11512drseg <name> <x1> <y1> <z1> <x2> <y2> <z2>
11513~~~~~
11514
11515Creates a linear segment between two 3D points. The new object is given the *name*. The object is drawn in the axonometric view.
11516
11517Example:
11518~~~~~{.cpp}
11519drseg s 0 0 0 1 0 0
11520~~~~~
11521
11522@subsubsection occt_draw_12_2_7 2ddrseg
11523
11524Syntax:
11525~~~~~
115262ddrseg <name> <x1> <y1> <x2> <y2>
11527~~~~~
11528
11529Creates a linear segment between two 2D points. The new object is given the *name*. The object is drawn in the 2D view.
11530
11531Example:
11532~~~~~{.cpp}
115332ddrseg s 0 0 1 0
11534~~~~~
11535
11536@subsubsection occt_draw_12_2_8 mpick
11537
11538Syntax:
11539~~~~~
11540mpick
11541~~~~~
11542
11543Prints in the console the coordinates of a point clicked by mouse in a view (axonometric or 2D). This command will wait for mouse click event in a view.
11544
11545Example:
11546~~~~~{.cpp}
11547mpick
11548~~~~~
11549
11550@subsubsection occt_draw_12_2_9 mdist
11551
11552Syntax:
11553~~~~~
11554mdist
11555~~~~~
11556
11557Prints in the console the distance between two points clicked by mouse in a view (axonometric or 2D). This command will wait for two mouse click events in a view.
11558
11559Example:
11560~~~~~{.cpp}
11561mdist
11562~~~~~
11563
d2c90917 11564@section occt_draw_13 Inspector commands
11565
11566
11567This section describes commands that make possible to use Inspector.
11568
11569@subsection occt_draw_13_1 tinspector
11570
11571Syntax:
11572~~~~~
11573tinspector [-plugins {name1 ... [nameN] | all}]
11574 [-activate name]
11575 [-shape object [name1] ... [nameN]]
11576 [-open file_name [name1] ... [nameN]]
11577 [-update]
11578 [-select {object | name1 ... [nameN]}]
11579 [-show {0|1} = 1]
11580~~~~~
14deaf42 11581Starts inspection tool.
d2c90917 11582Options:
11583* *plugins* enters plugins that should be added in the inspector.
14deaf42 11584Available names are: *dfbrowser*, *vinspector* and *shapeview*.
11585Plugins order will be the same as defined in the arguments.
d2c90917 11586'all' adds all available plugins in the order:
11587DFBrowser, VInspector and ShapeView.
14deaf42 11588If at the first call this option is not used, 'all' option is applied;
d2c90917 11589* *activate* activates the plugin in the tool view.
11590If at the first call this option is not used, the first plugin is activated;
14deaf42 11591* *shape* initializes plugin(s) by the shape object. If 'name' is empty, initializes all plugins;
11592* *open* gives the file to the plugin(s). If the plugin is active after open, the content will be updated;
d2c90917 11593* *update* updates content of the active plugin;
11594* *select* sets the parameter that should be selected in an active tool view.
14deaf42 11595Depending on the active tool the parameter is:
11596ShapeView: 'object' is an instance of *TopoDS_Shape TShape*,
11597DFBrowser: 'name' is an entry of *TDF_Label* and 'name2' (optionally) for *TDF_Attribute* type name,
11598VInspector: 'object' is an instance of *AIS_InteractiveObject*;
d2c90917 11599* *show* sets Inspector view visible or hidden. The first call of this command will show it.
11600
11601**Example:**
11602~~~~~
11603pload DCAF INSPECTOR
11604
11605NewDocument Doc BinOcaf
11606
11607set aSetAttr1 100
11608set aLabel 0:2
11609SetInteger Doc ${aLabel} ${aSetAttr1}
11610
11611tinspector -plugins dfbrowser -select 0:2 TDataStd_Integer
11612~~~~~
11613
11614**Example:**
11615~~~~~
11616pload ALL INSPECTOR
11617
11618box b1 200 100 120
11619box b2 100 200 220 100 120 100
11620
11621tinspector -plugins shapeview -shape b1 -shape b2 -select b1
11622~~~~~
11623
11624**Example:**
11625~~~~~
11626pload ALL INSPECTOR
11627
11628tinspector -plugins vinspector
11629
11630vinit
11631box box_1 100 100 100
11632vdisplay box_1
11633
11634box box_2 180 120 200 150 150 150
11635vdisplay box_2
11636
11637vfit
11638vselmode box_1 1 1
11639vselmode box_1 3 1
11640
11641tinspector -update -select box_1
11642~~~~~
11643
11644
bf62b306 11645@section occt_draw_11 Extending Test Harness with custom commands
72b7576f 11646
11647
11648The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism.
11649
11650
bf62b306 11651@subsection occt_draw_11_1 Custom command implementation
72b7576f 11652
11653Custom 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 11654
bf62b306 11655**Example:**
79d580f2 11656~~~~~
bf62b306 11657static Standard_Integer myadvcurve(Draw_Interpretor& di, Standard_Integer n, char** a)
72b7576f 11658{
11659...
11660}
79d580f2 11661~~~~~
72b7576f 11662
11663For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx).
11664
11665
bf62b306 11666@subsection occt_draw_11_2 Registration of commands in Test Harness
72b7576f 11667
11668To become available in the Test Harness the custom command must be registered in it. This should be done as follows.
72b7576f 11669
bf62b306 11670**Example:**
79d580f2 11671~~~~~
bf62b306 11672void MyPack::CurveCommands(Draw_Interpretor& theCommands)
72b7576f 11673{
11674...
bf62b306 11675char* g = "Advanced curves creation";
72b7576f 11676
3f812249 11677theCommands.Add ( "myadvcurve", "myadvcurve name p1 p2 p3 - Creates my advanced curve from points",
bf62b306 11678 __FILE__, myadvcurve, g );
72b7576f 11679...
11680}
79d580f2 11681~~~~~
72b7576f 11682
bf62b306 11683@subsection occt_draw_11_3 Creating a toolkit (library) as a plug-in
72b7576f 11684
bf62b306 11685All 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 11686
bf62b306 11687This exported function *PLUGINFACTORY()* must be implemented only once per library.
72b7576f 11688
bf62b306 11689For 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 11690
bf62b306 11691**Example:**
11692~~~~~
11693#include <Draw_PluginMacro.hxx>
11694
11695void MyPack::Factory(Draw_Interpretor& theDI)
11696{
11697...
11698//
11699MyPack::CurveCommands(theDI);
11700...
11701}
72b7576f 11702
bf62b306 11703// Declare entry point PLUGINFACTORY
11704DPLUGIN(MyPack)
11705~~~~~
72b7576f 11706
bf62b306 11707@subsection occt_draw_11_4 Creation of the plug-in resource file
72b7576f 11708
04c2daa4 11709As mentioned above, the plug-in resource file must be compliant with Open CASCADE Technology requirements (see *Resource_Manager.hxx* file for details). In particular, it should contain keys separated from their values by a colon (;:;).
72b7576f 11710For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name.
11711Thus, 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.
3f812249 11712For 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 11713
bf62b306 11714**Examples** (file MyDrawPlugin):
11715~~~~~
72b7576f 11716! Hierarchy of plug-ins
dba69de2 11717ALL : ADVMODELING, MESHING
11718DEFAULT : MESHING
11719ADVMODELING : ADVSURF, ADVCURV
72b7576f 11720
11721! Mapping from naming to toolkits (libraries)
dba69de2 11722ADVSURF : TKMyAdvSurf
11723ADVCURV : TKMyAdvCurv
11724MESHING : TKMyMesh
bf62b306 11725~~~~~
72b7576f 11726
67d7f07f 11727For other examples of the plug-in resource file refer to the @ref occt_draw_1_3_2 "Plug-in resource file" chapter above or to the <i>$CASROOT/src/DrawPlugin</i> file shipped with Open CASCADE Technology.
72b7576f 11728
11729
bf62b306 11730@subsection occt_draw_11_5 Dynamic loading and activation
72b7576f 11731
67d7f07f 11732Loading a plug-in and activating its commands is described in the @ref occt_draw_1_3_3 "Activation of the commands implemented in the plug-in" chapter.
72b7576f 11733
67d7f07f 11734The procedure consists in defining the system variables and using the *pload* commands in the Test Harness session.
72b7576f 11735
e5bd0d98 11736**Example:**
e5bd0d98 11737~~~~
bf62b306 11738Draw[]> set env(CSF_MyDrawPluginDefaults) /users/test
11739Draw[]> pload -MyDrawPlugin ALL
e5bd0d98 11740~~~~