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