0026874: Implementation of the Partition operator in OCCT
[occt.git] / dox / user_guides / draw_test_harness / draw_test_harness.md
CommitLineData
18006a0f 1Draw Test Harness {#occt_user_guides__test_harness}
72b7576f 2===============================
e5bd0d98 3
4@tableofcontents
72b7576f 5
e5bd0d98 6@section occt_draw_1 Introduction
72b7576f 7
18006a0f 8This manual explains how to use Draw, the test harness for Open CASCADE Technology (**OCCT**).
72b7576f 9Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
10
e5bd0d98 11@subsection occt_draw_1_1 Overview
72b7576f 12
13Draw is a test harness for Open CASCADE Technology. It provides a flexible and easy to use means of testing and demonstrating the OCCT modeling libraries.
14
15Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
16
17Scripts may be written to customize Draw and perform tests. New types of objects and new commands may be added using the C++ programing language.
18
19Draw consists of:
20
21 * A command interpreter based on the TCL command language.
22 * A 3d graphic viewer based on the X system.
23 * A basic set of commands covering scripts, variables and graphics.
24 * A set of geometric commands allowing the user to create and modify curves and surfaces and to use OCCT geometry algorithms. This set of commands is optional.
25 * A set of topological commands allowing the user to create and modify BRep shapes and to use the OCCT topology algorithms.
26
27
28There is also a set of commands for each delivery unit in the modeling libraries:
29
e5bd0d98 30 * GEOMETRY,
31 * TOPOLOGY,
32 * ADVALGOS,
33 * GRAPHIC,
34 * PRESENTATION.
72b7576f 35
36
e5bd0d98 37@subsection occt_draw_1_2 Contents of this documentation
72b7576f 38
39This documentation describes:
40
41 * The command language.
42 * The basic set of commands.
43 * The graphical commands.
44 * The Geometry set of commands.
45 * The Topology set of commands.
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
394~~~~~~
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~~~~~
2090vtrihedron name [X0] [Y0] [Z0] [Zu] [Zv] [Zw] [Xu] [Xv] [Xw]
2091~~~~~
72b7576f 2092
bf62b306 2093Creates a new *AIS_Trihedron* object. If no argument is set, the default trihedron (0XYZ) is created.
2094
e5bd0d98 2095**Example:**
bf62b306 2096~~~~~
72b7576f 2097vinit
bf62b306 2098vtrihedron tr
2099~~~~~
72b7576f 2100
bf62b306 2101@subsubsection occt_draw_4_4_2 vplanetri
72b7576f 2102
bf62b306 2103Syntax:
2104~~~~~
2105vplanetri name
2106~~~~~
72b7576f 2107
251a7984 2108Creates a plane from a trihedron selection. If no arguments are set, the default plane is created.
72b7576f 2109
2110
bf62b306 2111@subsubsection occt_draw_4_4_3 vsize
72b7576f 2112
bf62b306 2113Syntax:
2114~~~~~
2115vsize [name] [size]
2116~~~~~
72b7576f 2117
bf62b306 2118Changes 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.
2119
e5bd0d98 2120**Example:**
bf62b306 2121~~~~~
72b7576f 2122vinit
2123vtrihedron tr1
2124vtrihedron tr2 0 0 0 1 0 0 1 0 0
bf62b306 2125vsize tr2 400
2126~~~~~
72b7576f 2127
bf62b306 2128@subsubsection occt_draw_4_4_4 vaxis
72b7576f 2129
bf62b306 2130Syntax:
2131~~~~~
2132vaxis name [Xa Ya Za Xb Yb Zb]
2133~~~~~
72b7576f 2134
bf62b306 2135Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
2136
e5bd0d98 2137**Example:**
bf62b306 2138~~~~~
72b7576f 2139vinit
2140vtrihedron tr
2141vaxis axe1 0 0 0 1 0 0
bf62b306 2142~~~~~
72b7576f 2143
bf62b306 2144@subsubsection occt_draw_4_4_5 vaxispara
72b7576f 2145
bf62b306 2146Syntax:
2147~~~~~
faea8b40 2148vaxispara name
bf62b306 2149~~~~~
72b7576f 2150
2151Creates an axis by interactive selection of an edge and a vertex.
2152
bf62b306 2153@subsubsection occt_draw_4_4_6 vaxisortho
72b7576f 2154
bf62b306 2155Syntax:
2156~~~~~
2157vaxisotrho name
2158~~~~~
72b7576f 2159
2160Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
2161
bf62b306 2162@subsubsection occt_draw_4_4_7 vpoint
72b7576f 2163
bf62b306 2164Syntax:
2165~~~~~
2166vpoint name [Xa Ya Za]
2167~~~~~
72b7576f 2168
2169Creates 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 2170
bf62b306 2171**Example:**
2172~~~~~
72b7576f 2173vinit
2174vpoint p 0 0 0
bf62b306 2175~~~~~
72b7576f 2176
bf62b306 2177@subsubsection occt_draw_4_4_8 vplane
72b7576f 2178
bf62b306 2179Syntax:
2180~~~~~
2181vplane name [AxisName] [PointName]
2182vplane name [PointName] [PointName] [PointName]
2183vplane name [PlaneName] [PointName]
2184~~~~~
72b7576f 2185
bf62b306 2186Creates a plane from named or interactively selected entities.
faea8b40 2187TypeOfSensitivity:
3f812249 2188 * 0 -- Interior
2189 * 1 -- Boundary
faea8b40 2190
e5bd0d98 2191**Example:**
bf62b306 2192~~~~~
72b7576f 2193vinit
2194vpoint p1 0 50 0
2195vaxis axe1 0 0 0 0 0 1
2196vtrihedron tr
2197vplane plane1 axe1 p1
bf62b306 2198~~~~~
72b7576f 2199
bf62b306 2200@subsubsection occt_draw_4_4_9 vplanepara
72b7576f 2201
bf62b306 2202Syntax:
2203~~~~~
2204vplanepara name
2205~~~~~
72b7576f 2206
2207Creates a plane from interactively selected vertex and face.
2208
bf62b306 2209@subsubsection occt_draw_4_4_10 vplaneortho
72b7576f 2210
bf62b306 2211Syntax:
2212~~~~~
2213vplaneortho name
2214~~~~~
72b7576f 2215
2216Creates a plane from interactive selected face and coplanar edge.
2217
bf62b306 2218@subsubsection occt_draw_4_4_11 vline
72b7576f 2219
bf62b306 2220Syntax:
2221~~~~~
2222vline name [PointName] [PointName]
2223vline name [Xa Ya Za Xb Yb Zb]
2224~~~~~
72b7576f 2225
2226Creates a line from coordinates, named or interactively selected vertices.
72b7576f 2227
bf62b306 2228**Example:**
2229~~~~~
72b7576f 2230vinit
2231vtrihedron tr
2232vpoint p1 0 50 0
2233vpoint p2 50 0 0
2234vline line1 p1 p2
2235vline line2 0 0 0 50 0 1
bf62b306 2236~~~~~
72b7576f 2237
bf62b306 2238@subsubsection occt_draw_4_4_12 vcircle
72b7576f 2239
bf62b306 2240Syntax:
2241~~~~~
2242vcircle name [PointName PointName PointName IsFilled]
72b7576f 2243vcircle name [PlaneName PointName Radius IsFilled]
bf62b306 2244~~~~~
72b7576f 2245
bf62b306 2246Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
2247
e5bd0d98 2248**Example:**
bf62b306 2249~~~~~
72b7576f 2250vinit
2251vtrihedron tr
2252vpoint p1 0 50 0
2253vpoint p2 50 0 0
2254vpoint p3 0 0 0
bf62b306 2255vcircle circle1 p1 p2 p3 1
2256~~~~~
72b7576f 2257
bf62b306 2258@subsubsection occt_draw_4_4_13 vtri2d
72b7576f 2259
bf62b306 2260Syntax:
2261~~~~~
2262vtri2d name
2263~~~~~
72b7576f 2264
2265Creates a plane with a 2D trihedron from an interactively selected face.
2266
bf62b306 2267@subsubsection occt_draw_4_4_14 vselmode
72b7576f 2268
bf62b306 2269Syntax:
2270~~~~~
faea8b40 2271vselmode [object] mode_number is_turned_on=(1|0)
bf62b306 2272~~~~~
72b7576f 2273
2274Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects.
251a7984 2275*Mode_number* is a non-negative integer encoding different interactive object classes.
faea8b40 2276For shapes the following *mode_number* values are allowed:
3f812249 2277 * 0 -- shape
2278 * 1 -- vertex
2279 * 2 -- edge
2280 * 3 -- wire
2281 * 4 -- face
2282 * 5 -- shell
2283 * 6 -- solid
2284 * 7 -- compsolid
2285 * 8 -- compound
faea8b40 2286*is_turned_on* is:
2287 * 1 if mode is to be switched on
2288 * 0 if mode is to be switched off
72b7576f 2289
bf62b306 2290**Example:**
2291~~~~~
72b7576f 2292vinit
2293vpoint p1 0 0 0
2294vpoint p2 50 0 0
2295vpoint p3 25 40 0
2296vtriangle triangle1 p1 p2 p3
bf62b306 2297~~~~~
2298
faea8b40 2299@subsubsection occt_draw_4_4_15 vconnect
72b7576f 2300
bf62b306 2301Syntax:
2302~~~~~
faea8b40 2303vconnect vconnect name Xo Yo Zo object1 object2 ... [color=NAME]
bf62b306 2304~~~~~
72b7576f 2305
251a7984 2306Creates *AIS_ConnectedInteractive* object from the input object and location and displays it.
72b7576f 2307
bf62b306 2308**Example:**
2309~~~~~
73ddbb9a 2310vinit
72b7576f 2311vpoint p1 0 0 0
2312vpoint p2 50 0 0
2313vsegment segment p1 p2
2314restore CrankArm.brep obj
2315vdisplay obj
faea8b40 2316vconnect new obj 100100100 1 0 0 0 0 1
bf62b306 2317~~~~~
72b7576f 2318
bf62b306 2319@subsubsection occt_draw_4_4_16 vtriangle
72b7576f 2320
bf62b306 2321Syntax:
2322~~~~~
2323vtriangle name PointName PointName PointName
2324~~~~~
72b7576f 2325
2326Creates and displays a filled triangle from named points.
72b7576f 2327
bf62b306 2328**Example:**
2329~~~~~
72b7576f 2330vinit
2331vpoint p1 0 0 0
2332vpoint p2 50 0 0
2333vpoint p3 25 40 0
bf62b306 2334vtriangle triangle1 p1 p2 p3
2335~~~~~
72b7576f 2336
bf62b306 2337@subsubsection occt_draw_4_4_17 vsegment
72b7576f 2338
bf62b306 2339Syntax:
2340~~~~~
2341vsegment name PointName PointName
2342~~~~~
72b7576f 2343
2344Creates and displays a segment from named points.
72b7576f 2345
bf62b306 2346**Example:**
2347~~~~~
72b7576f 2348Vinit
2349vpoint p1 0 0 0
2350vpoint p2 50 0 0
2351vsegment segment p1 p2
bf62b306 2352~~~~~
72b7576f 2353
18006a0f 2354@subsubsection occt_draw_4_4_18 vpointcloud
2355
2356Syntax:
2357~~~~~
faea8b40 2358vpointcloud name shape [-randColor] [-normals] [-noNormals]
18006a0f 2359~~~~~
2360
251a7984 2361Creates an interactive object for an arbitrary set of points from the triangulated shape.
faea8b40 2362Additional options:
251a7984 2363 * *randColor* -- generates a random color per point;
2364 * *normals* -- generates a normal per point (default);
2365 * *noNormals* -- does not generate a normal per point.
18006a0f 2366
2367~~~~~
faea8b40 2368vpointcloud name x y z r npts {surface|volume} [-randColor] [-normals] [-noNormals]
18006a0f 2369~~~~~
2370Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r).
faea8b40 2371Additional options:
251a7984 2372 * *randColor* -- generates a random color per point;
2373 * *normals* -- generates a normal per point (default);
2374 * *noNormals* -- does not generate a normal per point.
18006a0f 2375
2376**Example:**
2377~~~~~
2378vinit
2379vpointcloud pc 0 0 0 100 100000 surface -randColor
2380vfit
2381~~~~~
2382
2383@subsubsection occt_draw_4_4_19 vclipplane
2384
2385Syntax:
2386~~~~~
3f812249 2387vclipplane maxplanes <view_name> -- gets plane limit for the view.
2388vclipplane create <plane_name> -- creates a new plane.
2389vclipplane delete <plane_name> -- deletes a plane.
2390vclipplane clone <source_plane> <plane_name> -- clones the plane definition.
2391vclipplane set/unset <plane_name> object <object list> -- sets/unsets the plane for an IO.
2392vclipplane set/unset <plane_name> view <view list> -- sets/unsets plane for a view.
2393vclipplane change <plane_name> on/off -- turns clipping on/off.
2394vclipplane change <plane_name> equation <a> <b> <c> <d> -- changes plane equation.
2395vclipplane change <plane_name> capping on/off -- turns capping on/off.
2396vclipplane change <plane_name> capping color <r> <g> <b> -- sets color.
2397vclipplane change <plane name> capping texname <texture> -- sets texture.
2398vclipplane change <plane_name> capping texscale <sx> <sy> -- sets texture scale.
2399vclipplane change <plane_name> capping texorigin <tx> <ty> -- sets texture origin.
2400vclipplane change <plane_name> capping texrotate <angle> -- sets texture rotation.
2401vclipplane change <plane_name> capping hatch on/off/<id> -- sets hatching mask.
18006a0f 2402~~~~~
2403
2404Manages clipping planes
2405
2406**Example:**
2407~~~~~
2408vinit
2409vclipplane create pln1
2410vclipplane change pln1 equation 1 0 0 -0.1
2411vclipplane set pln1 view Driver1/Viewer1/View1
2412box b 100 100 100
2413vdisplay b
2414vsetdispmode 1
2415vfit
2416vrotate 10 10 10
2417vselect 100 100
2418~~~~~
2419
2420@subsubsection occt_draw_4_4_20 vdimension
2421
2422Syntax:
2423~~~~~
2424vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]
2425 [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2426 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2427 [-arrow external|internal|fit] [{-arrowlength|-arlen} RealArrowLength]
2428 [{-arrowangle|-arangle} ArrowAngle(degrees)] [-plane xoy|yoz|zox]
73ddbb9a 2429 [-flyout FloatValue -extension FloatValue]
d5cdd12a 2430 [-autovalue] [-value CustomRealValue] [-textvalue CustomTextValue]
73ddbb9a 2431 [-dispunits DisplayUnitsString]
2432 [-modelunits ModelUnitsString] [-showunits | -hideunits]
18006a0f 2433~~~~~
2434
2435Builds angle, length, radius or diameter dimension interactive object **name**.
2436
2437**Attension:** length dimension can't be built without working plane.
2438
2439**Example:**
2440~~~~~
73ddbb9a 2441vinit
18006a0f 2442vpoint p1 0 0 0
2443vpoint p2 50 50 0
2444vdimension dim1 -length -plane xoy -shapes p1 p2
2445
2446vpoint p3 100 0 0
2447vdimension dim2 -angle -shapes p1 p2 p3
2448
2449vcircle circle p1 p2 p3 0
2450vdimension dim3 -radius -shapes circle
2451vfit
2452~~~~~
2453
2454@subsubsection occt_draw_4_4_21 vdimparam
2455
2456Syntax:
2457~~~~~
2458vdimparam name [-text 3d|2d wf|sh|wireframe|shading IntegerSize]
2459 [-label left|right|hcenter|hfit top|bottom|vcenter|vfit]
2460 [-arrow external|internal|fit]
2461 [{-arrowlength|-arlen} RealArrowLength]
2462 [{-arrowangle|-arangle} ArrowAngle(degrees)]
2463 [-plane xoy|yoz|zox]
2464 [-flyout FloatValue -extension FloatValue]
73ddbb9a 2465 [-autovalue]
2466 [-value CustomRealValue]
2467 [-textvalue CustomTextValue]
18006a0f 2468 [-dispunits DisplayUnitsString]
2469 [-modelunits ModelUnitsString]
2470 [-showunits | -hideunits]
2471~~~~~
2472
2473Sets parameters for angle, length, radius and diameter dimension **name**.
2474
2475**Example:**
2476~~~~~
73ddbb9a 2477vinit
18006a0f 2478vpoint p1 0 0 0
2479vpoint p2 50 50 0
2480vdimension dim1 -length -plane xoy -shapes p1 p2
2481vdimparam dim1 -flyout -15 -arrowlength 4 -showunits -value 10
73ddbb9a 2482vfit
2483vdimparam dim1 -textvalue "w_1"
2484vdimparam dim1 -autovalue
18006a0f 2485~~~~~
2486
ee905e84 2487@subsubsection occt_draw_4_4_22 vdimangleparam
2488
2489Syntax:
2490~~~~~
2491vangleparam name [-type interior|exterior]
2492 [-showarrow first|second|both|none]
2493~~~~~
2494
2495Sets parameters for angle dimension **name**.
2496
2497**Example:**
2498~~~~~
2499vinit
2500vpoint p1 0 0 0
2501vpoint p2 10 0 0
2502vpoint p3 10 5 0
2503vdimension dim1 -angle -plane xoy -shapes p1 p2 p3
2504vfit
2505vangleparam dim1 -type exterior -showarrow first
2506~~~~~
2507
2508@subsubsection occt_draw_4_4_23 vmovedim
18006a0f 2509
2510Syntax:
2511~~~~~
2512vmovedim [name] [x y z]
2513~~~~~
2514
2515Moves picked or named (if **name** parameter is defined) dimension
2516to picked mouse position or input point with coordinates **x**,**y**,**z**.
2517Text label of dimension **name** is moved to position, another parts of dimension
2518are adjusted.
2519
2520**Example:**
2521~~~~~
73ddbb9a 2522vinit
18006a0f 2523vpoint p1 0 0 0
2524vpoint p2 50 50 0
2525vdimension dim1 -length -plane xoy -shapes p1 p2
2526vmovedim dim1 -10 30 0
2527~~~~~
2528
2529
3f812249 2530@subsection occt_draw_4_5 AIS viewer -- Mesh Visualization Service
72b7576f 2531
bf62b306 2532**MeshVS** (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
72b7576f 2533
bf62b306 2534@subsubsection occt_draw_4_5_1 meshfromstl
72b7576f 2535
bf62b306 2536Syntax:
2537~~~~~
2538meshfromstl meshname file
2539~~~~~
2540
2541Creates a *MeshVS_Mesh* object based on STL file data. The object will be displayed immediately.
2542
2543**Example:**
2544~~~~~
2545meshfromstl mesh myfile.stl
2546~~~~~
72b7576f 2547
bf62b306 2548@subsubsection occt_draw_4_5_2 meshdispmode
72b7576f 2549
bf62b306 2550Syntax:
2551~~~~~
2552meshdispmode meshname displaymode
2553~~~~~
72b7576f 2554
bf62b306 2555Changes the display mode of object **meshname**. The **displaymode** is integer, which can be:
2556* *1* for *wireframe*,
2557* *2* for *shading* mode, or
2558* *3* for *shrink* mode.
72b7576f 2559
e5bd0d98 2560**Example:**
bf62b306 2561~~~~~
2562vinit
72b7576f 2563meshfromstl mesh myfile.stl
bf62b306 2564meshdispmode mesh 2
2565~~~~~
72b7576f 2566
bf62b306 2567@subsubsection occt_draw_4_5_3 meshselmode
72b7576f 2568
bf62b306 2569Syntax:
2570~~~~~
2571meshselmode meshname selectionmode
2572~~~~~
72b7576f 2573
bf62b306 2574Changes the selection mode of object **meshname**. The *selectionmode* is integer OR-combination of mode flags. The basic flags are the following:
3f812249 2575* *1* -- node selection;
2576* *2* -- 0D elements (not supported in STL);
2577* *4* -- links (not supported in STL);
2578* *8* -- faces.
bf62b306 2579
e5bd0d98 2580**Example:**
bf62b306 2581~~~~~
72b7576f 2582vinit
2583meshfromstl mesh myfile.stl
bf62b306 2584meshselmode mesh 1
2585~~~~~
72b7576f 2586
bf62b306 2587@subsubsection occt_draw_4_5_4 meshshadcolor
72b7576f 2588
bf62b306 2589Syntax:
2590~~~~~
2591meshshadcolor meshname red green blue
2592~~~~~
72b7576f 2593
ca0f3082 2594Changes the face interior color of object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
bf62b306 2595
e5bd0d98 2596**Example:**
bf62b306 2597~~~~~
72b7576f 2598vinit
2599meshfromstl mesh myfile.stl
bf62b306 2600meshshadcolormode mesh 0.5 0.5 0.5
2601~~~~~
72b7576f 2602
bf62b306 2603@subsubsection occt_draw_4_5_5 meshlinkcolor
72b7576f 2604
bf62b306 2605Syntax:
2606~~~~~
2607meshlinkcolor meshname red green blue
2608~~~~~
72b7576f 2609
bf62b306 2610Changes the color of face borders for object **meshname**. The *red*, *green* and *blue* are real values between *0* and *1*.
2611
e5bd0d98 2612**Example:**
bf62b306 2613~~~~~
72b7576f 2614vinit
2615meshfromstl mesh myfile.stl
bf62b306 2616meshlinkcolormode mesh 0.5 0.5 0.5
2617~~~~~
72b7576f 2618
bf62b306 2619@subsubsection occt_draw_4_5_6 meshmat
72b7576f 2620
bf62b306 2621Syntax:
2622~~~~~
2623meshmat meshname material
2624~~~~~
2625
2626Changes the material of object **meshname**.
2627
2628*material* is represented with an integer value as follows (equivalent to enumeration *Graphic3d_NameOfMaterial*):
3f812249 2629* *0 -- BRASS,*
2630* *1 -- BRONZE,*
2631* *2 -- COPPER,*
2632* *3 -- GOLD,*
2633* *4 -- PEWTER,*
2634* *5 -- PLASTER,*
2635* *6 -- PLASTIC,*
2636* *7 -- SILVER,*
2637* *8 -- STEEL,*
2638* *9 -- STONE,*
2639* *10 -- SHINY_PLASTIC,*
2640* *11 -- SATIN,*
2641* *12 -- METALIZED,*
2642* *13 -- NEON_GNC,*
2643* *14 -- CHROME,*
2644* *15 -- ALUMINIUM,*
2645* *16 -- OBSIDIAN,*
2646* *17 -- NEON_PHC,*
2647* *18 -- JADE,*
2648* *19 -- DEFAULT,*
2649* *20 -- UserDefined*
bf62b306 2650
e5bd0d98 2651**Example:**
bf62b306 2652~~~~~
72b7576f 2653vinit
2654meshfromstl mesh myfile.stl
2655meshmat mesh JADE
bf62b306 2656~~~~~
72b7576f 2657
bf62b306 2658@subsubsection occt_draw_4_5_7 meshshrcoef
72b7576f 2659
bf62b306 2660Syntax:
2661~~~~~
2662meshshrcoef meshname shrinkcoefficient
2663~~~~~
72b7576f 2664
bf62b306 2665Changes 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.
2666
e5bd0d98 2667**Example:**
bf62b306 2668~~~~~
72b7576f 2669vinit
2670meshfromstl mesh myfile.stl
bf62b306 2671meshshrcoef mesh 0.05
2672~~~~~
72b7576f 2673
bf62b306 2674@subsubsection occt_draw_4_5_8 meshshow
72b7576f 2675
bf62b306 2676Syntax:
2677~~~~~
2678meshshow meshname
2679~~~~~
72b7576f 2680
bf62b306 2681Displays **meshname** in the viewer (if it is erased).
2682
e5bd0d98 2683**Example:**
bf62b306 2684~~~~~
72b7576f 2685vinit
2686meshfromstl mesh myfile.stl
bf62b306 2687meshshow mesh
2688~~~~~
72b7576f 2689
bf62b306 2690@subsubsection occt_draw_4_5_9 meshhide
72b7576f 2691
bf62b306 2692Syntax:
2693~~~~~
2694meshhide meshname
2695~~~~~
72b7576f 2696
2697Hides **meshname** in the viewer.
72b7576f 2698
bf62b306 2699**Example:**
2700~~~~~
72b7576f 2701vinit
2702meshfromstl mesh myfile.stl
bf62b306 2703meshhide mesh
2704~~~~~
72b7576f 2705
bf62b306 2706@subsubsection occt_draw_4_5_10 meshhidesel
72b7576f 2707
bf62b306 2708Syntax:
2709~~~~~
2710meshhidesel meshname
2711~~~~~
72b7576f 2712
2713Hides only selected entities. The other part of **meshname** remains visible.
2714
bf62b306 2715@subsubsection occt_draw_4_5_11 meshshowsel
72b7576f 2716
bf62b306 2717Syntax:
2718~~~~~
2719meshshowsel meshname
2720~~~~~
72b7576f 2721
2722Shows only selected entities. The other part of **meshname** becomes invisible.
2723
bf62b306 2724@subsubsection occt_draw_4_5_12 meshshowall
72b7576f 2725
bf62b306 2726Syntax:
2727~~~~~
2728meshshowall meshname
2729~~~~~
72b7576f 2730
2731Changes the state of all entities to visible for **meshname**.
2732
bf62b306 2733@subsubsection occt_draw_4_5_13 meshdelete
72b7576f 2734
bf62b306 2735Syntax:
2736~~~~~
2737meshdelete meshname
2738~~~~~
72b7576f 2739
2740Deletes MeshVS_Mesh object **meshname**.
72b7576f 2741
bf62b306 2742**Example:**
2743~~~~~
72b7576f 2744vinit
2745meshfromstl mesh myfile.stl
2746meshdelete mesh
bf62b306 2747~~~~~
72b7576f 2748
18006a0f 2749@subsection occt_draw_4_6 VIS Viewer commands
2750
2751A specific plugin with alias *VIS* should be loaded to have access to VIS functionality in DRAW Test Harness:
2752
2753~~~~
2754\> pload VIS
2755~~~~
2756
2757@subsubsection occt_draw_4_6_1 ivtkinit
2758
2759Syntax:
2760~~~~~
2761ivtkinit
2762~~~~~
2763
2764Creates a window for VTK viewer.
2765
2766@figure{/user_guides/draw_test_harness/images/draw_image001.png}
2767
bfa7a685 2768@subsubsection occt_draw_4_6_2 ivtkdisplay
18006a0f 2769
2770Syntax:
2771~~~~~
2772ivtkdisplay name1 [name2] …[name n]
2773~~~~~
2774
2775Displays named objects.
2776
2777**Example:**
2778~~~~~
2779ivtkinit
2780# create cone
2781pcone c 5 0 10
2782ivtkdisplay c
2783~~~~~
2784
2785@figure{/user_guides/draw_test_harness/images/draw_image002.png}
2786
bfa7a685 2787@subsubsection occt_draw_4_6_3 ivtkerase
18006a0f 2788
2789Syntax:
2790~~~~~
2791ivtkerase [name1] [name2] … [name n]
2792~~~~~
2793
2794Erases named objects. If no arguments are passed, erases all displayed objects.
2795
2796**Example:**
2797~~~~~
2798ivtkinit
2799# create a sphere
2800psphere s 10
2801# create a cone
2802pcone c 5 0 10
2803# create a cylinder
2804pcylinder cy 5 10
2805# display objects
2806ivtkdisplay s c cy
2807# erase only the cylinder
2808ivtkerase cy
2809# erase the sphere and the cone
2810ivtkerase s c
2811~~~~~
2812
bfa7a685 2813@subsubsection occt_draw_4_6_4 ivtkfit
18006a0f 2814
2815Syntax:
2816~~~~~
2817ivtkfit
2818~~~~~
2819
2820Automatic zoom/panning.
2821
bfa7a685 2822@subsubsection occt_draw_4_6_5 ivtkdispmode
18006a0f 2823
2824Syntax:
2825~~~~~
2826ivtksetdispmode [name] {0|1}
2827~~~~~
2828
2829Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects
2830The possible modes are: 0 (WireFrame) and 1 (Shading).
2831
2832**Example:**
2833~~~~~
2834ivtkinit
2835# create a cone
2836pcone c 5 0 10
2837# display the cone
2838ivtkdisplay c
2839# set shading mode for the cone
2840ivtksetdispmode c 1
2841~~~~~
2842
2843@figure{/user_guides/draw_test_harness/images/draw_image003.png}
2844
bfa7a685 2845@subsubsection occt_draw_4_6_6 ivtksetselmode
18006a0f 2846
2847Syntax:
2848~~~~~
2849ivtksetselmode [name] mode {0|1}
2850~~~~~
2851
2852Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects.
2853
2854**Example:**
2855~~~~~
2856ivtkinit
2857# load a shape from file
2858restore CrankArm.brep a
2859# display the loaded shape
2860ivtkdisplay a
2861# set the face selection mode
2862ivtksetselmode a 4 1
2863~~~~~
2864
2865@figure{/user_guides/draw_test_harness/images/draw_image004.png}
2866
bfa7a685 2867@subsubsection occt_draw_4_6_7 ivtkmoveto
18006a0f 2868
2869Syntax:
2870~~~~~
2871ivtkmoveto x y
2872~~~~~
2873
2874Imitates mouse cursor moving to point with the given display coordinates **x**,**y**.
2875
2876**Example:**
2877~~~~~
2878ivtkinit
2879pcone c 5 0 10
2880ivtkdisplay c
2881ivtkmoveto 40 50
2882~~~~~
2883
bfa7a685 2884@subsubsection occt_draw_4_6_8 ivtkselect
18006a0f 2885
2886Syntax:
2887~~~~~
2888ivtkselect x y
2889~~~~~
2890
2891Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
2892
2893**Example:**
2894~~~~~
2895ivtkinit
2896pcone c 5 0 10
2897ivtkdisplay c
2898ivtkselect 40 50
2899~~~~~
2900
bfa7a685 2901@subsubsection occt_draw_4_6_9 ivtkdump
18006a0f 2902
2903Syntax:
2904~~~~~
2905ivtkdump *filename* [buffer={rgb|rgba|depth}] [width height] [stereoproj={L|R}]
2906~~~~~
2907
2908Dumps the contents of VTK viewer to image. It supports:
2909* dumping in different raster graphics formats: PNG, BMP, JPEG, TIFF or PNM.
2910* dumping of different buffers: RGB, RGBA or depth buffer.
2911* defining of image sizes (width and height in pixels).
2912* dumping of stereo projections (left or right).
2913
2914**Example:**
2915~~~~~
2916ivtkinit
2917pcone c 5 0 10
2918ivtkdisplay c
2919ivtkdump D:/ConeSnapshot.png rgb 768 768
2920~~~~~
2921
bfa7a685 2922@subsubsection occt_draw_4_6_10 ivtkbgcolor
18006a0f 2923
2924
2925Syntax:
2926~~~~~
2927ivtkbgcolor r g b [r2 g2 b2]
2928~~~~~
2929
2930Sets 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].
2931
2932**Example:**
2933~~~~~
2934ivtkinit
2935ivtkbgcolor 200 220 250
2936~~~~~
2937
2938@figure{/user_guides/draw_test_harness/images/draw_image005.png}
2939
2940~~~~~
2941ivtkbgcolor 10 30 80 255 255 255
2942~~~~~
2943
2944@figure{/user_guides/draw_test_harness/images/draw_image006.png}
2945
2946
bf62b306 2947@section occt_draw_5 OCAF commands
72b7576f 2948
2949
2950This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
2951
2952
bf62b306 2953@subsection occt_draw_5_1 Application commands
72b7576f 2954
2955
bf62b306 2956@subsubsection occt_draw_5_1_1 NewDocument
72b7576f 2957
bf62b306 2958Syntax:
2959~~~~~
2960NewDocument docname [format]
2961~~~~~
72b7576f 2962
2963Creates a new **docname** document with MDTV-Standard or described format.
72b7576f 2964
bf62b306 2965**Example:**
2966~~~~~
72b7576f 2967# Create new document with default (MDTV-Standard) format
2968NewDocument D
2969
2970# Create new document with BinOcaf format
2971NewDocument D2 BinOcaf
bf62b306 2972~~~~~
72b7576f 2973
bf62b306 2974@subsubsection occt_draw_5_1_2 IsInSession
72b7576f 2975
bf62b306 2976Syntax:
2977~~~~~
2978IsInSession path
2979~~~~~
72b7576f 2980
3f812249 2981Returns *0*, if **path** document is managed by the application session, *1* -- otherwise.
72b7576f 2982
bf62b306 2983**Example:**
2984~~~~~
72b7576f 2985IsInSession /myPath/myFile.std
bf62b306 2986~~~~~
72b7576f 2987
bf62b306 2988@subsubsection occt_draw_5_1_3 ListDocuments
72b7576f 2989
bf62b306 2990Syntax:
2991~~~~~
2992ListDocuments
2993~~~~~
72b7576f 2994
2995Makes a list of documents handled during the session of the application.
2996
2997
bf62b306 2998@subsubsection occt_draw_5_1_4 Open
72b7576f 2999
bf62b306 3000Syntax:
3001~~~~~
4ff92abe 3002Open path docname [-stream]
bf62b306 3003~~~~~
72b7576f 3004
3005Retrieves the document of file **docname** in the path **path**. Overwrites the document, if it is already in session.
72b7576f 3006
4ff92abe 3007option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
3008
bf62b306 3009**Example:**
3010~~~~~
3011Open /myPath/myFile.std D
3012~~~~~
72b7576f 3013
bf62b306 3014@subsubsection occt_draw_5_1_5 Close
72b7576f 3015
bf62b306 3016Syntax:
3017~~~~~
3018Close docname
3019~~~~~
72b7576f 3020
3021Closes **docname** document. The document is no longer handled by the applicative session.
72b7576f 3022
bf62b306 3023**Example:**
3024~~~~~
72b7576f 3025Close D
bf62b306 3026~~~~~
72b7576f 3027
bf62b306 3028@subsubsection occt_draw_5_1_6 Save
72b7576f 3029
bf62b306 3030Syntax:
3031~~~~~
3032Save docname
3033~~~~~
72b7576f 3034
3035Saves **docname** active document.
72b7576f 3036
bf62b306 3037**Example:**
3038~~~~~
72b7576f 3039Save D
bf62b306 3040~~~~~
72b7576f 3041
bf62b306 3042@subsubsection occt_draw_5_1_7 SaveAs
72b7576f 3043
bf62b306 3044Syntax:
3045~~~~~
4ff92abe 3046SaveAs docname path [-stream]
bf62b306 3047~~~~~
72b7576f 3048
4ff92abe 3049Saves the active document in the file **docname** in the path **path**. Overwrites the file if it already exists.
3050
3051option <i>-stream</i> activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
72b7576f 3052
bf62b306 3053**Example:**
3054~~~~~
3055SaveAs D /myPath/myFile.std
3056~~~~~
72b7576f 3057
ba06f8bb 3058@subsection occt_draw_5_2 Basic commands
72b7576f 3059
ba06f8bb 3060@subsubsection occt_draw_5_2_1 Label
72b7576f 3061
ba06f8bb 3062Syntax:
72b7576f 3063
bf62b306 3064~~~~~
3065Label docname entry
3066~~~~~
72b7576f 3067
ba06f8bb 3068Creates the label expressed by <i>\<entry\></i> if it does not exist.
72b7576f 3069
bf62b306 3070Example
3071~~~~~
3072Label D 0:2
3073~~~~~
72b7576f 3074
ba06f8bb 3075@subsubsection occt_draw_5_2_2 NewChild
72b7576f 3076
ba06f8bb 3077Syntax:
72b7576f 3078
bf62b306 3079~~~~~
3080NewChild docname [taggerlabel = Root label]
3081~~~~~
ba06f8bb 3082Finds (or creates) a *TagSource* attribute located at father label of <i>\<taggerlabel\></i> and makes a new child label.
72b7576f 3083
bf62b306 3084Example
3085~~~~~
3086# Create new child of root label
3087NewChild D
72b7576f 3088
bf62b306 3089# Create new child of existing label
3090Label D 0:2
3091NewChild D 0:2
3092~~~~~
72b7576f 3093
ba06f8bb 3094@subsubsection occt_draw_5_2_3 Children
72b7576f 3095
ba06f8bb 3096Syntax:
bf62b306 3097~~~~~
3098Children docname label
3099~~~~~
3100Returns the list of attributes of label.
72b7576f 3101
bf62b306 3102Example
3103~~~~~
3104Children D 0:2
3105~~~~~
72b7576f 3106
ba06f8bb 3107@subsubsection occt_draw_5_2_4 ForgetAll
72b7576f 3108
ba06f8bb 3109Syntax:
bf62b306 3110~~~~~
3111ForgetAll docname label
3112~~~~~
3113Forgets all attributes of the label.
72b7576f 3114
bf62b306 3115Example
3116~~~~~
3117ForgetAll D 0:2
3118~~~~~
72b7576f 3119
72b7576f 3120
bf62b306 3121@subsubsection occt_draw_5_3 Application commands
72b7576f 3122
bf62b306 3123@subsubsection occt_draw_5_3_1 Main
72b7576f 3124
bf62b306 3125Syntax:
3126~~~~~
3127Main docname
3128~~~~~
72b7576f 3129
3130Returns the main label of the framework.
72b7576f 3131
bf62b306 3132**Example:**
3133~~~~~
72b7576f 3134Main D
bf62b306 3135~~~~~
72b7576f 3136
bf62b306 3137@subsubsection occt_draw_5_3_2 UndoLimit
72b7576f 3138
bf62b306 3139Syntax:
3140~~~~~
3141UndoLimit docname [value=0]
3142~~~~~
72b7576f 3143
3144
bf62b306 3145Sets 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 3146
bf62b306 3147**Example:**
3148~~~~~
72b7576f 3149UndoLimit D 100
bf62b306 3150~~~~~
72b7576f 3151
bf62b306 3152@subsubsection occt_draw_5_3_3 Undo
72b7576f 3153
bf62b306 3154Syntax:
3155~~~~~
3156Undo docname [value=1]
3157~~~~~
72b7576f 3158
3159Undoes **value** steps.
72b7576f 3160
bf62b306 3161**Example:**
3162~~~~~
72b7576f 3163Undo D
bf62b306 3164~~~~~
72b7576f 3165
bf62b306 3166@subsubsection occt_draw_5_3_4 Redo
72b7576f 3167
bf62b306 3168Syntax:
3169~~~~~
3170Redo docname [value=1]
3171~~~~~
72b7576f 3172
bf62b306 3173Redoes **value** steps.
3174
e5bd0d98 3175**Example:**
bf62b306 3176~~~~~
72b7576f 3177Redo D
bf62b306 3178~~~~~
72b7576f 3179
bf62b306 3180@subsubsection occt_draw_5_3_5 OpenCommand
72b7576f 3181
bf62b306 3182Syntax:
3183~~~~~
3184OpenCommand docname
3185~~~~~
72b7576f 3186
3187Opens a new command transaction.
72b7576f 3188
bf62b306 3189**Example:**
3190~~~~~
3191OpenCommand D
3192~~~~~
72b7576f 3193
bf62b306 3194@subsubsection occt_draw_5_3_6 CommitCommand
72b7576f 3195
bf62b306 3196Syntax:
3197~~~~~
3198CommitCommand docname
3199~~~~~
72b7576f 3200
3201Commits the Command transaction.
72b7576f 3202
bf62b306 3203**Example:**
3204~~~~~
3205CommitCommand D
3206~~~~~
72b7576f 3207
bf62b306 3208@subsubsection occt_draw_5_3_7 NewCommand
72b7576f 3209
bf62b306 3210Syntax:
3211~~~~~
3212NewCommand docname
3213~~~~~
72b7576f 3214
3f812249 3215This is a shortcut for Commit and Open transaction.
72b7576f 3216
bf62b306 3217**Example:**
3218~~~~~
72b7576f 3219NewCommand D
bf62b306 3220~~~~~
72b7576f 3221
bf62b306 3222@subsubsection occt_draw_5_3_8 AbortCommand
72b7576f 3223
bf62b306 3224Syntax:
3225~~~~~
3226AbortCommand docname
3227~~~~~
72b7576f 3228
3229Aborts the Command transaction.
72b7576f 3230
bf62b306 3231**Example:**
3232~~~~~
72b7576f 3233AbortCommand D
bf62b306 3234~~~~~
3235
3236@subsubsection occt_draw_5_3_9 Copy
72b7576f 3237
bf62b306 3238Syntax:
3239~~~~~
3240Copy docname entry Xdocname Xentry
3241~~~~~
72b7576f 3242
bf62b306 3243Copies the contents of *entry* to *Xentry*. No links are registered.
72b7576f 3244
e5bd0d98 3245**Example:**
bf62b306 3246~~~~~
72b7576f 3247Copy D1 0:2 D2 0:4
bf62b306 3248~~~~~
72b7576f 3249
bf62b306 3250@subsubsection occt_draw_5_3_10 UpdateLink
72b7576f 3251
bf62b306 3252Syntax:
3253~~~~~
3254UpdateLink docname [entry]
3255~~~~~
72b7576f 3256
bf62b306 3257Updates external reference set at *entry*.
72b7576f 3258
bf62b306 3259**Example:**
3260~~~~~
72b7576f 3261UpdateLink D
bf62b306 3262~~~~~
72b7576f 3263
bf62b306 3264@subsubsection occt_draw_5_3_11 CopyWithLink
72b7576f 3265
bf62b306 3266Syntax:
3267~~~~~
3268CopyWithLink docname entry Xdocname Xentry
3269~~~~~
72b7576f 3270
3271Aborts the Command transaction.
bf62b306 3272Copies the content of *entry* to *Xentry*. The link is registered with an *Xlink* attribute at *Xentry* label.
3273
e5bd0d98 3274**Example:**
bf62b306 3275~~~~~
3276CopyWithLink D1 0:2 D2 0:4
3277~~~~~
72b7576f 3278
bf62b306 3279@subsubsection occt_draw_5_3_12 UpdateXLinks
72b7576f 3280
bf62b306 3281Syntax:
3282~~~~~
3283UpdateXLinks docname entry
3284~~~~~
72b7576f 3285
bf62b306 3286Sets modifications on labels impacted by external references to the *entry*. The *document* becomes invalid and must be recomputed
72b7576f 3287
e5bd0d98 3288**Example:**
bf62b306 3289~~~~~
72b7576f 3290UpdateXLinks D 0:2
bf62b306 3291~~~~~
72b7576f 3292
bf62b306 3293@subsubsection occt_draw_5_3_13 DumpDocument
72b7576f 3294
bf62b306 3295Syntax:
3296~~~~~
3297DumpDocument docname
3298~~~~~
72b7576f 3299
bf62b306 3300Displays parameters of *docname* document.
72b7576f 3301
bf62b306 3302**Example:**
3303~~~~~
72b7576f 3304DumpDocument D
bf62b306 3305~~~~~
3306
72b7576f 3307
bf62b306 3308@subsection occt_draw_5_4 Data Framework commands
72b7576f 3309
3310
bf62b306 3311@subsubsection occt_draw_5_4_1 MakeDF
72b7576f 3312
bf62b306 3313Syntax:
3314~~~~~
3315MakeDF dfname
3316~~~~~
72b7576f 3317
3318Creates a new data framework.
72b7576f 3319
bf62b306 3320**Example:**
3321~~~~~
72b7576f 3322MakeDF D
bf62b306 3323~~~~~
72b7576f 3324
bf62b306 3325@subsubsection occt_draw_5_4_2 ClearDF
72b7576f 3326
bf62b306 3327Syntax:
3328~~~~~
3329ClearDF dfname
3330~~~~~
72b7576f 3331
3332Clears a data framework.
72b7576f 3333
bf62b306 3334**Example:**
3335~~~~~
72b7576f 3336ClearDF D
bf62b306 3337~~~~~
72b7576f 3338
bf62b306 3339@subsubsection occt_draw_5_4_3 CopyDF
72b7576f 3340
bf62b306 3341Syntax:
3342~~~~~
3343CopyDF dfname1 entry1 [dfname2] entry2
3344~~~~~
72b7576f 3345
3346Copies a data framework.
72b7576f 3347
bf62b306 3348**Example:**
3349~~~~~
72b7576f 3350CopyDF D 0:2 0:4
bf62b306 3351~~~~~
72b7576f 3352
bf62b306 3353@subsubsection occt_draw_5_4_4 CopyLabel
72b7576f 3354
bf62b306 3355Syntax:
3356~~~~~
3357CopyLabel dfname fromlabel tolablel
3358~~~~~
72b7576f 3359
3360Copies a label.
72b7576f 3361
bf62b306 3362**Example:**
3363~~~~~
72b7576f 3364CopyLabel D1 0:2 0:4
bf62b306 3365~~~~~
72b7576f 3366
bf62b306 3367@subsubsection occt_draw_5_4_5 MiniDumpDF
72b7576f 3368
bf62b306 3369Syntax:
3370~~~~~
3371MiniDumpDF dfname
3372~~~~~
72b7576f 3373
3374Makes a mini-dump of a data framework.
72b7576f 3375
bf62b306 3376**Example:**
3377~~~~~
72b7576f 3378MiniDumpDF D
bf62b306 3379~~~~~
72b7576f 3380
bf62b306 3381@subsubsection occt_draw_5_4_6 XDumpDF
72b7576f 3382
bf62b306 3383Syntax:
3384~~~~~
3385XDumpDF dfname
3386~~~~~
72b7576f 3387
3388Makes an extended dump of a data framework.
bf62b306 3389
e5bd0d98 3390**Example:**
bf62b306 3391~~~~~
3392XDumpDF D
3393~~~~~
72b7576f 3394
bf62b306 3395@subsection occt_draw_5_5 General attributes commands
72b7576f 3396
72b7576f 3397
bf62b306 3398@subsubsection occt_draw_5_5_1 SetInteger
72b7576f 3399
bf62b306 3400Syntax:
3401~~~~~
3402SetInteger dfname entry value
3403~~~~~
72b7576f 3404
bf62b306 3405Finds or creates an Integer attribute at *entry* label and sets *value*.
72b7576f 3406
e5bd0d98 3407**Example:**
bf62b306 3408~~~~~
72b7576f 3409SetInteger D 0:2 100
bf62b306 3410~~~~~
3411
3412@subsubsection occt_draw_5_5_2 GetInteger
72b7576f 3413
bf62b306 3414Syntax:
3415~~~~~
3416GetInteger dfname entry [drawname]
3417~~~~~
72b7576f 3418
bf62b306 3419Gets a value of an Integer attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3420
e5bd0d98 3421**Example:**
bf62b306 3422~~~~~
72b7576f 3423GetInteger D 0:2 Int1
bf62b306 3424~~~~~
72b7576f 3425
bf62b306 3426@subsubsection occt_draw_5_5_3 SetReal
72b7576f 3427
bf62b306 3428Syntax:
3429~~~~~
3430SetReal dfname entry value
3431~~~~~
72b7576f 3432
bf62b306 3433Finds or creates a Real attribute at *entry* label and sets *value*.
72b7576f 3434
bf62b306 3435**Example:**
3436~~~~~
72b7576f 3437SetReal D 0:2 100.
bf62b306 3438~~~~~
72b7576f 3439
bf62b306 3440@subsubsection occt_draw_5_5_4 GetReal
72b7576f 3441
bf62b306 3442Syntax:
3443~~~~~
3444GetReal dfname entry [drawname]
3445~~~~~
72b7576f 3446
bf62b306 3447Gets a value of a Real attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3448
bf62b306 3449**Example:**
3450~~~~~
72b7576f 3451GetReal D 0:2 Real1
bf62b306 3452~~~~~
72b7576f 3453
bf62b306 3454@subsubsection occt_draw_5_5_5 SetIntArray
3455
3456Syntax:
3457~~~~~
3458SetIntArray dfname entry lower upper value1 value2 …
3459~~~~~
72b7576f 3460
bf62b306 3461Finds or creates an IntegerArray attribute at *entry* label with lower and upper bounds and sets **value1*, *value2*...
72b7576f 3462
e5bd0d98 3463**Example:**
bf62b306 3464~~~~~
3465SetIntArray D 0:2 1 4 100 200 300 400
3466~~~~~
72b7576f 3467
bf62b306 3468@subsubsection occt_draw_5_5_6 GetIntArray
72b7576f 3469
bf62b306 3470Syntax:
3471~~~~~
3472GetIntArray dfname entry
3473~~~~~
72b7576f 3474
bf62b306 3475Gets a value of an *IntegerArray* attribute at *entry* label.
72b7576f 3476
e5bd0d98 3477**Example:**
bf62b306 3478~~~~~
3479GetIntArray D 0:2
3480~~~~~
72b7576f 3481
bf62b306 3482@subsubsection occt_draw_5_5_7 SetRealArray
72b7576f 3483
bf62b306 3484Syntax:
3485~~~~~
3486SetRealArray dfname entry lower upper value1 value2 …
3487~~~~~
72b7576f 3488
bf62b306 3489Finds or creates a RealArray attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
72b7576f 3490
e5bd0d98 3491**Example:**
bf62b306 3492~~~~~
72b7576f 3493GetRealArray D 0:2 1 4 100. 200. 300. 400.
bf62b306 3494~~~~~
3495
3496@subsubsection occt_draw_5_5_8 GetRealArray
72b7576f 3497
bf62b306 3498Syntax:
3499~~~~~
3500GetRealArray dfname entry
3501~~~~~
72b7576f 3502
bf62b306 3503Gets a value of a RealArray attribute at *entry* label.
72b7576f 3504
e5bd0d98 3505**Example:**
bf62b306 3506~~~~~
72b7576f 3507GetRealArray D 0:2
bf62b306 3508~~~~~
72b7576f 3509
bf62b306 3510@subsubsection occt_draw_5_5_9 SetComment
72b7576f 3511
bf62b306 3512Syntax:
3513~~~~~
3514SetComment dfname entry value
3515~~~~~
3516
3517Finds or creates a Comment attribute at *entry* label and sets *value*.
72b7576f 3518
e5bd0d98 3519**Example:**
bf62b306 3520~~~~~
3521SetComment D 0:2 "My comment"
3522~~~~~
72b7576f 3523
bf62b306 3524@subsubsection occt_draw_5_5_10 GetComment
72b7576f 3525
bf62b306 3526Syntax:
3527~~~~~
3528GetComment dfname entry
3529~~~~~
72b7576f 3530
bf62b306 3531Gets a value of a Comment attribute at *entry* label.
72b7576f 3532
e5bd0d98 3533**Example:**
bf62b306 3534~~~~~
3535GetComment D 0:2
3536~~~~~
72b7576f 3537
bf62b306 3538@subsubsection occt_draw_5_5_11 SetExtStringArray
72b7576f 3539
bf62b306 3540Syntax:
3541~~~~~
3542SetExtStringArray dfname entry lower upper value1 value2 …
3543~~~~~
72b7576f 3544
bf62b306 3545Finds or creates an *ExtStringArray* attribute at *entry* label with lower and upper bounds and sets *value1*, *value2*…
72b7576f 3546
e5bd0d98 3547**Example:**
bf62b306 3548~~~~~
3549SetExtStringArray D 0:2 1 3 *string1* *string2* *string3*
3550~~~~~
72b7576f 3551
bf62b306 3552@subsubsection occt_draw_5_5_12 GetExtStringArray
72b7576f 3553
bf62b306 3554Syntax:
3555~~~~~
3556GetExtStringArray dfname entry
3557~~~~~
72b7576f 3558
bf62b306 3559Gets a value of an ExtStringArray attribute at *entry* label.
72b7576f 3560
e5bd0d98 3561**Example:**
bf62b306 3562~~~~~
72b7576f 3563GetExtStringArray D 0:2
bf62b306 3564~~~~~
72b7576f 3565
bf62b306 3566@subsubsection occt_draw_5_5_13 SetName
72b7576f 3567
bf62b306 3568Syntax:
3569~~~~~
3570SetName dfname entry value
3571~~~~~
72b7576f 3572
bf62b306 3573Finds or creates a Name attribute at *entry* label and sets *value*.
72b7576f 3574
bf62b306 3575**Example:**
3576~~~~~
72b7576f 3577SetName D 0:2 *My name*
bf62b306 3578~~~~~
3579
3580@subsubsection occt_draw_5_5_14 GetName
72b7576f 3581
bf62b306 3582Syntax:
3583~~~~~
3584GetName dfname entry
3585~~~~~
72b7576f 3586
bf62b306 3587Gets a value of a Name attribute at *entry* label.
72b7576f 3588
e5bd0d98 3589**Example:**
bf62b306 3590~~~~~
72b7576f 3591GetName D 0:2
bf62b306 3592~~~~~
72b7576f 3593
bf62b306 3594@subsubsection occt_draw_5_5_15 SetReference
72b7576f 3595
bf62b306 3596Syntax:
3597~~~~~
3598SetReference dfname entry reference
3599~~~~~
72b7576f 3600
bf62b306 3601Creates a Reference attribute at *entry* label and sets *reference*.
72b7576f 3602
bf62b306 3603**Example:**
3604~~~~~
72b7576f 3605SetReference D 0:2 0:4
bf62b306 3606~~~~~
72b7576f 3607
bf62b306 3608@subsubsection occt_draw_5_5_16 GetReference
3609
3610Syntax:
3611~~~~~
3612GetReference dfname entry
3613~~~~~
72b7576f 3614
bf62b306 3615Gets a value of a Reference attribute at *entry* label.
72b7576f 3616
e5bd0d98 3617**Example:**
bf62b306 3618~~~~~
72b7576f 3619GetReference D 0:2
bf62b306 3620~~~~~
72b7576f 3621
bf62b306 3622@subsubsection occt_draw_5_5_17 SetUAttribute
72b7576f 3623
bf62b306 3624Syntax:
3625~~~~~
3626SetUAttribute dfname entry localGUID
3627~~~~~
72b7576f 3628
bf62b306 3629Creates a UAttribute attribute at *entry* label with *localGUID*.
72b7576f 3630
bf62b306 3631**Example:**
3632~~~~~
3633set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3634SetUAttribute D 0:2 ${localGUID}
bf62b306 3635~~~~~
72b7576f 3636
bf62b306 3637@subsubsection occt_draw_5_5_18 GetUAttribute
72b7576f 3638
bf62b306 3639Syntax:
3640~~~~~
3641GetUAttribute dfname entry loacalGUID
3642~~~~~
72b7576f 3643
bf62b306 3644Finds a *UAttribute* at *entry* label with *localGUID*.
72b7576f 3645
bf62b306 3646**Example:**
3647~~~~~
3648set localGUID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3649GetUAttribute D 0:2 ${localGUID}
bf62b306 3650~~~~~
72b7576f 3651
bf62b306 3652@subsubsection occt_draw_5_5_19 SetFunction
72b7576f 3653
bf62b306 3654Syntax:
3655~~~~~
3656SetFunction dfname entry ID failure
3657~~~~~
72b7576f 3658
bf62b306 3659Finds or creates a *Function* attribute at *entry* label with driver ID and *failure* index.
72b7576f 3660
bf62b306 3661**Example:**
3662~~~~~
3663set ID "c73bd076-22ee-11d2-acde-080009dc4422"
72b7576f 3664SetFunction D 0:2 ${ID} 1
bf62b306 3665~~~~~
3666
3667@subsubsection occt_draw_5_5_20 GetFunction
72b7576f 3668
bf62b306 3669Syntax:
3670~~~~~
3671GetFunction dfname entry ID failure
3672~~~~~
72b7576f 3673
bf62b306 3674Finds a Function attribute at *entry* label and sets driver ID to *ID* variable and failure index to *failure* variable.
72b7576f 3675
e5bd0d98 3676**Example:**
bf62b306 3677~~~~~
72b7576f 3678GetFunction D 0:2 ID failure
bf62b306 3679~~~~~
72b7576f 3680
bf62b306 3681@subsubsection occt_draw_5_5_21 NewShape
72b7576f 3682
bf62b306 3683Syntax:
3684~~~~~
3685NewShape dfname entry [shape]
3686~~~~~
72b7576f 3687
bf62b306 3688Finds or creates a Shape attribute at *entry* label. Creates or updates the associated *NamedShape* attribute by *shape* if *shape* is defined.
72b7576f 3689
e5bd0d98 3690**Example:**
bf62b306 3691~~~~~
72b7576f 3692box b 10 10 10
3693NewShape D 0:2 b
bf62b306 3694~~~~~
72b7576f 3695
bf62b306 3696@subsubsection occt_draw_5_5_22 SetShape
72b7576f 3697
bf62b306 3698Syntax:
3699~~~~~
3700SetShape dfname entry shape
3701~~~~~
72b7576f 3702
bf62b306 3703Creates or updates a *NamedShape* attribute at *entry* label by *shape*.
72b7576f 3704
bf62b306 3705**Example:**
3706~~~~~
72b7576f 3707box b 10 10 10
3708SetShape D 0:2 b
bf62b306 3709~~~~~
72b7576f 3710
bf62b306 3711@subsubsection occt_draw_5_5_23 GetShape
72b7576f 3712
bf62b306 3713Syntax:
3714~~~~~
3715GetShape2 dfname entry shape
3716~~~~~
72b7576f 3717
bf62b306 3718Sets a shape from NamedShape attribute associated with *entry* label to *shape* draw variable.
72b7576f 3719
bf62b306 3720**Example:**
3721~~~~~
72b7576f 3722GetShape2 D 0:2 b
bf62b306 3723~~~~~
72b7576f 3724
bf62b306 3725@subsection occt_draw_5_6 Geometric attributes commands
72b7576f 3726
3727
bf62b306 3728@subsubsection occt_draw_5_6_1 SetPoint
72b7576f 3729
bf62b306 3730Syntax:
3731~~~~~
3732SetPoint dfname entry point
3733~~~~~
72b7576f 3734
bf62b306 3735Finds or creates a Point attribute at *entry* label and sets *point* as generated in the associated *NamedShape* attribute.
72b7576f 3736
bf62b306 3737**Example:**
3738~~~~~
72b7576f 3739point p 10 10 10
3740SetPoint D 0:2 p
bf62b306 3741~~~~~
72b7576f 3742
bf62b306 3743@subsubsection occt_draw_5_6_2 GetPoint
72b7576f 3744
bf62b306 3745Syntax:
3746~~~~~
3747GetPoint dfname entry [drawname]
3748~~~~~
72b7576f 3749
bf62b306 3750Gets a vertex from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3751
bf62b306 3752**Example:**
3753~~~~~
72b7576f 3754GetPoint D 0:2 p
bf62b306 3755~~~~~
72b7576f 3756
bf62b306 3757@subsubsection occt_draw_5_6_3 SetAxis
3758
3759Syntax:
3760~~~~~
3761SetAxis dfname entry axis
3762~~~~~
72b7576f 3763
bf62b306 3764Finds or creates an Axis attribute at *entry* label and sets *axis* as generated in the associated *NamedShape* attribute.
72b7576f 3765
e5bd0d98 3766**Example:**
bf62b306 3767~~~~~
72b7576f 3768line l 10 20 30 100 200 300
3769SetAxis D 0:2 l
bf62b306 3770~~~~~
72b7576f 3771
bf62b306 3772@subsubsection occt_draw_5_6_4 GetAxis
72b7576f 3773
bf62b306 3774Syntax:
3775~~~~~
3776GetAxis dfname entry [drawname]
3777~~~~~
72b7576f 3778
bf62b306 3779Gets a line from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3780
bf62b306 3781**Example:**
3782~~~~~
72b7576f 3783GetAxis D 0:2 l
bf62b306 3784~~~~~
72b7576f 3785
bf62b306 3786@subsubsection occt_draw_5_6_5 SetPlane
3787
3788Syntax:
3789~~~~~
3790SetPlane dfname entry plane
3791~~~~~
72b7576f 3792
bf62b306 3793Finds or creates a Plane attribute at *entry* label and sets *plane* as generated in the associated *NamedShape* attribute.
72b7576f 3794
e5bd0d98 3795**Example:**
bf62b306 3796~~~~~
3f812249 3797plane pl 10 20 30 -1 0 0
72b7576f 3798SetPlane D 0:2 pl
bf62b306 3799~~~~~
72b7576f 3800
bf62b306 3801@subsubsection occt_draw_5_6_6 GetPlane
72b7576f 3802
bf62b306 3803Syntax:
3804~~~~~
3805GetPlane dfname entry [drawname]
3806~~~~~
72b7576f 3807
bf62b306 3808Gets a plane from *NamedShape* attribute at *entry* label and sets it to *drawname* variable, if it is defined.
72b7576f 3809
bf62b306 3810**Example:**
3811~~~~~
72b7576f 3812GetPlane D 0:2 pl
bf62b306 3813~~~~~
72b7576f 3814
bf62b306 3815@subsubsection occt_draw_5_6_7 SetGeometry
72b7576f 3816
bf62b306 3817Syntax:
3818~~~~~
3819SetGeometry dfname entry [type] [shape]
3820~~~~~
72b7576f 3821
bf62b306 3822Creates 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 3823
e5bd0d98 3824**Example:**
bf62b306 3825~~~~~
72b7576f 3826point p 10 10 10
3827SetGeometry D 0:2 pnt p
bf62b306 3828~~~~~
72b7576f 3829
bf62b306 3830@subsubsection occt_draw_5_6_8 GetGeometryType
72b7576f 3831
bf62b306 3832Syntax:
3833~~~~~
3834GetGeometryType dfname entry
3835~~~~~
72b7576f 3836
bf62b306 3837Gets a geometry type from Geometry attribute at *entry* label.
72b7576f 3838
bf62b306 3839**Example:**
3840~~~~~
72b7576f 3841GetGeometryType D 0:2
bf62b306 3842~~~~~
72b7576f 3843
bf62b306 3844@subsubsection occt_draw_5_6_9 SetConstraint
72b7576f 3845
bf62b306 3846Syntax:
3847~~~~~
3848SetConstraint dfname entry keyword geometrie [geometrie …]
3849SetConstraint dfname entry "plane" geometrie
3850SetConstraint dfname entry "value" value
3851~~~~~
72b7576f 3852
bf62b306 38531. Creates a Constraint attribute at *entry* label and sets *keyword* constraint between geometry(ies).
3854*keyword* must be one of the following:
3855*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 38562. Sets plane for the existing constraint.
72b7576f 38573. Sets value for the existing constraint.
bf62b306 3858
e5bd0d98 3859**Example:**
bf62b306 3860~~~~~
3861SetConstraint D 0:2 "value" 5
3862~~~~~
72b7576f 3863
bf62b306 3864@subsubsection occt_draw_5_6_10 GetConstraint
72b7576f 3865
bf62b306 3866Syntax:
3867~~~~~
3868GetConstraint dfname entry
3869~~~~~
72b7576f 3870
bf62b306 3871Dumps a Constraint attribute at *entry* label
72b7576f 3872
e5bd0d98 3873**Example:**
bf62b306 3874~~~~~
72b7576f 3875GetConstraint D 0:2
bf62b306 3876~~~~~
3877
3878@subsubsection occt_draw_5_6_11 SetVariable
72b7576f 3879
bf62b306 3880Syntax:
3881~~~~~
3882SetVariable dfname entry isconstant(0/1) units
3883~~~~~
72b7576f 3884
bf62b306 3885Creates a Variable attribute at *entry* label and sets *isconstant* flag and *units* as a string.
72b7576f 3886
e5bd0d98 3887**Example:**
bf62b306 3888~~~~~
3889SetVariable D 0:2 1 "mm"
3890~~~~~
72b7576f 3891
bf62b306 3892@subsubsection occt_draw_5_6_12 GetVariable
72b7576f 3893
bf62b306 3894Syntax:
3895~~~~~
3896GetVariable dfname entry isconstant units
3897~~~~~
72b7576f 3898
bf62b306 3899Gets an *isconstant* flag and units of a Variable attribute at *entry* label.
72b7576f 3900
e5bd0d98 3901**Example:**
bf62b306 3902~~~~~
72b7576f 3903GetVariable D 0:2 isconstant units
bf62b306 3904puts "IsConstant=${isconstant}"
3905puts "Units=${units}"
3906~~~~~
72b7576f 3907
bf62b306 3908@subsection occt_draw_5_7 Tree attributes commands
72b7576f 3909
3910
bf62b306 3911@subsubsection occt_draw_5_7_1 RootNode
72b7576f 3912
bf62b306 3913Syntax:
3914~~~~~
3915RootNode dfname treenodeentry [ID]
3916~~~~~
72b7576f 3917
bf62b306 3918Returns the ultimate father of *TreeNode* attribute identified by its *treenodeentry* and its *ID* (or default ID, if *ID* is not defined).
72b7576f 3919
3920
bf62b306 3921@subsubsection occt_draw_5_7_2 SetNode
72b7576f 3922
bf62b306 3923Syntax:
3924~~~~~
3925SetNode dfname treenodeentry [ID]
3926~~~~~
72b7576f 3927
bf62b306 3928Creates a *TreeNode* attribute on the *treenodeentry* label with its tree *ID* (or assigns a default ID, if the *ID* is not defined).
72b7576f 3929
3930
bf62b306 3931@subsubsection occt_draw_5_7_3 AppendNode
72b7576f 3932
bf62b306 3933Syntax:
3934~~~~~
3935AppendNode dfname fatherentry childentry [fatherID]
3936~~~~~
72b7576f 3937
3938
bf62b306 3939Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as last child of *fatherentry*.
72b7576f 3940
3941
3942
3943
bf62b306 3944@subsubsection occt_draw_5_7_4 PrependNode
72b7576f 3945
bf62b306 3946Syntax:
3947~~~~~
3948PrependNode dfname fatherentry childentry [fatherID]
3949~~~~~
72b7576f 3950
3951
bf62b306 3952Inserts a *TreeNode* attribute with its tree *fatherID* (or default ID, if *fatherID* is not defined) on *childentry* as first child of *fatherentry*.
72b7576f 3953
3954
bf62b306 3955@subsubsection occt_draw_5_7_5 InsertNodeBefore
72b7576f 3956
bf62b306 3957Syntax:
3958~~~~~
3959InsertNodeBefore dfname treenodeentry beforetreenode [ID]
3960~~~~~
72b7576f 3961
bf62b306 3962Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *beforetreenode* before *treenodeentry*.
72b7576f 3963
3964
bf62b306 3965@subsubsection occt_draw_5_7_6 InsertNodeAfter
72b7576f 3966
bf62b306 3967Syntax:
3968~~~~~
3969InsertNodeAfter dfname treenodeentry aftertreenode [ID]
3970~~~~~
72b7576f 3971
bf62b306 3972Inserts a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) *aftertreenode* after *treenodeentry*.
72b7576f 3973
3974
bf62b306 3975@subsubsection occt_draw_5_7_7 DetachNode
72b7576f 3976
bf62b306 3977Syntax:
3978~~~~~
3979DetachNode dfname treenodeentry [ID]
3980~~~~~
72b7576f 3981
bf62b306 3982Removes a *TreeNode* attribute with tree *ID* (or default ID, if *ID* is not defined) from *treenodeentry*.
72b7576f 3983
3984
bf62b306 3985@subsubsection occt_draw_5_7_8 ChildNodeIterate
72b7576f 3986
bf62b306 3987Syntax:
3988~~~~~
3989ChildNodeIterate dfname treenodeentry alllevels(0/1) [ID]
3990~~~~~
72b7576f 3991
3992
bf62b306 3993Iterates 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.
3994
e5bd0d98 3995**Example:**
bf62b306 3996~~~~~
72b7576f 3997Label D 0:2
3998Label D 0:3
3999Label D 0:4
4000Label D 0:5
4001Label D 0:6
4002Label D 0:7
4003Label D 0:8
4004Label D 0:9
4005
4006# Set root node
4007SetNode D 0:2
4008
4009AppendNode D 0:2 0:4
4010AppendNode D 0:2 0:5
4011PrependNode D 0:4 0:3
4012PrependNode D 0:4 0:8
4013PrependNode D 0:4 0:9
4014
4015InsertNodeBefore D 0:5 0:6
4016InsertNodeAfter D 0:4 0:7
4017
4018DetachNode D 0:8
4019
4020
4021# List all levels
4022ChildNodeIterate D 0:2 1
4023
4024==0:4
4025==0:9
4026==0:3
4027==0:7
4028==0:6
4029==0:5
4030
4031
4032# List only first levels
4033ChildNodeIterate D 0:2 1
4034
4035==0:4
4036==0:7
4037==0:6
4038==0:5
bf62b306 4039~~~~~
4040
4041@subsubsection occt_draw_5_7_9 InitChildNodeIterator
72b7576f 4042
bf62b306 4043Syntax:
4044~~~~~
4045InitChildNodeIterator dfname treenodeentry alllevels(0/1) [ID]
4046~~~~~
72b7576f 4047
72b7576f 4048
bf62b306 4049Initializes 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 4050
e5bd0d98 4051**Example:**
bf62b306 4052~~~~~
72b7576f 4053InitChildNodeIterate D 0:5 1
4054set aChildNumber 0
d5cdd12a 4055for {set i 1} {$i < 100} {incr i} {
dba69de2 4056 if {[ChildNodeMore] == *TRUE*} {
4057 puts *Tree node = [ChildNodeValue]*
4058 incr aChildNumber
4059 ChildNodeNext
4060 }
72b7576f 4061}
bf62b306 4062puts "aChildNumber=$aChildNumber"
4063~~~~~
72b7576f 4064
bf62b306 4065@subsubsection occt_draw_5_7_10 ChildNodeMore
72b7576f 4066
bf62b306 4067Syntax:
4068~~~~~
4069ChildNodeMore
4070~~~~~
72b7576f 4071
4072Returns TRUE if there is a current item in the iteration.
4073
4074
bf62b306 4075@subsubsection occt_draw_5_7_11 ChildNodeNext
72b7576f 4076
bf62b306 4077Syntax:
4078~~~~~
4079ChildNodeNext
4080~~~~~
72b7576f 4081
4082Moves to the next Item.
4083
4084
bf62b306 4085@subsubsection occt_draw_5_7_12 ChildNodeValue
4086
4087Syntax:
4088~~~~~
4089ChildNodeValue
4090~~~~~
72b7576f 4091
bf62b306 4092Returns the current treenode of *ChildNodeIterator*.
72b7576f 4093
72b7576f 4094
bf62b306 4095@subsubsection occt_draw_5_7_13 ChildNodeNextBrother
72b7576f 4096
bf62b306 4097Syntax:
4098~~~~~
4099ChildNodeNextBrother
4100~~~~~
72b7576f 4101
bf62b306 4102Moves to the next *Brother*. If there is none, goes up. This method is interesting only with *allLevels* behavior.
72b7576f 4103
72b7576f 4104
bf62b306 4105@subsection occt_draw_5_8 Standard presentation commands
72b7576f 4106
72b7576f 4107
bf62b306 4108@subsubsection occt_draw_5_8_1 AISInitViewer
72b7576f 4109
bf62b306 4110Syntax:
4111~~~~~
4112AISInitViewer docname
4113~~~~~
72b7576f 4114
bf62b306 4115Creates and sets *AISViewer* attribute at root label, creates AIS viewer window.
72b7576f 4116
e5bd0d98 4117**Example:**
bf62b306 4118~~~~~
72b7576f 4119AISInitViewer D
bf62b306 4120~~~~~
72b7576f 4121
bf62b306 4122@subsubsection occt_draw_5_8_2 AISRepaint
72b7576f 4123
bf62b306 4124Syntax:
4125~~~~~
4126AISRepaint docname
4127~~~~~
72b7576f 4128
4129Updates the AIS viewer window.
72b7576f 4130
bf62b306 4131**Example:**
4132~~~~~
72b7576f 4133AISRepaint D
bf62b306 4134~~~~~
72b7576f 4135
bf62b306 4136@subsubsection occt_draw_5_8_3 AISDisplay
72b7576f 4137
bf62b306 4138Syntax:
4139~~~~~
4140AISDisplay docname entry [not_update]
4141~~~~~
72b7576f 4142
bf62b306 4143Displays 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 4144
e5bd0d98 4145**Example:**
bf62b306 4146~~~~~
72b7576f 4147AISDisplay D 0:5
bf62b306 4148~~~~~
72b7576f 4149
bf62b306 4150@subsubsection occt_draw_5_8_4 AISUpdate
72b7576f 4151
bf62b306 4152Syntax:
4153~~~~~
4154AISUpdate docname entry
4155~~~~~
72b7576f 4156
bf62b306 4157Recomputes a presentation of *AISobject* from *entry* label and applies the visualization setting in AIS viewer.
72b7576f 4158
bf62b306 4159**Example:**
4160~~~~~
72b7576f 4161AISUpdate D 0:5
bf62b306 4162~~~~~
72b7576f 4163
bf62b306 4164@subsubsection occt_draw_5_8_5 AISErase
4165
4166Syntax:
4167~~~~~
4168AISErase docname entry
4169~~~~~
72b7576f 4170
bf62b306 4171Erases *AISobject* of *entry* label in AIS viewer.
72b7576f 4172
e5bd0d98 4173**Example:**
bf62b306 4174~~~~~
72b7576f 4175AISErase D 0:5
bf62b306 4176~~~~~
72b7576f 4177
bf62b306 4178@subsubsection occt_draw_5_8_6 AISRemove
72b7576f 4179
bf62b306 4180Syntax:
4181~~~~~
4182AISRemove docname entry
4183~~~~~
72b7576f 4184
bf62b306 4185Erases *AISobject* of *entry* label in AIS viewer, then *AISobject* is removed from *AIS_InteractiveContext*.
72b7576f 4186
bf62b306 4187**Example:**
4188~~~~~
72b7576f 4189AISRemove D 0:5
bf62b306 4190~~~~~
72b7576f 4191
bf62b306 4192@subsubsection occt_draw_5_8_7 AISSet
72b7576f 4193
bf62b306 4194Syntax:
4195~~~~~
4196AISSet docname entry ID
4197~~~~~
72b7576f 4198
bf62b306 4199Creates *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 4200
e5bd0d98 4201**Example:**
bf62b306 4202~~~~~
72b7576f 4203AISSet D 0:5 NS
bf62b306 4204~~~~~
72b7576f 4205
bf62b306 4206@subsubsection occt_draw_5_8_8 AISDriver
72b7576f 4207
bf62b306 4208Syntax:
4209~~~~~
4210AISDriver docname entry [ID]
4211~~~~~
72b7576f 4212
bf62b306 4213Returns 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 4214
e5bd0d98 4215**Example:**
bf62b306 4216~~~~~
72b7576f 4217# Get Driver GUID
4218AISDriver D 0:5
bf62b306 4219~~~~~
72b7576f 4220
bf62b306 4221@subsubsection occt_draw_5_8_9 AISUnset
72b7576f 4222
bf62b306 4223Syntax:
4224~~~~~
4225AISUnset docname entry
4226~~~~~
72b7576f 4227
bf62b306 4228Deletes *AISPresentation* attribute (if it exists) of an *entry* label.
72b7576f 4229
bf62b306 4230**Example:**
4231~~~~~
72b7576f 4232AISUnset D 0:5
bf62b306 4233~~~~~
72b7576f 4234
bf62b306 4235@subsubsection occt_draw_5_8_10 AISTransparency
4236
4237Syntax:
4238~~~~~
4239AISTransparency docname entry [transparency]
4240~~~~~
72b7576f 4241
bf62b306 4242Sets (if *transparency* is defined) or gets the value of transparency for *AISPresentation* attribute of an *entry* label.
72b7576f 4243
e5bd0d98 4244**Example:**
bf62b306 4245~~~~~
72b7576f 4246AISTransparency D 0:5 0.5
bf62b306 4247~~~~~
72b7576f 4248
bf62b306 4249@subsubsection occt_draw_5_8_11 AISHasOwnTransparency
72b7576f 4250
bf62b306 4251Syntax:
4252~~~~~
4253AISHasOwnTransparency docname entry
4254~~~~~
72b7576f 4255
bf62b306 4256Tests *AISPresentation* attribute of an *entry* label by own transparency.
72b7576f 4257
bf62b306 4258**Example:**
4259~~~~~
72b7576f 4260AISHasOwnTransparency D 0:5
bf62b306 4261~~~~~
72b7576f 4262
bf62b306 4263@subsubsection occt_draw_5_8_12 AISMaterial
72b7576f 4264
bf62b306 4265Syntax:
4266~~~~~
4267AISMaterial docname entry [material]
4268~~~~~
72b7576f 4269
67d7f07f 4270Sets (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 4271
e5bd0d98 4272**Example:**
bf62b306 4273~~~~~
72b7576f 4274AISMaterial D 0:5 5
bf62b306 4275~~~~~
4276
4277@subsubsection occt_draw_5_8_13 AISHasOwnMaterial
72b7576f 4278
bf62b306 4279Syntax:
4280~~~~~
4281AISHasOwnMaterial docname entry
4282~~~~~
72b7576f 4283
bf62b306 4284Tests *AISPresentation* attribute of an *entry* label by own material.
72b7576f 4285
e5bd0d98 4286**Example:**
bf62b306 4287~~~~~
72b7576f 4288AISHasOwnMaterial D 0:5
bf62b306 4289~~~~~
72b7576f 4290
bf62b306 4291@subsubsection occt_draw_5_8_14 AISColor
72b7576f 4292
bf62b306 4293Syntax:
4294~~~~~
4295AISColor docname entry [color]
4296~~~~~
72b7576f 4297
bf62b306 4298Sets (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 4299
bf62b306 4300**Example:**
4301~~~~~
72b7576f 4302AISColor D 0:5 25
bf62b306 4303~~~~~
4304
4305@subsubsection occt_draw_5_8_15 AISHasOwnColor
72b7576f 4306
bf62b306 4307Syntax:
4308~~~~~
4309AISHasOwnColor docname entry
4310~~~~~
72b7576f 4311
bf62b306 4312Tests *AISPresentation* attribute of an *entry* label by own color.
72b7576f 4313
e5bd0d98 4314**Example:**
bf62b306 4315~~~~~
72b7576f 4316AISHasOwnColor D 0:5
bf62b306 4317~~~~~
72b7576f 4318
bf62b306 4319@section occt_draw_6 Geometry commands
72b7576f 4320
bf62b306 4321@subsection occt_draw_6_1 Overview
72b7576f 4322
bf62b306 4323Draw 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 4324
4325In the context of Geometry, Draw includes the following types of variable:
4326
4327 * 2d and 3d points
bf62b306 4328 * The 2d curve, which corresponds to *Curve* in *Geom2d*.
4329 * 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 4330
bf62b306 4331Draw geometric variables never share data; the *copy* command will always make a complete copy of the content of the variable.
72b7576f 4332
4333The following topics are covered in the nine sections of this chapter:
4334
e5bd0d98 4335 * **Curve creation** deals with the various types of curves and how to create them.
4336 * **Surface creation** deals with the different types of surfaces and how to create them.
4337 * **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.
4338 * **Geometric transformations** covers translation, rotation, mirror image and point scaling transformations.
4339 * **Curve and Surface Analysis** deals with the commands used to compute points, derivatives and curvatures.
4340 * **Intersections** presents intersections of surfaces and curves.
4341 * **Approximations** deals with creating curves and surfaces from a set of points.
4342 * **Constraints** concerns construction of 2d circles and lines by constraints such as tangency.
4343 * **Display** describes commands to control the display of curves and surfaces.
72b7576f 4344
bf62b306 4345Where 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 4346
bf62b306 4347Likewise, 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 4348
bf62b306 4349@subsection occt_draw_6_2 Curve creation
72b7576f 4350
4351This section deals with both points and curves. Types of curves are:
4352
4353 * Analytical curves such as lines, circles, ellipses, parabolas, and hyperbolas.
4354 * Polar curves such as bezier curves and bspline curves.
bf62b306 4355 * 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.
4356 * NURBS can be created from other curves using *convert* in the *Surface Creation* section.
4357 * Curves can be created from the isoparametric lines of surfaces by the *uiso* and *viso* commands.
4358 * 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 4359
4360Curves are displayed with an arrow showing the last parameter.
4361
4362
bf62b306 4363@subsubsection occt_draw_6_2_1 point
72b7576f 4364
bf62b306 4365Syntax:
4366~~~~~
4367point name x y [z]
4368~~~~~
e5bd0d98 4369
bf62b306 4370Creates a 2d or 3d point, depending on the number of arguments.
72b7576f 4371
bf62b306 4372**Example:**
4373~~~~~
4374# 2d point
4375point p1 1 2
72b7576f 4376
bf62b306 4377# 3d point
4378point p2 10 20 -5
4379~~~~~
e5bd0d98 4380
bf62b306 4381@subsubsection occt_draw_6_2_2 line
4382
4383Syntax:
4384~~~~~
4385line name x y [z] dx dy [dz]
4386~~~~~
72b7576f 4387
e5bd0d98 4388
bf62b306 4389Creates 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 4390
bf62b306 4391A 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 4392
bf62b306 4393**Example:**
4394~~~~~
4395# a 2d line at 45 degrees of the X axis
4396line l 2 0 1 1
72b7576f 4397
bf62b306 4398# a 3d line through the point 10 0 0 and parallel to Z
4399line l 10 0 0 0 0 1
4400~~~~~
72b7576f 4401
bf62b306 4402@subsubsection occt_draw_6_2_3 circle
72b7576f 4403
bf62b306 4404Syntax:
4405~~~~~
4406circle name x y [z [dx dy dz]] [ux uy [uz]] radius
4407~~~~~
72b7576f 4408
bf62b306 4409Creates a 2d or a 3d circle.
72b7576f 4410
bf62b306 4411In 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 4412
bf62b306 4413In 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 4414
4415The 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.
4416
e5bd0d98 4417**Example:**
bf62b306 4418~~~~~
72b7576f 4419# A 2d circle of radius 5 centered at 10,-2
4420circle c1 10 -2 5
4421
4422# another 2d circle with a user defined origin
4423# the point of parameter 0 on this circle will be
4424# 1+sqrt(2),1+sqrt(2)
4425circle c2 1 1 1 1 2
4426
4427# a 3d circle, center 10 20 -5, axis Z, radius 17
4428circle c3 10 20 -5 17
4429
4430# same 3d circle with axis Y
4431circle c4 10 20 -5 0 1 0 17
4432
4433# full 3d circle, axis X, origin on Z
4434circle c5 10 20 -5 1 0 0 0 0 1 17
bf62b306 4435~~~~~
72b7576f 4436
bf62b306 4437@subsubsection occt_draw_6_2_4 ellipse
72b7576f 4438
bf62b306 4439Syntax:
4440~~~~~
4441ellipse name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4442~~~~~
72b7576f 4443
bf62b306 4444Creates 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 4445
bf62b306 4446~~~~~
72b7576f 4447P(u) = O + firstradius*cos(u)*Xdir + secondradius*sin(u)*Ydir
bf62b306 4448~~~~~
72b7576f 4449where:
4450
bf62b306 4451 * P is the point of parameter *u*,
4452 * *O, Xdir* and *Ydir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system.
4453
e5bd0d98 4454**Example:**
bf62b306 4455~~~~~
72b7576f 4456# default 2d ellipse
4457ellipse e1 10 5 20 10
4458
4459# 2d ellipse at angle 60 degree
4460ellipse e2 0 0 1 2 30 5
4461
4462# 3d ellipse, in the XY plane
4463ellipse e3 0 0 0 25 5
4464
4465# 3d ellipse in the X,Z plane with axis 1, 0 ,1
4466ellipse e4 0 0 0 0 1 0 1 0 1 25 5
bf62b306 4467~~~~~
72b7576f 4468
bf62b306 4469@subsubsection occt_draw_6_2_5 hyperbola
72b7576f 4470
bf62b306 4471Syntax:
4472~~~~~
4473hyperbola name x y [z [dx dy dz]] [ux uy [uz]] firstradius secondradius
4474~~~~~
72b7576f 4475
bf62b306 4476Creates 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 4477
4478The Draw hyperbola is parameterized as follows:
bf62b306 4479~~~~~
72b7576f 4480P(U) = O + firstradius*Cosh(U)*XDir + secondradius*Sinh(U)*YDir
bf62b306 4481~~~~~
72b7576f 4482where:
4483
bf62b306 4484 * *P* is the point of parameter *U*,
4485 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *YDirection* of its local coordinate system.
72b7576f 4486
e5bd0d98 4487**Example:**
bf62b306 4488~~~~~
72b7576f 4489# default 2d hyperbola, with asymptotes 1,1 -1,1
4490hyperbola h1 0 0 30 30
4491
4492# 2d hyperbola at angle 60 degrees
4493hyperbola h2 0 0 1 2 20 20
4494
4495# 3d hyperbola, in the XY plane
4496hyperbola h3 0 0 0 50 50
bf62b306 4497~~~~~
72b7576f 4498
bf62b306 4499@subsubsection occt_draw_6_2_6 parabola
72b7576f 4500
bf62b306 4501Syntax:
4502~~~~~
4503parabola name x y [z [dx dy dz]] [ux uy [uz]] FocalLength
4504~~~~~
72b7576f 4505
bf62b306 4506Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola.
72b7576f 4507
bf62b306 4508The *Geom_Parabola* is parameterized as follows:
72b7576f 4509
bf62b306 4510~~~~~
72b7576f 4511P(u) = O + u*u/(4.*F)*XDir + u*YDir
bf62b306 4512~~~~~
72b7576f 4513
4514where:
bf62b306 4515 * *P* is the point of parameter *u*,
4516 * *O, XDir* and *YDir* are respectively the origin, *X Direction* and *Y Direction* of its local coordinate system,
4517 * *F* is the focal length of the parabola.
72b7576f 4518
bf62b306 4519**Example:**
4520~~~~~
72b7576f 4521# 2d parabola
4522parabola p1 0 0 50
4523
4524# 2d parabola with convexity +Y
4525parabola p2 0 0 0 1 50
4526
4527# 3d parabola in the Y-Z plane, convexity +Z
4528parabola p3 0 0 0 1 0 0 0 0 1 50
bf62b306 4529~~~~~
72b7576f 4530
ca0f3082 4531@subsubsection occt_draw_6_2_7 beziercurve, 2dbeziercurve
72b7576f 4532
bf62b306 4533Syntax:
4534~~~~~
4535beziercurve name nbpole pole, [weight]
45362dbeziercurve name nbpole pole, [weight]
4537~~~~~
72b7576f 4538
bf62b306 4539Creates 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 4540
e5bd0d98 4541**Example:**
bf62b306 4542~~~~~
72b7576f 4543# a rational 2d bezier curve (arc of circle)
45442dbeziercurve ci 3 0 0 1 10 0 sqrt(2.)/2. 10 10 1
4545
4546# a 3d bezier curve, not rational
4547beziercurve cc 4 0 0 0 10 0 0 10 0 10 10 10 10
bf62b306 4548~~~~~
72b7576f 4549
ca0f3082 4550@subsubsection occt_draw_6_2_8 bsplinecurve, 2dbsplinecurve, pbsplinecurve, 2dpbsplinecurve
72b7576f 4551
bf62b306 4552Syntax:
4553~~~~~
ca0f3082 4554bsplinecurve name degree nbknots knot, umult pole, weight
45552dbsplinecurve name degree nbknots knot, umult pole, weight
72b7576f 4556
ca0f3082 4557pbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
45582dpbsplinecurve name degree nbknots knot, umult pole, weight (periodic)
bf62b306 4559~~~~~
72b7576f 4560
bf62b306 4561Creates 2d or 3d bspline curves; the **pbsplinecurve** and **2dpbsplinecurve** commands create periodic bspline curves.
72b7576f 4562
4563A 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.
4564
4565The table of knots is an increasing sequence of reals without repetition.
4566Multiplicities 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.
4567
4568The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be:
4569
4570 * For a non periodic curve: Sum of multiplicities - degree + 1
4571 * For a periodic curve: Sum of multiplicities - last multiplicity
72b7576f 4572
bf62b306 4573**Example:**
4574~~~~~
72b7576f 4575# a bspline curve with 4 poles and 3 knots
4576bsplinecurve bc 2 3 0 3 1 1 2 3 \
457710 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
4578# a 2d periodic circle (parameter from 0 to 2*pi !!)
4579dset h sqrt(3)/2
45802dpbsplinecurve c 2 \
45814 0 2 pi/1.5 2 pi/0.75 2 2*pi 2 \
45820 -h/3 1 \
45830.5 -h/3 0.5 \
45840.25 h/6 1 \
45850 2*h/3 0.5 \
4586-0.25 h/6 1 \
4587-0.5 -h/3 0.5 \
45880 -h/3 1
bf62b306 4589~~~~~
72b7576f 4590
bf62b306 4591**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 4592
4593
bf62b306 4594@subsubsection occt_draw_6_2_9 uiso, viso
72b7576f 4595
bf62b306 4596Syntax:
4597~~~~~
4598uiso name surface u
72b7576f 4599viso name surface u
bf62b306 4600~~~~~
72b7576f 4601
bf62b306 4602Creates a U or V isoparametric curve from a surface.
72b7576f 4603
bf62b306 4604**Example:**
4605~~~~~
72b7576f 4606# create a cylinder and extract iso curves
4607
4608cylinder c 10
4609uiso c1 c pi/6
4610viso c2 c
bf62b306 4611~~~~~
72b7576f 4612
bf62b306 4613**Note** that this cannot be done from offset surfaces.
72b7576f 4614
4615
ca0f3082 4616@subsubsection occt_draw_6_2_10 to3d, to2d
72b7576f 4617
bf62b306 4618Syntax:
4619~~~~~
4620to3d name curve2d [plane]
72b7576f 4621to2d name curve3d [plane]
bf62b306 4622~~~~~
72b7576f 4623
bf62b306 4624Create 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 4625
bf62b306 4626**Example:**
4627~~~~~
72b7576f 4628# the following commands
4629circle c 0 0 5
4630plane p -2 1 0 1 2 3
4631to3d c c p
4632
4633# will create the same circle as
4634circle c -2 1 0 1 2 3 5
bf62b306 4635~~~~~
72b7576f 4636
4637See also: **project**
4638
4639
bf62b306 4640@subsubsection occt_draw_6_2_11 project
4641
4642Syntax:
4643~~~~~
4644project name curve3d surface
4645~~~~~
72b7576f 4646
bf62b306 4647Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces.
72b7576f 4648
bf62b306 4649If 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 4650
bf62b306 4651~~~~~
72b7576f 4652cylinder c 5
4653plane p 0 0 0 0 1 1
4654intersect i c p
4655project i2d i c
bf62b306 4656~~~~~
72b7576f 4657
bf62b306 4658@subsection occt_draw_6_3 Surface creation
72b7576f 4659
bf62b306 4660The following types of surfaces exist:
4661 * Analytical surfaces: plane, cylinder, cone, sphere, torus;
4662 * Polar surfaces: bezier surfaces, bspline surfaces;
4663 * Trimmed and Offset surfaces;
4664 * Surfaces produced by Revolution and Extrusion, created from curves with the *revsurf* and *extsurf*;
72b7576f 4665 * NURBS surfaces.
4666
4667Surfaces 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.
4668
bf62b306 4669@subsubsection occt_draw_6_3_1 plane
4670
4671Syntax:
4672~~~~~
4673plane name [x y z [dx dy dz [ux uy uz]]]
4674~~~~~
4675
4676Creates an infinite plane.
72b7576f 4677
bf62b306 4678A 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 4679
bf62b306 4680The 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 4681
bf62b306 4682There 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.
4683
4684Note that this definition will be used for all analytical surfaces.
72b7576f 4685
bf62b306 4686**Example:**
4687~~~~~
72b7576f 4688# a plane through the point 10,0,0 perpendicular to X
4689# with U direction on Y
4690plane p1 10 0 0 1 0 0 0 1 0
4691
4692# an horixontal plane with origin 10, -20, -5
4693plane p2 10 -20 -5
bf62b306 4694~~~~~
72b7576f 4695
bf62b306 4696@subsubsection occt_draw_6_3_2 cylinder
72b7576f 4697
bf62b306 4698Syntax:
4699~~~~~
4700cylinder name [x y z [dx dy dz [ux uy uz]]] radius
4701~~~~~
72b7576f 4702
4703A 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 4704
bf62b306 4705**Example:**
4706~~~~~
72b7576f 4707# a cylinder on the default Z axis, radius 10
4708cylinder c1 10
4709
4710# a cylinder, also along the Z axis but with origin 5,
471110, -3
4712cylinder c2 5 10 -3 10
4713
4714# a cylinder through the origin and on a diagonal
4715# with longitude pi/3 and latitude pi/4 (euler angles)
4716dset lo pi/3. la pi/4.
4717cylinder c3 0 0 0 cos(la)*cos(lo) cos(la)*sin(lo)
4718sin(la) 10
bf62b306 4719~~~~~
72b7576f 4720
bf62b306 4721@subsubsection occt_draw_6_3_3 cone
72b7576f 4722
bf62b306 4723Syntax:
4724~~~~~
4725cone name [x y z [dx dy dz [ux uy uz]]] semi-angle radius
4726~~~~~
3f812249 4727Creates 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 4728
bf62b306 4729**Example:**
4730~~~~~
72b7576f 4731# a cone at 45 degrees at the origin on Z
4732cone c1 45 0
4733
4734# a cone on axis Z with radius r1 at z1 and r2 at z2
4735cone c2 0 0 z1 180.*atan2(r2-r1,z2-z1)/pi r1
bf62b306 4736~~~~~
72b7576f 4737
bf62b306 4738@subsubsection occt_draw_6_3_4 sphere
72b7576f 4739
bf62b306 4740Syntax:
4741~~~~~
4742sphere name [x y z [dx dy dz [ux uy uz]]] radius
4743~~~~~
72b7576f 4744
bf62b306 4745Creates a sphere in the local coordinate system defined in the **plane** command. The sphere is centered at the origin.
4746
4747To 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.
4748
4749**Example:**
4750~~~~~
72b7576f 4751# a sphere at the origin
4752sphere s1 10
4753# a sphere at 10 10 10, with poles on the axis 1,1,1
4754sphere s2 10 10 10 1 1 1 10
bf62b306 4755~~~~~
72b7576f 4756
bf62b306 4757@subsubsection occt_draw_6_3_5 torus
72b7576f 4758
bf62b306 4759Syntax:
4760~~~~~
4761torus name [x y z [dx dy dz [ux uy uz]]] major minor
4762~~~~~
72b7576f 4763
bf62b306 4764Creates 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 4765
bf62b306 4766To 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 4767
e5bd0d98 4768**Example:**
bf62b306 4769~~~~~
72b7576f 4770# a torus at the origin
4771torus t1 20 5
4772
4773# a torus in another coordinate system
4774torus t2 10 5 -2 2 1 0 20 5
bf62b306 4775~~~~~
72b7576f 4776
4777
bf62b306 4778@subsubsection occt_draw_6_3_6 beziersurf
72b7576f 4779
bf62b306 4780Syntax:
4781~~~~~
4782beziersurf name nbupoles nbvolpes pole, [weight]
4783~~~~~
72b7576f 4784
4785Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions.
4786
bf62b306 4787Then give the poles in the following order: *pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles)* and *pole(nbupoles, nbvpoles)*.
72b7576f 4788
4789Weights may be omitted, but if you give one weight you must give all of them.
72b7576f 4790
bf62b306 4791**Example:**
4792~~~~~
72b7576f 4793# a non-rational degree 2,3 surface
4794beziersurf s 3 4 \
47950 0 0 10 0 5 20 0 0 \
47960 10 2 10 10 3 20 10 2 \
47970 20 10 10 20 20 20 20 10 \
47980 30 0 10 30 0 20 30 0
bf62b306 4799~~~~~
72b7576f 4800
bf62b306 4801@subsubsection occt_draw_6_3_7 bsplinesurf, upbsplinesurf, vpbsplinesurf, uvpbsplinesurf
72b7576f 4802
bf62b306 4803Syntax:
4804~~~~~
4805bsplinesurf name udegree nbuknots uknot umult ... nbvknot vknot
72b7576f 4806vmult ... x y z w ...
4807upbsplinesurf ...
4808vpbsplinesurf ...
4809uvpbsplinesurf ...
bf62b306 4810~~~~~
72b7576f 4811
bf62b306 4812* **bsplinesurf** generates bspline surfaces;
4813* **upbsplinesurf** creates a bspline surface periodic in u;
4814* **vpbsplinesurf** creates one periodic in v;
4815* **uvpbsplinesurf** creates one periodic in uv.
72b7576f 4816
bf62b306 4817The 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.
4818
4819See *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 4820
bf62b306 4821**Example:**
4822~~~~~
72b7576f 4823# create a bspline surface of degree 1 2
4824# with two knots in U and three in V
4825bsplinesurf s \
48261 2 0 2 1 2 \
48272 3 0 3 1 1 2 3 \
48280 0 0 1 10 0 5 1 \
48290 10 2 1 10 10 3 1 \
48300 20 10 1 10 20 20 1 \
48310 30 0 1 10 30 0 1
bf62b306 4832~~~~~
72b7576f 4833
4834
bf62b306 4835@subsubsection occt_draw_6_3_8 trim, trimu, trimv
72b7576f 4836
bf62b306 4837Syntax:
4838~~~~~
4839trim newname name [u1 u2 [v1 v2]]
72b7576f 4840trimu newname name
4841trimv newname name
bf62b306 4842~~~~~
72b7576f 4843
bf62b306 4844The **trim** commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the *Geom* package.
4845* *trim* creates either a new trimmed curve from a curve or a new trimmed surface in u and v from a surface.
4846* *trimu* creates a u-trimmed surface,
4847* *trimv* creates a v-trimmed surface.
72b7576f 4848
bf62b306 4849After 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.
4850
4851**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.
4852
4853**Example:**
4854~~~~~
72b7576f 4855# create a 3d circle
4856circle c 0 0 0 10
4857
4858# trim it, use the same variable, the original is
4859deleted
4860trim c c 0 pi/2
4861
4862# the original can be recovered!
4863trim orc c
4864
4865# trim again
4866trim c c pi/4 pi/2
4867
4868# the original is not the trimmed curve but the basis
4869trim orc c
4870
4871# as the circle is periodic, the two following commands
4872are identical
4873trim cc c pi/2 0
4874trim cc c pi/2 2*pi
4875
4876# trim an infinite cylinder
4877cylinder cy 10
4878trimv cy cy 0 50
bf62b306 4879~~~~~
72b7576f 4880
bf62b306 4881@subsubsection occt_draw_6_3_9 offset
72b7576f 4882
bf62b306 4883Syntax:
4884~~~~~
4885offset name basename distance [dx dy dz]
4886~~~~~
72b7576f 4887
4888Creates offset curves or surfaces at a given distance from a basis curve or surface. Offset curves and surfaces are classes from the *Geom *package.
4889
bf62b306 4890The 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 4891
4892The offset curve or surface copies the basic geometry, which can be modified later.
72b7576f 4893
bf62b306 4894**Example:**
4895~~~~~
72b7576f 4896# graphic demonstration that the outline of a torus
4897# is the offset of an ellipse
4898smallview +X+Y
4899dset angle pi/6
4900torus t 0 0 0 0 cos(angle) sin(angle) 50 20
4901fit
4902ellipse e 0 0 0 50 50*sin(angle)
4903# note that the distance can be negative
4904offset l1 e 20 0 0 1
bf62b306 4905~~~~~
72b7576f 4906
bf62b306 4907@subsubsection occt_draw_6_3_10 revsurf
72b7576f 4908
bf62b306 4909Syntax:
4910~~~~~
4911revsurf name curvename x y z dx dy dz
4912~~~~~
72b7576f 4913
bf62b306 4914Creates a surface of revolution from a 3d curve.
4915
4916A 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.
4917
4918To 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.
4919
4920**Example:**
4921~~~~~
72b7576f 4922# another way of creating a torus like surface
4923circle c 50 0 0 20
4924revsurf s c 0 0 0 0 1 0
bf62b306 4925~~~~~
4926
2683e647 4927@subsubsection occt_draw_6_3_11 extsurf
bf62b306 4928
4929Syntax:
4930~~~~~
4931extsurf newname curvename dx dy dz
4932~~~~~
72b7576f 4933
bf62b306 4934Creates 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 4935
bf62b306 4936In the syntax, *dx,dy,dz* gives the direction of extrusion.
72b7576f 4937
bf62b306 4938To parameterize a surface of extrusion: *u* is the parameter along the extruded curve; the *v* parameter is along the direction of extrusion.
72b7576f 4939
e5bd0d98 4940**Example:**
bf62b306 4941~~~~~
72b7576f 4942# an elliptic cylinder
4943ellipse e 0 0 0 10 5
4944extsurf s e 0 0 1
4945# to make it finite
4946trimv s s 0 10
bf62b306 4947~~~~~
72b7576f 4948
bf62b306 4949@subsubsection occt_draw_6_3_12 convert
72b7576f 4950
bf62b306 4951Syntax:
4952~~~~~
4953convert newname name
4954~~~~~
72b7576f 4955
bf62b306 4956Creates 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.
4957
e5bd0d98 4958**Example:**
bf62b306 4959~~~~~
72b7576f 4960# turn a 2d arc of a circle into a 2d NURBS
4961circle c 0 0 5
4962trim c c 0 pi/3
4963convert c1 c
4964
4965# an easy way to make a planar bspline surface
4966plane p
4967trim p p -1 1 -1 1
4968convert p1 p
bf62b306 4969~~~~~
72b7576f 4970
bf62b306 4971**Note** that offset curves and surfaces are not processed by this command.
72b7576f 4972
bf62b306 4973@subsection occt_draw_6_4 Curve and surface modifications
72b7576f 4974
4975Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines.
4976
4977General modifications:
4978
4979 * Reversing the parametrization: **reverse**, **ureverse**, **vreverse**
4980
4981Modifications for both bezier curves and bsplines:
4982
4983 * Exchanging U and V on a surface: **exchuv**
4984 * Segmentation: **segment**, **segsur**
4985 * Increasing the degree: **incdeg**, **incudeg**, **incvdeg**
4986 * Moving poles: **cmovep**, **movep**, **movecolp**, **moverowp**
4987
4988Modifications for bezier curves:
4989
4990 * Adding and removing poles: **insertpole**, **rempole**, **remcolpole**, **remrowpole**
4991
4992Modifications for bspline:
4993
4994 * Inserting and removing knots: **insertknot**, **remknot**, **insertuknot**, **remuknot**, **insetvknot**, **remvknot**
4995 * Modifying periodic curves and surfaces: **setperiodic**, **setnotperiodic**, **setorigin**, **setuperiodic**, **setunotperiodic**, **setuorigin**, **setvperiodic**, **setvnotperiodic**, **setvorigin**
4996
4997
4998
bf62b306 4999@subsubsection occt_draw_6_4_1 reverse, ureverse, vreverse
72b7576f 5000
5001
bf62b306 5002Syntax:
5003~~~~~
5004reverse curvename
72b7576f 5005ureverse surfacename
5006vreverse surfacename
bf62b306 5007~~~~~
72b7576f 5008
bf62b306 5009The **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 5010
bf62b306 5011**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 5012
5013Reversing a parameter on an analytical surface may create an indirect coordinate system.
72b7576f 5014
bf62b306 5015**Example:**
5016~~~~~
72b7576f 5017# reverse a trimmed 2d circle
5018circle c 0 0 5
5019trim c c pi/4 pi/2
5020reverse c
5021
5022# dumping c will show that it is now trimmed between
5023# 3*pi/2 and 7*pi/4 i.e. 2*pi-pi/2 and 2*pi-pi/4
bf62b306 5024~~~~~
72b7576f 5025
bf62b306 5026@subsubsection occt_draw_6_4_2 exchuv
72b7576f 5027
bf62b306 5028Syntax:
5029~~~~~
5030exchuv surfacename
5031~~~~~
72b7576f 5032
5033For a bezier or bspline surface this command exchanges the u and v parameters.
72b7576f 5034
bf62b306 5035**Example:**
5036~~~~~
72b7576f 5037# exchanging u and v on a spline (made from a cylinder)
5038cylinder c 5
5039trimv c c 0 10
5040convert c1 c
5041exchuv c1
bf62b306 5042~~~~~
72b7576f 5043
bf62b306 5044@subsubsection occt_draw_6_4_3 segment, segsur
72b7576f 5045
bf62b306 5046Syntax:
5047~~~~~
5048segment curve Ufirst Ulast
72b7576f 5049segsur surface Ufirst Ulast Vfirst Vlast
bf62b306 5050~~~~~
72b7576f 5051
bf62b306 5052**segment** and **segsur** segment a bezier curve and a bspline curve or surface respectively.
72b7576f 5053
bf62b306 5054These 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 5055
bf62b306 5056This command must not be confused with **trim** which creates a new geometry.
72b7576f 5057
bf62b306 5058**Example:**
5059~~~~~
72b7576f 5060# segment a bezier curve in half
5061beziercurve c 3 0 0 0 10 0 0 10 10 0
5062segment c ufirst ulast
bf62b306 5063~~~~~
72b7576f 5064
bf62b306 5065@subsubsection occt_draw_6_4_4 iincudeg, incvdeg
72b7576f 5066
bf62b306 5067Syntax:
5068~~~~~
5069incudeg surfacename newdegree
72b7576f 5070incvdeg surfacename newdegree
bf62b306 5071~~~~~
72b7576f 5072
bf62b306 5073**incudeg** and **incvdeg** increase the degree in the U or V parameter of a bezier or bspline surface.
5074
e5bd0d98 5075**Example:**
bf62b306 5076~~~~~
72b7576f 5077# make a planar bspline and increase the degree to 2 3
5078plane p
5079trim p p -1 1 -1 1
5080convert p1 p
5081incudeg p1 2
5082incvdeg p1 3
bf62b306 5083~~~~~
72b7576f 5084
bf62b306 5085**Note** that the geometry is modified.
72b7576f 5086
5087
bf62b306 5088@subsubsection occt_draw_6_4_5 cmovep, movep, movecolp, moverowp
72b7576f 5089
bf62b306 5090Syntax:
5091~~~~~
5092cmovep curve index dx dy [dz]
72b7576f 5093movep surface uindex vindex dx dy dz
5094movecolp surface uindex dx dy dz
5095moverowp surface vindex dx dy dz
bf62b306 5096~~~~~
72b7576f 5097
bf62b306 5098**move** methods translate poles of a bezier curve, a bspline curve or a bspline surface.
5099* **cmovep** and **movep** translate one pole with a given index.
5100* **movecolp** and **moverowp** translate a whole column (expressed by the *uindex*) or row (expressed by the *vindex*) of poles.
72b7576f 5101
e5bd0d98 5102**Example:**
bf62b306 5103~~~~~
72b7576f 5104# start with a plane
5105# transform to bspline, raise degree and add relief
5106plane p
5107trim p p -10 10 -10 10
5108convert p1 p
5109incud p1 2
5110incvd p1 2
5111movecolp p1 2 0 0 5
5112moverowp p1 2 0 0 5
5113movep p1 2 2 0 0 5
bf62b306 5114~~~~~
72b7576f 5115
bf62b306 5116@subsubsection occt_draw_6_4_6 insertpole, rempole, remcolpole, remrowpole
72b7576f 5117
bf62b306 5118Syntax:
5119~~~~~
5120insertpole curvename index x y [z] [weight]
72b7576f 5121rempole curvename index
5122remcolpole surfacename index
bf62b306 5123remrowpole surfacename index
5124~~~~~
72b7576f 5125
bf62b306 5126**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 5127
bf62b306 5128**rempole** removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves.
72b7576f 5129
bf62b306 5130**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 5131
bf62b306 5132**Example:**
5133~~~~~
72b7576f 5134# start with a segment, insert a pole at end
5135# then remove the central pole
5136beziercurve c 2 0 0 0 10 0 0
5137insertpole c 2 10 10 0
5138rempole c 2
bf62b306 5139~~~~~
72b7576f 5140
bf62b306 5141@subsubsection occt_draw_6_4_7 insertknot, insertuknot, insertvknot
72b7576f 5142
bf62b306 5143Syntax:
5144~~~~~
5145insertknot name knot [mult = 1] [knot mult ...]
72b7576f 5146insertuknot surfacename knot mult
5147insertvknot surfacename knot mult
bf62b306 5148~~~~~
72b7576f 5149
bf62b306 5150**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 5151
bf62b306 5152**insertuknot** and **insertvknot** insert knots in a surface.
72b7576f 5153
e5bd0d98 5154**Example:**
bf62b306 5155~~~~~
72b7576f 5156# create a cylindrical surface and insert a knot
5157cylinder c 10
5158trim c c 0 pi/2 0 10
5159convert c1 c
5160insertuknot c1 pi/4 1
bf62b306 5161~~~~~
72b7576f 5162
bf62b306 5163@subsubsection occt_draw_6_4_8 remknot, remuknot, remvknot
72b7576f 5164
bf62b306 5165Syntax:
5166~~~~~
5167remknot index [mult] [tol]
72b7576f 5168remuknot index [mult] [tol]
5169remvknot index [mult] [tol]
bf62b306 5170~~~~~
72b7576f 5171
bf62b306 5172**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 5173
5174By default, if no tolerance is given, the knot will always be removed.
72b7576f 5175
bf62b306 5176**Example:**
5177~~~~~
72b7576f 5178# bspline circle, remove a knot
5179circle c 0 0 5
5180convert c1 c
5181incd c1 5
5182remknot c1 2
bf62b306 5183~~~~~
72b7576f 5184
bf62b306 5185**Note** that Curves or Surfaces may be modified.
72b7576f 5186
5187
bf62b306 5188@subsubsection occt_draw_6_4_9 setperiodic, setnotperiodic, setuperiodic, setunotperiodic, setvperiodic, setvnotperiodic
72b7576f 5189
bf62b306 5190Syntax:
5191~~~~~
5192setperiodic curve
72b7576f 5193setnotperiodic curve
5194setuperiodic surface
5195setunotperiodic surface
5196setvperiodic surface
bf62b306 5197setvnotperiodic surface
5198~~~~~
72b7576f 5199
bf62b306 5200**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 5201
bf62b306 5202**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 5203
bf62b306 5204**Example:**
5205~~~~~
72b7576f 5206# a circle deperiodicized
5207circle c 0 0 5
5208convert c1 c
5209setnotperiodic c1
bf62b306 5210~~~~~
72b7576f 5211
bf62b306 5212@subsubsection occt_draw_6_4_10 setorigin, setuorigin, setvorigin
5213
5214Syntax:
5215~~~~~
5216setorigin curvename index
72b7576f 5217setuorigin surfacename index
5218setuorigin surfacename index
bf62b306 5219~~~~~
72b7576f 5220
bf62b306 5221These 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 5222
bf62b306 5223**Example:**
5224~~~~~
72b7576f 5225# a torus with new U and V origins
5226torus t 20 5
5227convert t1 t
5228setuorigin t1 2
bf62b306 5229setvorigin t1 2
5230~~~~~
72b7576f 5231
5232
bf62b306 5233@subsection occt_draw_6_5 Transformations
72b7576f 5234
5235Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling.
5236
bf62b306 5237@subsubsection occt_draw_6_5_1 translate, dtranslate
72b7576f 5238
bf62b306 5239Syntax:
5240~~~~~
5241translate name [names ...] dx dy dz
72b7576f 52422dtranslate name [names ...] dx dy
bf62b306 5243~~~~~
72b7576f 5244
bf62b306 5245The **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 5246
bf62b306 5247For 2d points or curves, use the **2dtranslate** command.
72b7576f 5248
bf62b306 5249**Example:**
5250~~~~~
72b7576f 5251# 3d tranlation
5252point p 10 20 30
5253circle c 10 20 30 5
5254torus t 10 20 30 5 2
bf62b306 5255translate p c t 0 0 15
5256~~~~~
5257
72b7576f 5258*NOTE*
5259*Objects are modified by this command.*
5260
bf62b306 5261@subsubsection occt_draw_6_5_2 rotate, 2drotate
5262
5263Syntax:
5264~~~~~
5265rotate name [name ...] x y z dx dy dz angle
52662drotate name [name ...] x y angle
5267~~~~~
72b7576f 5268
bf62b306 5269The **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 5270
5271For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative.
72b7576f 5272
bf62b306 5273**Example:**
5274~~~~~
d5cdd12a 5275# make a helix of circles. create a script file with
72b7576f 5276this code and execute it using **source**.
5277circle c0 10 0 0 3
d5cdd12a 5278for {set i 1} {$i <= 10} {incr i} {
72b7576f 5279copy c[expr $i-1] c$i
5280translate c$i 0 0 3
5281rotate c$i 0 0 0 0 0 1 36
5282}
bf62b306 5283~~~~~
72b7576f 5284
bf62b306 5285@subsubsection occt_draw_6_5_3 pmirror, lmirror, smirror, dpmirror, dlmirror
72b7576f 5286
bf62b306 5287Syntax:
5288~~~~~
5289pmirror name [names ...] x y z
72b7576f 5290lmirror name [names ...] x y z dx dy dz
5291smirror name [names ...] x y z dx dy dz
52922dpmirror name [names ...] x y
52932dlmirror name [names ...] x y dx dy
bf62b306 5294~~~~~
72b7576f 5295
5296The mirror commands perform a mirror transformation of 2d or 3d geometry.
5297
bf62b306 5298* **pmirror** is the point mirror, mirroring 3d curves and surfaces about a point of symmetry.
5299* **lmirror** is the line mirror commamd, mirroring 3d curves and surfaces about an axis of symmetry.
5300* **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.
5301* **2dpmirror** is the point mirror in 2D.
5302* **2dlmirror** is the axis symmetry mirror in 2D.
72b7576f 5303
e5bd0d98 5304**Example:**
bf62b306 5305~~~~~
72b7576f 5306# build 3 images of a torus
5307torus t 10 10 10 1 2 3 5 1
5308copy t t1
5309pmirror t1 0 0 0
5310copy t t2
5311lmirror t2 0 0 0 1 0 0
5312copy t t3
5313smirror t3 0 0 0 1 0 0
bf62b306 5314~~~~~
72b7576f 5315
bf62b306 5316@subsubsection occt_draw_6_5_4 pscale, dpscale
72b7576f 5317
bf62b306 5318Syntax:
5319~~~~~
5320pscale name [name ...] x y z s
72b7576f 53212dpscale name [name ...] x y s
bf62b306 5322~~~~~
72b7576f 5323
bf62b306 5324The **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**.
5325
5326
5327**Example:**
5328~~~~~
72b7576f 5329# double the size of a sphere
5330sphere s 0 0 0 10
5331pscale s 0 0 0 2
bf62b306 5332~~~~~
72b7576f 5333
bf62b306 5334@subsection occt_draw_6_6 Curve and surface analysis
72b7576f 5335
bf62b306 5336**Draw** provides methods to compute information about curves and surfaces:
72b7576f 5337
bf62b306 5338 * **coord** to find the coordinates of a point.
5339 * **cvalue** and **2dcvalue** to compute points and derivatives on curves.
5340 * **svalue** to compute points and derivatives on a surface.
5341 * **localprop** and **minmaxcurandif** to compute the curvature on a curve.
5342 * **parameters** to compute (u,v) values for a point on a surface.
5343 * **proj** and **2dproj** to project a point on a curve or a surface.
5344 * **surface_radius** to compute the curvature on a surface.
72b7576f 5345
bf62b306 5346@subsubsection occt_draw_6_6_1 coord
72b7576f 5347
bf62b306 5348Syntax:
5349~~~~~
5350coord P x y [z]
5351~~~~~
72b7576f 5352
bf62b306 5353Sets the x, y (and optionally z) coordinates of the point P.
72b7576f 5354
bf62b306 5355**Example:**
5356~~~~~
72b7576f 5357# translate a point
5358point p 10 5 5
5359translate p 5 0 0
5360coord p x y z
5361# x value is 15
bf62b306 5362~~~~~
5363
72b7576f 5364
bf62b306 5365@subsubsection occt_draw_6_6_2 cvalue, 2dcvalue
5366
5367Syntax:
5368~~~~~
5369cvalue curve U x y z [d1x d1y d1z [d2x d2y d2z]]
72b7576f 53702dcvalue curve U x y [d1x d1y [d2x d2y]]
bf62b306 5371~~~~~
5372
5373For 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 5374
e5bd0d98 5375**Example:**
72b7576f 5376
bf62b306 5377Let 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* :
5378
5379~~~~~
72b7576f 53802dbeziercurve c 4 0 0 1 1 2 1 3 0
53812dcvalue c 0 x y d1x d1y d2x d2y
5382
5383# values of x y d1x d1y d2x d2y
5384# are 0 0 3 3 0 -6
bf62b306 5385~~~~~
72b7576f 5386
bf62b306 5387@subsubsection occt_draw_6_6_3 svalue
72b7576f 5388
bf62b306 5389Syntax:
5390~~~~~
5391svalue surfname U v x y z [dux duy duz dvx dvy dvz [d2ux d2uy d2uz d2vx d2vy d2vz d2uvx d2uvy d2uvz]]
5392~~~~~
72b7576f 5393
bf62b306 5394Computes 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 5395
e5bd0d98 5396**Example:**
bf62b306 5397~~~~~
72b7576f 5398# display points on a sphere
5399sphere s 10
d5cdd12a 5400for {dset t 0} {[dval t] <= 1} {dset t t+0.01} {
72b7576f 5401svalue s t*2*pi t*pi-pi/2 x y z
5402point . x y z
5403}
bf62b306 5404~~~~~
72b7576f 5405
bf62b306 5406@subsubsection occt_draw_6_6_4 localprop, minmaxcurandinf
72b7576f 5407
bf62b306 5408Syntax:
5409~~~~~
5410localprop curvename U
5411minmaxcurandinf curve
5412~~~~~
72b7576f 5413
bf62b306 5414**localprop** computes the curvature of a curve.
5415**minmaxcurandinf** computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve.
72b7576f 5416
e5bd0d98 5417**Example:**
bf62b306 5418~~~~~
72b7576f 5419# show curvature at the center of a bezier curve
5420beziercurve c 3 0 0 0 10 2 0 20 0 0
5421localprop c 0.5
5422== Curvature : 0.02
bf62b306 5423~~~~~
72b7576f 5424
bf62b306 5425@subsubsection occt_draw_6_6_5 parameters
72b7576f 5426
bf62b306 5427Syntax:
5428~~~~~
5429parameters surf/curve x y z U [V]
5430~~~~~
72b7576f 5431
bf62b306 5432Returns 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 5433
e5bd0d98 5434**Example:**
bf62b306 5435~~~~~
72b7576f 5436# Compute parameters on a plane
5437plane p 0 0 10 1 1 0
5438parameters p 5 5 5 u v
5439# the values of u and v are : 0 5
bf62b306 5440~~~~~
72b7576f 5441
bf62b306 5442@subsubsection occt_draw_6_6_6 proj, dproj
72b7576f 5443
bf62b306 5444Syntax:
5445~~~~~
5446proj name x y z
72b7576f 54472dproj name xy
bf62b306 5448~~~~~
72b7576f 5449
bf62b306 5450Use **proj** to project a point on a 3d curve or a surface and **2dproj** for a 2d curve.
5451
5452The 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 5453
e5bd0d98 5454**Example:**
72b7576f 5455
bf62b306 5456Let us project a point on a torus
5457
5458~~~~~
72b7576f 5459torus t 20 5
5460proj t 30 10 7
5461== ext_1 ext_2 ext_3 ext_4
bf62b306 5462~~~~~
72b7576f 5463
bf62b306 5464@subsubsection occt_draw_6_6_7 surface_radius
72b7576f 5465
bf62b306 5466Syntax:
5467~~~~~
5468surface_radius surface u v [c1 c2]
5469~~~~~
72b7576f 5470
bf62b306 5471Computes 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 5472
e5bd0d98 5473**Example:**
72b7576f 5474
bf62b306 5475Let us compute curvatures of a cylinder:
5476
5477~~~~~
72b7576f 5478cylinder c 5
5479surface_radius c pi 3 c1 c2
5480== Min Radius of Curvature : -5
5481== Min Radius of Curvature : infinite
bf62b306 5482~~~~~
72b7576f 5483
5484
bf62b306 5485@subsection occt_draw_6_7 Intersections
72b7576f 5486
bf62b306 5487* **intersect** computes intersections of surfaces;
5488* **2dintersect** computes intersections of 2d curves.
72b7576f 5489
bf62b306 5490@subsubsection occt_draw_6_7_1 intersect
72b7576f 5491
bf62b306 5492Syntax:
5493~~~~~
5494intersect name surface1 surface2
5495~~~~~
72b7576f 5496
bf62b306 5497Intersects 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 5498
e5bd0d98 5499**Example:**
bf62b306 5500~~~~~
72b7576f 5501# create an ellipse
5502cone c 45 0
5503plane p 0 0 40 0 1 5
5504intersect e c p
bf62b306 5505~~~~~
72b7576f 5506
bf62b306 5507@subsubsection occt_draw_6_7_2 dintersect
72b7576f 5508
bf62b306 5509Syntax:
5510~~~~~
55112dintersect curve1 curve2
5512~~~~~
72b7576f 5513
bf62b306 5514Displays the intersection points between two 2d curves.
72b7576f 5515
e5bd0d98 5516**Example:**
bf62b306 5517~~~~~
72b7576f 5518# intersect two 2d ellipses
5519ellipse e1 0 0 5 2
5520ellipse e2 0 0 0 1 5 2
55212dintersect e1 e2
bf62b306 5522~~~~~
5523
5524@subsection occt_draw_6_8 Approximations
72b7576f 5525
5526Draw provides command to create curves and surfaces by approximation.
5527
bf62b306 5528* **2dapprox** fits a curve through 2d points;
5529* **appro** fits a curve through 3d points;
5530* **surfapp** and **grilapp** fit a surface through 3d points;
5531* **2dinterpolate** interpolates a curve.
72b7576f 5532
bf62b306 5533@subsubsection occt_draw_6_8_1 appro, dapprox
72b7576f 5534
bf62b306 5535Syntax:
5536~~~~~
5537appro result nbpoint [curve]
55382dapprox result nbpoint [curve / x1 y1 x2 y2]
5539~~~~~
72b7576f 5540
5541These 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 5542
e5bd0d98 5543**Example:**
72b7576f 5544
bf62b306 5545Let us pick points and they will be fitted
72b7576f 5546
bf62b306 5547~~~~~
55482dapprox c 10
5549~~~~~
72b7576f 5550
bf62b306 5551@subsubsection occt_draw_6_8_2 surfapp, grilapp
72b7576f 5552
5553
bf62b306 5554Syntax:
5555~~~~~
5556surfapp name nbupoints nbvpoints x y z ....
72b7576f 5557grilapp name nbupoints nbvpoints xo dx yo dy z11 z12 ...
bf62b306 5558~~~~~
72b7576f 5559
bf62b306 5560* **surfapp** fits a surface through an array of u and v points, nbupoints*nbvpoints.
5561* **grilapp** has the same function, but the x,y coordinates of the points are on a grid starting at x0,y0 with steps dx,dy.
72b7576f 5562
e5bd0d98 5563**Example:**
bf62b306 5564~~~~~
72b7576f 5565# a surface using the same data as in the beziersurf
5566example sect 4.4
5567surfapp s 3 4 \
55680 0 0 10 0 5 20 0 0 \
55690 10 2 10 10 3 20 10 2 \
55700 20 10 10 20 20 20 20 10 \
55710 30 0 10 30 0 20 30 0
bf62b306 5572~~~~~
72b7576f 5573
bf62b306 5574@subsection occt_draw_6_9 Constraints
72b7576f 5575
bf62b306 5576* **cirtang** constructs 2d circles tangent to curves;
5577* **lintan** constructs 2d lines tangent to curves.
72b7576f 5578
5579
bf62b306 5580@subsubsection occt_draw_6_9_1 cirtang
72b7576f 5581
bf62b306 5582Syntax:
5583~~~~~
5584cirtang cname curve/point/radius curve/point/radius curve/point/radius
5585~~~~~
72b7576f 5586
bf62b306 5587Builds all circles satisfying the three constraints which are either a curve (the circle must be tangent to that curve), a point (the circle must pass through that point), or a radius for the circle. Only one constraint can be a radius. The solutions will be stored in variables *name_1*, *name_2*, etc.
72b7576f 5588
e5bd0d98 5589**Example:**
bf62b306 5590~~~~~
72b7576f 5591# a point, a line and a radius. 2 solutions
5592point p 0 0
5593line 1 10 0 -1 1
5594cirtang c p 1 4
5595== c_1 c_2
bf62b306 5596~~~~~
72b7576f 5597
bf62b306 5598@subsubsection occt_draw_6_9_2 lintan
72b7576f 5599
bf62b306 5600Syntax:
5601~~~~~
5602lintan name curve curve [angle]
5603~~~~~
72b7576f 5604
bf62b306 5605Builds 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 5606
e5bd0d98 5607**Example:**
bf62b306 5608~~~~~
72b7576f 5609# lines tangent to 2 circles, 4 solutions
5610circle c1 -10 0 10
5611circle c2 10 0 5
5612lintan l c1 c2
5613
5614# lines at 15 degrees tangent to a circle and a line, 2
5615solutions: l1_1 l1_2
5616circle c1 -10 0 1
5617line l 2 0 1 1
5618lintan l1 c1 l 15
bf62b306 5619~~~~~
72b7576f 5620
bf62b306 5621@subsection occt_draw_6_10 Display
72b7576f 5622
5623Draw 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.
5624
bf62b306 5625On 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 5626
bf62b306 5627On surfaces, you can control the number of isoparametric curves displayed on the surface with the **nbiso** command.
72b7576f 5628
bf62b306 5629On bezier and bspline curve and surface you can toggle the display of the control points with the **clpoles** and **shpoles** commands.
72b7576f 5630
bf62b306 5631On bspline curves and surfaces you can toggle the display of the knots with the **shknots** and **clknots** commands.
72b7576f 5632
5633
bf62b306 5634@subsubsection occt_draw_6_10_1 dmod, discr, defle
72b7576f 5635
bf62b306 5636Syntax:
5637~~~~~
5638dmode name [name ...] u/d
72b7576f 5639discr name [name ...] nbintervals
5640defle name [name ...] deflection
bf62b306 5641~~~~~
72b7576f 5642
bf62b306 5643**dmod** command allows choosing the display mode for a curve or a surface.
72b7576f 5644
bf62b306 5645In 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 5646
bf62b306 5647In *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 5648
5649If 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 5650
bf62b306 5651**Example:**
5652~~~~~
72b7576f 5653# increment the number of points on a big circle
5654circle c 0 0 50 50
5655discr 100
5656
5657# change the mode
5658dmode c u
bf62b306 5659~~~~~
72b7576f 5660
bf62b306 5661@subsubsection occt_draw_6_10_2 nbiso
72b7576f 5662
bf62b306 5663Syntax:
5664~~~~~
5665nbiso name [names...] nuiso nviso
5666~~~~~
72b7576f 5667
bf62b306 5668Changes 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 5669
e5bd0d98 5670**Example:**
72b7576f 5671
bf62b306 5672Let us display 35 meridians and 15 parallels on a sphere:
5673~~~~~
72b7576f 5674sphere s 20
5675nbiso s 35 15
bf62b306 5676~~~~~
72b7576f 5677
bf62b306 5678@subsubsection occt_draw_6_10_3 clpoles, shpoles
72b7576f 5679
bf62b306 5680Syntax:
5681~~~~~
5682clpoles name
72b7576f 5683shpoles name
bf62b306 5684~~~~~
5685
5686On bezier and bspline curves and surfaces, the control polygon is displayed by default: *clpoles* erases it and *shpoles* restores it.
72b7576f 5687
e5bd0d98 5688**Example:**
72b7576f 5689
bf62b306 5690Let us make a bezier curve and erase the poles
5691
5692~~~~~
72b7576f 5693beziercurve c 3 0 0 0 10 0 0 10 10 0
5694clpoles c
bf62b306 5695~~~~~
72b7576f 5696
bf62b306 5697@subsubsection occt_draw_6_10_4 clknots, shknots
72b7576f 5698
bf62b306 5699Syntax:
5700~~~~~
5701clknots name
72b7576f 5702shknots name
bf62b306 5703~~~~~
72b7576f 5704
bf62b306 5705By 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 5706
bf62b306 5707**Example:**
5708~~~~~
72b7576f 5709# hide the knots on a bspline curve
5710bsplinecurve bc 2 3 0 3 1 1 2 3 \
571110 0 7 1 7 0 7 1 3 0 8 1 0 0 7 1
bf62b306 5712clknots bc
5713~~~~~
1a457208 5714
5715
bf62b306 5716@section occt_draw_7 Topology commands
72b7576f 5717
5718Draw 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.
5719
5720Topology 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.
5721
bf62b306 5722The <a href="user_guides__modeling_data.html#occt_modat_5">different topological shapes</a> include:
72b7576f 5723
bf62b306 5724 * **COMPOUND**: A group of any type of topological object.
5725 * **COMPSOLID**: A set of solids connected by their faces. This expands the notions of WIRE and SHELL to solids.
5726 * **SOLID**: A part of space limited by shells. It is three dimensional.
5727 * **SHELL**: A set of faces connected by their edges. A shell can be open or closed.
5728 * **FACE**: In 2d, a plane; in 3d, part of a surface. Its geometry is constrained (trimmed) by contours. It is two dimensional.
5729 * **WIRE**: A set of edges connected by their vertices. It can be open or closed depending on whether the edges are linked or not.
5730 * **EDGE**: A topological element corresponding to a restrained curve. An edge is generally limited by vertices. It has one dimension.
5731 * **VERTEX**: A topological element corresponding to a point. It has a zero dimension.
72b7576f 5732
bf62b306 5733Shapes 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 5734
5735The following topics are covered in the eight sections of this chapter:
5736
5737 * Basic shape commands to handle the structure of shapes and control the display.
5738 * Curve and surface topology, or methods to create topology from geometry and vice versa.
5739 * Primitive construction commands: box, cylinder, wedge etc.
5740 * Sweeping of shapes.
5741 * Transformations of shapes: translation, copy, etc.
5742 * Topological operations, or booleans.
5743 * Drafting and blending.
5744 * Analysis of shapes.
5745
5746
bf62b306 5747@subsection occt_draw_7_1 Basic topology
72b7576f 5748
5749The 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:
5750
bf62b306 5751 * **isos** and **discretisation** to control display of shape faces by isoparametric curves .
5752 * **orientation**, **complement** and **invert** to modify topological attributes such as orientation.
5753 * **explode**, **exwire** and **nbshapes** to analyze the structure of a shape.
5754 * **emptycopy**, **add**, **compound** to create shapes by stepwise construction.
72b7576f 5755
5756In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges:
5757
5758 * a red edge is an isolated edge, which belongs to no faces.
5759 * a green edge is a free boundary edge, which belongs to one face,
5760 * a yellow edge is a shared edge, which belongs to at least two faces.
5761
5762
bf62b306 5763@subsubsection occt_draw_7_1_1 isos, discretisation
5764
5765Syntax:
5766~~~~~
5767isos [name ...][nbisos]
5768discretisation nbpoints
5769~~~~~
5770
5771Determines or changes the number of isoparametric curves on shapes.
72b7576f 5772
bf62b306 5773The 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 5774
bf62b306 5775*discretisation* changes the default number of points used to display the curves. The default value is 30.
72b7576f 5776
e5bd0d98 5777**Example:**
bf62b306 5778~~~~~
72b7576f 5779# Display only the edges (the wireframe)
5780isos 0
bf62b306 5781~~~~~
72b7576f 5782
bf62b306 5783**Warning**: don’t confuse *isos* and *discretisation* with the geometric commands *nbisos* and *discr*.
72b7576f 5784
5785
bf62b306 5786@subsubsection occt_draw_7_1_2 orientation, complement, invert, normals, range
72b7576f 5787
bf62b306 5788Syntax:
5789~~~~~
5790orientation name [name ...] F/R/E/I
72b7576f 5791complement name [name ...]
5792invert name
5793normals s (length = 10), disp normals
5794range name value value
bf62b306 5795~~~~~
72b7576f 5796
3f812249 5797* **orientation** -- assigns the orientation of simple and complex shapes to one of the following four values: *FORWARD, REVERSED, INTERNAL, EXTERNAL*.
5798* **complement** -- changes the current orientation of shapes to its complement: *FORWARD* to *REVERSED* and *INTERNAL* to *EXTERNAL*.
5799* **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.
5800* *normals** -- returns the assignment of colors to orientation values.
5801* **range** -- defines the length of a selected edge by defining the values of a starting point and an end point.
bf62b306 5802
e5bd0d98 5803**Example:**
bf62b306 5804~~~~~
5805# to invert normals of a box
72b7576f 5806box b 10 20 30
5807normals b 5
5808invert b
5809normals b 5
5810
5811# to assign a value to an edge
5812box b1 10 20 30
5813# to define the box as edges
5814explode b1 e
5815b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8 b_9 b_10 b_11 b_12
5816# to define as an edge
5817makedge e 1
5818# to define the length of the edge as starting from 0
5819and finishing at 1
5820range e 0 1
bf62b306 5821~~~~~
72b7576f 5822
bf62b306 5823@subsubsection occt_draw_7_1_3 explode, exwire, nbshapes
72b7576f 5824
bf62b306 5825Syntax:
5826~~~~~
5827explode name [C/So/Sh/F/W/E/V]
72b7576f 5828exwire name
5829nbshapes name
bf62b306 5830~~~~~
72b7576f 5831
bf62b306 5832**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 5833
bf62b306 5834With 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 5835
bf62b306 5836**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 5837
bf62b306 5838**nbshapes** counts the number of shapes of each type in an entity.
72b7576f 5839
bf62b306 5840**Example:**
5841~~~~~
72b7576f 5842# on a box
5843box b 10 20 30
5844
5845# whatis returns the type and various information
5846whatis b
5847= b is a shape SOLID FORWARD Free Modified
5848
5849# make one shell
5850explode b
5851whatis b_1
5852= b_1 is a shape SHELL FORWARD Modified Orientable
5853Closed
5854
5855# extract the edges b_1, ... , b_12
5856explode b e
5857==b_1 ... b_12
5858
5859# count subshapes
5860nbshapes b
5861==
5862Number of shapes in b
5863VERTEX : 8
5864EDGE : 12
5865WIRE : 6
5866FACE : 6
5867SHELL : 1
5868SOLID : 1
5869COMPSOLID : 0
5870COMPOUND : 0
5871SHAPE : 34
bf62b306 5872~~~~~
72b7576f 5873
bf62b306 5874@subsubsection occt_draw_7_1_4 emptycopy, add, compound
72b7576f 5875
bf62b306 5876Syntax:
5877~~~~~
5878emptycopy [newname] name
72b7576f 5879add name toname
5880compound [name ...] compoundname
bf62b306 5881~~~~~
72b7576f 5882
3f812249 5883**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 5884
bf62b306 5885**add** inserts shape *C* into shape *S*. Verify that *C* and *S* reference compatible types of objects:
5886 * Any *Shape* can be added to a *Compound*.
5887 * Only a *Solid* can be added to a *CompSolid*.
5888 * Only a *Shell* can *Edge* or a *Vertex* can be added into a *Solid*.
5889 * Only a *Face* can be added to a *Shell*.
5890 * Only a *Wire* and *Vertex* can be added in a *Solid*.
5891 * Only an *Edge* can be added to a *Wire*.
5892 * Only a *Vertex* can be added to an *Edge*.
72b7576f 5893 * Nothing can be added to a *Vertex*.
5894
bf62b306 5895**emptycopy** and **add** should be used with care.
72b7576f 5896
bf62b306 5897On 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 5898
bf62b306 5899**Example:**
5900~~~~~
72b7576f 5901# a compound with three boxes
5902box b1 0 0 0 1 1 1
5903box b2 3 0 0 1 1 1
5904box b3 6 0 0 1 1 1
5905compound b1 b2 b3 c
bf62b306 5906~~~~~
72b7576f 5907
bf62b306 5908@subsubsection occt_draw_7_1_5 checkshape
72b7576f 5909
bf62b306 5910Syntax:
5911~~~~~
5912checkshape [-top] shape [result] [-short]
5913~~~~~
72b7576f 5914
5915Where:
3f812249 5916* *top* -- optional parameter, which allows checking only topological validity of a shape.
5917* *shape* -- the only required parameter which represents the name of the shape to check.
5918* *result* -- optional parameter which is the prefix of the output shape names.
5919* *short* -- a short description of the check.
72b7576f 5920
bf62b306 5921**checkshape** examines the selected object for topological and geometric coherence. The object should be a three dimensional shape.
72b7576f 5922
e5bd0d98 5923**Example:**
bf62b306 5924~~~~~
72b7576f 5925# checkshape returns a comment valid or invalid
5926box b1 0 0 0 1 1 1
5927checkshape b1
5928# returns the comment
5929this shape seems to be valid
bf62b306 5930~~~~~
72b7576f 5931
bf62b306 5932**Note** that this test is performed using the tolerance set in the algorithm.
72b7576f 5933
5934
bf62b306 5935@subsection occt_draw_7_2 Curve and surface topology
72b7576f 5936
5937This group of commands is used to create topology from shapes and to extract shapes from geometry.
5938
bf62b306 5939 * To create vertices, use the **vertex** command.
5940 * To create edges use, the **edge**, **mkedge** commands.
5941 * To create wires, use the **wire**, **polyline**, **polyvertex** commands.
5942 * To create faces, use the **mkplane**, **mkface** commands.
5943 * To extract the geometry from edges or faces, use the **mkcurve** and **mkface** commands.
5944 * To extract the 2d curves from edges or faces, use the **pcurve** command.
72b7576f 5945
5946
bf62b306 5947@subsubsection occt_draw_7_2_1 vertex
72b7576f 5948
bf62b306 5949Syntax:
5950~~~~~
5951vertex name [x y z / p edge]
5952~~~~~
72b7576f 5953
5954Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge.
72b7576f 5955
bf62b306 5956**Example:**
5957~~~~~
72b7576f 5958vertex v1 10 20 30
bf62b306 5959~~~~~
72b7576f 5960
472634fa 5961@subsubsection occt_draw_7_2_1a mkpoint
5962
5963Syntax:
5964~~~~~
5965mkpoint name vertex
5966~~~~~
5967
5968Creates a point from the coordinates of a given vertex.
5969
5970**Example:**
5971~~~~~
5972mkpoint p v1
5973~~~~~
5974
bf62b306 5975@subsubsection occt_draw_7_2_2 edge, mkedge, uisoedge, visoedge
72b7576f 5976
bf62b306 5977Syntax:
5978~~~~~
5979edge name vertex1 vertex2
72b7576f 5980mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]]
5981uisoedge edge face u v1 v2
5982visoedge edge face v u1 u2
bf62b306 5983~~~~~
72b7576f 5984
bf62b306 5985* **edge** creates a straight line edge between two vertices.
5986* **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 5987
e5bd0d98 5988**Example:**
bf62b306 5989~~~~~
72b7576f 5990# straight line edge
5991vertex v1 10 0 0
5992vertex v2 10 10 0
5993edge e1 v1 v2
5994
5995# make a circular edge
5996circle c 0 0 0 5
5997mkedge e2 c 0 pi/2
5998
5999# A similar result may be achieved by trimming the curve
6000# The trimming is removed by mkedge
6001trim c c 0 pi/2
6002mkedge e2 c
bf62b306 6003~~~~~
72b7576f 6004
bf62b306 6005* **visoedge** and **uisoedge** are commands that generate a *uiso* parameter edge or a *viso* parameter edge.
72b7576f 6006
e5bd0d98 6007**Example:**
bf62b306 6008~~~~~
72b7576f 6009# to create an edge between v1 and v2 at point u
6010# to create the example plane
6011plane p
6012trim p p 0 1 0 1
6013convert p p
6014incudeg p 3
6015incvdeg p 3
6016movep p 2 2 0 0 1
6017movep p 3 3 0 0 0.5
6018mkface p p
6019# to create the edge in the plane at the u axis point
60200.5, and between the v axis points v=0.2 and v =0.8
6021uisoedge e p 0.5 0.20 0.8
bf62b306 6022~~~~~
72b7576f 6023
bf62b306 6024@subsubsection occt_draw_7_2_3 wire, polyline, polyvertex
72b7576f 6025
bf62b306 6026Syntax:
6027~~~~~
6028wire wirename e1/w1 [e2/w2 ...]
72b7576f 6029polyline name x1 y1 z1 x2 y2 z2 ...
6030polyvertex name v1 v2 ...
bf62b306 6031~~~~~
72b7576f 6032
bf62b306 6033**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 6034
bf62b306 6035**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 6036
bf62b306 6037**polyvertex** creates a polygonal wire from vertices.
72b7576f 6038
bf62b306 6039**Example:**
6040~~~~~
72b7576f 6041# create two polygonal wires
6042# glue them and define as a single wire
6043polyline w1 0 0 0 10 0 0 10 10 0
6044polyline w2 10 10 0 0 10 0 0 0 0
6045wire w w1 w2
bf62b306 6046~~~~~
72b7576f 6047
bf62b306 6048@subsubsection occt_draw_7_2_4 profile
72b7576f 6049
bf62b306 6050Syntax
6051~~~~~
6052profile name [code values] [code values] ...
6053~~~~~
72b7576f 6054
dba69de2 6055
bf62b306 6056**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 6057
72b7576f 6058
bf62b306 6059| **Code** | **Values ** | **Action** |
6060| :------------ | :------------- | :---------------- |
6061| O | X Y Z | Sets the origin of the plane |
6062| P | DX DY DZ UX UY UZ | Sets the normal and X of the plane |
6063| F | X Y | Sets the first point |
6064| X | DX | Translates a point along X |
6065| Y | DY | Translates a point along Y |
6066| L | DL | Translates a point along direction |
6067| XX | X | Sets point X coordinate |
6068| YY | Y | Sets point Y coordinate |
6069| T | DX DY | Translates a point |
6070| TT | X Y | Sets a point |
6071| R | Angle | Rotates direction |
6072| RR | Angle | Sets direction |
6073| D | DX DY | Sets direction |
6074| IX | X | Intersects with vertical |
6075| IY | Y | Intersects with horizontal |
6076| C | Radius Angle | Arc of circle tangent to direction |
72b7576f 6077
72b7576f 6078
6079Codes 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.
6080
6081The point [code values] can be repeated any number of times and in any order to create the profile contour.
6082
bf62b306 6083| Suffix | Action |
6084| :----- | :----- |
6085| No suffix | Makes a closed face |
6086| W | Make a closed wire |
6087| WW | Make an open wire |
6088
6089The profile shape definition is the suffix; no suffix produces a face, *w* is a closed wire, *ww* is an open wire.
72b7576f 6090
6091Code letters are not case-sensitive.
72b7576f 6092
bf62b306 6093**Example:**
6094~~~~~
72b7576f 6095# to create a trianglular plane using a vertex at the
6096origin, in the xy plane
6097profile p O 0 0 0 X 1 Y 0 x 1 y 1
bf62b306 6098~~~~~
72b7576f 6099
bf62b306 6100**Example:**
6101~~~~~
72b7576f 6102# to create a contour using the different code
6103possibilities
6104
6105# two vertices in the xy plane
6106profile p F 1 0 x 2 y 1 ww
6107
6108# to view from a point normal to the plane
6109top
6110
6111# add a circular element of 45 degrees
6112profile p F 1 0 x 2 y 1 c 1 45 ww
6113
6114# add a tangential segment with a length value 1
6115profile p F 1 0 x 2 y 1 c 1 45 l 1 ww
6116
6117# add a vertex with xy values of 1.5 and 1.5
6118profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 ww
6119
6120# add a vertex with the x value 0.2, y value is constant
6121profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 xx 0.2 ww
6122
6123# add a vertex with the y value 2 x value is constant
6124profile p F 1 0 x 2 y 1 c 1 45 l 1 tt 1.5 1.5 yy 2 ww
6125
6126# add a circular element with a radius value of 1 and a circular value of 290 degrees
6127profile 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
6128
6129# wire continues at a tangent to the intersection x = 0
6130profile 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
6131
6132# continue the wire at an angle of 90 degrees until it intersects the y axis at y= -o.3
6133profile 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
6134
6135#close the wire
6136profile 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
6137
6138# to create the plane with the same contour
6139profile 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 6140~~~~~
72b7576f 6141
bf62b306 6142@subsubsection occt_draw_7_2_5 bsplineprof
72b7576f 6143
bf62b306 6144Syntax:
6145~~~~~
6146bsplineprof name [S face] [W WW]
6147~~~~~
72b7576f 6148
ba06f8bb 6149* for an edge : \<digitizes\> ... <mouse button 2>
bf62b306 6150* to end profile : <mouse button 3>
72b7576f 6151
bf62b306 6152Builds a profile in the XY plane from digitizes. By default the profile is closed and a face is built.
72b7576f 6153
bf62b306 6154**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 6155
bf62b306 6156The profile shape definition is the suffix; no suffix produces a face, **w** is a closed wire, **ww** is an open wire.
72b7576f 6157
e5bd0d98 6158**Example:**
bf62b306 6159~~~~~
72b7576f 6160#to view the xy plane
6161top
6162#to create a 2d curve with the mouse
6163bsplineprof res
6164# click mb1 to start the curve
6165# click mb1 to create the second vertex
6166# click mb1 to create a curve
6167==
6168#click mb2 to finish the curve and start a new curve
6169==
6170# click mb1 to create the second curve
6171# click mb3 to create the face
bf62b306 6172~~~~~
72b7576f 6173
bf62b306 6174@subsubsection occt_draw_7_2_6 mkoffset
72b7576f 6175
bf62b306 6176Syntax:
6177~~~~~
6178mkoffset result face/compound of wires nboffset stepoffset
6179~~~~~
72b7576f 6180
bf62b306 6181**mkoffset** creates a parallel wire in the same plane using a face or an existing continuous set of wires as a reference. The number of occurences is not limited.
72b7576f 6182
bf62b306 6183The offset distance defines the spacing and the positioning of the occurences.
72b7576f 6184
e5bd0d98 6185**Example:**
bf62b306 6186~~~~~
72b7576f 6187#Create a box and select a face
6188box b 1 2 3
6189explode b f
6190#Create three exterior parallel contours with an offset
6191value of 2
6192mkoffset r b_1 3 2
6193Create one interior parallel contour with an offset
6194value of
61950.4
6196mkoffset r b_1 1 -0.4
bf62b306 6197~~~~~
72b7576f 6198
bf62b306 6199**Note** that *mkoffset* command must be used with prudence, as angular contours produce offset contours with fillets. Interior parallel contours can produce more than one wire, normally these are refused. In the following example, any increase in the offset value is refused.
72b7576f 6200
bf62b306 6201**Example:**
6202~~~~~
72b7576f 6203# to create the example contour
6204profile p F 0 0 x 2 y 4 tt 1 1 tt 0 4 w
6205# to create an incoherent interior offset
6206mkoffset r p 1 -0.50
6207==p is not a FACE but a WIRE
6208BRepFill_TrimEdgeTool: incoherent intersection
6209# to create two incoherent wires
6210mkoffset r p 1 -0.50
bf62b306 6211~~~~~
72b7576f 6212
bf62b306 6213@subsubsection occt_draw_7_2_7 mkplane, mkface
72b7576f 6214
bf62b306 6215Syntax:
6216~~~~~
6217mkplane name wire
72b7576f 6218mkface name surface [ufirst ulast vfirst vlast]
bf62b306 6219~~~~~
72b7576f 6220
bf62b306 6221**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 6222
bf62b306 6223**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 6224
bf62b306 6225**Example:**
6226~~~~~
72b7576f 6227# make a polygonal face
6228polyline f 0 0 0 20 0 0 20 10 0 10 10 0 10 20 0 0 20 0 0 0 0
6229mkplane f f
6230
6231# make a cylindrical face
6232cylinder g 10
6233trim g g -pi/3 pi/2 0 15
6234mkface g g
bf62b306 6235~~~~~
72b7576f 6236
bf62b306 6237@subsubsection occt_draw_7_2_8 mkcurve, mksurface
72b7576f 6238
bf62b306 6239Syntax:
6240~~~~~
6241mkcurve curve edge
72b7576f 6242mksurface name face
bf62b306 6243~~~~~
72b7576f 6244
bf62b306 6245**mkcurve** creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries.
72b7576f 6246
bf62b306 6247**mksurface** creates a surface from a face. The surface will not be trimmed.
72b7576f 6248
bf62b306 6249**Example:**
6250~~~~~
72b7576f 6251# make a line
6252vertex v1 0 0 0
6253vertex v2 10 0 0
6254edge e v1 v2
bf62b306 6255~~~~~
72b7576f 6256
bf62b306 6257@subsubsection occt_draw_7_2_9 pcurve
6258
6259Syntax:
72b7576f 6260
bf62b306 6261~~~~~
6262pcurve [name edgename] facename
6263~~~~~
72b7576f 6264
bf62b306 6265Extracts 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 6266
e5bd0d98 6267**Example:**
bf62b306 6268~~~~~
72b7576f 6269# view the pcurves of a face
6270plane p
6271trim p p -1 1 -1 1
6272mkface p p
6273av2d; # a 2d view
6274pcurve p
62752dfit
bf62b306 6276~~~~~
72b7576f 6277
bf62b306 6278@subsubsection occt_draw_7_2_10 chfi2d
72b7576f 6279
bf62b306 6280Syntax:
6281~~~~~
6282chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) ....
6283~~~~~
72b7576f 6284
72b7576f 6285
bf62b306 6286Creates chamfers and fillets on 2D objects. Select two adjacent edges and:
72b7576f 6287 * a radius value
6288 * two respective distance values
6289 * a distance value and an angle
6290
6291The radius value produces a fillet between the two faces.
6292
6293The distance is the length value from the edge between the two selected faces in a normal direction.
6294
e5bd0d98 6295**Example:**
72b7576f 6296
bf62b306 6297Let us create a 2d fillet:
6298
6299~~~~~
72b7576f 6300top
6301profile p x 2 y 2 x -2
6302chfi2d cfr p . . F 0.3
6303==Pick an object
6304#select an edge
6305==Pick an object
6306#select an edge
bf62b306 6307~~~~~
72b7576f 6308
bf62b306 6309Let us create a 2d chamfer using two distances:
6310
6311~~~~~
72b7576f 6312profile p x 2 y 2 x -2
6313chfi2d cfr p . . CDD 0.3 0.6
6314==Pick an object
6315#select an edge
6316==Pick an object
6317#select an edge
bf62b306 6318~~~~~
6319
6320Let us create a 2d chamfer using a defined distance and angle
72b7576f 6321
bf62b306 6322~~~~~
72b7576f 6323top
6324profile p x 2 y 2 x -2
6325chfi2d cfr p . . CDA 0.3 75
6326==Pick an object
6327#select an edge
6328==Pick an object
6329#select an edge
bf62b306 6330~~~~~
72b7576f 6331
bf62b306 6332@subsubsection occt_draw_7_2_11 nproject
72b7576f 6333
bf62b306 6334Syntax:
6335~~~~~
6336nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol
72b7576f 6337[continuity [maxdeg [maxseg]]]
bf62b306 6338~~~~~
72b7576f 6339
bf62b306 6340Creates a shape projection which is normal to the target surface.
72b7576f 6341
bf62b306 6342**Example:**
6343~~~~~
72b7576f 6344# create a curved surface
6345line l 0 0 0 1 0 0
6346trim l l 0 2
6347convert l l
6348
6349incdeg l 3
6350cmovep l 1 0 0.5 0
6351cmovep l 3 0 0.5 0
6352copy l ll
6353translate ll 2 -0.5 0
6354mkedge e1 l
6355mkedge e2 ll
6356wire w e1 e2
6357prism p w 0 0 3
6358donl p
6359#display in four views
6360mu4
6361fit
6362# create the example shape
6363circle c 1.8 -0.5 1 0 1 0 1 0 0 0.4
6364mkedge e c
6365donly p e
6366# create the normal projection of the shape(circle)
6367nproject r e p
bf62b306 6368~~~~~
72b7576f 6369
6370
bf62b306 6371@subsection occt_draw_7_3 Primitives
72b7576f 6372
6373Primitive commands make it possible to create simple shapes. They include:
6374
bf62b306 6375 * **box** and **wedge** commands.
6376 * **pcylinder**, **pcone**, **psphere**, **ptorus** commands.
6377 * **halfspace** command
72b7576f 6378
6379
bf62b306 6380@subsubsection occt_draw_7_3_1 box, wedge
72b7576f 6381
bf62b306 6382Syntax:
6383~~~~~
6384box name [x y z] dx dy dz
72b7576f 6385wedge name dx dy dz ltx / xmin zmin xmax xmax
bf62b306 6386~~~~~
72b7576f 6387
bf62b306 6388**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 6389
bf62b306 6390**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 6391
bf62b306 6392The 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 6393
bf62b306 6394**Example:**
6395~~~~~
72b7576f 6396# a box at the origin
6397box b1 10 20 30
6398
6399# another box
6400box b2 30 30 40 10 20 30
6401
6402# a wedge
6403wedge w1 10 20 30 5
6404
6405# a wedge with a sharp edge (5 faces)
6406wedge w2 10 20 30 0
6407
6408# a pyramid
6409wedge w3 20 20 20 10 10 10 10
bf62b306 6410~~~~~
72b7576f 6411
bf62b306 6412@subsubsection occt_draw_7_3_2 pcylinder, pcone, psphere, ptorus
72b7576f 6413
bf62b306 6414Syntax:
6415~~~~~
6416pcylinder name [plane] radius height [angle]
72b7576f 6417pcone name [plane] radius1 radius2 height [angle]
6418pcone name [plane] radius1 radius2 height [angle]
6419psphere name [plane] radius1 [angle1 angle2] [angle]
6420ptorus name [plane] radius1 radius2 [angle1 angle2] [angle]
bf62b306 6421~~~~~
72b7576f 6422
bf62b306 6423All 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 6424
bf62b306 6425**pcylinder** creates a cylindrical block with the given radius and height.
72b7576f 6426
bf62b306 6427**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 6428
bf62b306 6429**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 6430
3f812249 6431**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 6432
bf62b306 6433**Example:**
6434~~~~~
72b7576f 6435# a can shape
6436pcylinder cy 5 10
6437
6438# a quarter of a truncated cone
6439pcone co 15 10 10 90
6440
6441# three-quarters of sphere
6442psphere sp 10 270
6443
6444# half torus
6445ptorus to 20 5 0 90
bf62b306 6446~~~~~
72b7576f 6447
bf62b306 6448@subsubsection occt_draw_7_3_3 halfspace
72b7576f 6449
bf62b306 6450Syntax:
6451~~~~~
6452halfspace result face/shell x y z
6453~~~~~
72b7576f 6454
bf62b306 6455**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.
6456
6457**Example:**
6458~~~~~
72b7576f 6459box b 0 0 0 1 2 3
6460explode b f
6461==b_1 b_2 b_3 b_4 b_5 b_6
6462halfspace hr b_3 0.5 0.5 0.5
bf62b306 6463~~~~~
72b7576f 6464
6465
bf62b306 6466@subsection occt_draw_7_4 Sweeping
72b7576f 6467
6468Sweeping creates shapes by sweeping out a shape along a defined path:
6469
3f812249 6470 * **prism** -- sweeps along a direction.
6471 * **revol** -- sweeps around an axis.
6472 * **pipe** -- sweeps along a wire.
6473 * **mksweep** and **buildsweep** -- to create sweeps by defining the arguments and algorithms.
6474 * **thrusections** -- creates a sweep from wire in different planes.
bf62b306 6475
72b7576f 6476
bf62b306 6477@subsubsection occt_draw_7_4_1 prism
72b7576f 6478
bf62b306 6479Syntax:
6480~~~~~
6481prism result base dx dy dz [Copy | Inf | SemiInf]
6482~~~~~
72b7576f 6483
bf62b306 6484Creates 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 6485
bf62b306 6486The 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 6487
e5bd0d98 6488**Example:**
bf62b306 6489~~~~~
72b7576f 6490# sweep a planar face to make a solid
6491polyline f 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0 0 0 0
6492mkplane f f
bf62b306 6493~~~~~
72b7576f 6494
bf62b306 6495@subsubsection occt_draw_7_4_2 revol
72b7576f 6496
bf62b306 6497Syntax:
6498~~~~~
6499revol result base x y z dx dy dz angle [Copy]
6500~~~~~
72b7576f 6501
bf62b306 6502Creates 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 6503
e5bd0d98 6504**Example:**
bf62b306 6505~~~~~
72b7576f 6506# shell by wire rotation
6507polyline w 0 0 0 10 0 0 10 5 0 5 5 0 5 15 0 0 15 0
6508revol s w 20 0 0 0 1 0 90
bf62b306 6509~~~~~
72b7576f 6510
6511
bf62b306 6512@subsubsection occt_draw_7_4_3 pipe
72b7576f 6513
bf62b306 6514Syntax:
6515~~~~~
6516pipe name wire_spine Profile
6517~~~~~
72b7576f 6518
bf62b306 6519Creates a new shape by sweeping a shape known as the profile along a wire known as the spine.
72b7576f 6520
e5bd0d98 6521**Example:**
bf62b306 6522~~~~~
72b7576f 6523# sweep a circle along a bezier curve to make a solid
6524pipe
6525
6526beziercurve spine 4 0 0 0 10 0 0 10 10 0 20 10 0
6527mkedge spine spine
6528wire spine spine
6529circle profile 0 0 0 1 0 0 2
6530mkedge profile profile
6531wire profile profile
6532mkplane profile profile
6533pipe p spine profile
bf62b306 6534~~~~~
72b7576f 6535
bf62b306 6536@subsubsection occt_draw_7_4_4 mksweep, addsweep, setsweep, deletesweep, buildsweep, simulsweep
72b7576f 6537
bf62b306 6538Syntax:
6539~~~~~
6540mksweep wire
6541addsweep wire[vertex][-M][-C] [auxiilaryshape]
6542deletesweep wire
72b7576f 6543setsweep options [arg1 [arg2 [...]]]
72b7576f 6544simulsweep r [n] [option]
6545buildsweep [r] [option] [Tol]
bf62b306 6546~~~~~
72b7576f 6547
bf62b306 6548options are :
6549 * *-FR* : Tangent and Normal are defined by a Frenet trihedron
6550 * *-CF* : Tangent is given by Frenet, the Normal is computed to minimize the torsion
6551 * *-DX Surf* : Tangent and Normal are given by Darboux trihedron, surf must be a shell or a face
6552 * *-CN dx dy dz* : BiNormal is given by *dx dy dz*
6553 * *-FX Tx Ty TZ [Nx Ny Nz]* : Tangent and Normal are fixed
6554 * *-G guide*
72b7576f 6555
bf62b306 6556These 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 6557* **mksweep** -- initializes the sweep creation and defines the wire to be used as the spine.
6558* **addsweep** -- defines the wire to be used as the profile.
6559* **deletesweep** -- cancels the choice of profile wire, without leaving the mksweep mode. You can re-select a profile wire.
6560* **setsweep** -- commands the algorithms used for the construction of the sweep.
6561* **simulsweep** -- can be used to create a preview of the shape. [n] is the number of sections that are used to simulate the sweep.
6562* **buildsweep** -- creates the sweep using the arguments defined by all the commands.
72b7576f 6563
e5bd0d98 6564**Example:**
bf62b306 6565~~~~~
72b7576f 6566#create a sweep based on a semi-circular wire using the
6567Frenet algorithm
6568#create a circular figure
6569circle c2 0 0 0 1 0 0 10
6570trim c2 c2 -pi/2 pi/2
6571mkedge e2 c2
6572donly e2
6573wire w e2
6574whatis w
6575mksweep w
6576# to display all the options for a sweep
6577setsweep
6578#to create a sweep using the Frenet algorithm where the
6579#normal is computed to minimise the torsion
6580setsweep -CF
6581addsweep w -R
6582# to simulate the sweep with a visual approximation
6583simulsweep w 3
bf62b306 6584~~~~~
72b7576f 6585
bf62b306 6586@subsubsection occt_draw_7_4_5 thrusections
72b7576f 6587
bf62b306 6588Syntax:
6589~~~~~
6590thrusections [-N] result issolid isruled wire1 wire2 [..wire..]
6591~~~~~
72b7576f 6592
bf62b306 6593**thrusections** creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices.
6594A bezier curve is generated between the vertices of each wire. The option *[-N]* means that no check is made on wires for direction.
72b7576f 6595
e5bd0d98 6596**Example:**
bf62b306 6597~~~~~
72b7576f 6598#create three wires in three planes
6599polyline w1 0 0 0 5 0 0 5 5 0 2 3 0
6600polyline w2 0 1 3 4 1 3 4 4 3 1 3 3
6601polyline w3 0 0 5 5 0 5 5 5 5 2 3 5
6602# create the shape
6603thrusections th issolid isruled w1 w2 w3
6604==thrusections th issolid isruled w1 w2 w3
dba69de2 6605Tolerances obtenues -- 3d : 0
72b7576f 6606-- 2d : 0
bf62b306 6607~~~~~
72b7576f 6608
6609
bf62b306 6610@subsection occt_draw_7_5 Topological transformation
72b7576f 6611
bf62b306 6612Transformations 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 6613
3f812249 6614 * **tcopy** -- makes a copy of the structure of a shape.
6615 * **ttranslate**, **trotate**, **tmove** and **reset** -- move a shape.
6616 * **tmirror** and **tscale** -- always modify the shape.
72b7576f 6617
6618
bf62b306 6619@subsubsection occt_draw_7_5_1 tcopy
72b7576f 6620
bf62b306 6621Syntax:
6622~~~~~
6623tcopy name toname [name toname ...]
6624~~~~~
72b7576f 6625
6626Copies the structure of one shape, including the geometry, into another, newer shape.
72b7576f 6627
bf62b306 6628**Example:**
6629~~~~~
72b7576f 6630# create an edge from a curve and copy it
6631beziercurve c 3 0 0 0 10 0 0 20 10 0
6632mkedge e1 c
6633ttranslate e1 0 5 0
6634tcopy e1 e2
6635ttranslate e2 0 5 0
6636# now modify the curve, only e1 and e2 will be modified
bf62b306 6637~~~~~
72b7576f 6638
bf62b306 6639@subsubsection occt_draw_7_5_2 tmove, treset
72b7576f 6640
bf62b306 6641Syntax:
6642~~~~~
6643tmove name [name ...] shape
72b7576f 6644reset name [name ...]
bf62b306 6645~~~~~
72b7576f 6646
bf62b306 6647**tmove** and **reset** modify the location, or the local coordinate system of a shape.
72b7576f 6648
bf62b306 6649**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 6650
bf62b306 6651**Example:**
6652~~~~~
72b7576f 6653# create two boxes
6654box b1 10 10 10
6655box b2 20 0 0 10 10 10
6656# translate the first box
6657ttranslate b1 0 10 0
6658# and apply the same location to b2
6659tmove b2 b1
6660# return to original positions
6661reset b1 b2
bf62b306 6662~~~~~
72b7576f 6663
bf62b306 6664@subsubsection occt_draw_7_5_3 ttranslate, trotate
72b7576f 6665
bf62b306 6666Syntax:
6667~~~~~
6668ttranslate [name ...] dx dy dz
72b7576f 6669trotate [name ...] x y z dx dy dz angle
bf62b306 6670~~~~~
72b7576f 6671
bf62b306 6672**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.
6673When 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 6674
6675Locations are very economic in the data structure because multiple occurences of an object share the topological description.
bf62b306 6676
e5bd0d98 6677**Example:**
bf62b306 6678~~~~~
72b7576f 6679# make rotated copies of a sphere in between two cylinders
6680# create a file source toto.tcl
6681# toto.tcl code:
d5cdd12a 6682for {set i 0} {$i < 360} {incr i 20} {
72b7576f 6683copy s s$i
6684trotate s$i 0 0 0 0 0 1 $i
6685}
6686
6687# create two cylinders
6688pcylinder c1 30 5
6689copy c1 c2
6690ttranslate c2 0 0 20
6691
6692#create a sphere
6693psphere s 3
6694ttranslate s 25 0 12.5
6695
6696# call the source file for multiple copies
6697source toto.tcl
bf62b306 6698~~~~~
72b7576f 6699
bf62b306 6700@subsubsection occt_draw_7_5_4 tmirror, tscale
72b7576f 6701
bf62b306 6702Syntax:
6703~~~~~
6704tmirror name x y z dx dy dz
72b7576f 6705tscale name x y z scale
bf62b306 6706~~~~~
72b7576f 6707
bf62b306 6708* **tmirror** makes a mirror copy of a shape about a plane x,y,z dx,dy,dz.
6709
6710* **Tscale** applies a central homotopic mapping to a shape.
72b7576f 6711
bf62b306 6712**Example:**
6713~~~~~
72b7576f 6714# mirror a portion of cylinder about the YZ plane
6715pcylinder c1 10 10 270
6716copy c1 c2
6717tmirror c2 15 0 0 1 0 0
6718# and scale it
6719tscale c1 0 0 0 0.5
bf62b306 6720~~~~~
72b7576f 6721
6722
bf62b306 6723@subsection occt_draw_7_6 Old Topological operations
72b7576f 6724
bf62b306 6725 * **fuse**, **cut**, **common** are boolean operations.
6726 * **section**, **psection** compute sections.
6727 * **sewing** joins two or more shapes.
72b7576f 6728
6729
bf62b306 6730@subsubsection occt_draw_7_6_1 fuse, cut, common
72b7576f 6731
bf62b306 6732Syntax:
6733~~~~~
6734fuse name shape1 shape2
72b7576f 6735cut name shape1 shape2
6736common name shape1 shape2
bf62b306 6737~~~~~
72b7576f 6738
bf62b306 6739**fuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
72b7576f 6740
bf62b306 6741**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 6742
bf62b306 6743**common** creates a new shape which contains only what is in common between the two original shapes in their intersection.
72b7576f 6744
bf62b306 6745**Example:**
6746~~~~~
72b7576f 6747# all four boolean operations on a box and a cylinder
6748
6749box b 0 -10 5 20 20 10
6750pcylinder c 5 20
6751
6752fuse s1 b c
6753ttranslate s1 40 0 0
6754
6755cut s2 b c
6756ttranslate s2 -40 0 0
6757
6758cut s3 c b
6759ttranslate s3 0 40 0
6760
6761common s4 b c
6762ttranslate s4 0 -40 0
bf62b306 6763~~~~~
72b7576f 6764
6765
bf62b306 6766@subsubsection occt_draw_7_6_2 section, psection
72b7576f 6767
bf62b306 6768Syntax:
6769~~~~~
6770section result shape1 shape2
72b7576f 6771psection name shape plane
bf62b306 6772~~~~~
72b7576f 6773
bf62b306 6774**section** creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
72b7576f 6775
bf62b306 6776**psection** creates a planar section consisting of the edges for the intersection curves on the faces of a shape and a plane.
72b7576f 6777
bf62b306 6778**Example:**
6779~~~~~
72b7576f 6780# section line between a cylinder and a box
6781pcylinder c 10 20
6782box b 0 0 5 15 15 15
6783trotate b 0 0 0 1 1 1 20
6784section s b c
6785
6786# planar section of a cone
6787pcone c 10 30 30
6788plane p 0 0 15 1 1 2
6789psection s c p
bf62b306 6790~~~~~
72b7576f 6791
bf62b306 6792@subsubsection occt_draw_7_6_3 sewing
72b7576f 6793
bf62b306 6794Syntax:
6795~~~~~
6796sewing result [tolerance] shape1 shape2 ...
6797~~~~~
72b7576f 6798
bf62b306 6799**Sewing** joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value.
72b7576f 6800
e5bd0d98 6801**Example:**
bf62b306 6802~~~~~
72b7576f 6803# create two adjacent boxes
6804box b 0 0 0 1 2 3
6805box b2 0 2 0 1 2 3
6806sewing sr b b2
bf62b306 6807whatis sr
6808sr is a shape COMPOUND FORWARD Free Modified
6809~~~~~
72b7576f 6810
bf62b306 6811@subsection occt_draw_7_7 New Topological operations
72b7576f 6812
72b7576f 6813
bf62b306 6814The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm.
72b7576f 6815
72b7576f 6816
e322db46 6817@subsubsection occt_draw_7_7_1 bparallelmode
6818
6819* **bparallelmode** enable or disable parallel mode for boolean operations. Sequential computing is used by default.
6820
6821Syntax:
6822~~~~~
6823bparallelmode [1/0]
6824
6825~~~~~
6826
6827Without arguments, bparallelmode shows current state of parallel mode for boolean operations.
6828
6829* *0* Disable parallel mode,
6830* *1* Enable parallel mode
6831
6832**Example:**
6833~~~~~
6834# Enable parallel mode for boolean operations.
6835bparallelmode 1
6836
6837# Show state of parallel mode for boolean operations.
6838bparallelmode
6839~~~~~
6840
6841@subsubsection occt_draw_7_7_2 bop, bopfuse, bopcut, boptuc, bopcommon
72b7576f 6842
bf62b306 6843* **bop** defines *shape1* and *shape2* subject to ulterior Boolean operations
6844* **bopfuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
6845* **bopcut** creates a new shape which contains all parts of the second shape but only the first shape without the intersection of the two shapes.
6846* **boptuc** is a reverced **bopcut**.
6847* **bopcommon** creates a new shape which contains only whatever is in common between the two original shapes in their intersection.
72b7576f 6848
bf62b306 6849Syntax:
6850~~~~~
6851bop shape1 shape2
72b7576f 6852bopcommon result
6853bopfuse result
6854bopcut result
6855boptuc result
bf62b306 6856~~~~~
72b7576f 6857
6858These commands have short variants:
6859
bf62b306 6860~~~~~
72b7576f 6861bcommon result shape1 shape2
6862bfuse result shape1 shape2
6863bcut result shape1 shape2
bf62b306 6864~~~~~
6865
72b7576f 6866
bf62b306 6867**bop** fills data structure (DS) of boolean operation for *shape1* and *shape2*.
6868**bopcommon, bopfuse, bopcut, boptuc** commands are used after **bop** command. After one **bop** command it is possible to call several commands from the list above. For example:
6869
6870~~~~~
6871bop S1 S2
6872bopfuse R
6873~~~~~
72b7576f 6874
72b7576f 6875
e5bd0d98 6876**Example:**
72b7576f 6877
bf62b306 6878Let us produce all four boolean operations on a box and a cylinder:
72b7576f 6879
bf62b306 6880~~~~~
72b7576f 6881box b 0 -10 5 20 20 10
6882pcylinder c 5 20
6883
6884# fills data structure
6885bop b c
6886
6887bopfuse s1
6888ttranslate s1 40 0 0
6889
6890bopcut s2
6891ttranslate s2 -40 0 0
6892
6893boptuc s3
6894ttranslate s3 0 40 0
6895
6896bopcommon s4
6897ttranslate s4 0 -40 0
bf62b306 6898~~~~~
72b7576f 6899
bf62b306 6900Now use short variants of the commands:
72b7576f 6901
bf62b306 6902~~~~~
72b7576f 6903bfuse s11 b c
6904ttranslate s11 40 0 100
6905
6906bcut s12 b c
6907ttranslate s12 -40 0 100
6908
6909bcommon s14 b c
6910ttranslate s14 0 -40 100
bf62b306 6911~~~~~
72b7576f 6912
e322db46 6913@subsubsection occt_draw_7_7_3 bopsection
72b7576f 6914
bf62b306 6915Syntax:
6916~~~~~
6917bop shape1 shape2
72b7576f 6918bopsection result
bf62b306 6919~~~~~
72b7576f 6920
3f812249 6921* **bopsection** -- creates a compound object consisting of the edges for the intersection curves on the faces of two shapes.
6922* **bop** -- fills data structure (DS) of boolean operation for *shape1* and *shape2*.
6923* **bopsection** -- is used after **bop** command.
bf62b306 6924
6925Short variant syntax:
6926~~~~~
72b7576f 6927bsection result shape1 shape2 [-2d/-2d1/-2s2] [-a]
bf62b306 6928~~~~~
72b7576f 6929
3f812249 6930* <i>-2d</i> -- PCurves are computed on both parts.
6931* <i>-2d1</i> -- PCurves are computed on first part.
6932* <i>-2d2</i> -- PCurves are computed on second part.
6933* <i>-a</i> -- built geometries are approximated.
72b7576f 6934
e5bd0d98 6935**Example:**
72b7576f 6936
bf62b306 6937Let us build a section line between a cylinder and a box
6938~~~~~
72b7576f 6939pcylinder c 10 20
6940box b 0 0 5 15 15 15
6941trotate b 0 0 0 1 1 1 20
6942bop b c
6943bopsection s
6944# Short variant:
6945bsection s2 b c
bf62b306 6946~~~~~
72b7576f 6947
e322db46 6948@subsubsection occt_draw_7_7_4 bopcheck, bopargshape
72b7576f 6949
bf62b306 6950Syntax:
6951~~~~~
6952bopcheck shape
72b7576f 6953bopargcheck shape1 [[shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF]
bf62b306 6954~~~~~
72b7576f 6955
6956**bopcheck** checks a shape for self-interference.
6957
6958**bopargcheck** checks the validity of argument(s) for boolean operations.
6959
3f812249 6960* Boolean Operation -- (by default a section is made) :
ba06f8bb 6961 * **F** (fuse)
6962 * **O** (common)
6963 * **C** (cut)
6964 * **T** (cut21)
6965 * **S** (section)
6966 * **U** (unknown)
3f812249 6967* Test Options -- (by default all options are enabled) :
6968 * **R** (disable small edges (shrink range) test)
ba06f8bb 6969 * **F** (disable faces verification test)
6970 * **T** (disable tangent faces searching test)
6971 * **V** (disable test possibility to merge vertices)
6972 * **E** (disable test possibility to merge edges)
6973 * **I** (disable self-interference test)
6974 * **P** (disable shape type test)
bf62b306 6975* Additional Test Options :
3f812249 6976 * **B** (stop test on first faulty found) -- by default it is off;
6977 * **F** (full output for faulty shapes) -- by default the output is made in a short format.
bf62b306 6978
6979**Note** that Boolean Operation and Test Options are used only for a couple of argument shapes, except for <b>I</b> and <b>P</b> options that are always used to test a couple of shapes as well as a single shape.
72b7576f 6980
e5bd0d98 6981**Example:**
bf62b306 6982~~~~~
72b7576f 6983# checks a shape on self-interference
6984box b1 0 0 0 1 1 1
6985bopcheck b1
6986
6987# checks the validity of argument for boolean cut operations
6988box b2 0 0 0 10 10 10
6989bopargcheck b1 b2 -C
bf62b306 6990~~~~~
72b7576f 6991
bf62b306 6992@subsection occt_draw_7_8 Drafting and blending
72b7576f 6993
6994Drafting is creation of a new shape by tilting faces through an angle.
6995
6996Blending is the creation of a new shape by rounding edges to create a fillet.
6997
bf62b306 6998 * Use the **depouille** command for drafting.
6999 * Use the **chamf** command to add a chamfer to an edge
7000 * Use the **blend** command for simple blending.
7001 * Use **fubl** for a fusion + blending operation.
7002 * Use **buildevol**, **mkevol**, **updatevol** to realize varying radius blending.
72b7576f 7003
7004
bf62b306 7005@subsubsection occt_draw_7_8_1 depouille
72b7576f 7006
bf62b306 7007Syntax:
7008~~~~~
7009dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...]
7010~~~~~
72b7576f 7011
bf62b306 7012Creates a new shape by drafting one or more faces of a shape.
72b7576f 7013
7014Identify 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 7015
e5bd0d98 7016**Example:**
bf62b306 7017~~~~~
72b7576f 7018# draft a face of a box
7019box b 10 10 10
7020explode b f
7021== b_1 b_2 b_3 b_4 b_5 b_6
7022
7023dep a b 0 0 1 b_2 10 0 10 0 1 0 5
bf62b306 7024~~~~~
72b7576f 7025
bf62b306 7026@subsubsection occt_draw_7_8_2 chamf
72b7576f 7027
bf62b306 7028Syntax:
7029~~~~~
7030chamf newname shape edge face S dist
72b7576f 7031chamf newname shape edge face dist1 dist2
7032chamf newname shape edge face A dist angle
bf62b306 7033~~~~~
72b7576f 7034
bf62b306 7035Creates a chamfer along the edge between faces using:
72b7576f 7036
7037 * a equal distances from the edge
7038 * the edge, a face and distance, a second distance
7039 * the edge, a reference face and an angle
7040
7041Use the dot syntax to select the faces and edges.
72b7576f 7042
bf62b306 7043**Examples:**
7044
7045Let us create a chamfer based on equal distances from the edge (45 degree angle):
7046~~~~~
72b7576f 7047# create a box
7048box b 1 2 3
7049chamf ch b . . S 0.5
7050==Pick an object
7051# select an edge
7052==Pick an object
7053# select an adjacent face
bf62b306 7054~~~~~
72b7576f 7055
bf62b306 7056Let us create a chamfer based on different distances from the selected edge:
7057~~~~~
72b7576f 7058box b 1 2 3
7059chamf ch b . . 0.3 0.4
7060==Pick an object
7061# select an edge
7062==Pick an object
bf62b306 7063# select an adjacent face
7064~~~~~
7065
7066Let us create a chamfer based on a distance from the edge and an angle:
7067
7068~~~~~
72b7576f 7069box b 1 2 3
7070chamf ch b . . A 0.4 30
7071==Pick an object
7072# select an edge
7073==Pick an object
7074# select an adjacent face
bf62b306 7075~~~~~
72b7576f 7076
bf62b306 7077@subsubsection occt_draw_7_8_3 blend
72b7576f 7078
bf62b306 7079Syntax:
7080~~~~~
7081blend result object rad1 ed1 rad2 ed2 ... [R/Q/P]
7082~~~~~
72b7576f 7083
bf62b306 7084Creates 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 7085
e5bd0d98 7086**Example:**
bf62b306 7087~~~~~
72b7576f 7088# blend a box, click on an edge
7089box b 20 20 20
7090blend b b 2 .
7091==tolerance ang : 0.01
7092==tolerance 3d : 0.0001
7093==tolerance 2d : 1e-05
7094==fleche : 0.001
7095==tolblend 0.01 0.0001 1e-05 0.001
7096==Pick an object
7097# click on the edge you want ot fillet
7098
7099==COMPUTE: temps total 0.1s dont :
7100==- Init + ExtentAnalyse 0s
7101==- PerformSetOfSurf 0.02s
7102==- PerformFilletOnVertex 0.02s
7103==- FilDS 0s
7104==- Reconstruction 0.06s
7105==- SetRegul 0s
bf62b306 7106~~~~~
72b7576f 7107
bf62b306 7108@subsubsection occt_draw_7_8_4 fubl
72b7576f 7109
bf62b306 7110Syntax:
7111~~~~~
7112fubl name shape1 shape2 radius
7113~~~~~
7114
7115Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius.
72b7576f 7116
e5bd0d98 7117**Example:**
bf62b306 7118~~~~~
72b7576f 7119# fuse-blend two boxes
7120box b1 20 20 5
7121copy b1 b2
7122ttranslate b2 -10 10 3
7123fubl a b1 b2 1
bf62b306 7124~~~~~
72b7576f 7125
7126
bf62b306 7127@subsubsection occt_draw_7_8_5 mkevol, updatevol, buildevol
72b7576f 7128
bf62b306 7129Syntax:
7130~~~~~
7131mkevol result object (then use updatevol) [R/Q/P]
72b7576f 7132updatevol edge u1 radius1 [u2 radius2 ...]
7133buildevol
bf62b306 7134~~~~~
72b7576f 7135
7136These three commands work together to create fillets with evolving radii.
7137
bf62b306 7138* **mkevol** allows specifying the shape and the name of the result. It returns the tolerances of the fillet.
7139* **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.
7140* **buildevol** produces the result described previously in **mkevol** and **updatevol**.
72b7576f 7141
e5bd0d98 7142**Example:**
bf62b306 7143~~~~~
72b7576f 7144# makes an evolved radius on a box
7145box b 10 10 10
7146mkevol b b
7147==tolerance ang : 0.01
7148==tolerance 3d : 0.0001
7149==tolerance 2d : 1e-05
7150==fleche : 0.001
7151==tolblend 0.01 0.0001 1e-05 0.001
7152
7153# click an edge
7154updatevol . 0 1 1 3 2 2
7155==Pick an object
7156
7157buildevol
7158==Dump of SweepApproximation
7159==Error 3d = 1.28548881203818e-14
7160==Error 2d = 1.3468326936926e-14 ,
7161==1.20292299999388e-14
7162==2 Segment(s) of degree 3
7163
7164==COMPUTE: temps total 0.91s dont :
7165==- Init + ExtentAnalyse 0s
7166==- PerformSetOfSurf 0.33s
7167==- PerformFilletOnVertex 0.53s
7168==- FilDS 0.01s
7169==- Reconstruction 0.04s
7170==- SetRegul 0s
bf62b306 7171~~~~~
72b7576f 7172
7173
ae3eaf7b 7174@subsection occt_draw_7_9 Analysis of topology and geometry
72b7576f 7175
7176Analysis of shapes includes commands to compute length, area, volumes and inertial properties.
7177
bf62b306 7178 * Use **lprops**, **sprops**, **vprops** to compute integral properties.
7179 * Use **bounding** to display the bounding box of a shape.
7180 * Use **distmini** to calculate the minimum distance between two shapes.
ae3eaf7b 7181 * Use **xdistef**, **xdistcs**, **xdistcc**, **xdistc2dc2dss**, **xdistcc2ds** to check the distance between two objects on even grid.
72b7576f 7182
7183
bf62b306 7184@subsubsection occt_draw_7_9_1 lprops, sprops, vprops
72b7576f 7185
bf62b306 7186Syntax:
7187~~~~~
7188lprops shape
72b7576f 7189sprops shape
7190vprops shape
bf62b306 7191~~~~~
72b7576f 7192
bf62b306 7193* **lprops** computes the mass properties of all edges in the shape with a linear density of 1;
7194* **sprops** of all faces with a surface density of 1;
7195* **vprops** of all solids with a density of 1.
72b7576f 7196
7197All 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 7198
bf62b306 7199**Example:**
7200~~~~~
72b7576f 7201# volume of a cylinder
7202pcylinder c 10 20
7203vprops c
7204== results
7205Mass : 6283.18529981086
7206
7207Center of gravity :
7208X = 4.1004749224903e-06
7209Y = -2.03392858349861e-16
7210Z = 9.9999999941362
7211
7212Matrix of Inertia :
dba69de2 7213366519.141445068 5.71451850691484e-12
72b7576f 72140.257640437382627
dba69de2 72155.71451850691484e-12 366519.141444962
72162.26823064169991e-10 0.257640437382627
72172.26823064169991e-10 314159.265358863
72b7576f 7218
7219Moments :
7220IX = 366519.141446336
7221IY = 366519.141444962
7222I.Z = 314159.265357595
bf62b306 7223~~~~~
72b7576f 7224
7225
bf62b306 7226@subsubsection occt_draw_7_9_2 bounding
72b7576f 7227
bf62b306 7228Syntax:
7229~~~~~
7230bounding shape
7231~~~~~
72b7576f 7232
7233Displays the bounding box of a shape. The bounding box is a cuboid created with faces parallel to the x, y, and z planes. The command returns the dimension values of the the box, *xmin ymin zmin xmax ymax zmax.*
72b7576f 7234
bf62b306 7235**Example:**
7236~~~~~
72b7576f 7237# bounding box of a torus
7238ptorus t 20 5
7239bounding t
dba69de2 7240==-27.059805107309852 -27.059805107309852 -
72b7576f 72415.0000001000000003
dba69de2 7242==27.059805107309852 27.059805107309852
72b7576f 72435.0000001000000003
bf62b306 7244~~~~~
72b7576f 7245
bf62b306 7246@subsubsection occt_draw_7_9_3 distmini
72b7576f 7247
bf62b306 7248Syntax:
7249~~~~~
7250distmini name Shape1 Shape2
7251~~~~~
72b7576f 7252
bf62b306 7253Calculates the minimum distance between two shapes. The calculation returns the number of solutions, If more than one solution exists. The options are displayed in the viewer(red) and the results are listed in the shell window. The *distmini* lines are considered as shapes which have a value v.
72b7576f 7254
e5bd0d98 7255**Example:**
bf62b306 7256~~~~~
72b7576f 7257box b 0 0 0 10 20 30
7258box b2 30 30 0 10 20 30
7259distmini d1 b b2
7260==the distance value is : 22.3606797749979
7261==the number of solutions is :2
7262
7263==solution number 1
7264==the type of the solution on the first shape is 0
7265==the type of the solution on the second shape is 0
7266==the coordinates of the point on the first shape are:
7267==X=10 Y=20 Z=30
7268==the coordinates of the point on the second shape
7269are:
7270==X=30 Y=30 Z=30
7271
7272==solution number 2:
7273==the type of the solution on the first shape is 0
7274==the type of the solution on the second shape is 0
7275==the coordinates of the point on the first shape are:
7276==X=10 Y=20 Z=0
7277==the coordinates of the point on the second shape
7278are:
7279==X=30 Y=30 Z=0
7280
7281==d1_val d1 d12
bf62b306 7282~~~~~
72b7576f 7283
ae3eaf7b 7284@subsubsection occt_draw_7_9_4 xdistef, xdistcs, xdistcc, xdistc2dc2dss, xdistcc2ds
7285
7286Syntax:
7287~~~~~
7288xdistef edge face
7289xdistcs curve surface firstParam lastParam [NumberOfSamplePoints]
7290xdistcc curve1 curve2 startParam finishParam [NumberOfSamplePoints]
7291xdistcc2ds c curve2d surf startParam finishParam [NumberOfSamplePoints]
7292xdistc2dc2dss curve2d_1 curve2d_2 surface_1 surface_2 startParam finishParam [NumberOfSamplePoints]
7293~~~~~
7294
7295It is assumed that curves have the same parametrization range and *startParam* is less than *finishParam*.
7296
7297Commands with prefix *xdist* allow checking the distance between two objects on even grid:
3f812249 7298 * **xdistef** -- distance between edge and face;
7299 * **xdistcs** -- distance between curve and surface. This means that the projection of each sample point to the surface is computed;
7300 * **xdistcc** -- distance between two 3D curves;
7301 * **xdistcc2ds** -- distance between 3d curve and 2d curve on surface;
7302 * **xdistc2dc2dss** -- distance between two 2d curves on surface.
ae3eaf7b 7303
7304**Examples**
7305~~~~~
7306bopcurves b1 b2 -2d
7307mksurf s1 b1
7308mksurf s2 b2
7309xdistcs c_1 s1 0 1 100
7310xdistcc2ds c_1 c2d2_1 s2 0 1
7311xdistc2dc2dss c2d1_1 c2d2_1 s1 s2 0 1 1000
7312~~~~~
7313
7314
bf62b306 7315@subsection occt_draw_7_10 Surface creation
72b7576f 7316
7317Surface creation commands include surfaces created from boundaries and from spaces between shapes.
bf62b306 7318 * **gplate** creates a surface from a boundary definition.
7319 * **filling** creates a surface from a group of surfaces.
72b7576f 7320
bf62b306 7321@subsubsection occt_draw_7_10_1 gplate,
72b7576f 7322
bf62b306 7323Syntax:
7324~~~~~
7325gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]...[point] [u v tang (1:G1;2:G2) surf] ...
7326~~~~~
72b7576f 7327
bf62b306 7328Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces.
72b7576f 7329
e5bd0d98 7330**Example:**
bf62b306 7331~~~~~
72b7576f 7332plane p
7333trim p p -1 3 -1 3
7334mkface p p
7335
7336beziercurve c1 3 0 0 0 1 0 1 2 0 0
7337mkedge e1 c1
7338tcopy e1 e2
7339tcopy e1 e3
7340
7341ttranslate e2 0 2 0
7342trotate e3 0 0 0 0 0 1 90
7343tcopy e3 e4
7344ttranslate e4 2 0 0
7345# create the surface
7346gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0
7347==
7348======== Results ===========
7349DistMax=8.50014503228635e-16
7350* GEOMPLATE END*
7351Calculation time: 0.33
7352Loop number: 1
7353Approximation results
7354Approximation error : 2.06274907619957e-13
7355Criterium error : 4.97600631215754e-14
7356
7357#to create a surface defined by edges and passing through a point
7358# to define the border edges and the point
7359plane p
7360trim p p -1 3 -1 3
7361mkface p p
7362
7363beziercurve c1 3 0 0 0 1 0 1 2 0 0
7364mkedge e1 c1
7365tcopy e1 e2
7366tcopy e1 e3
7367
7368ttranslate e2 0 2 0
7369trotate e3 0 0 0 0 0 1 90
7370tcopy e3 e4
7371ttranslate e4 2 0 0
7372# to create a point
7373point pp 1 1 0
7374# to create the surface
7375gplate r2 4 1 p e1 0 e2 0 e3 0 e4 0 pp
7376==
7377======== Results ===========
7378DistMax=3.65622157610934e-06
7379* GEOMPLATE END*
7380Calculculation time: 0.27
7381Loop number: 1
7382Approximation results
7383Approximation error : 0.000422195884750181
7384Criterium error : 3.43709808053967e-05
bf62b306 7385~~~~~
72b7576f 7386
bf62b306 7387@subsubsection occt_draw_7_10_2 filling, fillingparam
72b7576f 7388
bf62b306 7389Syntax:
7390~~~~~
7391filling result nbB nbC nbP [SurfInit] [edge][face]order...
72b7576f 7392edge[face]order... point/u v face order...
bf62b306 7393~~~~~
72b7576f 7394
bf62b306 7395Creates 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 7396
7397To define the surface border:
7398
7399 * enter the number of edges, constraints, and points
7400 * enumerate the edges, constraints and points
7401
7402The surface can pass through other points. These are defined after the border definition.
7403
bf62b306 7404You can use the *fillingparam* command to access the filling parameters.
72b7576f 7405
7406The options are:
7407
bf62b306 7408 * <i>-l</i> : to list current values
7409 * <i>-i</i> : to set default values
7410 * <i>-rdeg nbPonC nbIt anis </i> : to set filling options
7411 * <i>-c t2d t3d tang tcur </i> : to set tolerances
7412 * <i>-a maxdeg maxseg </i> : Approximation option
72b7576f 7413
e5bd0d98 7414**Example:**
bf62b306 7415~~~~~
72b7576f 7416# to create four curved survaces and a point
7417plane p
7418trim p p -1 3 -1 3
7419mkface p p
7420
7421beziercurve c1 3 0 0 0 1 0 1 2 0 0
7422mkedge e1 c1
7423tcopy e1 e2
7424tcopy e1 e3
7425
7426ttranslate e2 0 2 0
7427trotate e3 0 0 0 0 0 1 90
7428tcopy e3 e4
7429ttranslate e4 2 0 0
7430
7431point pp 1 1 0
7432
7433prism f1 e1 0 -1 0
7434prism f2 e2 0 1 0
7435prism f3 e3 -1 0 0
7436prism f4 e4 1 0 0
7437
7438# to create a tangential surface
7439filling r1 4 0 0 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1
7440# to create a tangential surface passing through point pp
7441filling r2 4 0 1 p e1 f1 1 e2 f2 1 e3 f3 1 e4 f4 1 pp#
7442# to visualise the surface in detail
7443isos r2 40
7444# to display the current filling parameters
7445fillingparam -l
7446==
7447Degree = 3
7448NbPtsOnCur = 10
7449NbIter = 3
7450Anisotropie = 0
7451Tol2d = 1e-05
7452Tol3d = 0.0001
7453TolAng = 0.01
7454TolCurv = 0.1
7455
7456MaxDeg = 8
7457MaxSegments = 9
bf62b306 7458~~~~~
72b7576f 7459
7460
bf62b306 7461@subsection occt_draw_7_11 Complex Topology
72b7576f 7462
7463Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling.
7464
7465
bf62b306 7466@subsubsection occt_draw_7_11_1 offsetshape, offsetcompshape
72b7576f 7467
bf62b306 7468Syntax:
7469~~~~~
7470offsetshape r shape offset [tol] [face ...]
72b7576f 7471offsetcompshape r shape offset [face ...]
bf62b306 7472~~~~~
72b7576f 7473
bf62b306 7474**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 7475
bf62b306 7476The 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 7477
bf62b306 7478In 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 7479
7480The opening between the object interior and exterior is defined by the argument face or faces.
72b7576f 7481
e5bd0d98 7482**Example:**
bf62b306 7483~~~~~
72b7576f 7484box b1 10 20 30
7485explode b1 f
7486== b1_1 b1_2 b1_3 b1_4 b1_5 b1_6
bf62b306 7487offsetcompshape r b1 -1 b1_3
7488~~~~~
72b7576f 7489
bf62b306 7490@subsubsection occt_draw_7_11_2 featprism, featdprism, featrevol, featlf, featrf
72b7576f 7491
bf62b306 7492Syntax:
7493~~~~~
7494featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)
72b7576f 7495featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)
7496featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)
7497featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)
7498featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)
7499featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]
7500featperformval prism/revol/dprism/lf result value
bf62b306 7501~~~~~
72b7576f 7502
bf62b306 7503**featprism** loads the arguments for a prism with contiguous sides normal to the face.
72b7576f 7504
bf62b306 7505**featdprism** loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle.
72b7576f 7506
bf62b306 7507**featrevol** loads the arguments for a prism with a circular evolution.
72b7576f 7508
bf62b306 7509**featlf** loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline.
72b7576f 7510
bf62b306 7511**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 7512
bf62b306 7513**featperform** loads the arguments to create the feature.
72b7576f 7514
bf62b306 7515**featperformval** uses the defined arguments to create a feature with a limiting value.
72b7576f 7516
7517All 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 7518
bf62b306 7519**Examples:**
7520
7521Let us create a feature prism with a draft angle and a normal direction :
7522
7523~~~~~
72b7576f 7524# create a box with a wire contour on the upper face
7525box b 1 1 1
7526profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7527explode b f
7528# loads the feature arguments defining the draft angle
7529featdprism b f b_6 5 1 0
7530# create the feature
7531featperformval dprism r 1
7532==BRepFeat_MakeDPrism::Perform(Height)
7533BRepFeat_Form::GlobalPerform ()
ba06f8bb 7534 Gluer
7535 still Gluer
7536 Gluer result
bf62b306 7537~~~~~
72b7576f 7538
bf62b306 7539Let us create a feature prism with circular direction :
7540
7541~~~~~
72b7576f 7542# create a box with a wire contour on the upper face
7543box b 1 1 1
7544profil f O 0 0 1 F 0.25 0.25 x 0.5 y 0.5 x -0.5
7545explode b f
7546# loads the feature arguments defining a rotation axis
7547featrevol b f b_6 1 0 1 0 1 0 1 0
7548featperformval revol r 45
7549==BRepFeat_MakeRevol::Perform(Angle)
7550BRepFeat_Form::GlobalPerform ()
ba06f8bb 7551 Gluer
7552 still Gluer
7553 Gluer result
bf62b306 7554~~~~~
7555
72b7576f 7556
bf62b306 7557Let us create a slot using the linear feature :
7558
7559~~~~~
72b7576f 7560#create the base model using the multi viewer
7561mu4
7562profile 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
7563prism pr p 0 0 1
7564# create the contour for the linear feature
7565vertex v1 -0.2 4 0.3
7566vertex v2 0.2 4 0.3
7567vertex v3 0.2 0.2 0.3
7568vertex v4 4 0.2 0.3
7569vertex v5 4 -0.2 0.3
7570edge e1 v1 v2
7571edge e2 v2 v3
7572edge e3 v3 v4
7573edge e4 v4 v5
7574wire w e1 e2 e3 e4
7575# define a plane
7576plane pl 0.2 0.2 0.3 0 0 1
7577# loads the linear feature arguments
7578featlf pr w pl 0 0 0.3 0 0 0 0 1
7579featperform lf result
bf62b306 7580~~~~~
7581
7582Let us create a rib using the revolution feature :
72b7576f 7583
bf62b306 7584~~~~~
72b7576f 7585#create the base model using the multi viewer
7586mu4
7587pcylinder c1 3 5
7588# create the contour for the revolution feature
7589profile w c 1 190 WW
7590trotate w 0 0 0 1 0 0 90
7591ttranslate w -3 0 1
7592trotate w -3 0 1.5 0 0 1 180
7593plane pl -3 0 1.5 0 1 0
7594# loads the revolution feature arguments
7595featrf c1 w pl 0 0 0 0 0 1 0.3 0.3 1 1
7596featperform rf result
bf62b306 7597~~~~~
72b7576f 7598
bf62b306 7599@subsubsection occt_draw_7_11_3 draft
72b7576f 7600
bf62b306 7601Syntax:
7602~~~~~
7603draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal]
7604~~~~~
72b7576f 7605
bf62b306 7606Computes 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 7607
7608 * The draft angle is measured in radians.
7609 * The draft direction is determined by the argument -INTERNAL
bf62b306 7610 * The argument Ri/Ro deftermines wether the corner edges of the draft surfaces are angular or rounded.
72b7576f 7611 * Arguments that can be used to define the surface distance are:
ba06f8bb 7612 * length, a defined distance
7613 * shape, until the surface contacts a shape
7614 * surface, until the surface contacts a surface.
72b7576f 7615
bf62b306 7616**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 7617
e5bd0d98 7618**Example:**
bf62b306 7619~~~~~
72b7576f 7620# to create a simple profile
7621profile p F 0 0 x 2 y 4 tt 0 4 w
7622# creates a draft with rounded angles
7623draft res p 0 0 1 3 1 -Ro
7624# to create a profile with an internal angle
7625profile p F 0 0 x 2 y 4 tt 1 1.5 tt 0 4 w
7626# creates a draft with rounded external angles
7627draft res p 0 0 1 3 1 -Ro
bf62b306 7628~~~~~
72b7576f 7629
bf62b306 7630@subsubsection occt_draw_7_11_4 deform
72b7576f 7631
bf62b306 7632Syntax:
7633~~~~~
7634deform newname name CoeffX CoeffY CoeffZ
7635~~~~~
72b7576f 7636
bf62b306 7637Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions.
7638
e5bd0d98 7639**Example:**
bf62b306 7640~~~~~
72b7576f 7641pcylinder c 20 20
7642deform a c 1 3 5
7643# the conversion to bspline is followed by the
7644deformation
bf62b306 7645~~~~~
7646
72b7576f 7647
bf62b306 7648@subsubsection occt_draw_7_11_5 nurbsconvert
72b7576f 7649
bf62b306 7650Syntax:
7651
7652~~~~~
7653nurbsconvert result name [result name]
7654~~~~~
72b7576f 7655
bf62b306 7656Changes 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.
7657
7658
e6ae74fd 7659@subsubsection occt_draw_7_11_6 edgestofaces
7660
7661**edgestofaces** - The command allows building planar faces from the planar edges randomly located in 3D space.
7662
7663It has the following syntax:
7664~~~~
7665edgestofaces r_faces edges [-a AngTol -s Shared(0/1)]
7666~~~~
7667Options:
7668 * -a AngTol - angular tolerance used for distinguishing the planar faces;
7669 * -s Shared(0/1) - boolean flag which defines whether the input edges are already shared or have to be intersected.
7670
7671
bf62b306 7672@subsection occt_draw_7_12 Texture Mapping to a Shape
72b7576f 7673
7674Texture 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.
7675
bf62b306 7676@subsubsection occt_draw_7_12_1 vtexture
72b7576f 7677
bf62b306 7678Syntax:
7679~~~~~
7680vtexture NameOfShape TextureFile
72b7576f 7681vtexture NameOfShape
7682vtexture NameOfShape ?
7683vtexture NameOfShape IdOfTexture
bf62b306 7684~~~~~
72b7576f 7685
bf62b306 7686**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 7687
bf62b306 7688@subsubsection occt_draw_7_12_2 vtexscale
72b7576f 7689
bf62b306 7690Syntax:
7691~~~~~
7692vtexscale NameOfShape ScaleU ScaleV
72b7576f 7693vtexscale NameOfShape ScaleUV
7694vtexscale NameOfShape
bf62b306 7695~~~~~
72b7576f 7696
bf62b306 7697*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 7698
bf62b306 7699The syntax without *ScaleU*, *ScaleV* or *ScaleUV* disables texture scaling.
72b7576f 7700
bf62b306 7701@subsubsection occt_draw_7_12_3 vtexorigin
7702
7703Syntax:
7704~~~~~
7705vtexorigin NameOfShape UOrigin VOrigin
72b7576f 7706vtexorigin NameOfShape UVOrigin
7707vtexorigin NameOfShape
bf62b306 7708~~~~~
7709
7710*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 7711
bf62b306 7712The syntax without *UOrigin*, *VOrigin* or *UVOrigin* disables origin positioning.
72b7576f 7713
bf62b306 7714@subsubsection occt_draw_7_12_4 vtexrepeat
72b7576f 7715
bf62b306 7716Syntax:
7717~~~~~
7718vtexrepeat NameOfShape URepeat VRepeat
72b7576f 7719vtexrepeat NameOfShape UVRepeat
7720vtexrepeat NameOfShape
bf62b306 7721~~~~~
72b7576f 7722
bf62b306 7723*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 7724
bf62b306 7725The same syntax without *URepeat*, *VRepeat* or *UVRepeat* disables texture repetition.
72b7576f 7726
bf62b306 7727@subsubsection occt_draw_7_12_5 vtexdefault
7728
7729Syntax:
7730~~~~~
7731vtexdefault NameOfShape
7732~~~~~
72b7576f 7733
bf62b306 7734*Vtexdefault* sets or resets the texture mapping default parameters.
72b7576f 7735
7736The defaults are:
7737
bf62b306 7738 * *URepeat = VRepeat = 1* no repetition
7739 * *UOrigin = VOrigin = 1* origin set at (0,0)
7740 * *UScale = VScale = 1* texture covers 100% of the face
1a457208 7741
7742
7743@section occt_draw_20 General Fuse Algorithm commands
7744
7745This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for debugging of General Fuse Algorithm (GFA). It is also applicable for Boolean Operations Algorithm (BOA) and Partition Algorithm (PA) because these algorithms are subclasses of GFA.
7746
7747See @ref occt_user_guides__boolean_operations "Boolean operations" user's guide for the description of these algorithms.
7748
7749@subsection occt_draw_20_1 Definitions
7750
7751The following terms and definitions are used in this document:
3f812249 7752* **Objects** -- list of shapes that are arguments of the algorithm.
7753* **Tools** -- list of shapes that are arguments of the algorithm. Difference between Objects and Tools is defined by specific requirements of the operations (Boolean Operations, Partition Operation).
7754* **DS** -- internal data structure used by the algorithm (*BOPDS_DS* object).
7755* **PaveFiller** -- intersection part of the algorithm (*BOPAlgo_PaveFiller* object).
7756* **Builder** -- builder part of the algorithm (*BOPAlgo_Builder* object).
7757* **IDS Index** -- the index of the vector *myLines*.
1a457208 7758
7759@subsection occt_draw_20_2 General commands
7760
3f812249 7761* **bclearobjects** -- clears the list of Objects;
7762* **bcleartools** -- clears the list of Tools;
7763* **baddobjects** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Objects;
7764* **baddtools** *S1 S2...Sn* -- adds shapes *S1, S2, ... Sn* as Tools;
7765* **bfillds** -- performs the Intersection Part of the Algorithm;
c58055ad 7766* **bbuild** *r* -- performs the Building Part of the Algorithm (General Fuse operation); *r* is the resulting shape;
7767* **bsplit** *r* -- performs the Partition operation; *r* is the resulting shape;
7768* **bbop** *r* *iOp* -- performs the Boolean operation; *r* is the resulting shape; *iOp* - type of the operation (0 - COMMON; 1 - FUSE; 2 - CUT; 3 - CUT21; 4 - SECTION).
1a457208 7769
7770@subsection occt_draw_20_3 Commands for Intersection Part
7771
7772All commands listed below are available when the Intersection Part of the algorithm is done (i.e. after the command *bfillds*).
7773
7774@subsubsection occt_draw_20_3_1 bopds
7775
7776Syntax:
7777~~~~
3f812249 7778bopds -v [e, f]
1a457208 7779~~~~
7780
7781Displays:
7782* all BRep shapes of arguments that are in the DS [default];
3f812249 7783* <i>-v</i> : only vertices of arguments that are in the DS;
7784* <i>-e</i> : only edges of arguments that are in the DS;
7785* <i>-f</i> : only faces of arguments that are in the DS.
1a457208 7786
7787@subsubsection occt_draw_20_3_2 bopdsdump
7788
7789Prints contents of the DS.
7790
7791Example:
7792
7793~~~~
7794 Draw[28]> bopdsdump
7795 *** DS ***
7796 Ranges:2 number of ranges
7797 range: 0 33 indices for range 1
7798 range: 34 67 indices for range 2
7799 Shapes:68 total number of source shapes
7800 0 : SOLID { 1 }
7801 1 : SHELL { 2 12 22 26 30 32 }
7802 2 : FACE { 4 5 6 7 8 9 10 11 }
7803 3 : WIRE { 4 7 9 11 }
7804 4 : EDGE { 5 6 }
7805 5 : VERTEX { }
7806 6 : VERTEX { }
7807 7 : EDGE { 8 5 }
7808 8 : VERTEX { }
7809~~~~
7810
7811@code 0 : SOLID { 1 } @endcode has the following meaning:
3f812249 7812* *0* -- index in the DS;
7813* *SOLID* -- type of the shape;
7814* <i>{ 1 }</i> -- a DS index of the successors.
1a457208 7815
7816@subsubsection occt_draw_20_3_3 bopindex
7817
7818Syntax:
7819~~~~
7820bopindex S
7821~~~~
7822Prints DS index of shape *S*.
7823
7824@subsubsection occt_draw_20_3_4 bopiterator
7825
7826Syntax:
7827~~~~~
7828bopiterator [t1 t2]
7829~~~~~
7830
7831Prints pairs of DS indices of source shapes that are intersected in terms of bounding boxes.
7832
7833<i>[t1 t2]</i> are types of the shapes:
3f812249 7834* *7* -- vertex;
7835* *6* -- edge;
7836* *4* -- face.
1a457208 7837
7838Example:
7839~~~~
7840 Draw[104]> bopiterator 6 4
7841 EF: ( z58 z12 )
7842 EF: ( z17 z56 )
7843 EF: ( z19 z64 )
7844 EF: ( z45 z26 )
7845 EF: ( z29 z36 )
7846 EF: ( z38 z32 )
7847~~~~
7848
7849* *bopiterator 6 4* prints pairs of indices for types: edge/face;
3f812249 7850* *z58 z12* -- DS indices of intersecting edge and face.
1a457208 7851
7852
7853@subsubsection occt_draw_20_3_5 bopinterf
7854
7855Syntax:
7856~~~~
7857bopinterf t
7858~~~~
7859
7860Prints contents of *myInterfTB* for the type of interference *t*:
7861* *t=0* : vertex/vertex;
7862* *t=1* : vertex/edge;
7863* *t=2* : edge/edge;
7864* *t=3* : vertex/face;
7865* *t=4* : edge/face.
7866
7867Example:
7868~~~~
7869 Draw[108]> bopinterf 4
7870 EF: (58, 12, 68), (17, 56, 69), (19, 64, 70), (45, 26, 71), (29, 36, 72), (38, 32, 73), 6 EF found.
7871~~~~
7872
7873Here, record <i>(58, 12, 68)</i> means:
3f812249 7874* *58* -- a DS index of the edge;
7875* *12* -- a DS index of the face;
7876* *68* -- a DS index of the new vertex.
1a457208 7877
7878@subsubsection occt_draw_20_3_6 bopsp
7879
7880Displays split edges.
7881
7882Example:
7883~~~~
7884 Draw[33]> bopsp
7885 edge 58 : z58_74 z58_75
7886 edge 17 : z17_76 z17_77
7887 edge 19 : z19_78 z19_79
7888 edge 45 : z45_80 z45_81
7889 edge 29 : z29_82 z29_83
7890 edge 38 : z38_84 z38_85
7891~~~~
7892
3f812249 7893* *edge 58* -- 58 is a DS index of the original edge.
7894* *z58_74 z58_75* -- split edges, where 74, 75 are DS indices of the split edges.
1a457208 7895
7896@subsubsection occt_draw_20_3_7 bopcb
72b7576f 7897
1a457208 7898Syntax:
7899~~~~
7900bopcb [nE]
7901~~~~
7902
7903Prints Common Blocks for:
7904* all source edges (by default);
7905* the source edge with the specified index *nE*.
7906
7907Example:
7908~~~~
7909 Draw[43]> bopcb 17
7910 -- CB:
7911 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
7912 Faces: 36
7913~~~~
7914
7915This command dumps common blocks for the source edge with index 17.
3f812249 7916* *PB* -- information about the Pave Block;
7917 * *71* -- a DS index of the split edge
7918 * *17* -- a DS index of the original edge
7919* <i>Pave1 : { 68 3.000 }</i> -- information about the Pave:
7920 * *68* -- a DS index of the vertex of the pave
7921 * *3.000* -- a parameter of vertex 68 on edge 17
7922* *Faces: 36* -- 36 is a DS index of the face the common block belongs to.
1a457208 7923
7924
7925@subsubsection occt_draw_20_3_8 bopfin
7926
7927Syntax:
7928
7929~~~~
7930bopfin nF
7931~~~~
7932Prints Face Info about IN-parts for the face with DS index *nF*.
7933
7934Example:
7935~~~~
7936 Draw[47]> bopfin 36
7937 pave blocks In:
7938 PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }
7939 PB:{ E:75 orE:19 Pave1: { 69 3.000 } Pave2: { 18 10.000 } }
7940 vrts In:
7941 18
7942~~~~
7943
7944
3f812249 7945* <i>PB:{ E:71 orE:17 Pave1: { 68 3.000 } Pave2: { 18 10.000 } }</i> -- information about the Pave Block;
7946* <i>vrts In ... 18 </i> -- a DS index of the vertex IN the face.
1a457208 7947
7948@subsubsection occt_draw_20_3_9 bopfon
7949
7950Syntax:
7951~~~~
7952bopfon nF
7953~~~~
7954Print Face Info about ON-parts for the face with DS index *nF*.
7955
7956Example:
7957~~~~
7958 Draw[58]> bopfon 36
7959 pave blocks On:
7960 PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }
7961 PB:{ E:76 orE:45 Pave1: { 69 0.000 } Pave2: { 71 10.000 } }
7962 PB:{ E:78 orE:43 Pave1: { 71 0.000 } Pave2: { 70 10.000 } }
7963 PB:{ E:74 orE:41 Pave1: { 68 0.000 } Pave2: { 70 10.000 } }
7964 vrts On:
7965 68 69 70 71
7966~~~~
7967
3f812249 7968* <i>PB:{ E:72 orE:38 Pave1: { 69 0.000 } Pave2: { 68 10.000 } }</i> -- information about the Pave Block;
7969* <i>vrts On: ... 68 69 70 71</i> -- DS indices of the vertices ON the face.
1a457208 7970
7971@subsubsection occt_draw_20_3_10 bopwho
7972
7973Syntax:
7974~~~~
7975bopwho nS
7976~~~~
7977
7978Prints the information about the shape with DS index *nF*.
7979
7980Example:
7981~~~~
7982 Draw[116]> bopwho 5
7983 rank: 0
7984~~~~
7985
3f812249 7986* *rank: 0* -- means that shape 5 results from the Argument with index 0.
1a457208 7987
7988Example:
7989~~~~
7990 Draw[118]> bopwho 68
7991 the shape is new
7992 EF: (58, 12),
7993 FF curves: (12, 56),
7994 FF curves: (12, 64),
7995~~~~
7996
7997This means that shape 68 is a result of the following interferences:
3f812249 7998* *EF: (58, 12)* -- edge 58 / face 12
7999* *FF curves: (12, 56)* -- edge from the intersection curve between faces 12 and 56
8000* *FF curves: (12, 64)* -- edge from the intersection curve between faces 12 and 64
1a457208 8001
8002@subsubsection occt_draw_20_3_11 bopnews
8003
8004Syntax:
8005~~~~
8006bopnews -v [-e]
8007~~~~
8008
3f812249 8009* <i>-v</i> -- displays all new vertices produced during the operation;
8010* <i>-e</i> -- displays all new edges produced during the operation.
1a457208 8011
8012@subsection occt_draw_20_4 Commands for the Building Part
8013
8014The commands listed below are available when the Building Part of the algorithm is done (i.e. after the command *bbuild*).
8015
8016@subsubsection occt_draw_20_4_1 bopim
8017
8018Syntax:
8019
8020~~~~
8021bopim S
8022~~~~
8023Shows the compound of shapes that are images of shape *S* from the argument.
8024
8025
bf62b306 8026@section occt_draw_8 Data Exchange commands
72b7576f 8027
1a457208 8028This chapter presents some general information about Data Exchange (DE) operations.
72b7576f 8029
8030DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.)
8031
bf62b306 8032This 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
8033* for <a href="user_guides__step.html#occt_step_1">STEP format</a> and
8034* for <a href="user_guides__iges.html#occt_iges_1">IGES format</a>.
72b7576f 8035
bf62b306 8036Each Draw session has an interface model, which is a structure for keeping various information.
72b7576f 8037
bf62b306 8038The first step of translation is loading information from a file into a model.
8039The second step is creation of an OpenCASCADE shape from this model.
72b7576f 8040
bf62b306 8041Each 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 8042
bf62b306 8043The model and the map are used for working with most of DE commands.
72b7576f 8044
bf62b306 8045@subsection occt_draw_8_1 IGES commands
72b7576f 8046
bf62b306 8047@subsubsection occt_draw_8_1_1 igesread
8048
8049Syntax:
8050~~~~~
8051igesread <file_name> <result_shape_name> [<selection>]
8052~~~~~
8053
8054Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted.
72b7576f 8055
bf62b306 8056
ba06f8bb 8057| N | Mode | Description |
bf62b306 8058| :-- | :-- | :---------- |
ba06f8bb 8059| 0 | End | finish conversion and exit igesbrep |
8060| 1 | Visible roots | convert only visible roots |
8061| 2 | All roots | convert all roots |
8062| 3 | One entity | convert entity with number provided by the user |
8063| 4 | Selection | convert only entities contained in selection |
72b7576f 8064
8065
8066After 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 8067
bf62b306 8068The 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*.
8069
ba06f8bb 8070<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 8071
8072See also the detailed description of <a href="user_guides__iges.html#occt_iges_2_3_4">Selecting IGES entities</a>.
8073
8074**Example:**
8075~~~~~
72b7576f 8076# translation all roots from file
8077igesread /disk01/files/model.igs a *
bf62b306 8078~~~~~
72b7576f 8079
bf62b306 8080@subsubsection occt_draw_8_1_2 tplosttrim
72b7576f 8081
bf62b306 8082Syntax:
8083~~~~~
8084tplosttrim [<IGES_type>]
8085~~~~~
72b7576f 8086
8087Sometimes 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.
8088It 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 8089Optional parameter <i>\<IGES_type\></i> can be *0TrimmedSurface, BoundedSurface* or *Face* to specify the only type of IGES faces.
72b7576f 8090
bf62b306 8091**Example:**
8092~~~~~
72b7576f 8093tplosttrim TrimmedSurface
bf62b306 8094~~~~~
72b7576f 8095
bf62b306 8096@subsubsection occt_draw_8_1_3 brepiges
72b7576f 8097
bf62b306 8098Syntax:
8099~~~~~
8100brepiges <shape_name> <filename.igs>
8101~~~~~
72b7576f 8102
8103Writes an OCCT shape to an IGES file.
bf62b306 8104
e5bd0d98 8105**Example:**
bf62b306 8106~~~~~
72b7576f 8107# write shape with name aa to IGES file
8108brepiges aa /disk1/tmp/aaa.igs
8109== unit (write) : MM
dba69de2 8110== mode write : Faces
8111== To modifiy : command param
72b7576f 8112== 1 Shapes written, giving 345 Entities
dba69de2 8113== Now, to write a file, command : writeall filename
8114== Output on file : /disk1/tmp/aaa.igs
8115== Write OK
bf62b306 8116~~~~~
72b7576f 8117
bf62b306 8118@subsection occt_draw_8_2 STEP commands
72b7576f 8119
8120These commands are used during the translation of STEP models.
8121
8122
bf62b306 8123@subsubsection occt_draw_8_2_1 stepread
72b7576f 8124
bf62b306 8125Syntax:
8126~~~~~
8127stepread file_name result_shape_name [selection]
8128~~~~~
72b7576f 8129
8130Read a STEP file to an OCCT shape.
8131This command will interactively ask the user to select a set of entities to be converted:
8132
bf62b306 8133| N | Mode | Description |
8134| :---- | :---- | :---- |
ba06f8bb 8135| 0 | End | Finish transfer and exit stepread |
8136| 1 | root with rank 1 | Transfer first root |
8137| 2 | root by its rank | Transfer root specified by its rank |
8138| 3 | One entity | Transfer entity with a number provided by the user |
8139| 4 | Selection | Transfer only entities contained in selection |
72b7576f 8140
8141After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes.
bf62b306 8142The 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 8143<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 8144
bf62b306 8145See also the detailed description of <a href="user_guides__step.html#occt_step_2_3_6">Selecting STEP entities</a>.
8146
8147**Example:**
8148~~~~~
72b7576f 8149# translation all roots from file
8150stepread /disk01/files/model.stp a *
bf62b306 8151~~~~~
8152
8153@subsubsection occt_draw_8_2_2 stepwrite
8154
8155Syntax:
8156~~~~~
8157stepwrite mode shape_name file_name
8158~~~~~
72b7576f 8159
bf62b306 8160Writes an OCCT shape to a STEP file.
72b7576f 8161
bf62b306 8162The following modes are available :
3f812249 8163 * *a* -- as is -- the mode is selected automatically depending on the type & geometry of the shape;
8164 * *m* -- *manifold_solid_brep* or *brep_with_voids*
8165 * *f* -- *faceted_brep*
8166 * *w* -- *geometric_curve_set*
8167 * *s* -- *shell_based_surface_model*
ba06f8bb 8168
bf62b306 8169For further information see <a href="#user_guides__step.html#occt_step_6_5">Writing a STEP file</a>.
72b7576f 8170
e5bd0d98 8171**Example:**
72b7576f 8172
bf62b306 8173Let us write shape *a* to a STEP file in mode *0*.
8174
8175~~~~~
72b7576f 8176stepwrite 0 a /disk1/tmp/aaa.igs
bf62b306 8177~~~~~
72b7576f 8178
8179
bf62b306 8180@subsection occt_draw_8_3 General commands
72b7576f 8181
bf62b306 8182These are auxilary commands used for the analysis of result of translation of IGES and STEP files.
72b7576f 8183
bf62b306 8184@subsubsection occt_draw_8_3_1 count
72b7576f 8185
bf62b306 8186Syntax:
8187~~~~~
8188count <counter> [<selection>]
8189~~~~~
72b7576f 8190
bf62b306 8191Calculates statistics on the entities in the model and outputs a count of entities.
72b7576f 8192
bf62b306 8193The 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 8194
ba06f8bb 8195| Counter | Operation |
bf62b306 8196| :-------- | :-------- |
ba06f8bb 8197| xst-types | Calculates how many entities of each OCCT type exist |
8198| step214-types | Calculates how many entities of each STEP type exist |
72b7576f 8199
bf62b306 8200**Example:**
8201~~~~~
72b7576f 8202count xst-types
bf62b306 8203~~~~~
8204
8205@subsubsection occt_draw_8_3_2 data
72b7576f 8206
bf62b306 8207Syntax:
8208~~~~~
8209data <symbol>
8210~~~~~
72b7576f 8211
bf62b306 8212Obtains general statistics on the loaded data.
8213The information printed by this command depends on the symbol specified.
72b7576f 8214
e5bd0d98 8215**Example:**
bf62b306 8216~~~~~
72b7576f 8217# print full information about warnings and fails
8218data c
bf62b306 8219~~~~~
8220
ba06f8bb 8221| Symbol | Output |
bf62b306 8222| :------ | :------ |
ba06f8bb 8223| g | Prints the information contained in the header of the file |
8224| 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) |
8225| t | The same as c or f, with a list of failed or warned entities |
bf62b306 8226| m or l | The same as t but also prints a status for each entity |
8227| e | Lists all entities of the model with their numbers, types, validity status etc. |
ba06f8bb 8228| R | The same as e but lists only root entities |
bf62b306 8229
72b7576f 8230
72b7576f 8231
bf62b306 8232@subsubsection occt_draw_8_3_3 elabel
8233
8234Syntax:
8235~~~~~
8236elabel <num>
8237~~~~~
72b7576f 8238
8239Entities 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 8240
bf62b306 8241**Example:**
8242~~~~~
72b7576f 8243elabel 84
bf62b306 8244~~~~~
72b7576f 8245
bf62b306 8246@subsubsection occt_draw_8_3_4 entity
72b7576f 8247
bf62b306 8248Syntax:
8249~~~~~
8250entity <#(D)>_or_<num> <level_of_information>
8251~~~~~
72b7576f 8252
8253The content of an IGES or STEP entity can be obtained by using this command.
8254Entity can be determined by its number or label.
ba06f8bb 8255<i>\<level_of_information\></i> has range [0-6]. You can get more information about this level using this command without parameters.
72b7576f 8256
bf62b306 8257**Example:**
8258~~~~~
72b7576f 8259# full information for STEP entity with label 84
8260entity #84 6
bf62b306 8261~~~~~
72b7576f 8262
bf62b306 8263@subsubsection occt_draw_8_3_5 enum
72b7576f 8264
bf62b306 8265Syntax:
8266~~~~~
8267enum <#(D)>
8268~~~~~
72b7576f 8269
8270Prints a number for the entity with a given label.
72b7576f 8271
bf62b306 8272**Example:**
8273~~~~~
72b7576f 8274# give a number for IGES entity with label 21
8275enum D21
bf62b306 8276~~~~~
72b7576f 8277
bf62b306 8278@subsubsection occt_draw_8_3_6 estatus
72b7576f 8279
bf62b306 8280Syntax:
8281~~~~~
8282estatus <#(D)>_or_<num>
8283~~~~~
72b7576f 8284
8285The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command.
72b7576f 8286
bf62b306 8287**Example:**
8288~~~~~
72b7576f 8289estatus #315
bf62b306 8290~~~~~
8291
8292@subsubsection occt_draw_8_3_7 fromshape
72b7576f 8293
bf62b306 8294Syntax:
8295~~~~~
8296fromshape <shape_name>
8297~~~~~
72b7576f 8298
bf62b306 8299Gives 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 8300
e5bd0d98 8301**Example:**
bf62b306 8302~~~~~
72b7576f 8303fromshape a_1_23
bf62b306 8304~~~~~
72b7576f 8305
bf62b306 8306@subsubsection occt_draw_8_3_8 givecount
72b7576f 8307
ba06f8bb 8308Syntax:
bf62b306 8309~~~~~
8310givecount <selection_name> [<selection_name>]
8311~~~~~
72b7576f 8312
72b7576f 8313
bf62b306 8314Prints a number of loaded entities defined by the selection argument.
ba06f8bb 8315Possible values of \<selection_name\> you can find in the “IGES FORMAT Users’s Guide”.
bf62b306 8316
8317**Example:**
8318~~~~~
72b7576f 8319givecount xst-model-roots
bf62b306 8320~~~~~
72b7576f 8321
bf62b306 8322@subsubsection occt_draw_8_3_9 givelist
72b7576f 8323
bf62b306 8324Syntax:
8325~~~~~
8326givelist <selection_name>
8327~~~~~
72b7576f 8328
8329Prints a list of a subset of loaded entities defined by the selection argument:
ba06f8bb 8330| Selection | Description |
8331| :-------- | :----------- |
8332| xst-model-all | all entities of the model |
8333| xst-model-roots | all roots |
8334| xst-pointed | (Interactively) pointed entities (not used in DRAW) |
8335| xst-transferrable-all | all transferable (recognized) entities |
8336| xst-transferrable-roots | Transferable roots |
72b7576f 8337
72b7576f 8338
bf62b306 8339**Example:**
8340~~~~~
72b7576f 8341# give a list of all entities of the model
8342givelist xst-model-all
bf62b306 8343~~~~~
72b7576f 8344
bf62b306 8345@subsubsection occt_draw_8_3_10 listcount
72b7576f 8346
ba06f8bb 8347Syntax: listcount \<counter\> [\<selection\> ...]
72b7576f 8348
8349Prints a list of entities per each type matching the criteria defined by arguments.
ba06f8bb 8350Optional <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 8351
ba06f8bb 8352| Counter | Operation |
8353| :----- | :------ |
8354| xst-types | Calculates how many entities of each OCCT type exist |
8355| iges-types | Calculates how many entities of each IGES type and form exist |
8356| iges-levels | Calculates how many entities lie in different IGES levels |
72b7576f 8357
bf62b306 8358**Example:**
8359~~~~~
72b7576f 8360listcount xst-types
bf62b306 8361~~~~~
72b7576f 8362
bf62b306 8363@subsubsection occt_draw_8_3_11 listitems
72b7576f 8364
bf62b306 8365Syntax:
8366~~~~~
8367listitems
8368~~~~~
72b7576f 8369
8370This command prints a list of objects (counters, selections etc.) defined in the current session.
72b7576f 8371
72b7576f 8372
bf62b306 8373@subsubsection occt_draw_8_3_12 listtypes
72b7576f 8374
bf62b306 8375Syntax:
8376~~~~~
8377listtypes [<selection_name> ...]
8378~~~~~
72b7576f 8379
8380Gives 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 8381
72b7576f 8382
bf62b306 8383@subsubsection occt_draw_8_3_13 newmodel
72b7576f 8384
bf62b306 8385Syntax:
8386~~~~~
8387newmodel
8388~~~~~
72b7576f 8389
8390Clears the current model.
72b7576f 8391
72b7576f 8392
bf62b306 8393@subsubsection occt_draw_8_3_14 param
72b7576f 8394
bf62b306 8395Syntax:
8396~~~~~
8397param [<parameter>] [<value>]
8398~~~~~
72b7576f 8399
8400This command is used to manage translation parameters.
bf62b306 8401Command without arguments gives a full list of parameters with current values.
ba06f8bb 8402Command 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 8403
e5bd0d98 8404**Example:**
72b7576f 8405
bf62b306 8406Let us get the information about possible schemes for writing STEP file :
8407
8408~~~~~
72b7576f 8409param write.step.schema
bf62b306 8410~~~~~
72b7576f 8411
bf62b306 8412@subsubsection occt_draw_8_3_15 sumcount
72b7576f 8413
bf62b306 8414Syntax:
8415~~~~~
8416sumcount <counter> [<selection> ...]
8417~~~~~
72b7576f 8418
8419Prints only a number of entities per each type matching the criteria defined by arguments.
72b7576f 8420
bf62b306 8421**Example:**
8422~~~~~
72b7576f 8423sumcount xst-types
bf62b306 8424~~~~~
72b7576f 8425
bf62b306 8426@subsubsection occt_draw_8_3_16 tpclear
72b7576f 8427
bf62b306 8428Syntax:
8429~~~~~
8430tpclear
8431~~~~~
72b7576f 8432
8433Clears the map of correspondences between IGES or STEP entities and OCCT shapes.
72b7576f 8434
72b7576f 8435
72b7576f 8436
bf62b306 8437@subsubsection occt_draw_8_3_17 tpdraw
72b7576f 8438
bf62b306 8439Syntax:
8440~~~~~
8441tpdraw <#(D)>_or_<num>
8442~~~~~
72b7576f 8443
bf62b306 8444**Example:**
8445~~~~~
72b7576f 8446tpdraw 57
bf62b306 8447~~~~~
72b7576f 8448
bf62b306 8449@subsubsection occt_draw_8_3_18 tpent
8450
8451Syntax:
8452~~~~~
8453tpent <#(D)>_or_<num>
8454~~~~~
72b7576f 8455
bf62b306 8456Get information about the result of translation of the given IGES or STEP entity.
72b7576f 8457
e5bd0d98 8458**Example:**
bf62b306 8459~~~~~
8460tpent \#23
8461~~~~~
8462
8463@subsubsection occt_draw_8_3_19 tpstat
8464
8465Syntax:
8466~~~~~
8467tpstat [*|?]<symbol> [<selection>]
8468~~~~~
72b7576f 8469
72b7576f 8470
ba06f8bb 8471Provides 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 8472
3f812249 8473* *g* -- General statistics (a list of results and messages)
8474* *c* -- Count of all warning and fail messages
8475* *C* -- List of all warning and fail messages
8476* *f* -- Count of all fail messages
8477* *F* -- List of all fail messages
8478* *n* -- List of all transferred roots
8479* *s* -- The same, with types of source entity and the type of result
8480* *b* -- The same, with messages
8481* *t* -- Count of roots for geometrical types
8482* *r* -- Count of roots for topological types
8483* *l* -- The same, with the type of the source entity
72b7576f 8484
bf62b306 8485The sign \* before parameters *n, s, b, t, r* makes it work on all entities (not only on roots).
72b7576f 8486
bf62b306 8487The sign ? before *n, s, b, t* limits the scope of information to invalid entities.
72b7576f 8488
bf62b306 8489Optional argument \<selection\> can limit the action of the command to the selection, not to all entities.
72b7576f 8490
bf62b306 8491To get help, run this command without arguments.
8492
8493**Example:**
8494~~~~~
72b7576f 8495# translation ratio on IGES faces
8496tpstat *l iges-faces
bf62b306 8497~~~~~
72b7576f 8498
bf62b306 8499@subsubsection occt_draw_8_3_20 xload
72b7576f 8500
bf62b306 8501Syntax:
8502~~~~~
8503xload <file_name>
8504~~~~~
72b7576f 8505
8506This 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 8507
bf62b306 8508**Example:**
8509~~~~~
72b7576f 8510xload /disk1/tmp/aaa.stp
bf62b306 8511~~~~~
72b7576f 8512
8513
bf62b306 8514@subsection occt_draw_8_4 Overview of XDE commands
72b7576f 8515
3f812249 8516These 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 8517 * XDE translation commands
8518 * XDE general commands
8519 * XDE shape’s commands
8520 * XDE color’s commands
8521 * XDE layer’s commands
8522 * XDE property’s commands
72b7576f 8523
67d7f07f 8524Reminding: All operations of translation are performed with parameters managed by command @ref occt_draw_8_3_14 "param".
72b7576f 8525
bf62b306 8526@subsubsection occt_draw_8_4_1 ReadIges
72b7576f 8527
bf62b306 8528Syntax:
8529~~~~~
8530ReadIges document file_name
8531~~~~~
72b7576f 8532
8533Reads information from an IGES file to an XCAF document.
72b7576f 8534
bf62b306 8535**Example:**
8536~~~~~
72b7576f 8537ReadIges D /disk1/tmp/aaa.igs
bf62b306 8538==> Document saved with name D
8539~~~~~
72b7576f 8540
bf62b306 8541@subsubsection occt_draw_8_4_2 ReadStep
72b7576f 8542
bf62b306 8543Syntax:
8544~~~~~
8545ReadStep <document> <file_name>
8546~~~~~
72b7576f 8547
8548Reads information from a STEP file to an XCAF document.
72b7576f 8549
bf62b306 8550**Example:**
8551~~~~~
72b7576f 8552ReadStep D /disk1/tmp/aaa.stp
8553== Document saved with name D
bf62b306 8554~~~~~
72b7576f 8555
bf62b306 8556@subsubsection occt_draw_8_4_3 WriteIges
72b7576f 8557
bf62b306 8558Syntax:
8559~~~~~
8560WriteIges <document> <file_name>
8561~~~~~
72b7576f 8562
e5bd0d98 8563**Example:**
bf62b306 8564~~~~~
72b7576f 8565WriteIges D /disk1/tmp/aaa.igs
bf62b306 8566~~~~~
72b7576f 8567
bf62b306 8568@subsubsection occt_draw_8_4_4 WriteStep
72b7576f 8569
bf62b306 8570Syntax:
8571~~~~~
8572WriteStep <document> <file_name>
8573~~~~~
72b7576f 8574
8575Writes information from an XCAF document to a STEP file.
72b7576f 8576
bf62b306 8577**Example:**
8578~~~~~
72b7576f 8579WriteStep D /disk1/tmp/aaa.stp
bf62b306 8580~~~~~
72b7576f 8581
bf62b306 8582@subsubsection occt_draw_8_4_5 XFileCur
72b7576f 8583
bf62b306 8584Syntax:
8585~~~~~
8586XFileCur
8587~~~~~
72b7576f 8588
8589Returns the name of file which is set as the current one in the Draw session.
72b7576f 8590
bf62b306 8591**Example:**
8592~~~~~
72b7576f 8593XFileCur
8594== *as1-ct-203.stp*
bf62b306 8595~~~~~
72b7576f 8596
bf62b306 8597@subsubsection occt_draw_8_4_6 XFileList
72b7576f 8598
bf62b306 8599Syntax:
8600~~~~~
8601XFileList
8602~~~~~
72b7576f 8603
dba69de2 8604Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file.
72b7576f 8605
bf62b306 8606**Example:**
8607~~~~~
72b7576f 8608XFileList
bf62b306 8609==> *as1-ct-Bolt.stp*
8610==> *as1-ct-L-Bracktet.stp*
8611==> *as1-ct-LBA.stp*
8612==> *as1-ct-NBA.stp*
8613==> …
8614~~~~~
72b7576f 8615
bf62b306 8616@subsubsection occt_draw_8_4_7 XFileSet
72b7576f 8617
bf62b306 8618Syntax:
8619~~~~~
8620XFileSet <filename>
8621~~~~~
72b7576f 8622
8623Sets the current file taking it from the components list of the assemble file.
72b7576f 8624
bf62b306 8625**Example:**
8626~~~~~
72b7576f 8627XFileSet as1-ct-NBA.stp
bf62b306 8628~~~~~
72b7576f 8629
bf62b306 8630@subsubsection occt_draw_8_4_8 XFromShape
72b7576f 8631
bf62b306 8632Syntax:
8633~~~~~
8634XFromShape <shape>
8635~~~~~
72b7576f 8636
67d7f07f 8637This 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 8638
bf62b306 8639**Example:**
8640~~~~~
72b7576f 8641XFromShape a
bf62b306 8642==> Shape a: imported from entity 217:#26 in file as1-ct-Nut.stp
8643~~~~~
72b7576f 8644
bf62b306 8645@subsection occt_draw_8_5 XDE general commands
72b7576f 8646
bf62b306 8647@subsubsection occt_draw_8_5_1 XNewDoc
72b7576f 8648
bf62b306 8649Syntax:
8650~~~~~
8651XNewDoc <document>
8652~~~~~
72b7576f 8653
8654Creates a new XCAF document.
72b7576f 8655
bf62b306 8656**Example:**
8657~~~~~
72b7576f 8658XNewDoc D
bf62b306 8659~~~~~
72b7576f 8660
bf62b306 8661@subsubsection occt_draw_8_5_2 XShow
72b7576f 8662
bf62b306 8663Syntax:
8664~~~~~
8665XShow <document> [ <label1> … ]
8666~~~~~
72b7576f 8667
3f812249 8668Shows a shape from a given label in the 3D viewer. If the label is not given -- shows all shapes from the document.
72b7576f 8669
bf62b306 8670**Example:**
8671~~~~~
72b7576f 8672# show shape from label 0:1:1:4 from document D
8673XShow D 0:1:1:4
bf62b306 8674~~~~~
72b7576f 8675
bf62b306 8676@subsubsection occt_draw_8_5_3 XStat
72b7576f 8677
bf62b306 8678Syntax:
8679~~~~~
8680XStat <document>
8681~~~~~
72b7576f 8682
8683Prints common information from an XCAF document.
72b7576f 8684
bf62b306 8685**Example:**
8686~~~~~
72b7576f 8687XStat D
bf62b306 8688==>Statistis of shapes in the document:
8689==>level N 0 : 9
8690==>level N 1 : 18
8691==>level N 2 : 5
8692==>Total number of labels for shapes in the document = 32
8693==>Number of labels with name = 27
8694==>Number of labels with color link = 3
72b7576f 8695==Number of labels with layer link = 0
bf62b306 8696==>Statistis of Props in the document:
8697==>Number of Centroid Props = 5
8698==>Number of Volume Props = 5
8699==>Number of Area Props = 5
8700==>Number of colors = 4
8701==>BLUE1 RED YELLOW BLUE2
8702==>Number of layers = 0
8703~~~~~
72b7576f 8704
bf62b306 8705@subsubsection occt_draw_8_5_4 XWdump
72b7576f 8706
bf62b306 8707Syntax:
8708~~~~~
8709XWdump <document> <filename>
8710~~~~~
72b7576f 8711
8712Saves the contents of the viewer window as an image (XWD, png or BMP file).
ba06f8bb 8713<i>\<filename\></i> must have a corresponding extention.
72b7576f 8714
bf62b306 8715**Example:**
8716~~~~~
72b7576f 8717XWdump D /disk1/tmp/image.png
bf62b306 8718~~~~~
72b7576f 8719
bf62b306 8720@subsubsection occt_draw_8_5_5 Xdump
72b7576f 8721
bf62b306 8722Syntax:
8723~~~~~
8724Xdump <document> [int deep {0|1}]
8725~~~~~
72b7576f 8726
8727Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes.
72b7576f 8728
bf62b306 8729**Example:**
8730~~~~~
72b7576f 8731Xdump D 1
bf62b306 8732==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
8733==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
8734==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
8735==> ASSEMBLY 0:1:1:4 PLATE(0xe8387780)
8736==> ASSEMBLY 0:1:1:5 ROD(0xe8475418)
8737==> ASSEMBLY 0:1:1:6 AS1(0xe8476968)
8738==> ASSEMBLY 0:1:1:7 L-BRACKET-ASSEMBLY(0xe8476230)
8739==> ASSEMBLY 0:1:1:1 L-BRACKET(0xe8180448)
8740==> ASSEMBLY 0:1:1:8 NUT-BOLT-ASSEMBLY(0xe8475ec0)
8741==> ASSEMBLY 0:1:1:2 NUT(0xe82151e8)
8742==> ASSEMBLY 0:1:1:3 BOLT(0xe829b000)
72b7576f 8743etc.
bf62b306 8744~~~~~
72b7576f 8745
bf62b306 8746@subsection occt_draw_8_6 XDE shape commands
72b7576f 8747
bf62b306 8748@subsubsection occt_draw_8_6_1 XAddComponent
72b7576f 8749
bf62b306 8750Syntax:
8751~~~~~
8752XAddComponent <document> <label> <shape>
8753~~~~~
72b7576f 8754
8755Adds a component shape to assembly.
bf62b306 8756
e5bd0d98 8757**Example:**
72b7576f 8758
bf62b306 8759Let us add shape b as component shape to assembly shape from label *0:1:1:1*
8760
8761~~~~~
72b7576f 8762XAddComponent D 0:1:1:1 b
bf62b306 8763~~~~~
72b7576f 8764
bf62b306 8765@subsubsection occt_draw_8_6_2 XAddShape
72b7576f 8766
bf62b306 8767Syntax:
8768~~~~~
8769XAddShape <document> <shape> [makeassembly=1]
8770~~~~~
72b7576f 8771
8772Adds 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 8773
bf62b306 8774**Example:**
8775~~~~~
72b7576f 8776# add shape b to document D
8777XAddShape D b 0
8778== 0:1:1:10
8779# if pointed shape is compound and last parameter in
8780# XAddShape command is used by default (1), then for
8781# each subshapes new label is created
bf62b306 8782~~~~~
72b7576f 8783
bf62b306 8784@subsubsection occt_draw_8_6_3 XFindComponent
72b7576f 8785
bf62b306 8786Syntax:
8787~~~~~
8788XFindComponent <document> <shape>
8789~~~~~
72b7576f 8790
8791Prints a sequence of labels of the assembly path.
72b7576f 8792
bf62b306 8793**Example:**
8794~~~~~
72b7576f 8795XFindComponent D b
bf62b306 8796~~~~~
72b7576f 8797
bf62b306 8798@subsubsection occt_draw_8_6_4 XFindShape
72b7576f 8799
bf62b306 8800Syntax:
8801~~~~~
8802XFindShape <document> <shape>
8803~~~~~
72b7576f 8804
8805Finds and prints a label with an indicated top-level shape.
72b7576f 8806
bf62b306 8807**Example:**
8808~~~~~
72b7576f 8809XFindShape D a
bf62b306 8810~~~~~
72b7576f 8811
bf62b306 8812@subsubsection occt_draw_8_6_5 XGetFreeShapes
72b7576f 8813
bf62b306 8814Syntax:
8815~~~~~
8816XGetFreeShapes <document> [shape_prefix]
8817~~~~~
72b7576f 8818
8819Print labels or create DRAW shapes for all free shapes in the document.
3f812249 8820If *shape_prefix* is absent -- prints labels, else -- creates DRAW shapes with names
bf62b306 8821<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 8822
bf62b306 8823**Note**: a free shape is a shape to which no other shape refers to.
8824
8825**Example:**
8826~~~~~
72b7576f 8827XGetFreeShapes D
8828== 0:1:1:6 0:1:1:10 0:1:1:12 0:1:1:13
8829
8830XGetFreeShapes D sh
8831== sh_1 sh_2 sh_3 sh_4
bf62b306 8832~~~~~
72b7576f 8833
bf62b306 8834@subsubsection occt_draw_8_6_6 XGetOneShape
72b7576f 8835
bf62b306 8836Syntax:
8837~~~~~
8838XGetOneShape <shape> <document>
8839~~~~~
72b7576f 8840
8841Creates one DRAW shape for all free shapes from a document.
72b7576f 8842
bf62b306 8843**Example:**
8844~~~~~
72b7576f 8845XGetOneShape a D
bf62b306 8846~~~~~
72b7576f 8847
bf62b306 8848@subsubsection occt_draw_8_6_7 XGetReferredShape
72b7576f 8849
bf62b306 8850Syntax:
8851~~~~~
8852XGetReferredShape <document> <label>
8853~~~~~
72b7576f 8854
8855Prints a label that contains a top-level shape that corresponds to a shape at a given label.
72b7576f 8856
bf62b306 8857**Example:**
8858~~~~~
72b7576f 8859XGetReferredShape D 0:1:1:1:1
bf62b306 8860~~~~~
72b7576f 8861
bf62b306 8862@subsubsection occt_draw_8_6_8 XGetShape
72b7576f 8863
bf62b306 8864Syntax:
8865~~~~~
8866XGetShape <result> <document> <label>
8867~~~~~
72b7576f 8868
8869Puts a shape from the indicated label in document to result.
72b7576f 8870
bf62b306 8871**Example:**
8872~~~~~
72b7576f 8873XGetShape b D 0:1:1:3
bf62b306 8874~~~~~
72b7576f 8875
bf62b306 8876@subsubsection occt_draw_8_6_9 XGetTopLevelShapes
72b7576f 8877
bf62b306 8878Syntax:
8879~~~~~
8880XGetTopLevelShapes <document>
8881~~~~~
72b7576f 8882
8883Prints labels that contain top-level shapes.
72b7576f 8884
bf62b306 8885**Example:**
8886~~~~~
72b7576f 8887XGetTopLevelShapes D
8888== 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
88890:1:1:8 0:1:1:9
bf62b306 8890~~~~~
72b7576f 8891
bf62b306 8892@subsubsection occt_draw_8_6_10 XLabelInfo
72b7576f 8893
bf62b306 8894Syntax:
8895~~~~~
8896XLabelInfo <document> <label>
8897~~~~~
72b7576f 8898
8899Prints information about a shape, stored at an indicated label.
bf62b306 8900
e5bd0d98 8901**Example:**
bf62b306 8902~~~~~
72b7576f 8903XLabelInfo D 0:1:1:6
bf62b306 8904==> There are TopLevel shapes. There is an Assembly. This Shape is not used.
8905~~~~~
72b7576f 8906
bf62b306 8907@subsubsection occt_draw_8_6_11 XNewShape
72b7576f 8908
bf62b306 8909Syntax:
8910~~~~~
8911XNewShape <document>
8912~~~~~
72b7576f 8913
8914Creates a new empty top-level shape.
72b7576f 8915
bf62b306 8916**Example:**
8917~~~~~
72b7576f 8918XNewShape D
bf62b306 8919~~~~~
72b7576f 8920
bf62b306 8921@subsubsection occt_draw_8_6_12 XRemoveComponent
72b7576f 8922
bf62b306 8923Syntax:
8924~~~~~
8925XRemoveComponent <document> <label>
8926~~~~~
72b7576f 8927
8928Removes a component from the components label.
72b7576f 8929
bf62b306 8930**Example:**
8931~~~~~
72b7576f 8932XRemoveComponent D 0:1:1:1:1
bf62b306 8933~~~~~
72b7576f 8934
bf62b306 8935@subsubsection occt_draw_8_6_13 XRemoveShape
72b7576f 8936
bf62b306 8937Syntax:
8938~~~~~
8939XRemoveShape <document> <label>
8940~~~~~
72b7576f 8941
8942Removes a shape from a document (by it’s label).
72b7576f 8943
bf62b306 8944**Example:**
8945~~~~~
72b7576f 8946XRemoveShape D 0:1:1:2
bf62b306 8947~~~~~
72b7576f 8948
bf62b306 8949@subsubsection occt_draw_8_6_14 XSetShape
72b7576f 8950
bf62b306 8951Syntax:
8952~~~~~
8953XSetShape <document> <label> <shape>
8954~~~~~
72b7576f 8955
8956Sets a shape at the indicated label.
72b7576f 8957
bf62b306 8958**Example:**
8959~~~~~
72b7576f 8960XSetShape D 0:1:1:3 b
bf62b306 8961~~~~~
72b7576f 8962
acc909a8 8963@subsubsection occt_draw_8_6_15 XUpdateAssemblies
8964
8965Syntax:
8966~~~~~
8967XUpdateAssemblies <document>
8968~~~~~
8969
8970Updates all assembly compounds in the XDE document.
8971
8972**Example:**
8973~~~~~
8974XUpdateAssemblies D
8975~~~~~
72b7576f 8976
bf62b306 8977@subsection occt_draw_8_7_ XDE color commands
72b7576f 8978
bf62b306 8979@subsubsection occt_draw_8_7_1 XAddColor
72b7576f 8980
bf62b306 8981Syntax:
8982~~~~~
8983XAddColor <document> <R> <G> <B>
8984~~~~~
72b7576f 8985
8986Adds color in document to the color table. Parameters R,G,B are real.
72b7576f 8987
bf62b306 8988**Example:**
8989~~~~~
72b7576f 8990XAddColor D 0.5 0.25 0.25
bf62b306 8991~~~~~
72b7576f 8992
bf62b306 8993@subsubsection occt_draw_8_7_2 XFindColor
72b7576f 8994
bf62b306 8995Syntax:
8996~~~~~
8997XFindColor <document> <R> <G> <B>
8998~~~~~
72b7576f 8999
9000Finds a label where the indicated color is situated.
72b7576f 9001
bf62b306 9002**Example:**
9003~~~~~
72b7576f 9004XFindColor D 0.25 0.25 0.5
bf62b306 9005==> 0:1:2:2
9006~~~~~
72b7576f 9007
bf62b306 9008@subsubsection occt_draw_8_7_3 XGetAllColors
72b7576f 9009
bf62b306 9010Syntax:
9011~~~~~
9012XGetAllColors <document>
9013~~~~~
72b7576f 9014
9015Prints all colors that are defined in the document.
72b7576f 9016
bf62b306 9017**Example:**
9018~~~~~
72b7576f 9019XGetAllColors D
bf62b306 9020==> RED DARKORANGE BLUE1 GREEN YELLOW3
9021~~~~~
72b7576f 9022
bf62b306 9023@subsubsection occt_draw_8_7_4 XGetColor
72b7576f 9024
bf62b306 9025Syntax:
9026~~~~~
9027XGetColor <document> <label>
9028~~~~~
72b7576f 9029
9030Returns a color defined at the indicated label from the color table.
72b7576f 9031
bf62b306 9032**Example:**
9033~~~~~
72b7576f 9034XGetColor D 0:1:2:3
9035== BLUE1
bf62b306 9036~~~~~
72b7576f 9037
bf62b306 9038@subsubsection occt_draw_8_7_5 XGetObjVisibility
72b7576f 9039
bf62b306 9040Syntax:
9041~~~~~
9042XGetObjVisibility <document> {<label>|<shape>}
9043~~~~~
72b7576f 9044
9045Returns the visibility of a shape.
72b7576f 9046
bf62b306 9047**Example:**
9048~~~~~
72b7576f 9049XGetObjVisibility D 0:1:1:4
bf62b306 9050~~~~~
72b7576f 9051
bf62b306 9052@subsubsection occt_draw_8_7_6 XGetShapeColor
72b7576f 9053
bf62b306 9054Syntax:
9055~~~~~
9056XGetShapeColor <document> <label> <colortype(s|c)>
9057~~~~~
72b7576f 9058
3f812249 9059Returns the color defined by label. If <i>colortype</i>=’s’ -- returns surface color, else -- returns curve color.
72b7576f 9060
bf62b306 9061**Example:**
9062~~~~~
72b7576f 9063XGetShapeColor D 0:1:1:4 c
bf62b306 9064~~~~~
72b7576f 9065
bf62b306 9066@subsubsection occt_draw_8_7_7 XRemoveColor
72b7576f 9067
bf62b306 9068Syntax:
9069~~~~~
9070XRemoveColor <document> <label>
9071~~~~~
72b7576f 9072
9073Removes a color from the color table in a document.
72b7576f 9074
bf62b306 9075**Example:**
9076~~~~~
72b7576f 9077XRemoveColor D 0:1:2:1
bf62b306 9078~~~~~
72b7576f 9079
bf62b306 9080@subsubsection occt_draw_8_7_8 XSetColor
72b7576f 9081
bf62b306 9082Syntax:
9083~~~~~
9084XSetColor <document> {<label>|<shape>} <R> <G> <B>
9085~~~~~
72b7576f 9086
9087Sets an RGB color to a shape given by label.
72b7576f 9088
bf62b306 9089**Example:**
9090~~~~~
72b7576f 9091XsetColor D 0:1:1:4 0.5 0.5 0.
bf62b306 9092~~~~~
72b7576f 9093
bf62b306 9094@subsubsection occt_draw_8_7_9 XSetObjVisibility
72b7576f 9095
bf62b306 9096Syntax:
9097~~~~~
9098XSetObjVisibility <document> {<label>|<shape>} {0|1}
9099~~~~~
72b7576f 9100
9101Sets the visibility of a shape.
72b7576f 9102
bf62b306 9103**Example:**
9104~~~~~
72b7576f 9105# set shape from label 0:1:1:4 as invisible
9106XSetObjVisibility D 0:1:1:4 0
bf62b306 9107~~~~~
72b7576f 9108
bf62b306 9109@subsubsection occt_draw_8_7_10 XUnsetColor
72b7576f 9110
bf62b306 9111Syntax:
9112~~~~~
9113XUnsetColor <document> {<label>|<shape>} <colortype>
9114~~~~~
72b7576f 9115
bf62b306 9116Unset a color given type (‘s’ or ‘c’) for the indicated shape.
72b7576f 9117
bf62b306 9118**Example:**
9119~~~~~
72b7576f 9120XUnsetColor D 0:1:1:4 s
bf62b306 9121~~~~~
9122
72b7576f 9123
bf62b306 9124@subsection occt_draw_8_8_ XDE layer commands
72b7576f 9125
bf62b306 9126@subsubsection occt_draw_8_8_1 XAddLayer
72b7576f 9127
bf62b306 9128Syntax:
9129~~~~~
9130XAddLayer <document> <layer>
9131~~~~~
72b7576f 9132
bf62b306 9133Adds a new layer in an XCAF document.
72b7576f 9134
e5bd0d98 9135**Example:**
bf62b306 9136~~~~~
72b7576f 9137XAddLayer D layer2
bf62b306 9138~~~~~
72b7576f 9139
bf62b306 9140@subsubsection occt_draw_8_8_2 XFindLayer
72b7576f 9141
bf62b306 9142Syntax:
9143~~~~~
9144XFindLayer <document> <layer>
9145~~~~~
72b7576f 9146
9147Prints a label where a layer is situated.
72b7576f 9148
bf62b306 9149**Example:**
9150~~~~~
72b7576f 9151XFindLayer D Bolt
9152== 0:1:3:2
bf62b306 9153~~~~~
72b7576f 9154
bf62b306 9155@subsubsection occt_draw_8_8_3 XGetAllLayers
72b7576f 9156
bf62b306 9157Syntax:
9158~~~~~
9159XGetAllLayers <document>
9160~~~~~
72b7576f 9161
9162Prints all layers in an XCAF document.
72b7576f 9163
bf62b306 9164**Example:**
9165~~~~~
72b7576f 9166XGetAllLayers D
9167== *0:1:1:3* *Bolt* *0:1:1:9*
bf62b306 9168~~~~~
72b7576f 9169
bf62b306 9170@subsubsection occt_draw_8_8_4 XGetLayers
72b7576f 9171
bf62b306 9172Syntax:
9173~~~~~
9174XGetLayers <document> {<shape>|<label>}
9175~~~~~
72b7576f 9176
9177Returns names of layers, which are pointed to by links of an indicated shape.
72b7576f 9178
bf62b306 9179**Example:**
9180~~~~~
72b7576f 9181XGetLayers D 0:1:1:3
9182== *bolt* *123*
bf62b306 9183~~~~~
72b7576f 9184
bf62b306 9185@subsubsection occt_draw_8_8_5 XGetOneLayer
72b7576f 9186
bf62b306 9187Syntax:
9188~~~~~
9189XGetOneLayer <document> <label>
9190~~~~~
72b7576f 9191
9192Prints the name of a layer at a given label.
72b7576f 9193
bf62b306 9194**Example:**
9195~~~~~
72b7576f 9196XGetOneLayer D 0:1:3:2
bf62b306 9197~~~~~
72b7576f 9198
bf62b306 9199@subsubsection occt_draw_8_8_6 XIsVisible
72b7576f 9200
bf62b306 9201Syntax:
9202~~~~~
9203XIsVisible <document> {<label>|<layer>}
9204~~~~~
72b7576f 9205
9206Returns 1 if the indicated layer is visible, else returns 0.
72b7576f 9207
bf62b306 9208**Example:**
9209~~~~~
72b7576f 9210XIsVisible D 0:1:3:1
bf62b306 9211~~~~~
72b7576f 9212
bf62b306 9213@subsubsection occt_draw_8_8_7 XRemoveAllLayers
72b7576f 9214
bf62b306 9215Syntax:
9216~~~~~
9217XRemoveAllLayers <document>
9218~~~~~
72b7576f 9219
9220Removes all layers from an XCAF document.
72b7576f 9221
bf62b306 9222**Example:**
9223~~~~~
72b7576f 9224XRemoveAllLayers D
bf62b306 9225~~~~~
72b7576f 9226
bf62b306 9227@subsubsection occt_draw_8_8_8 XRemoveLayer
72b7576f 9228
bf62b306 9229Syntax:
9230~~~~~
9231XRemoveLayer <document> {<label>|<layer>}
9232~~~~~
72b7576f 9233
9234Removes the indicated layer from an XCAF document.
72b7576f 9235
bf62b306 9236**Example:**
9237~~~~~
72b7576f 9238XRemoveLayer D layer2
bf62b306 9239~~~~~
72b7576f 9240
bf62b306 9241@subsubsection occt_draw_8_8_9 XSetLayer
72b7576f 9242
bf62b306 9243Syntax:
9244~~~~~
9245XSetLayer XSetLayer <document> {<shape>|<label>} <layer> [shape_in_one_layer {0|1}]
72b7576f 9246
bf62b306 9247~~~~~
9248
72b7576f 9249Sets a reference between a shape and a layer (adds a layer if it is necessary).
ba06f8bb 9250Parameter <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 9251
bf62b306 9252**Example:**
9253~~~~~
72b7576f 9254XSetLayer D 0:1:1:2 layer2
bf62b306 9255~~~~~
72b7576f 9256
bf62b306 9257@subsubsection occt_draw_8_8_10 XSetVisibility
72b7576f 9258
bf62b306 9259Syntax:
9260~~~~~
9261XSetVisibility <document> {<label>|<layer>} <isvisible {0|1}>
9262~~~~~
72b7576f 9263
9264Sets the visibility of a layer.
72b7576f 9265
bf62b306 9266**Example:**
9267~~~~~
72b7576f 9268# set layer at label 0:1:3:2 as invisible
9269XSetVisibility D 0:1:3:2 0
bf62b306 9270~~~~~
72b7576f 9271
bf62b306 9272@subsubsection occt_draw_8_8_11 XUnSetAllLayers
72b7576f 9273
bf62b306 9274Syntax:
9275~~~~~
9276XUnSetAllLayers <document> {<label>|<shape>}
9277~~~~~
72b7576f 9278
9279Unsets a shape from all layers.
72b7576f 9280
bf62b306 9281**Example:**
9282~~~~~
72b7576f 9283XUnSetAllLayers D 0:1:1:2
bf62b306 9284~~~~~
72b7576f 9285
bf62b306 9286@subsubsection occt_draw_8_8_12 XUnSetLayer
72b7576f 9287
bf62b306 9288Syntax:
9289~~~~~
9290XUnSetLayer <document> {<label>|<shape>} <layer>
9291~~~~~
72b7576f 9292
9293Unsets a shape from the indicated layer.
72b7576f 9294
bf62b306 9295**Example:**
9296~~~~~
72b7576f 9297XUnSetLayer D 0:1:1:2 layer1
bf62b306 9298~~~~~
72b7576f 9299
bf62b306 9300@subsection occt_draw_8_9 XDE property commands
72b7576f 9301
bf62b306 9302@subsubsection occt_draw_8_9_1 XCheckProps
72b7576f 9303
bf62b306 9304Syntax:
9305~~~~~
9306XCheckProps <document> [ {0|deflection} [<shape>|<label>] ]
9307~~~~~
72b7576f 9308
3f812249 9309Gets 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 9310
e5bd0d98 9311**Example:**
bf62b306 9312~~~~~
72b7576f 9313# check properties for shapes at label 0:1:1:1 from
9314# document using standard Open CASCADE Technology tools
9315XCheckProps D 0 0:1:1:1
dba69de2 9316== Label 0:1:1:1 ;L-BRACKET*
9317== Area defect: -0.0 ( 0%)
9318== Volume defect: 0.0 ( 0%)
9319== CG defect: dX=-0.000, dY=0.000, dZ=0.000
bf62b306 9320~~~~~
72b7576f 9321
bf62b306 9322@subsubsection occt_draw_8_9_2 XGetArea
72b7576f 9323
bf62b306 9324Syntax:
9325~~~~~
9326XGetArea <document> {<shape>|<label>}
9327~~~~~
72b7576f 9328
9329Returns the area of a given shape.
72b7576f 9330
bf62b306 9331**Example:**
9332~~~~~
72b7576f 9333XGetArea D 0:1:1:1
9334== 24628.31815094999
bf62b306 9335~~~~~
72b7576f 9336
bf62b306 9337@subsubsection occt_draw_8_9_3 XGetCentroid
72b7576f 9338
bf62b306 9339Syntax:
9340~~~~~
9341XGetCentroid <document> {<shape>|<label>}
9342~~~~~
72b7576f 9343
9344Returns the center of gravity coordinates of a given shape.
72b7576f 9345
bf62b306 9346**Example:**
9347~~~~~
72b7576f 9348XGetCentroid D 0:1:1:1
bf62b306 9349~~~~~
72b7576f 9350
bf62b306 9351@subsubsection occt_draw_8_9_4 XGetVolume
72b7576f 9352
bf62b306 9353Syntax:
9354~~~~~
9355XGetVolume <document> {<shape>|<label>}
9356~~~~~
72b7576f 9357
9358Returns the volume of a given shape.
72b7576f 9359
bf62b306 9360**Example:**
9361~~~~~
72b7576f 9362XGetVolume D 0:1:1:1
bf62b306 9363~~~~~
72b7576f 9364
bf62b306 9365@subsubsection occt_draw_8_9_5 XSetArea
72b7576f 9366
bf62b306 9367Syntax:
9368~~~~~
9369XSetArea <document> {<shape>|<label>} <area>
9370~~~~~
72b7576f 9371
9372Sets new area to attribute list ??? given shape.
72b7576f 9373
bf62b306 9374**Example:**
9375~~~~~
72b7576f 9376XSetArea D 0:1:1:1 2233.99
bf62b306 9377~~~~~
72b7576f 9378
bf62b306 9379@subsubsection occt_draw_8_9_6 XSetCentroid
9380
9381Syntax:
9382~~~~~
9383XSetCentroid <document> {<shape>|<label>} <x> <y> <z>
9384~~~~~
72b7576f 9385
bf62b306 9386Sets new center of gravity to the attribute list given shape.
72b7576f 9387
e5bd0d98 9388**Example:**
bf62b306 9389~~~~~
72b7576f 9390XSetCentroid D 0:1:1:1 0. 0. 100.
bf62b306 9391~~~~~
72b7576f 9392
bf62b306 9393@subsubsection occt_draw_8_9_7 XSetMaterial
72b7576f 9394
bf62b306 9395Syntax:
9396~~~~~
9397XSetMaterial <document> {<shape>|<label>} <name> <density(g/cu sm)>
9398~~~~~
72b7576f 9399
bf62b306 9400Adds 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 9401
bf62b306 9402**Example:**
9403~~~~~
72b7576f 9404XSetMaterial D 0:1:1:1 Titanium 8899.77
bf62b306 9405~~~~~
72b7576f 9406
bf62b306 9407@subsubsection occt_draw_8_9_8 XSetVolume
72b7576f 9408
bf62b306 9409Syntax:
9410~~~~~
9411XSetVolume <document> {<shape>|<label>} <volume>
9412~~~~~
72b7576f 9413
9414Sets new volume to the attribute list ??? given shape.
72b7576f 9415
bf62b306 9416**Example:**
9417~~~~~
72b7576f 9418XSetVolume D 0:1:1:1 444555.33
bf62b306 9419~~~~~
72b7576f 9420
bf62b306 9421@subsubsection occt_draw_8_9_9 XShapeMassProps
72b7576f 9422
bf62b306 9423Syntax:
9424~~~~~
9425XShapeMassProps <document> [ <deflection> [{<shape>|<label>}] ]
9426~~~~~
72b7576f 9427
3f812249 9428Computes 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 9429
bf62b306 9430**Example:**
9431~~~~~
72b7576f 9432XShapeMassProps D
9433== Shape from label : 0:1:1:1
9434== Mass = 193.71681469282299
9435== CenterOfGravity X = 14.594564763807696,Y =
dba69de2 9436 20.20271885211281,Z = 49.999999385313245
72b7576f 9437== Shape from label : 0:1:1:2 not have a mass
9438etc.
bf62b306 9439~~~~~
72b7576f 9440
bf62b306 9441@subsubsection occt_draw_8_9_10 XShapeVolume
72b7576f 9442
bf62b306 9443Syntax:
9444~~~~~
9445XShapeVolume <shape> <deflection>
9446~~~~~
72b7576f 9447
9448Calculates the real volume of a pointed shape with a given deflection.
72b7576f 9449
bf62b306 9450**Example:**
9451~~~~~
72b7576f 9452XShapeVolume a 0
bf62b306 9453~~~~~
72b7576f 9454
bf62b306 9455@section occt_draw_9 Shape Healing commands
72b7576f 9456
9457
9458
bf62b306 9459@subsection occt_draw_9_1 General commands
72b7576f 9460
bf62b306 9461@subsubsection occt_draw_9_1_1 bsplres
72b7576f 9462
bf62b306 9463Syntax:
9464~~~~~
9465bsplres <result> <shape> <tol3d> <tol2d< <reqdegree> <reqnbsegments> <continuity3d> <continuity2d> <PriorDeg> <RationalConvert>
9466~~~~~
72b7576f 9467
bf62b306 9468Performs 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 9469
bf62b306 9470@subsubsection occt_draw_9_1_2 checkfclass2d
72b7576f 9471
bf62b306 9472Syntax:
9473~~~~~
9474checkfclass2d <face> <ucoord> <vcoord>
9475~~~~~
72b7576f 9476
3f812249 9477Shows where a point which is given by coordinates is located in relation to a given face -- outbound, inside or at the bounds.
72b7576f 9478
bf62b306 9479**Example:**
9480~~~~~
72b7576f 9481checkfclass2d f 10.5 1.1
9482== Point is OUT
bf62b306 9483~~~~~
72b7576f 9484
bf62b306 9485@subsubsection occt_draw_9_1_3 checkoverlapedges
9486
9487Syntax:
9488~~~~~
9489checkoverlapedges <edge1> <edge2> [<toler> <domaindist>]
9490~~~~~
72b7576f 9491
ba06f8bb 9492Checks 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 9493
e5bd0d98 9494**Example:**
bf62b306 9495~~~~~
72b7576f 9496checkoverlapedges e1 e2
bf62b306 9497~~~~~
72b7576f 9498
bf62b306 9499@subsubsection occt_draw_9_1_4 comtol
72b7576f 9500
bf62b306 9501Syntax:
9502~~~~~
9503comptol <shape> [nbpoints] [prefix]
9504~~~~~
72b7576f 9505
9506Compares 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 9507
e5bd0d98 9508**Example:**
bf62b306 9509~~~~~
72b7576f 9510comptol h 871 t
9511
bf62b306 9512==> Edges tolerance computed by 871 points:
9513==> MAX=8.0001130696523449e-008 AVG=6.349346868091096e-009 MIN=0
9514==> Relation real tolerance / tolerance set in edge
9515==> MAX=0.80001130696523448 AVG=0.06349345591805905 MIN=0
9516==> Edge with max tolerance saved to t_edge_tol
9517==> Concerned faces saved to shapes t_1, t_2
9518~~~~~
72b7576f 9519
bf62b306 9520@subsubsection occt_draw_9_1_5 convtorevol
72b7576f 9521
bf62b306 9522Syntax:
9523~~~~~
9524convtorevol <result> <shape>
9525~~~~~
72b7576f 9526
9527Converts all elementary surfaces of a given shape into surfaces of revolution.
ba06f8bb 9528Results are put into the shape, which is given as the <i>\<result\></i> parameter.
72b7576f 9529
bf62b306 9530**Example:**
9531~~~~~
72b7576f 9532convtorevol r a
bf62b306 9533~~~~~
72b7576f 9534
bf62b306 9535@subsubsection occt_draw_9_1_6 directfaces
72b7576f 9536
bf62b306 9537Syntax:
9538~~~~~
9539directfaces <result> <shape>
9540~~~~~
72b7576f 9541
9542Converts indirect surfaces and returns the results into the shape, which is given as the result parameter.
72b7576f 9543
bf62b306 9544**Example:**
9545~~~~~
72b7576f 9546directfaces r a
bf62b306 9547~~~~~
72b7576f 9548
bf62b306 9549@subsubsection occt_draw_9_1_7 expshape
72b7576f 9550
bf62b306 9551Syntax:
9552~~~~~
9553expshape <shape> <maxdegree> <maxseg>
9554~~~~~
72b7576f 9555
9556Gives statistics for a given shape. This test command is working with Bezier and BSpline entities.
72b7576f 9557
bf62b306 9558**Example:**
9559~~~~~
72b7576f 9560expshape a 10 10
bf62b306 9561==> Number of Rational Bspline curves 128
9562==> Number of Rational Bspline pcurves 48
9563~~~~~
72b7576f 9564
bf62b306 9565@subsubsection occt_draw_9_1_8 fixsmall
72b7576f 9566
bf62b306 9567Syntax:
9568~~~~~
9569fixsmall <result> <shape> [<toler>=1.]
9570~~~~~
72b7576f 9571
9572Fixes 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 9573
bf62b306 9574**Example:**
9575~~~~~
72b7576f 9576fixsmall r a 0.1
bf62b306 9577~~~~~
72b7576f 9578
bf62b306 9579@subsubsection occt_draw_9_1_9 fixsmalledges
9580
9581Syntax:
9582~~~~~
9583fixsmalledges <result> <shape> [<toler> <mode> <maxangle>]
9584~~~~~
72b7576f 9585
ba06f8bb 9586Searches 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 9587
e5bd0d98 9588**Example:**
bf62b306 9589~~~~~
72b7576f 9590fixsmalledges r a 0.1 1
bf62b306 9591~~~~~
9592
9593@subsubsection occt_draw_9_1_10 fixshape
72b7576f 9594
bf62b306 9595Syntax:
9596~~~~~
9597fixshape <result> <shape> [<preci> [<maxpreci>]] [{switches}]
9598~~~~~
9599
ba06f8bb 9600Performs 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 9601
9602The following syntax is used:
ba06f8bb 9603* <i>\<symbol\></i> may be
9604 * "-" to set parameter off,
9605 * "+" to set on or
9606 * "*" to set default
9607* <i>\<parameter\></i> is identified by letters:
3f812249 9608 * l -- FixLackingMode
9609 * o -- FixOrientationMode
9610 * h -- FixShiftedMode
9611 * m -- FixMissingSeamMode
9612 * d -- FixDegeneratedMode
9613 * s -- FixSmallMode
9614 * i -- FixSelfIntersectionMode
9615 * n -- FixNotchedEdgesMode
72b7576f 9616For enhanced message output, use switch '+?'
72b7576f 9617
bf62b306 9618**Example:**
9619~~~~~
72b7576f 9620fixshape r a 0.001
bf62b306 9621~~~~~
72b7576f 9622
bf62b306 9623@subsubsection occt_draw_9_1_11 fixwgaps
72b7576f 9624
bf62b306 9625Syntax:
9626~~~~~
9627fixwgaps <result> <shape> [<toler>=0]
9628~~~~~
72b7576f 9629
9630Fixes 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 9631
bf62b306 9632**Example:**
9633~~~~~
72b7576f 9634fixwgaps r a
bf62b306 9635~~~~~
9636
9637@subsubsection occt_draw_9_1_12 offsetcurve, offset2dcurve
72b7576f 9638
bf62b306 9639Syntax:
9640~~~~~
9641offsetcurve <result> <curve> <offset> <direction(as point)>
9642offset2dcurve <result> <curve> <offset>
9643~~~~~
72b7576f 9644
bf62b306 9645**offsetcurve** works with the curve in 3d space, **offset2dcurve** in 2d space.
72b7576f 9646
ba06f8bb 9647Both 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 9648
bf62b306 9649**Example:**
9650~~~~~
72b7576f 9651point pp 10 10 10
9652offsetcurve r c 20 pp
bf62b306 9653~~~~~
9654
9655@subsubsection occt_draw_9_1_13 projcurve
72b7576f 9656
bf62b306 9657Syntax:
9658~~~~~
9659projcurve <edge>|<curve3d>|<curve3d first last> <X> <Y> <Z>
9660~~~~~
72b7576f 9661
bf62b306 9662**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 9663
e5bd0d98 9664**Example:**
bf62b306 9665~~~~~
72b7576f 9666projcurve k_1 0 1 5
9667==Edge k_1 Params from 0 to 1.3
dba69de2 9668==Precision (BRepBuilderAPI) : 9.9999999999999995e-008 ==Projection : 0 1 5
9669==Result : 0 1.1000000000000001 0
9670==Param = -0.20000000000000001 Gap = 5.0009999000199947
bf62b306 9671~~~~~
72b7576f 9672
bf62b306 9673@subsubsection occt_draw_9_1_14 projface
72b7576f 9674
bf62b306 9675Syntax:
9676~~~~~
9677projface <face> <X> <Y> [<Z>]
9678~~~~~
72b7576f 9679
9680Returns 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 9681
bf62b306 9682**Example:**
9683~~~~~
72b7576f 9684projface a_1 10.0 0.0
dba69de2 9685== Point UV U = 10 V = 0
9686== = proj X = -116 Y = -45 Z = 0
bf62b306 9687~~~~~
72b7576f 9688
bf62b306 9689@subsubsection occt_draw_9_1_15 scaleshape
72b7576f 9690
bf62b306 9691Syntax:
9692~~~~~
9693scaleshape <result> <shape> <scale>
9694~~~~~
72b7576f 9695
ba06f8bb 9696Returns 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 9697
bf62b306 9698**Example:**
9699~~~~~
72b7576f 9700scaleshape r a_1 0.8
bf62b306 9701~~~~~
72b7576f 9702
bf62b306 9703@subsubsection occt_draw_9_1_16 settolerance
9704
9705Syntax:
9706~~~~~
9707settolerance <shape> [<mode>=v-e-w-f-a] <val>(fix value) or
9708 <tolmin> <tolmax>
9709~~~~~
72b7576f 9710
bf62b306 9711Sets 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 9712
e5bd0d98 9713**Example:**
bf62b306 9714~~~~~
72b7576f 9715settolerance a 0.001
bf62b306 9716~~~~~
72b7576f 9717
bf62b306 9718@subsubsection occt_draw_9_1_17 splitface
72b7576f 9719
bf62b306 9720Syntax:
9721~~~~~
9722splitface <result> <face> [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]
9723~~~~~
72b7576f 9724
ba06f8bb 9725Splits a given face in parametric space and puts the result into the given parameter <i>\<result\></i>.
72b7576f 9726Returns the status of split face.
72b7576f 9727
bf62b306 9728**Example:**
9729~~~~~
72b7576f 9730# split face f by parameter u = 5
9731splitface r f u 5
bf62b306 9732==> Splitting by U: ,5
9733==> Status: DONE1
9734~~~~~
72b7576f 9735
bf62b306 9736@subsubsection occt_draw_9_1_18 statshape
72b7576f 9737
bf62b306 9738Syntax:
9739~~~~~
9740statshape <shape> [particul]
9741~~~~~
72b7576f 9742
bf62b306 9743Returns 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
9744surfaces. The last parameter becomes out of date.
72b7576f 9745
e5bd0d98 9746**Example:**
bf62b306 9747~~~~~
9748statshape a
9749==> Count Item
9750==> ----- ----
9751==> 402 Edge (oriented)
9752==> 402 Edge (Shared)
9753==> 74 Face
9754==> 74 Face (Free)
9755==> 804 Vertex (Oriented)
9756==> 402 Vertex (Shared)
9757==> 78 Wire
9758==> 4 Face with more than one wire
9759==> 34 bspsur: BSplineSurface
9760~~~~~
9761
9762@subsubsection occt_draw_9_1_19 tolerance
9763
ba06f8bb 9764Syntax:
bf62b306 9765~~~~~
9766tolerance <shape> [<mode>:D v e f c] [<tolmin> <tolmax>:real]
9767~~~~~
72b7576f 9768
ba06f8bb 9769Returns 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 9770
9771**Example:**
9772~~~~~
72b7576f 9773tolerance a
bf62b306 9774==> Tolerance MAX=0.31512672416608001 AVG=0.14901359484722074 MIN=9.9999999999999995e-08
9775==> FACE : MAX=9.9999999999999995e-08 AVG=9.9999999999999995e-08 MIN=9.9999999999999995e-08
9776==> EDGE : MAX=0.31512672416608001 AVG=0.098691334511810405 MIN=9.9999999999999995e-08
9777==> VERTEX : MAX=0.31512672416608001 AVG=0.189076074499648 MIN=9.9999999999999995e-08
72b7576f 9778
9779tolerance a v 0.1 0.001
bf62b306 9780==> Analysing Vertices gives 6 Shapes between tol1=0.10000000000000001 and tol2=0.001 , named tol_1 to tol_6
9781~~~~~
72b7576f 9782
9783
bf62b306 9784@subsection occt_draw_9_2 Conversion commands
72b7576f 9785
bf62b306 9786@subsubsection occt_draw_9_2_1 DT_ClosedSplit
72b7576f 9787
bf62b306 9788Syntax:
9789~~~~~
9790DT_ClosedSplit <result> <shape>
9791~~~~~
72b7576f 9792
9793Divides 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 9794Note: A closed face is a face with one or more seam.
72b7576f 9795
bf62b306 9796**Example:**
9797~~~~~
72b7576f 9798DT_ClosetSplit r a
bf62b306 9799~~~~~
72b7576f 9800
bf62b306 9801@subsubsection occt_draw_9_2_2 DT_ShapeConvert, DT_ShapeConvertRev
72b7576f 9802
bf62b306 9803Syntax:
9804~~~~~
9805DT_ShapeConvert <result> <shape> <convert2d> <convert3d>
9806DT_ShapeConvertRev <result> <shape> <convert2d> <convert3d>
9807~~~~~
9808
9809Both 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 9810
e5bd0d98 9811**Example:**
bf62b306 9812~~~~~
72b7576f 9813DT_ShapeConvert r a 1 1
9814== Status: DONE1
bf62b306 9815~~~~~
9816
9817@subsubsection occt_draw_9_2_3 DT_ShapeDivide
72b7576f 9818
bf62b306 9819Syntax:
9820~~~~~
9821DT_ShapeDivide <result> <shape> <tol>
9822~~~~~
72b7576f 9823
bf62b306 9824Divides 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:
9825 * OK : no splitting was done
9826 * Done1 : Some edges were split
9827 * Done2 : Surface was split
9828 * Fail1 : Some errors occurred
72b7576f 9829
e5bd0d98 9830**Example:**
bf62b306 9831~~~~~
72b7576f 9832DT_ShapeDivide r a 0.001
9833== Status: OK
bf62b306 9834~~~~~
72b7576f 9835
bf62b306 9836@subsubsection occt_draw_9_2_4 DT_SplitAngle
9837
9838Syntax:
9839~~~~~
9840DT_SplitAngle <result> <shape> [MaxAngle=95]
9841~~~~~
72b7576f 9842
bf62b306 9843Works 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.
9844This command illustrates how class *ShapeUpgrade_ShapeDivideAngle* works.
72b7576f 9845
e5bd0d98 9846**Example:**
bf62b306 9847~~~~~
72b7576f 9848DT_SplitAngle r a
9849== Status: DONE2
bf62b306 9850~~~~~
72b7576f 9851
bf62b306 9852@subsubsection occt_draw_9_2_5 DT_SplitCurve
72b7576f 9853
bf62b306 9854Syntax:
9855~~~~~
9856DT_SplitCurve <curve> <tol> <split(0|1)>
9857~~~~~
72b7576f 9858
dba69de2 9859Divides 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 9860
bf62b306 9861**Example:**
9862~~~~~
72b7576f 9863DT_SplitCurve r c
bf62b306 9864~~~~~
72b7576f 9865
bf62b306 9866@subsubsection occt_draw_9_2_6 DT_SplitCurve2d
72b7576f 9867
bf62b306 9868Syntax:
9869~~~~~
9870DT_SplitCurve2d Curve Tol Split(0/1)
9871~~~~~
72b7576f 9872
bf62b306 9873Works just as **DT_SplitCurve** (see above), only with 2d curve.
72b7576f 9874
bf62b306 9875**Example:**
9876~~~~~
72b7576f 9877DT_SplitCurve2d r c
bf62b306 9878~~~~~
72b7576f 9879
bf62b306 9880@subsubsection occt_draw_9_2_7 DT_SplitSurface
72b7576f 9881
bf62b306 9882Syntax:
9883~~~~~
9884DT_SplitSurface <result> <Surface|GridSurf> <tol> <split(0|1)>
9885~~~~~
72b7576f 9886
dba69de2 9887Divides 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 9888
e5bd0d98 9889**Example:**
ba06f8bb 9890~~~~~
79d580f2 9891
9892~~~~~
9893# split surface with name "su"
72b7576f 9894DT_SplitSurface res su 0.1 1
bf62b306 9895==> single surf
9896==> appel a SplitSurface::Init
9897==> appel a SplitSurface::Build
9898==> appel a SplitSurface::GlobalU/VKnots
9899==> nb GlobalU;nb GlobalV=7 2 0 1 2 3 4 5 6.2831853072 0 1
9900==> appel a Surfaces
9901==> transfert resultat
9902==> res1_1_1 res1_2_1 res1_3_1 res1_4_1 res1_5_1 res1_6_1
9903~~~~~
79d580f2 9904~~~~~
72b7576f 9905
bf62b306 9906@subsubsection occt_draw_9_2_8 DT_ToBspl
72b7576f 9907
ba06f8bb 9908Syntax:
bf62b306 9909~~~~~
9910DT_ToBspl <result> <shape>
9911~~~~~
72b7576f 9912
9913Converts 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 9914
e5bd0d98 9915**Example:**
bf62b306 9916~~~~~
72b7576f 9917DT_ToBspl res sh
dba69de2 9918== error = 5.20375663162094e-08 spans = 10
9919== Surface is aproximated with continuity 2
bf62b306 9920~~~~~
72b7576f 9921
bf62b306 9922@section occt_draw_10 Performance evaluation commands
72b7576f 9923
9924
bf62b306 9925@subsection occt_draw_10_1 VDrawSphere
72b7576f 9926
bf62b306 9927Syntax:
9928~~~~~
9929vdrawsphere shapeName Fineness [X=0.0 Y=0.0 Z=0.0] [Radius=100.0] [ToEnableVBO=1] [NumberOfViewerUpdate=1] [ToShowEdges=0]
9930~~~~~
72b7576f 9931
9932Calculates 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.
9933
9934This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter.
72b7576f 9935
bf62b306 9936**Example:**
9937~~~~~
9938vdrawsphere s 200 1 1 1 500 1
9939== Compute Triangulation...
9940== NumberOfPoints: 39602
9941== NumberOfTriangles: 79200
9942== Amount of memory required for PolyTriangulation without Normals: 2 Mb
9943== Amount of memory for colors: 0 Mb
9944== Amount of memory for PolyConnect: 1 Mb
9945== Amount of graphic card memory required: 2 Mb
9946== Number of scene redrawings: 1
9947== CPU user time: 15.6000999999998950 msec
9948== CPU system time: 0.0000000000000000 msec
9949== CPU average time of scene redrawing: 15.6000999999998950 msec
9950~~~~~
72b7576f 9951
9952
472634fa 9953@section occt_draw_12 Simple vector algebra and measurements
9954
9955This section contains description of auxiliary commands that can be useful for simple calculations and manipulations needed when analyzing complex models.
9956
9957@subsection occt_draw_12_1 Vector algebra commands
9958
9959This 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:
9960~~~~~{.cpp}
9961Draw[10]> set vec1 [vec 12 28 99 12 58 99]
99620 30 0
9963Draw[13]> set vec2 [vec 12 28 99 16 21 89]
99644 -7 -10
9965Draw[14]> set cross [eval cross $vec1 $vec2]
9966-300 0 -120
9967Draw[15]> eval module $cross
9968323.10988842807024
9969~~~~~
9970
9971@subsubsection occt_draw_12_1_1 vec
9972
9973Syntax:
9974~~~~~
9975vec <x1> <y1> <z1> <x2> <y2> <z2>
9976~~~~~
9977
9978Returns coordinates of vector between two 3D points.
9979
9980Example:
9981~~~~~{.cpp}
9982vec 1 2 3 6 5 4
9983~~~~~
9984
9985@subsubsection occt_draw_12_1_2 2dvec
9986
9987Syntax:
9988~~~~~
99892dvec <x1> <y1> <x2> <y2>
9990~~~~~
9991
9992Returns coordinates of vector between two 2D points.
9993
9994Example:
9995~~~~~{.cpp}
99962dvec 1 2 4 3
9997~~~~~
9998
9999@subsubsection occt_draw_12_1_3 pln
10000
10001Syntax:
10002~~~~~
10003pln <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
10004~~~~~
10005
10006Returns plane built on three points. A plane is represented by 6 double values: coordinates of the origin point and the normal directoin.
10007
10008Example:
10009~~~~~{.cpp}
10010pln 1 2 3 6 5 4 9 8 7
10011~~~~~
10012
10013@subsubsection occt_draw_12_1_4 module
10014
10015Syntax:
10016~~~~~
10017module <x> <y> <z>
10018~~~~~
10019
10020Returns module of a vector.
10021
10022Example:
10023~~~~~{.cpp}
10024module 1 2 3
10025~~~~~
10026
10027@subsubsection occt_draw_12_1_5 2dmodule
10028
10029Syntax:
10030~~~~~
100312dmodule <x> <y>
10032~~~~~
10033
10034Returns module of a 2D vector.
10035
10036Example:
10037~~~~~{.cpp}
100382dmodule 1 2
10039~~~~~
10040
10041@subsubsection occt_draw_12_1_6 norm
10042
10043Syntax:
10044~~~~~
10045norm <x> <y> <z>
10046~~~~~
10047
10048Returns unified vector from a given 3D vector.
10049
10050Example:
10051~~~~~{.cpp}
10052norm 1 2 3
10053~~~~~
10054
10055@subsubsection occt_draw_12_1_7 2dnorm
10056
10057Syntax:
10058~~~~~
100592dnorm <x> <y>
10060~~~~~
10061
10062Returns unified vector from a given 2D vector.
10063
10064Example:
10065~~~~~{.cpp}
100662dnorm 1 2
10067~~~~~
10068
10069@subsubsection occt_draw_12_1_8 inverse
10070
10071Syntax:
10072~~~~~
10073inverse <x> <y> <z>
10074~~~~~
10075
10076Returns inversed 3D vector.
10077
10078Example:
10079~~~~~{.cpp}
10080inverse 1 2 3
10081~~~~~
10082
10083@subsubsection occt_draw_12_1_9 2dinverse
10084
10085Syntax:
10086~~~~~
100872dinverse <x> <y>
10088~~~~~
10089
10090Returns inversed 2D vector.
10091
10092Example:
10093~~~~~{.cpp}
100942dinverse 1 2
10095~~~~~
10096
10097@subsubsection occt_draw_12_1_10 2dort
10098
10099Syntax:
10100~~~~~
101012dort <x> <y>
10102~~~~~
10103
10104Returns 2D vector rotated on 90 degrees.
10105
10106Example:
10107~~~~~{.cpp}
101082dort 1 2
10109~~~~~
10110
10111@subsubsection occt_draw_12_1_11 distpp
10112
10113Syntax:
10114~~~~~
10115distpp <x1> <y1> <z1> <x2> <y2> <z2>
10116~~~~~
10117
10118Returns distance between two 3D points.
10119
10120Example:
10121~~~~~{.cpp}
10122distpp 1 2 3 4 5 6
10123~~~~~
10124
10125@subsubsection occt_draw_12_1_12 2ddistpp
10126
10127Syntax:
10128~~~~~
101292ddistpp <x1> <y1> <x2> <y2>
10130~~~~~
10131
10132Returns distance between two 2D points.
10133
10134Example:
10135~~~~~{.cpp}
101362ddistpp 1 2 3 4
10137~~~~~
10138
10139@subsubsection occt_draw_12_1_13 distplp
10140
10141Syntax:
10142~~~~~
10143distplp <x0> <y0> <z0> <nx> <ny> <nz> <xp> <yp> <zp>
10144~~~~~
10145
10146Returns distance between plane defined by point and normal direction and another point.
10147
10148Example:
10149~~~~~{.cpp}
10150distplp 0 0 0 0 0 1 5 6 7
10151~~~~~
10152
10153@subsubsection occt_draw_12_1_14 distlp
10154
10155Syntax:
10156~~~~~
10157distlp <x0> <y0> <z0> <dx> <dy> <dz> <xp> <yp> <zp>
10158~~~~~
10159
10160Returns distance between 3D line defined by point and direction and another point.
10161
10162Example:
10163~~~~~{.cpp}
10164distlp 0 0 0 1 0 0 5 6 7
10165~~~~~
10166
10167@subsubsection occt_draw_12_1_15 2ddistlp
10168
10169Syntax:
10170~~~~~
101712ddistlp <x0> <y0> <dx> <dy> <xp> <yp>
10172~~~~~
10173
10174Returns distance between 2D line defined by point and direction and another point.
10175
10176Example:
10177~~~~~{.cpp}
101782ddistlp 0 0 1 0 5 6
10179~~~~~
10180
10181@subsubsection occt_draw_12_1_16 distppp
10182
10183Syntax:
10184~~~~~
10185distppp <x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3>
10186~~~~~
10187
10188Returns deviation of point (x2,y2,z2) from segment defined by points (x1,y1,z1) and (x3,y3,z3).
10189
10190Example:
10191~~~~~{.cpp}
10192distppp 0 0 0 1 1 0 2 0 0
10193~~~~~
10194
10195@subsubsection occt_draw_12_1_17 2ddistppp
10196
10197Syntax:
10198~~~~~
101992ddistppp <x1> <y1> <x2> <y2> <x3> <y3>
10200~~~~~
10201
10202Returns 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.
10203
10204Example:
10205~~~~~{.cpp}
102062ddistppp 0 0 1 -1 2 0
10207~~~~~
10208
10209@subsubsection occt_draw_12_1_18 barycen
10210
10211Syntax:
10212~~~~~
10213barycen <x1> <y1> <z1> <x2> <y2> <z2> <par>
10214~~~~~
10215
10216Returns point of a given parameter between two 3D points.
10217
10218Example:
10219~~~~~{.cpp}
10220barycen 0 0 0 1 1 1 0.3
10221~~~~~
10222
10223@subsubsection occt_draw_12_1_19 2dbarycen
10224
10225Syntax:
10226~~~~~
102272dbarycen <x1> <y1> <x2> <y2> <par>
10228~~~~~
10229
10230Returns point of a given parameter between two 2D points.
10231
10232Example:
10233~~~~~{.cpp}
102342dbarycen 0 0 1 1 0.3
10235~~~~~
10236
10237@subsubsection occt_draw_12_1_20 cross
10238
10239Syntax:
10240~~~~~
10241cross <x1> <y1> <z1> <x2> <y2> <z2>
10242~~~~~
10243
10244Returns cross product of two 3D vectors.
10245
10246Example:
10247~~~~~{.cpp}
10248cross 1 0 0 0 1 0
10249~~~~~
10250
10251@subsubsection occt_draw_12_1_21 2dcross
10252
10253Syntax:
10254~~~~~
102552dcross <x1> <y1> <x2> <y2>
10256~~~~~
10257
10258Returns cross product of two 2D vectors.
10259
10260Example:
10261~~~~~{.cpp}
102622dcross 1 0 0 1
10263~~~~~
10264
10265@subsubsection occt_draw_12_1_22 dot
10266
10267Syntax:
10268~~~~~
10269dot <x1> <y1> <z1> <x2> <y2> <z2>
10270~~~~~
10271
10272Returns scalar product of two 3D vectors.
10273
10274Example:
10275~~~~~{.cpp}
10276dot 1 0 0 0 1 0
10277~~~~~
10278
10279@subsubsection occt_draw_12_1_23 2ddot
10280
10281Syntax:
10282~~~~~
102832ddot <x1> <y1> <x2> <y2>
10284~~~~~
10285
10286Returns scalar product of two 2D vectors.
10287
10288Example:
10289~~~~~{.cpp}
102902ddot 1 0 0 1
10291~~~~~
10292
97f3782b 10293@subsubsection occt_draw_12_1_24 scale
472634fa 10294
10295Syntax:
10296~~~~~
10297scale <x> <y> <z> <factor>
10298~~~~~
10299
10300Returns 3D vector multiplied by scalar.
10301
10302Example:
10303~~~~~{.cpp}
10304scale 1 0 0 5
10305~~~~~
10306
97f3782b 10307@subsubsection occt_draw_12_1_25 2dscale
472634fa 10308
10309Syntax:
10310~~~~~
103112dscale <x> <y> <factor>
10312~~~~~
10313
10314Returns 2D vector multiplied by scalar.
10315
10316Example:
10317~~~~~{.cpp}
103182dscale 1 0 5
10319~~~~~
10320
10321@subsection occt_draw_12_2 Measurements commands
10322
10323This section describes commands that make possible to provide measurements on a model.
10324
10325@subsubsection occt_draw_12_2_1 pnt
10326
10327Syntax:
10328~~~~~
10329pnt <object>
10330~~~~~
10331
10332Returns 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".
10333
10334Example:
10335~~~~~{.cpp}
10336vertex v 0 1 0
10337pnt v
10338~~~~~
10339
10340@subsubsection occt_draw_12_2_2 pntc
10341
10342Syntax:
10343~~~~~
10344pntc <curv> <par>
10345~~~~~
10346
10347Returns coordinates of point on 3D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "cvalue".
10348
10349Example:
10350~~~~~{.cpp}
10351circle c 0 0 0 10
10352pntc c [dval pi/2]
10353~~~~~
10354
10355@subsubsection occt_draw_12_2_3 2dpntc
10356
10357Syntax:
10358~~~~~
103592dpntc <curv2d> <par>
10360~~~~~
10361
10362Returns coordinates of point on 2D curve with given parameter. Actually this command is based on the command @ref occt_draw_6_6_2 "2dcvalue".
10363
10364Example:
10365~~~~~{.cpp}
10366circle c 0 0 10
103672dpntc c [dval pi/2]
10368~~~~~
10369
10370@subsubsection occt_draw_12_2_4 pntsu
10371
10372Syntax:
10373~~~~~
10374pntsu <surf> <u> <v>
10375~~~~~
10376
10377Returns coordinates of point on surface with given parameters. Actually this command is based on the command @ref occt_draw_6_6_3 "svalue".
10378
10379Example:
10380~~~~~{.cpp}
10381cylinder s 10
10382pntsu s [dval pi/2] 5
10383~~~~~
10384
10385@subsubsection occt_draw_12_2_5 pntcons
10386
10387Syntax:
10388~~~~~
10389pntcons <curv2d> <surf> <par>
10390~~~~~
10391
10392Returns 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".
10393
10394Example:
10395~~~~~{.cpp}
10396line c 0 0 1 0
10397cylinder s 10
10398pntcons c s [dval pi/2]
10399~~~~~
10400
10401@subsubsection occt_draw_12_2_6 drseg
10402
10403Syntax:
10404~~~~~
10405drseg <name> <x1> <y1> <z1> <x2> <y2> <z2>
10406~~~~~
10407
10408Creates a linear segment between two 3D points. The new object is given the *name*. The object is drawn in the axonometric view.
10409
10410Example:
10411~~~~~{.cpp}
10412drseg s 0 0 0 1 0 0
10413~~~~~
10414
10415@subsubsection occt_draw_12_2_7 2ddrseg
10416
10417Syntax:
10418~~~~~
104192ddrseg <name> <x1> <y1> <x2> <y2>
10420~~~~~
10421
10422Creates a linear segment between two 2D points. The new object is given the *name*. The object is drawn in the 2D view.
10423
10424Example:
10425~~~~~{.cpp}
104262ddrseg s 0 0 1 0
10427~~~~~
10428
10429@subsubsection occt_draw_12_2_8 mpick
10430
10431Syntax:
10432~~~~~
10433mpick
10434~~~~~
10435
10436Prints 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.
10437
10438Example:
10439~~~~~{.cpp}
10440mpick
10441~~~~~
10442
10443@subsubsection occt_draw_12_2_9 mdist
10444
10445Syntax:
10446~~~~~
10447mdist
10448~~~~~
10449
10450Prints 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.
10451
10452Example:
10453~~~~~{.cpp}
10454mdist
10455~~~~~
10456
bf62b306 10457@section occt_draw_11 Extending Test Harness with custom commands
72b7576f 10458
10459
10460The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism.
10461
10462
bf62b306 10463@subsection occt_draw_11_1 Custom command implementation
72b7576f 10464
10465Custom 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 10466
bf62b306 10467**Example:**
79d580f2 10468~~~~~
bf62b306 10469static Standard_Integer myadvcurve(Draw_Interpretor& di, Standard_Integer n, char** a)
72b7576f 10470{
10471...
10472}
79d580f2 10473~~~~~
72b7576f 10474
10475For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx).
10476
10477
bf62b306 10478@subsection occt_draw_11_2 Registration of commands in Test Harness
72b7576f 10479
10480To become available in the Test Harness the custom command must be registered in it. This should be done as follows.
72b7576f 10481
bf62b306 10482**Example:**
79d580f2 10483~~~~~
bf62b306 10484void MyPack::CurveCommands(Draw_Interpretor& theCommands)
72b7576f 10485{
10486...
bf62b306 10487char* g = "Advanced curves creation";
72b7576f 10488
3f812249 10489theCommands.Add ( "myadvcurve", "myadvcurve name p1 p2 p3 - Creates my advanced curve from points",
bf62b306 10490 __FILE__, myadvcurve, g );
72b7576f 10491...
10492}
79d580f2 10493~~~~~
72b7576f 10494
bf62b306 10495@subsection occt_draw_11_3 Creating a toolkit (library) as a plug-in
72b7576f 10496
bf62b306 10497All 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 10498
bf62b306 10499This exported function *PLUGINFACTORY()* must be implemented only once per library.
72b7576f 10500
bf62b306 10501For 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 10502
bf62b306 10503**Example:**
10504~~~~~
10505#include <Draw_PluginMacro.hxx>
10506
10507void MyPack::Factory(Draw_Interpretor& theDI)
10508{
10509...
10510//
10511MyPack::CurveCommands(theDI);
10512...
10513}
72b7576f 10514
bf62b306 10515// Declare entry point PLUGINFACTORY
10516DPLUGIN(MyPack)
10517~~~~~
72b7576f 10518
bf62b306 10519@subsection occt_draw_11_4 Creation of the plug-in resource file
72b7576f 10520
04c2daa4 10521As 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 10522For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name.
10523Thus, 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 10524For 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 10525
bf62b306 10526**Examples** (file MyDrawPlugin):
10527~~~~~
72b7576f 10528! Hierarchy of plug-ins
dba69de2 10529ALL : ADVMODELING, MESHING
10530DEFAULT : MESHING
10531ADVMODELING : ADVSURF, ADVCURV
72b7576f 10532
10533! Mapping from naming to toolkits (libraries)
dba69de2 10534ADVSURF : TKMyAdvSurf
10535ADVCURV : TKMyAdvCurv
10536MESHING : TKMyMesh
bf62b306 10537~~~~~
72b7576f 10538
67d7f07f 10539For 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 10540
10541
bf62b306 10542@subsection occt_draw_11_5 Dynamic loading and activation
72b7576f 10543
67d7f07f 10544Loading 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 10545
67d7f07f 10546The procedure consists in defining the system variables and using the *pload* commands in the Test Harness session.
72b7576f 10547
e5bd0d98 10548**Example:**
e5bd0d98 10549~~~~
bf62b306 10550Draw[]> set env(CSF_MyDrawPluginDefaults) /users/test
10551Draw[]> pload -MyDrawPlugin ALL
e5bd0d98 10552~~~~
72b7576f 10553