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