Open CASCADE Technology
7.6.0
|
|
This manual explains how to use Draw, the test harness for Open CASCADE Technology (OCCT). Draw is a command interpreter based on TCL and a graphical system used to test and demonstrate Open CASCADE Technology modeling libraries.
Draw 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.
Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.
Scripts may be written to customize Draw and perform tests. New types of objects and new commands may be added using the C++ programming language.
Draw consists of:
There is also a set of commands for each delivery unit in the modeling libraries:
This documentation describes:
This document is a reference manual. It contains a full description of each command. All descriptions have the format illustrated below for the exit command.
Terminates the Draw, TCL session. If the commands are read from a file using the source command, this will terminate the file.
Example:
Install Draw and launch Emacs. Get a command line in Emacs using Esc x and key in woksh.
All 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.
Declaration 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.
Test Harness executable DRAWEXE is located in the $CASROOT/<platform>/bin 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).
Open CASCADE Technology is shipped with the DrawPlugin resource file located in the $CASROOT/src/DrawResources directory.
The format of the file is compliant with standard Open CASCADE Technology resource files (see the Resource_Manager.hxx file for details).
Each 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.
Example: (excerpt from DrawPlugin):
To load a plug-in declared in the resource file and to activate the commands the following command must be used in Test Harness:
Where:
According 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 $CASROOT/src/DrawResources directory.
This 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 $CASROOT/src/DrawResources 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.
This command will find the default DrawPlugin file and the DEFAULT key. The latter finally maps to the TKTopTest toolkit which implements basic modeling commands.
The 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.
This 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:
TCL 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.
The basic program for TCL is a script. A script consists of one or more commands. Commands are separated by new lines or semicolons.
Each command consists of one or more words; the first word is the name of a command and additional words are arguments to that command.
Words 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.
The 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.
The following substitutions are performed by TCL:
Variable 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.
Example:
Command substitution is triggered by the [ ] characters. The brackets must enclose a valid script. The script is evaluated and the result is substituted.
Compare command construction in csh.
Example:
Backslash 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.
TCL uses two forms of quoting to prevent substitution and word breaking.
Double quote quoting enables the definition of a string with space and tabs as a single word. Substitutions are still performed inside the inverted commas " ".
Example:
Braces 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.
Example:
Comments 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.
Example:
The 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.
Example:
TCL 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.
TCL provides a mechanism to link user data to variables. Using this functionality, Draw defines its variables as TCL variables with associated data.
The 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 $ does not change the result of a command. The content of a Draw variable is accessed using appropriate commands.
There are many kinds of Draw variables, and new ones may be added with C++. Geometric and topological variables are described below.
Draw 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.
Example:
It 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.
Syntax:
set assigns a string value to a variable. If the variable does not already exist, it is created.
Without a value, set returns the content of the variable.
unset deletes variables. It is also used to delete Draw variables.
Example:
Note, that the set command can set only one variable, unlike the dset command.
Syntax
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.
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.
Example:
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. (a + b) is parsed as three words: "(a + b)" or (a+b) are correct.
Syntax:
del command does the same thing as unset, but it deletes the variables matched by the pattern.
dall command deletes all variables in the session.
TCL 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.
This allows you to insert lists within lists.
Example:
Many TCL commands return lists and foreach is a useful way to create loops on list elements.
TCL 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:
Syntax
If evaluates the condition and the script to see whether the condition is true.
Example:
Syntax:
The 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. \
Example:
Syntax:
Within loops, the break and continue commands have the same effect as in C.
break interrupts the innermost loop and continue jumps to the next iteration.
Example:
TCL 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.
The 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.
There 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.
As 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.
Syntax:
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.
return gives a return value to the procedure.
Example:
Syntax:
global accesses high level variables. Unlike C, global variables are not visible in procedures.
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.
Note that in the following examples the $ character is always necessarily used to access the arguments.
Example:
This 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:
Note that Draw also features a GUI task bar providing an alternative way to give certain general, graphic and display commands
This section describes several useful commands:
Syntax:
Provides help or modifies the help information.
help without arguments lists all groups and the commands in each group.
Specifying 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.
Example:
Syntax:
Executes a file.
The exit command will terminate the file.
Syntax:
Saves 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.
If a command returns an error it is saved with a comment mark.
The file created by spy can be executed with the source command.
Example:
Syntax:
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.
Example:
Syntax:
Suspends 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.
Syntax:
Without arguments, chrono activates Draw chronometers. The elapsed time ,cpu system and cpu user times for each command will be printed.
With arguments, chrono is used to manage activated chronometers. You can perform the following actions with a chronometer.
Example:
Syntax:
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.
Use directory to return a list of all Draw global variables matching a pattern.
Example:
Syntax:
whatis returns short information about a Draw variable. This is usually the type name.
dump returns a brief type description, the coordinates, and if need be, the parameters of a Draw variable.
Example:
Note The behavior of whatis on other variables (not Draw) is not excellent.
Syntax:
Example:
Syntax:
If the path starts with a dot (.) only the last directory name will be changed in the path.
The exact content of the file is type-dependent. They are usually ASCII files and so, architecture independent.
Example:
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.
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.
Example of DrawTrSurf
Example of DBRep
Example of DrawTrSurf
Example of DBRep
Graphic 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.
Syntax:
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.
As 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..
delete deletes a view. If no index is given, all the views are deleted.
Type selects from the following range:
The index, the type, the current zoom are displayed in the window title .
Example:
See also: axo, pers, top, bottom, left, right, front, back, mu4, v2d, av2d, smallview
Syntax:
All 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.
See also: view, delete
Syntax:
Example:
See also: fit, 2dfit
Syntax:
The p_ 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.
See also: fit, 2dfit
Syntax:
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.
When fitting all views a unique zoom is computed for all the views. All views are on the same scale.
Example:
See also: zoom, mu, pu
Syntax:
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.
Example:
Syntax:
Example:
Note: Do not use a negative or null focal value.
See also: pers
Syntax:
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.
The 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.
Example:
Note that the color change will be visible on the next redraw of the views, for example, after fit or mu, etc.
Syntax:
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.
The coordinates are real space coordinates.
Example:
Syntax:
Example:
Note: When more than one view is present, specify the index of the view.
Only use a postscript printer to print postscript files.
See also: color
Syntax:
wclick defers an event until the mouse button is clicked. The message just click
is displayed.
Use the pick command to get graphic input. The arguments must be names for variables where the results are stored.
When 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.
This option is useful for tracking the pointer.
Note that the results are stored in Draw numeric variables.
Example:
See also: repaint
Draw provides commands to manage the display of objects.
The 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.
Example:
Syntax:
By 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.
When autodisplay is off, using the dot return argument is ineffective.
Example:
Syntax:
Example:
Syntax:
erase removes objects from all views. erase without arguments erases everything in 2d and 3d.
clear erases only 3d objects and 2dclear only 2d objects. erase without arguments is similar to clear; 2dclear.
Example:
These commands have the same meaning as correspondingly display, donly and erase, but with the difference that they evaluate the arguments using glob pattern rules. For example, to display all objects with names d_1, d_2, d_3, etc. it is enough to run the command:
Syntax:
These commands are useful within loops or in scripts.
When 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.
Graphic 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.
See also: pick command.
Syntax:
Creates a new View window with the specified view_name. By default the view is created in the viewer and in the graphic driver shared with the active view.
If driverName is not specified the driver will be shared with the active view. If viewerName is not specified the viewer will be shared with the active view.
Syntax:
Displays help in the 3D viewer window. The help consists in a list of hotkeys and their functionalities.
Syntax:
Displays top view in the 3D viewer window. Orientation +X+Y.
Example:
Syntax:
Displays axonometric view in the 3D viewer window. Orientation +X-Y+Z.
Example:
Syntax:
Loads image file as background. filltype must be NONE, CENTERED, TILED or STRETCH.
Example:
Syntax:
Removes all objects from the viewer.
Syntax:
Forcibly redisplays the shape in the 3D viewer window.
Syntax:
Automatic zoom/panning. Objects in the view are visualized to occupy the maximum surface.
Syntax:
Automatic depth panning. Objects in the view are visualized to occupy the maximum 3d space.
Syntax:
Read pixel value for active view.
Syntax:
Emulates different types of selection:
Syntax:
Emulates cursor movement to pixel position (x,y).
Syntax:
Gets or sets the current view parameters.
Syntax:
Adds a shape to selection or removes one from it.
Syntax:
Returns the number of selected objects in the interactive context.
Syntax:
Hidden line removal algorithm:
Syntax:
Changes the type of HLR algorithm used for shapes. If the algo_type is algo, the exact HLR algorithm is used, otherwise the polygonal algorithm is used for defined shapes.
If 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.
Note that this command works with instances of AIS_Shape or derived classes only, other interactive object types are ignored.
Syntax:
Manages camera parameters. Prints the current value when the option is called without argument.
Orthographic camera:
Perspective camera:
Stereoscopic camera:
Example:
Syntax:
Defines the stereo output mode. The following modes are available:
Example:
Syntax:
Enables/disables objects clipping.
Syntax:
Displays named objects. Option -local enables display of objects in the local selection context. Local selection context will be opened if there is not any.
Example:
Syntax:
Displays only selected or named objects. If there are no selected or named objects, nothing is done.
Example:
Syntax:
Displays all erased interactive objects (see vdir and vstate). Option -local enables displaying objects in the local selection context.
Example:
Syntax:
Erases some selected or named objects. If there are no selected or named objects, the whole viewer is erased.
Example:
Syntax:
Erases all objects displayed in the viewer.
Example:
Syntax:
Sets display mode for all, selected or named objects.
Example:
Syntax:
Displays all objects of a given type. The following types are possible: Point, Axis, Trihedron, PlaneTrihedron, Line, Circle, Plane, Shape, ConnectedShape, MultiConn.Shape, ConnectedInter., MultiConn., Constraint and Dimension.
Syntax:
Erases all objects of a given type. Possible type is Point, Axis, Trihedron, PlaneTrihedron, Line, Circle, Plane, Shape, ConnectedShape, MultiConn.Shape, ConnectedInter., MultiConn., Constraint and Dimension.
Syntax:
Makes a list of known types and signatures in AIS.
Syntax:
Manages presentation properties of all, selected or named objects.
Aliases:
Manages presentation properties (color, material, transparency) of all objects, selected or named.
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.
Transparency. The Transp may be between 0.0 (opaque) and 1.0 (fully transparent). **Warning: at 1.0 the shape becomes invisible.
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.
Line width. Specifies width of the edges. The LineWidth may be between 0.0 and 10.0.
Example:
Syntax:
Sets deflection coefficient that defines the quality of the shape’s representation in the shading mode. Default coefficient is 0.0008.
Example:
Syntax:
Sets default deflection coefficient (0.0008) that defines the quality of the shape’s representation in the shading mode.
Syntax:
Activates selection mode for all selected or named shapes:
Example:
Syntax:
Deactivates all selection modes for all shapes.
Syntax:
Extracts the contents of the viewer window to a image file.
Syntax:
Displays the list of displayed objects.
Syntax:
Hilights/unhilights named or selected objects which are displayed at neutral state with subintensity color.
Example:
Syntax:
Displays active entities (sensitive entities of one of the standard types corresponding to active selection modes).
Standard entity types are those defined in Select3D package:
Syntax:
Erases active entities.
Syntax:
Reads shape from BREP-format file and displays it in the viewer.
Example:
Syntax:
Reports show/hidden state for selected or named objects:
Syntax:
Turns on/off ray tracing renderer.
Syntax:
Manages rendering parameters:
Unlike vcaps, these parameters dramatically change visual properties. The command is intended to control presentation quality depending on hardware capabilities and performance.
Example:
Syntax:
Enables rendering using a shader program.
Syntax:
Sets background color.
Example:
Syntax:
Creates a new AIS_Trihedron object or changes existing trihedron. If no argument is set, the default trihedron (0XYZ) is created.
Example:
Syntax:
Creates a plane from a trihedron selection. If no arguments are set, the default plane is created.
Syntax:
Changes 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.
Example:
Syntax:
Creates an axis. If the values are not defined, an axis is created by interactive selection of two vertices or one edge
Example:
Syntax:
Creates an axis by interactive selection of an edge and a vertex.
Syntax:
Creates an axis by interactive selection of an edge and a vertex. The axis will be orthogonal to the selected edge.
Syntax:
Creates 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).
Example:
Syntax:
Creates a plane from named or interactively selected entities. TypeOfSensitivity:
Example:
Syntax:
Creates a plane from interactively selected vertex and face.
Syntax:
Creates a plane from interactive selected face and coplanar edge.
Syntax:
Creates a line from coordinates, named or interactively selected vertices.
Example:
Syntax:
Creates a circle from named or interactively selected entities. Parameter IsFilled is defined as 0 or 1.
Example:
Syntax:
Creates a plane with a 2D trihedron from an interactively selected face.
Syntax:
Sets the selection mode for an object. If the object value is not defined, the selection mode is set for all displayed objects. Mode_number is a non-negative integer encoding different interactive object classes. For shapes the following mode_number values are allowed:
Example:
Syntax:
Creates AIS_ConnectedInteractive object from the input object and location and displays it.
Example:
Syntax:
Creates and displays a filled triangle from named points.
Example:
Syntax:
Creates and displays a segment from named points.
Example:
Syntax:
Creates an interactive object for an arbitrary set of points from the triangulated shape. Additional options:
Creates an arbitrary set of points (npts) randomly distributed on a spheric surface or within a spheric volume (x y z r). Additional options:
Example:
Syntax:
Manages clipping planes
Example:
Syntax:
Builds angle, length, radius or diameter dimension interactive object name.
Attention: length dimension can't be built without working plane.
Example:
Syntax:
Sets parameters for angle, length, radius and diameter dimension name.
Example:
Syntax:
Sets parameters for angle dimension name.
Example:
Syntax:
Sets parameters for length dimension name.
Example:
Syntax:
Moves picked or named (if name parameter is defined) dimension to picked mouse position or input point with coordinates x,y,z. Text label of dimension name is moved to position, another parts of dimension are adjusted.
Example:
MeshVS (Mesh Visualization Service) component provides flexible means of displaying meshes with associated pre- and post- processor data.
Syntax:
Creates a MeshVS_Mesh object based on STL file data. The object will be displayed immediately.
Example:
Syntax:
Changes the display mode of object meshname. The displaymode is integer, which can be:
Example:
Syntax:
Changes the selection mode of object meshname. The selectionmode is integer OR-combination of mode flags. The basic flags are the following:
Example:
Syntax:
Changes the face interior color of object meshname. The red, green and blue are real values between 0 and 1.
Example:
Syntax:
Changes the color of face borders for object meshname. The red, green and blue are real values between 0 and 1.
Example:
Syntax:
Changes the material of object meshname.
material is represented with an integer value as follows (equivalent to enumeration Graphic3d_NameOfMaterial):
Example:
Syntax:
Changes 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.
Example:
Syntax:
Displays meshname in the viewer (if it is erased).
Example:
Syntax:
Hides meshname in the viewer.
Example:
Syntax:
Hides only selected entities. The other part of meshname remains visible.
Syntax:
Shows only selected entities. The other part of meshname becomes invisible.
Syntax:
Changes the state of all entities to visible for meshname.
Syntax:
Deletes MeshVS_Mesh object meshname.
Example:
A specific plugin with alias VIS should be loaded to have access to VIS functionality in DRAW Test Harness:
Syntax:
Creates a window for VTK viewer.
Syntax:
Displays named objects.
Example:
Syntax:
Erases named objects. If no arguments are passed, erases all displayed objects.
Example:
Syntax:
Automatic zoom/panning.
Syntax:
Sets display mode for a named object. If no arguments are passed, sets the given display mode for all displayed objects The possible modes are: 0 (WireFrame) and 1 (Shading).
Example:
Syntax:
Sets selection mode for a named object. If no arguments are passed, sets the given selection mode for all the displayed objects.
Example:
Syntax:
Imitates mouse cursor moving to point with the given display coordinates x,y.
Example:
Syntax:
Imitates mouse cursor moving to point with the given display coordinates and performs selection at this point.
Example:
Syntax:
Dumps the contents of VTK viewer to image. It supports:
Example:
Syntax:
Sets 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].
Example:
This chapter contains a set of commands for Open CASCADE Technology Application Framework (OCAF).
Syntax:
Creates a new docname document with MDTV-Standard or described format.
Example:
Syntax:
Returns 0, if path document is managed by the application session, 1 – otherwise.
Example:
Syntax:
Makes a list of documents handled during the session of the application.
Syntax:
Retrieves the document of file docname in the path path. Overwrites the document, if it is already in session.
option -stream activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
Example:
Syntax:
Closes docname document. The document is no longer handled by the applicative session.
Example:
Syntax:
Saves docname active document.
Example:
Syntax:
Saves the active document in the file docname in the path path. Overwrites the file if it already exists.
option -stream activates usage of alternative interface of OCAF persistence working with C++ streams instead of file names.
Example:
Syntax:
Creates the label expressed by <entry> if it does not exist.
Example
Syntax:
Finds (or creates) a TagSource attribute located at father label of <taggerlabel> and makes a new child label.
Example
Syntax:
Returns the list of attributes of label.
Example
Syntax:
Forgets all attributes of the label.
Example
Syntax:
Returns the main label of the framework.
Example:
Syntax:
Sets 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
Example:
Syntax:
Undoes value steps.
Example:
Syntax:
Redoes value steps.
Example:
Syntax:
Opens a new command transaction.
Example:
Syntax:
Commits the Command transaction.
Example:
Syntax:
This is a shortcut for Commit and Open transaction.
Example:
Syntax:
Aborts the Command transaction.
Example:
Syntax:
Copies the contents of entry to Xentry. No links are registered.
Example:
Syntax:
Updates external reference set at entry.
Example:
Syntax:
Aborts the Command transaction. Copies the content of entry to Xentry. The link is registered with an Xlink attribute at Xentry label.
Example:
Syntax:
Sets modifications on labels impacted by external references to the entry. The document becomes invalid and must be recomputed
Example:
Syntax:
Displays parameters of docname document.
Example:
Syntax:
Creates a new data framework.
Example:
Syntax:
Clears a data framework.
Example:
Syntax:
Copies a data framework.
Example:
Syntax:
Copies a label.
Example:
Syntax:
Makes a mini-dump of a data framework.
Example:
Syntax:
Makes an extended dump of a data framework.
Example:
Syntax:
Finds or creates an Integer attribute at entry label and sets value.
Example:
Syntax:
Gets a value of an Integer attribute at entry label and sets it to drawname variable, if it is defined.
Example:
Syntax:
Finds or creates a Real attribute at entry label and sets value.
Example:
Syntax:
Gets a value of a Real attribute at entry label and sets it to drawname variable, if it is defined.
Example:
Syntax:
Finds or creates an IntegerArray attribute at entry label with lower and upper bounds and sets **value1*, value2...
Example:
Syntax:
Gets a value of an IntegerArray attribute at entry label.
Example:
Syntax:
Finds or creates a RealArray attribute at entry label with lower and upper bounds and sets value1, *value2*…
Example:
Syntax:
Gets a value of a RealArray attribute at entry label.
Example:
Syntax:
Finds or creates a Comment attribute at entry label and sets value.
Example:
Syntax:
Gets a value of a Comment attribute at entry label.
Example:
Syntax:
Finds or creates an ExtStringArray attribute at entry label with lower and upper bounds and sets value1, *value2*…
Example:
Syntax:
Gets a value of an ExtStringArray attribute at entry label.
Example:
Syntax:
Finds or creates a Name attribute at entry label and sets value.
Example:
Syntax:
Gets a value of a Name attribute at entry label.
Example:
Syntax:
Creates a Reference attribute at entry label and sets reference.
Example:
Syntax:
Gets a value of a Reference attribute at entry label.
Example:
Syntax:
Creates a UAttribute attribute at entry label with localGUID.
Example:
Syntax:
Finds a UAttribute at entry label with localGUID.
Example:
Syntax:
Finds or creates a Function attribute at entry label with driver ID and failure index.
Example:
Syntax:
Finds a Function attribute at entry label and sets driver ID to ID variable and failure index to failure variable.
Example:
Syntax:
Finds or creates a Shape attribute at entry label. Creates or updates the associated NamedShape attribute by shape if shape is defined.
Example:
Syntax:
Creates or updates a NamedShape attribute at entry label by shape.
Example:
Syntax:
Sets a shape from NamedShape attribute associated with entry label to shape draw variable.
Example:
Syntax:
Finds or creates a Point attribute at entry label and sets point as generated in the associated NamedShape attribute.
Example:
Syntax:
Gets a vertex from NamedShape attribute at entry label and sets it to drawname variable, if it is defined.
Example:
Syntax:
Finds or creates an Axis attribute at entry label and sets axis as generated in the associated NamedShape attribute.
Example:
Syntax:
Gets a line from NamedShape attribute at entry label and sets it to drawname variable, if it is defined.
Example:
Syntax:
Finds or creates a Plane attribute at entry label and sets plane as generated in the associated NamedShape attribute.
Example:
Syntax:
Gets a plane from NamedShape attribute at entry label and sets it to drawname variable, if it is defined.
Example:
Syntax:
Creates 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.
Example:
Syntax:
Gets a geometry type from Geometry attribute at entry label.
Example:
Syntax:
Example:
Syntax:
Dumps a Constraint attribute at entry label
Example:
Syntax:
Creates a Variable attribute at entry label and sets isconstant flag and units as a string.
Example:
Syntax:
Gets an isconstant flag and units of a Variable attribute at entry label.
Example:
Syntax:
Returns the ultimate father of TreeNode attribute identified by its treenodeentry and its ID (or default ID, if ID is not defined).
Syntax:
Creates a TreeNode attribute on the treenodeentry label with its tree ID (or assigns a default ID, if the ID is not defined).
Syntax:
Inserts a TreeNode attribute with its tree fatherID (or default ID, if fatherID is not defined) on childentry as last child of fatherentry.
Syntax:
Inserts a TreeNode attribute with its tree fatherID (or default ID, if fatherID is not defined) on childentry as first child of fatherentry.
Syntax:
Inserts a TreeNode attribute with tree ID (or default ID, if ID is not defined) beforetreenode before treenodeentry.
Syntax:
Inserts a TreeNode attribute with tree ID (or default ID, if ID is not defined) aftertreenode after treenodeentry.
Syntax:
Removes a TreeNode attribute with tree ID (or default ID, if ID is not defined) from treenodeentry.
Syntax:
Iterates 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.
Example:
Syntax:
Initializes 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.
Example:
Syntax:
Returns TRUE if there is a current item in the iteration.
Syntax:
Moves to the next Item.
Syntax:
Returns the current treenode of ChildNodeIterator.
Syntax:
Moves to the next Brother. If there is none, goes up. This method is interesting only with allLevels behavior.
Syntax:
Creates and sets AISViewer attribute at root label, creates AIS viewer window.
Example:
Syntax:
Updates the AIS viewer window.
Example:
Syntax:
Displays 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.
Example:
Syntax:
Recomputes a presentation of AISobject from entry label and applies the visualization setting in AIS viewer.
Example:
Syntax:
Erases AISobject of entry label in AIS viewer.
Example:
Syntax:
Erases AISobject of entry label in AIS viewer, then AISobject is removed from AIS_InteractiveContext.
Example:
Syntax:
Creates 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).
Example:
Syntax:
Returns 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).
Example:
Syntax:
Deletes AISPresentation attribute (if it exists) of an entry label.
Example:
Syntax:
Sets (if transparency is defined) or gets the value of transparency for AISPresentation attribute of an entry label.
Example:
Syntax:
Tests AISPresentation attribute of an entry label by own transparency.
Example:
Syntax:
Sets (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 meshmat command).
Example:
Syntax:
Tests AISPresentation attribute of an entry label by own material.
Example:
Syntax:
Sets (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).
Example:
Syntax:
Tests AISPresentation attribute of an entry label by own color.
Example:
Draw 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.
In the context of Geometry, Draw includes the following types of variable:
Draw geometric variables never share data; the copy command will always make a complete copy of the content of the variable.
The following topics are covered in the nine sections of this chapter:
Where 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.
Likewise, 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.
This section deals with both points and curves. Types of curves are:
Curves are displayed with an arrow showing the last parameter.
Syntax:
Creates a 2d or 3d point, depending on the number of arguments.
Example:
Syntax:
Creates 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.
A 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.
Example:
Syntax:
Creates a 2d or a 3d circle.
In 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.
In 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.
The 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.
Example:
Syntax:
Creates 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:
Where:
Example:
Syntax:
Creates 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.
The Draw hyperbola is parameterized as follows:
Where:
Example:
Syntax:
Creates a 2d or 3d parabola. in the axis system defined by the first arguments. The origin is the apex of the parabola.
The Geom_Parabola is parameterized as follows:
Where:
Example:
Syntax:
Creates 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.
Example:
Syntax:
Creates 2d or 3d bspline curves; the pbsplinecurve and 2dpbsplinecurve commands create periodic bspline curves.
A 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.
The table of knots is an increasing sequence of reals without repetition. Multiplicities 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.
The poles must be given with their weights, use weights of 1 for a non rational curve, the number of poles must be:
Example:
Note that you can create the NURBS subset of bspline curves and surfaces by trimming analytical curves and surfaces and executing the command convert.
Syntax:
Creates a U or V isoparametric curve from a surface.
Example:
Note that this cannot be done from offset surfaces.
Syntax:
Create 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.
Example:
See also: project
Syntax:
Computes a 2d curve in the parametric space of a surface corresponding to a 3d curve. This can only be used on analytical surfaces.
If 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.
The following types of surfaces exist:
Surfaces 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.
Syntax:
Creates an infinite plane.
A 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.
The 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.
There 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.
Note that this definition will be used for all analytical surfaces.
Example:
Syntax:
A 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.
Example:
Syntax:
Creates 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.
Example:
Syntax:
Creates a sphere in the local coordinate system defined in the plane command. The sphere is centered at the origin.
To 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.
Example:
Syntax:
Creates 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.
To 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.
Example:
Syntax:
Use this command to create a bezier surface, rational or non-rational. First give the numbers of poles in the u and v directions.
Then give the poles in the following order: pole(1, 1), pole(nbupoles, 1), pole(1, nbvpoles) and pole(nbupoles, nbvpoles).
Weights may be omitted, but if you give one weight you must give all of them.
Example:
Syntax:
The 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.
See 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.
Example:
Syntax:
The trim commands create trimmed curves or trimmed surfaces. Note that trimmed curves and surfaces are classes of the Geom package.
After 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.
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.
Example:
Syntax:
Creates offset curves or surfaces at a given distance from a basis curve or surface. Offset curves and surfaces are classes from the *Geom *package.
The 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.
The offset curve or surface copies the basic geometry, which can be modified later.
Example:
Syntax:
Creates a surface of revolution from a 3d curve.
A 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.
To 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.
Example:
Syntax:
Creates 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.
In the syntax, dx,dy,dz gives the direction of extrusion.
To parameterize a surface of extrusion: u is the parameter along the extruded curve; the v parameter is along the direction of extrusion.
Example:
Syntax:
Creates 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.
Example:
Note that offset curves and surfaces are not processed by this command.
Draw provides commands to modify curves and surfaces, some of them are general, others restricted to bezier curves or bsplines.
General modifications:
Modifications for both bezier curves and bsplines:
Modifications for bezier curves:
Modifications for bspline:
Syntax:
The 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.
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.
Reversing a parameter on an analytical surface may create an indirect coordinate system.
Example:
Syntax:
For a bezier or bspline surface this command exchanges the u and v parameters.
Example:
Syntax:
segment and segsur segment a bezier curve and a bspline curve or surface respectively.
These 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.
This command must not be confused with trim which creates a new geometry.
Example:
Syntax:
incudeg and incvdeg increase the degree in the U or V parameter of a bezier or bspline surface.
Example:
Note that the geometry is modified.
Syntax:
move methods translate poles of a bezier curve, a bspline curve or a bspline surface.
Example:
Syntax:
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.
rempole removes a pole from a 2d or 3d bezier curve. Leave at least two poles in the curves.
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.
Example:
Syntax:
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.
insertuknot and insertvknot insert knots in a surface.
Example:
Syntax:
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.
By default, if no tolerance is given, the knot will always be removed.
Example:
Note that Curves or Surfaces may be modified.
Syntax:
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.
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.
Example:
Syntax:
These 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.
Example:
Draw provides commands to apply linear transformations to geometric objects: they include translation, rotation, mirroring and scaling.
Syntax:
The 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.
For 2d points or curves, use the 2dtranslate command.
Example:
NOTE Objects are modified by this command.
Syntax:
The 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.
For a 2d rotation, you need only give the center point and the angle. In 2d or 3d, the angle can be negative.
Example:
Syntax:
The mirror commands perform a mirror transformation of 2d or 3d geometry.
Example:
Syntax:
The 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.
Example:
Draw provides methods to compute information about curves and surfaces:
Syntax:
Sets the x, y (and optionally z) coordinates of the point P.
Example:
Syntax:
For 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.
Example:
Let 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 :
Syntax:
Computes 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.
Example:
Syntax:
localprop computes the curvature of a curve. minmaxcurandinf computes and prints the parameters of the points where the curvature is minimum and maximum on a 2d curve.
Example:
Syntax:
Returns 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.
Example:
Syntax:
Use proj to project a point on a 3d curve or a surface and 2dproj for a 2d curve.
The 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, ... *
Example:
Let us project a point on a torus
Syntax:
Computes the main curvatures of a surface at parameters *(u,v)*. If there are extra arguments, their curvatures are stored in variables c1 and c2.
Example:
Let us compute curvatures of a cylinder:
Syntax:
Intersects 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, ...
Example:
Syntax:
Displays the intersection points between 2d curves. Options: -tol - allows changing the intersection tolerance (default value is 1.e-3); -state - allows printing the intersection state for each point.
Example:
Syntax:
Displays the intersection points between two 2d curves. Curves must be only conic sections: 2d lines, circles, ellipses, hyperbolas, parabolas. The algorithm from IntAna2d_AnaIntersection is used.
Example:
Draw provides command to create curves and surfaces by approximation.
Syntax:
These 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.
Example:
Let us pick points and they will be fitted
Syntax:
Example:
Draw provides commands to project points/curves on curves/surfaces.
Syntax:
projponf projects point pnt on the face face. You can change the Extrema options:
Example
Syntax:
Builds all circles satisfying the condition:
Only 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.
Example:
Additionally it is possible to create a circle(s) with given center and tangent to the given curve (Curve-Point type).
Example:
Syntax:
Builds 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.
Example:
Draw 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.
On 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.
On surfaces, you can control the number of isoparametric curves displayed on the surface with the nbiso command.
On bezier and bspline curve and surface you can toggle the display of the control points with the clpoles and shpoles commands.
On bspline curves and surfaces you can toggle the display of the knots with the shknots and clknots commands.
Syntax:
dmod command allows choosing the display mode for a curve or a surface.
In 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.
In 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).
If 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.
Example:
Syntax:
Changes 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.
Example:
Let us display 35 meridians and 15 parallels on a sphere:
Syntax:
On bezier and bspline curves and surfaces, the control polygon is displayed by default: clpoles erases it and shpoles restores it.
Example:
Let us make a bezier curve and erase the poles
Syntax:
By 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.
Example:
Draw 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.
Topology 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.
The different topological shapes include:
Shapes 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).
The following topics are covered in the eight sections of this chapter:
The 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:
In Draw, shapes are displayed using isoparametric curves. There is color coding for the edges:
Syntax:
Determines or changes the number of isoparametric curves on shapes.
The 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.
discretisation changes the default number of points used to display the curves. The default value is 30.
Example:
Warning: don’t confuse isos and discretisation with the geometric commands nbisos and discr.
Syntax:
Example:
Syntax:
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.
With 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.
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.
nbshapes counts the number of shapes of each type in an entity.
Example:
Syntax:
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.
add inserts shape C into shape S. Verify that C and S reference compatible types of objects:
emptycopy and add should be used with care.
On 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.
Example:
Syntax:
compare compares the two shapes shape1 and shape2 using the methods TopoDS_Shape::IsSame() and TopoDS_Shape::IsEqual().
Example
Syntax:
issubshape checks if the shape subshape is sub-shape of the shape shape and gets its index in the shape.
Example
This group of commands is used to create topology from shapes and to extract shapes from geometry.
Syntax:
Creates a vertex at either a 3d location x,y,z or the point at parameter p on an edge.
Example:
Syntax:
Creates a point from the coordinates of a given vertex.
Example:
Syntax:
Example:
Example:
Syntax:
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.
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.
polyvertex creates a polygonal wire from vertices.
Example:
Syntax
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.
Code | **Values ** | Action |
---|---|---|
O | X Y Z | Sets the origin of the plane |
P | DX DY DZ UX UY UZ | Sets the normal and X of the plane |
F | X Y | Sets the first point |
X | DX | Translates a point along X |
Y | DY | Translates a point along Y |
L | DL | Translates a point along direction |
XX | X | Sets point X coordinate |
YY | Y | Sets point Y coordinate |
T | DX DY | Translates a point |
TT | X Y | Sets a point |
R | Angle | Rotates direction |
RR | Angle | Sets direction |
D | DX DY | Sets direction |
IX | X | Intersects with vertical |
IY | Y | Intersects with horizontal |
C | Radius Angle | Arc of circle tangent to direction |
Codes 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.
The point [code values] can be repeated any number of times and in any order to create the profile contour.
Suffix | Action |
---|---|
No suffix | Makes a closed face |
W | Make a closed wire |
WW | Make an open wire |
The profile shape definition is the suffix; no suffix produces a face, w is a closed wire, ww is an open wire.
Code letters are not case-sensitive.
Example:
Example:
Syntax:
Builds a profile in the XY plane from digitizes. By default the profile is closed and a face is built.
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.
The profile shape definition is the suffix; no suffix produces a face, w is a closed wire, ww is an open wire.
Example:
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. The offset distance defines the spacing and the positioning of the occurrences.
Syntax:
Where:
Example:
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.
Example:
Syntax:
mkplane generates a face from a planar wire. The planar surface will be constructed with an orientation which keeps the face inside the wire.
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.
Example:
Syntax:
mkcurve creates a 3d curve from an edge. The curve will be trimmed to the edge boundaries.
mksurface creates a surface from a face. The surface will not be trimmed.
Example:
Syntax:
Extracts 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.
Example:
Syntax:
Creates chamfers and fillets on 2D objects. Select two adjacent edges and:
The radius value produces a fillet between the two faces.
The distance is the length value from the edge between the two selected faces in a normal direction.
Example:
Let us create a 2d fillet:
Let us create a 2d chamfer using two distances:
Let us create a 2d chamfer using a defined distance and angle
Syntax:
Creates a shape projection which is normal to the target surface.
Example:
Primitive commands make it possible to create simple shapes. They include:
Syntax:
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.
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.
The 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.
Example:
Syntax:
All 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.
pcylinder creates a cylindrical block with the given radius and height.
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.
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.
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.
Example:
Syntax:
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.
Example:
Sweeping creates shapes by sweeping out a shape along a defined path:
Syntax:
Creates 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.
The 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.
Example:
Syntax:
Creates 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.
Example:
Syntax:
Creates a new shape by sweeping a shape known as the profile along a wire known as the spine.
Example:
Syntax:
options are :
These commands are used to create a shape from wires. One wire is designated as the contour that defines the direction; it is called the spine. At least one other wire is used to define the sweep profile.
Example:
Syntax:
thrusections creates a shape using wires that are positioned in different planes. Each wire selected must have the same number of edges and vertices. A bezier curve is generated between the vertices of each wire. The option [-N] means that no check is made on wires for direction.
Example:
Transformations 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.
Syntax:
Copies the structure of one shape, including the geometry, into another, newer shape.
Example:
Syntax:
tmove and reset modify the location, or the local coordinate system of a shape.
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).
Example:
Syntax:
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. When 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.)
Locations are very economic in the data structure because multiple occurrences of an object share the topological description.
Example:
Syntax:
Example:
sewing joins two or more shapes. Syntax:
Sewing joins shapes by connecting their adjacent or near adjacent edges. Adjacency can be redefined by modifying the tolerance value.
Example:
The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old Boolean operation algorithm. It also provides wider range of options and diagnostics. The algorithms of Boolean component are fully described in the Boolean Operations of boolean operation user guide.
For the Draw commands to perform operations in Boolean component, read the dedicated section Boolean operations commands
Drafting is creation of a new shape by tilting faces through an angle.
Blending is the creation of a new shape by rounding edges to create a fillet.
Syntax:
Creates a new shape by drafting one or more faces of a shape.
Identify 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.
Example:
Syntax:
Creates a chamfer along the edge between faces using:
Use the dot syntax to select the faces and edges.
Examples:
Let us create a chamfer based on equal distances from the edge (45 degree angle):
Let us create a chamfer based on different distances from the selected edge:
Let us create a chamfer based on a distance from the edge and an angle:
Syntax:
Creates 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.
Example:
Syntax:
Creates a boolean fusion of two shapes and then blends (fillets) the intersection edges using the given radius. Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
Example:
Syntax:
Creates a boolean cut of two shapes and then blends (fillets) the intersection edges using the given radius. Option [-d] enables the Debugging mode in which the error messages, if any, will be printed.
Example:
Syntax:
These three commands work together to create fillets with evolving radii.
Example:
Draw command removefeatures is intended for performing 3D Model Defeaturing, i.e. it performs the removal of the requested features from the shape.
Syntax:
Where: result - result of the operation; shape - the shape to remove the features from; f1, f2 - features to remove from the shape;
Options: nohist - disables the history collection; parallel - enables the parallel processing mode.
Draw module for making the shape periodic includes the following commands:
The command makes the shape periodic in the required directions with the required period. If trimming is given it trims the shape to fit the requested period.
Syntax:
Where: result - resulting periodic shape; shape - input shape to make it periodic: -x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period; -trim first - option to trim the shape to fit the required period, starting the period in first.
The command repeats the periodic shape in periodic direction requested number of time. The result contains the all the repeated shapes glued together. The command should be called after makeperiodic command.
Syntax:
Where: result - resulting shape; -x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
For the given shape the command returns the identical shapes located on the opposite sides of the periodic direction. All periodic twins should have the same geometry. The command should be called after makeperiodic command.
Syntax:
Where: twins - periodic twins for the given shape shape - shape to find the twins for
The command clears all previous repetitions of the periodic shape allowing to start the repetitions over. No arguments are needed for the command.
Draw module for making the touching same-dimensional shapes connected includes the following commands:
The command makes the input touching shapes connected.
Syntax:
Where: result - resulting connected shape. shape1 shape2 ... - shapes to be made connected.
The command returns the materials located on the requested side of the shape. The command should be called after the shapes have been made connected, i.e. after the command makeconnected.
Syntax:
Where: result - material shapes shape - shape for which the materials are needed +/- - side of a given shape ('+' for positive side, '-' - for negative).
The command makes the connected shape periodic in the required directions with the required period. The command should be called after the shapes have been made connected, i.e. after the command makeconnected.
Syntax:
Where: result - resulting periodic shape; shape - input shape to make it periodic: -x/y/z period - option to make the shape periodic in X, Y or Z direction with the given period; -trim first - option to trim the shape to fit the required period, starting the period in first.
The command repeats the connected periodic shape in the required periodic directions required number of times. The command should be called after the shapes have been made connected and periodic, i.e. after the commands makeconnected and cmakeperiodic.
Syntax:
Where: result - resulting shape; -x/y/z times - direction for repetition and number of repetitions (negative number of times means the repetition in negative direction).
The command returns all periodic twins for the shape. The command should be called after the shapes have been made connected and periodic, i.e. after the commands makeconnected and cmakeperiodic.
Syntax:
Where: twins - periodic twins of a shape. shape - input shape.
The command clears all previous repetitions of the periodic shape keeping the shape periodic. The 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. Otherwise the command will have no effect.
Syntax:
Analysis of shapes includes commands to compute length, area, volumes and inertial properties, as well as to compute some aspects impacting shape validity.
Syntax:
For computation of properties of the shape, exact geometry (curves, surfaces) or some discrete data (polygons, triangulations) can be used for calculations. The epsilon, if given, defines relative precision of computation. The closed flag, if present, forces computation only closed shells of the shape. The centroid coordinates will be put to DRAW variables x y z (if given). Shared entities will be taken in account only one time in the skip mode. All values are output with the full precision in the full mode. Preferable source of geometry data are triangulations in case if it exists, if the -tri key is used, otherwise preferable data is exact geometry. If epsilon is given, exact geometry (curves, surfaces) are used for calculations independently of using key -tri.
All 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.
Example:
Syntax:
Computes and displays the bounding box (BndBox) of a shape. The bounding box is a cuboid that circumscribes the source shape. Generally, bounding boxes can be divided into two main types:
Detailed information about this command is available in DRAW help-system (enter "help bounding" in DRAW application).
Example 1: Creation of AABB with given corners
Example 2: Compare AABB and OBB
The same result is obtained.
As we can see, the volume of OBB is significantly less than the volume of AABB.
Syntax:
Checks 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.
Example 1: Not interfered AABB
Example 2: Interfered AABB
Example 3: Not interfered OBB
Example 4: Interfered OBB
Syntax:
Calculates 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.
Example:
Syntax:
It is assumed that curves have the same parametrization range and startParam is less than finishParam.
Commands with prefix xdist allow checking the distance between two objects on even grid:
Examples
Syntax:
Where:
checkshape examines the selected object for topological and geometric coherence. The object should be a three dimensional shape.
Example:
Syntax:
Where:
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.
Example:
Syntax:
Where:
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.
Example:
Surface creation commands include surfaces created from boundaries and from spaces between shapes.
Syntax:
Creates a surface from a defined boundary. The boundary can be defined using edges, points, or other surfaces.
Example:
Syntax:
Creates 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.
To define the surface border:
The surface can pass through other points. These are defined after the border definition.
You can use the fillingparam command to access the filling parameters.
The options are:
Example:
Complex topology is the group of commands that modify the topology of shapes. This includes feature modeling.
Syntax:
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.
The 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.
In 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.
The opening between the object interior and exterior is defined by the argument face or faces.
Example:
Syntax:
featprism loads the arguments for a prism with contiguous sides normal to the face.
featdprism loads the arguments for a prism which is created in a direction normal to the face and includes a draft angle.
featrevol loads the arguments for a prism with a circular evolution.
featlf loads the arguments for a linear rib or slot. This feature uses planar faces and a wire as a guideline.
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.
featperform loads the arguments to create the feature.
featperformval uses the defined arguments to create a feature with a limiting value.
All 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.
Examples:
Let us create a feature prism with a draft angle and a normal direction :
Let us create a feature prism with circular direction :
Let us create a slot using the linear feature :
Let us create a rib using the revolution feature :
Syntax:
Computes 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.
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.
Example:
Syntax:
Modifies the shape using the x, y, and z coefficients. You can reduce or magnify the shape in the x,y, and z directions.
Example:
Syntax:
Changes the NURBS curve definition of a shape to a Bspline curve definition. This conversion is required for asymmetric deformation and prepares the arguments for other commands such as deform. The conversion can be necessary when transferring shape data to other applications.
edgestofaces - The command allows building planar faces from the planar edges randomly located in 3D space.
It has the following syntax:
Options:
Draw module for 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:
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. By default it is TRUE, i.e. the history is filled and saved.
Syntax:
Example:
savehistory command saves the history from the session into a drawable object with the given name.
Syntax:
If the history of shape modifications performed during an operation is needed, the savehistory command should be called after the command performing the operation. If another operation supporting history will be performed before the history of the first operation is saved it will be overwritten with the new history.
Example:
isdeleted command checks if the given shape has been deleted in the given history.
Syntax:
Example:
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.
Syntax:
Example:
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.
Syntax:
Example:
Draw History mechanism allows fast and easy enabling of the Draw history support for the OCCT algorithms supporting standard history methods. To enable History commands for the algorithm it is necessary to save the history of the algorithm into the session. For that, it is necessary to put the following code into the command implementation just after the command is done:
Here is the example of how it is done in the command performing Split operation (see implementation of the bapisplit command):
The 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).
Texture 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.
Syntax:
TextureFile identifies the file containing the texture you want. The same syntax without TextureFile disables texture mapping. The question-mark ? lists available textures. IdOfTexture allows applying predefined textures.
Syntax:
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.
The syntax without ScaleU, ScaleV or ScaleUV disables texture scaling.
Syntax:
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.
The syntax without UOrigin, VOrigin or UVOrigin disables origin positioning.
Syntax:
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.
The same syntax without URepeat, VRepeat or UVRepeat disables texture repetition.
Syntax:
Vtexdefault sets or resets the texture mapping default parameters.
The defaults are:
This chapter describes existing commands of Open CASCADE Draw Test Harness that are used for performing, analyzing, debugging the algorithm in Boolean Component. See Boolean operations user's guide for the description of these algorithms.
All commands in this section perform Boolean operations on two shapes. One of them is considered as object, and the other as a tool.
These commands perform Boolean operations on two shapes:
These 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. It may be very useful as the intersection part is usually most time-consuming part of the operation.
Syntax:
Example:
Let's produce all four boolean operations on a box and a cylinder performing intersection only once:
These commands also perform Boolean operations on two shapes. These are the short variants of the bop* commands. Each 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.
Syntax:
bection command has some additional options for faces intersection:
Where: result - result of the operation shape1, shape2 - arguments of the operation -n2d - disables PCurve construction on both objects -n2d1 - disables PCurve construction on first object -n2d2 - disables PCurve construction on second object -na - disables approximation of the section curves
The 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. In 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.
The Boolean operations are based on the General Fuse operation (see General Fuse algorithm) which splits all input shapes basing on the intersection results. Depending on the type of Boolean operation the BOP algorithm choses the necessary splits of the arguments.
The 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.
The following commands are used to add the objects and tools for Boolean operations:
The following commands are used to clear the objects and tools:
So, 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.
The command bfillds performs intersection of the arguments (Objects and Tools) and stores the intersection results into internal Data Structure.
The command bbop is used for building the result of Boolean Operation. It has to be used after bfillds command.
Syntax:
Where: result - result of the operation iOp - type of Boolean Operation. It could have the following values: 0 - COMMON operation 1 - FUSE operation 2 - CUT operation 3 - CUT21 (opposite CUT, i.e. objects and tools are swapped) operation 4 - SECTION operation
Example
The command bbuild is used for building the result of General Fuse Operation. It has to be used after bfillds command. General Fuse operation does not make the difference between Objects and Tools considering both as objects.
Syntax:
Example
Split operation splits the Objects by the Tools. The command bsplit is used for building the result of Split operation. It has to be used after bfillds command.
Example
There 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. The command has the following features:
Syntax:
Where: result - result shape of the operation s1 s2 s3 s4 - arguments (solids) of the GF operation operation - type of boolean operation
Example
See the Cells Builder Usage for the Draw usage of Cells Builder algorithm.
The following commands are used to perform the operation using API implementation of the algorithms:
These commands have the same syntax as the analogical commands described above.
The algorithms in Boolean component have a wide range of options. To see the current state of all option the command boptions should be used. It has the following syntax:
To have an effect the options should be set before the operation (before bfillds command).
brunparallel command enables/disables the parallel processing mode of the operation.
Syntax:
Where: flag is the boolean flag controlling the mode: flag == 0 - parallel processing mode is off. flag != 0 - parallel processing mode is on.
The command is applicable for all commands in the component.
bnondestructive command enables/disables the safe processing mode in which the input arguments are protected from modification.
Syntax:
Where: flag is the boolean flag controlling the mode: flag == 0 - safe processing mode is off. flag != 0 - safe processing mode is on.
The command is applicable for all commands in the component.
bfuzzyvalue command sets the additional tolerance for operations.
Syntax:
The command is applicable for all commands in the component.
bglue command sets the gluing mode for the BOP algorithms.
Syntax:
Where: 0 - disables gluing mode. 1 - enables the Shift gluing mode. 2 - enables the Full gluing mode.
The command is applicable for all commands in the component.
bcheckinverted command enables/disables the check of the input solids on inverted status in BOP algorithms.
Syntax:
The command is applicable for all commands in the component.
buseobb command enables/disables the usage of OBB in BOP algorithms.
Syntax:
The command is applicable for all commands in the component.
bsimplify command enables/disables the result simplification after BOP. The command is applicable only to the API variants of GF, BOP and Split operations.
Syntax:
Where: -e 0/1 - enables/disables edges unification -f 0/1 - enables/disables faces unification -a tol - changes default angular tolerance of unification algo.
bdrawwarnshapes command enables/disables drawing of warning shapes of BOP algorithms.
Syntax:
The command is applicable for all commands in the component.
The following commands are analyzing the given shape on the validity of Boolean operation.
Syntax:
It 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:
Example:
In 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. bopcheck command does not modifies the input shape, thus can be safely used.
bopargcheck syntax:
As you can see bopargcheck performs more extended check of the given shapes than bopcheck.
Example: Let's make an edge with big vertices:
Here is the output of this command:
The following terms and definitions are used in this chapter:
All commands listed below are available when the Intersection Part of the algorithm is done (i.e. after the command bfillds).
bopds
Syntax:
Displays:
bopdsdump
Prints contents of the DS.
Example:
has the following meaning:
bopindex
Syntax:
Prints DS index of shape S.
bopiterator
Syntax:
Prints pairs of DS indices of source shapes that are intersected in terms of bounding boxes.
[t1 t2] are types of the shapes:
Example:
bopinterf
Syntax:
Prints contents of myInterfTB for the type of interference t:
Example:
Here, record (58, 12, 68) means:
bopsp
Displays split edges.
Example:
bopcb
Syntax:
Prints Common Blocks for:
Example:
This command dumps common blocks for the source edge with index 17.
bopfin
Syntax:
Prints Face Info about IN-parts for the face with DS index nF.
Example:
bopfon
Syntax:
Print Face Info about ON-parts for the face with DS index nF.
Example:
bopwho
Syntax:
Prints the information about the shape with DS index nF.
Example:
Example:
This means that shape 68 is a result of the following interferences:
bopnews
Syntax:
The commands listed below are available when the Building Part of the algorithm is done (i.e. after the command bbuild).
bopim
Syntax:
Shows the compound of shapes that are images of shape S from the argument.
This chapter presents some general information about Data Exchange (DE) operations.
DE commands are intended for translation files of various formats (IGES,STEP) into OCCT shapes with their attributes (colors, layers etc.)
This 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
Each Draw session has an interface model, which is a structure for keeping various information.
The first step of translation is loading information from a file into a model. The second step is creation of an OpenCASCADE shape from this model.
Each 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.
The model and the map are used for working with most of DE commands.
Syntax:
Reads an IGES file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted.
N | Mode | Description |
---|---|---|
0 | End | finish conversion and exit igesbrep |
1 | Visible roots | convert only visible roots |
2 | All roots | convert all roots |
3 | One entity | convert entity with number provided by the user |
4 | Selection | convert only entities contained in selection |
After 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.
The 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.
<selection> specifies the scope of selected entities in the model, by default it is xst-transferrable-roots. If we use symbol * as <selection> all roots will be translated.
See also the detailed description of Selecting IGES entities.
Example:
Syntax:
Sometimes 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. It 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. Optional parameter <IGES_type> can be 0TrimmedSurface, BoundedSurface or Face to specify the only type of IGES faces.
Example:
Syntax:
Writes an OCCT shape to an IGES file.
Example:
These commands are used during the translation of STEP models.
Syntax:
Read a STEP file to an OCCT shape. This command will interactively ask the user to select a set of entities to be converted:
N | Mode | Description |
---|---|---|
0 | End | Finish transfer and exit stepread |
1 | root with rank 1 | Transfer first root |
2 | root by its rank | Transfer root specified by its rank |
3 | One entity | Transfer entity with a number provided by the user |
4 | Selection | Transfer only entities contained in selection |
After the selected set of entities is loaded the user will be asked how loaded entities should be converted into OCCT shapes. The 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. <selection> specifies the scope of selected entities in the model. If we use symbol * as <selection> all roots will be translated.
See also the detailed description of Selecting STEP entities.
Example:
Syntax:
Writes an OCCT shape to a STEP file.
The following modes are available :
For further information see Writing a STEP file.
Example:
Let us write shape a to a STEP file in mode 0.
These are auxiliary commands used for the analysis of result of translation of IGES and STEP files.
Syntax:
Calculates statistics on the entities in the model and outputs a count of entities.
The 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.
Counter | Operation |
---|---|
xst-types | Calculates how many entities of each OCCT type exist |
step214-types | Calculates how many entities of each STEP type exist |
Example:
Syntax:
Obtains general statistics on the loaded data. The information printed by this command depends on the symbol specified.
Example:
Symbol | Output |
---|---|
g | Prints the information contained in the header of the file |
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) |
t | The same as c or f, with a list of failed or warned entities |
m or l | The same as t but also prints a status for each entity |
e | Lists all entities of the model with their numbers, types, validity status etc. |
R | The same as e but lists only root entities |
Syntax:
Entities 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.
Example:
Syntax:
The content of an IGES or STEP entity can be obtained by using this command. Entity can be determined by its number or label. <level_of_information> has range [0-6]. You can get more information about this level using this command without parameters.
Example:
Syntax:
Prints a number for the entity with a given label.
Example:
Syntax:
The list of entities referenced by a given entity and the list of entities referencing to it can be obtained by this command.
Example:
Syntax:
Gives 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.
Example:
Syntax:
Prints a number of loaded entities defined by the selection argument. Possible values of <selection_name> you can find in the “IGES FORMAT Users’s Guide”.
Example:
Syntax:
Prints a list of a subset of loaded entities defined by the selection argument:
Selection | Description |
---|---|
xst-model-all | all entities of the model |
xst-model-roots | all roots |
xst-pointed | (Interactively) pointed entities (not used in DRAW) |
xst-transferrable-all | all transferable (recognized) entities |
xst-transferrable-roots | Transferable roots |
Example:
Syntax:listcount <counter> [<selection> ...]
Prints a list of entities per each type matching the criteria defined by arguments. Optional <selection> argument, if specified, defines a subset of entities, which are to be taken into account. Argument <counter> should be one of the currently defined counters:
Counter | Operation |
---|---|
xst-types | Calculates how many entities of each OCCT type exist |
iges-types | Calculates how many entities of each IGES type and form exist |
iges-levels | Calculates how many entities lie in different IGES levels |
Example:
Syntax:
This command prints a list of objects (counters, selections etc.) defined in the current session.
Syntax:
Gives 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.
Syntax:
Clears the current model.
Syntax:
This command is used to manage translation parameters. Command without arguments gives a full list of parameters with current values. Command with <parameter> (without
) gives us the current value of this parameter and all possible values for it. Command with
sets this new value to <parameter>.
Example:
Let us get the information about possible schemes for writing STEP file :
Syntax:
Prints only a number of entities per each type matching the criteria defined by arguments.
Example:
Syntax:
Clears the map of correspondences between IGES or STEP entities and OCCT shapes.
Syntax:
Example:
Syntax:
Get information about the result of translation of the given IGES or STEP entity.
Example:
Syntax:
Provides 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 <symbol> defines what information will be printed:
The sign * before parameters n, s, b, t, r makes it work on all entities (not only on roots).
The sign ? before n, s, b, t limits the scope of information to invalid entities.
Optional argument <selection> can limit the action of the command to the selection, not to all entities.
To get help, run this command without arguments.
Example:
Syntax:
This 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.
Example:
These 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:
Reminding: All operations of translation are performed with parameters managed by command param.
Syntax:
Reads information from an IGES file to an XCAF document.
Example:
Syntax:
Reads information from a STEP file to an XCAF document.
Example:
Syntax:
Example:
Syntax:
Writes information from an XCAF document to a STEP file.
Example:
Syntax:
Returns the name of file which is set as the current one in the Draw session.
Example:
Syntax:
Returns a list all files that were transferred by the last transfer. This command is meant (assigned) for the assemble step file.
Example:
Syntax:
Sets the current file taking it from the components list of the assemble file.
Example:
Syntax:
This command is similar to the command fromshape, but gives additional information about the file name. It is useful if a shape was translated from several files.
Example:
Syntax:
Creates a new XCAF document.
Example:
Syntax:
Shows a shape from a given label in the 3D viewer. If the label is not given – shows all shapes from the document.
Example:
Syntax:
Prints common information from an XCAF document.
Example:
Syntax:
Saves the contents of the viewer window as an image (XWD, png or BMP file). <filename> must have a corresponding extension.
Example:
Syntax:
Prints information about the tree structure of the document. If parameter 1 is given, then the tree is printed with a link to shapes.
Example:
Syntax:
Adds a component shape to assembly.
Example:
Let us add shape b as component shape to assembly shape from label 0:1:1:1
Syntax:
Adds 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.
Example:
Syntax:
Prints a sequence of labels of the assembly path.
Example:
Syntax:
Finds and prints a label with an indicated top-level shape.
Example:
Syntax:
Print labels or create DRAW shapes for all free shapes in the document. If shape_prefix is absent – prints labels, else – creates DRAW shapes with names shape_prefix_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).
Note: a free shape is a shape to which no other shape refers to.
Example:
Syntax:
Creates one DRAW shape for all free shapes from a document.
Example:
Syntax:
Prints a label that contains a top-level shape that corresponds to a shape at a given label.
Example:
Syntax:
Puts a shape from the indicated label in document to result.
Example:
Syntax:
Prints labels that contain top-level shapes.
Example:
Syntax:
Prints information about a shape, stored at an indicated label.
Example:
Syntax:
Creates a new empty top-level shape.
Example:
Syntax:
Removes a component from the components label.
Example:
Syntax:
Removes a shape from a document (by it’s label).
Example:
Syntax:
Sets a shape at the indicated label.
Example:
Syntax:
Updates all assembly compounds in the XDE document.
Example:
Syntax:
Adds color in document to the color table. Parameters R,G,B are real.
Example:
Syntax:
Finds a label where the indicated color is situated.
Example:
Syntax:
Prints all colors that are defined in the document.
Example:
Syntax:
Returns a color defined at the indicated label from the color table.
Example:
Syntax:
Returns the visibility of a shape.
Example:
Syntax:
Returns the color defined by label. If colortype=’s’ – returns surface color, else – returns curve color.
Example:
Syntax:
Removes a color from the color table in a document.
Example:
Syntax:
Sets an RGB color to a shape given by label.
Example:
Syntax:
Sets the visibility of a shape.
Example:
Syntax:
Unset a color given type (‘s’ or ‘c’) for the indicated shape.
Example:
Syntax:
Adds a new layer in an XCAF document.
Example:
Syntax:
Prints a label where a layer is situated.
Example:
Syntax:
Prints all layers in an XCAF document.
Example:
Syntax:
Returns names of layers, which are pointed to by links of an indicated shape.
Example:
Syntax:
Prints the name of a layer at a given label.
Example:
Syntax:
Returns 1 if the indicated layer is visible, else returns 0.
Example:
Syntax:
Removes all layers from an XCAF document.
Example:
Syntax:
Removes the indicated layer from an XCAF document.
Example:
Syntax:
Sets a reference between a shape and a layer (adds a layer if it is necessary). Parameter <shape_in_one_layer> shows whether a shape could be in a number of layers or only in one (0 by default).
Example:
Syntax:
Sets the visibility of a layer.
Example:
Syntax:
Unsets a shape from all layers.
Example:
Syntax:
Unsets a shape from the indicated layer.
Example:
Syntax:
Gets properties for a given shape (volume, area and centroid) 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.
Example:
Syntax:
Returns the area of a given shape.
Example:
Syntax:
Returns the center of gravity coordinates of a given shape.
Example:
Syntax:
Returns the volume of a given shape.
Example:
Syntax:
Sets new area to attribute list ??? given shape.
Example:
Syntax:
Sets new center of gravity to the attribute list given shape.
Example:
Syntax:
Adds 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.
Example:
Syntax:
Sets new volume to the attribute list ??? given shape.
Example:
Syntax:
Computes 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.
Example:
Syntax:
Calculates the real volume of a pointed shape with a given deflection.
Example:
Syntax:
Performs 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).
Syntax:
Shows where a point which is given by coordinates is located in relation to a given face – outbound, inside or at the bounds.
Example:
Syntax:
Checks 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.
Example:
Syntax:
Compares 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.
Example:
Syntax:
Converts all elementary surfaces of a given shape into surfaces of revolution. Results are put into the shape, which is given as the <result> parameter.
Example:
Syntax:
Converts indirect surfaces and returns the results into the shape, which is given as the result parameter.
Example:
Syntax:
Gives statistics for a given shape. This test command is working with Bezier and BSpline entities.
Example:
Syntax:
Fixes 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.
Example:
Syntax:
Searches 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 <mode> 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 <maxangle> 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.
Example:
Syntax:
Performs fixes of all sub-shapes (such as Solids, Shells, Faces, Wires and Edges) of a given shape. Parameter <preci> sets a basic precision value, <maxpreci> sets the maximal allowed tolerance. Results are put into the shape, which is given as parameter result. {switches} allows to tune parameters of ShapeFix
The following syntax is used:
Example:
Syntax:
Fixes 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.
Example:
Syntax:
offsetcurve works with the curve in 3d space, offset2dcurve in 2d space.
Both commands are intended to create a new offset curve by copying the given curve to distance, given by parameter <offset>. Parameter <direction> 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 <result>.
Example:
Syntax:
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.
Example:
Syntax:
projpcurve returns the projection of a given point on a given curve on surface. The curve on surface is defined by giving the edge and face names. Edge must have curve 2D representation on the face. Optional parameter <start_param> 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. If this parameter is not set, algorithm uses whole parametric interval of pcurve for searching projection.
Example:
Syntax:
Returns 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.
Example:
Syntax:
Returns a new shape, which is the result of scaling of a given shape with a coefficient equal to the parameter <scale>. Tolerance is calculated for the new shape as well.
Example:
Syntax:
Sets new values of tolerance for a given shape. If the second parameter mode is given, then the tolerance value is set only for these sub shapes.
Example:
Syntax:
Splits a given face in parametric space and puts the result into the given parameter <result>. Returns the status of split face.
Example:
Syntax:
Returns 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 surfaces. The last parameter becomes out of date.
Example:
Syntax:
Returns tolerance (maximal, avg and minimal values) of all given shapes and tolerance of their Faces, Edges and Vertices. If parameter <tolmin> or <tolmax> 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.
Example:
Syntax:
Divides 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. Note: A closed face is a face with one or more seam.
Example:
Syntax:
Both 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.
Example:
Syntax:
Divides 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:
Example:
Syntax:
Works 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. This command illustrates how class ShapeUpgrade_ShapeDivideAngle works.
Example:
Syntax:
Divides 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.
Example:
Syntax:
Works just as DT_SplitCurve (see above), only with 2d curve.
Example:
Syntax:
Divides 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.
Example:
Syntax:
Converts a surface of linear extrusion, revolution and offset surfaces into BSpline surfaces. Returns the result into the shape, which is given as parameter result.
Example:
Syntax:
Calculates 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.
This command can be used for visualization performance evaluation instead of the outdated Visualization Performance Meter.
Example:
This section contains description of auxiliary commands that can be useful for simple calculations and manipulations needed when analyzing complex models.
This 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:
Syntax:
Returns coordinates of vector between two 3D points.
Example:
Syntax:
Returns coordinates of vector between two 2D points.
Example:
Syntax:
Returns plane built on three points. A plane is represented by 6 double values: coordinates of the origin point and the normal directoin.
Example:
Syntax:
Returns module of a vector.
Example:
Syntax:
Returns module of a 2D vector.
Example:
Syntax:
Returns unified vector from a given 3D vector.
Example:
Syntax:
Returns unified vector from a given 2D vector.
Example:
Syntax:
Returns inversed 3D vector.
Example:
Syntax:
Returns inversed 2D vector.
Example:
Syntax:
Returns 2D vector rotated on 90 degrees.
Example:
Syntax:
Returns distance between two 3D points.
Example:
Syntax:
Returns distance between two 2D points.
Example:
Syntax:
Returns distance between plane defined by point and normal direction and another point.
Example:
Syntax:
Returns distance between 3D line defined by point and direction and another point.
Example:
Syntax:
Returns distance between 2D line defined by point and direction and another point.
Example:
Syntax:
Returns deviation of point (x2,y2,z2) from segment defined by points (x1,y1,z1) and (x3,y3,z3).
Example:
Syntax:
Returns 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.
Example:
Syntax:
Returns point of a given parameter between two 3D points.
Example:
Syntax:
Returns point of a given parameter between two 2D points.
Example:
Syntax:
Returns cross product of two 3D vectors.
Example:
Syntax:
Returns cross product of two 2D vectors.
Example:
Syntax:
Returns scalar product of two 3D vectors.
Example:
Syntax:
Returns scalar product of two 2D vectors.
Example:
Syntax:
Returns 3D vector multiplied by scalar.
Example:
Syntax:
Returns 2D vector multiplied by scalar.
Example:
This section describes commands that make possible to provide measurements on a model.
Syntax:
Returns 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 mkpoint and coord.
Example:
Syntax:
Returns coordinates of point on 3D curve with given parameter. Actually this command is based on the command cvalue.
Example:
Syntax:
Returns coordinates of point on 2D curve with given parameter. Actually this command is based on the command 2dcvalue.
Example:
Syntax:
Returns coordinates of point on surface with given parameters. Actually this command is based on the command svalue.
Example:
Syntax:
Returns coordinates of point on surface defined by point on 2D curve with given parameter. Actually this command is based on the commands 2dcvalue and svalue.
Example:
Syntax:
Creates a linear segment between two 3D points. The new object is given the name. The object is drawn in the axonometric view.
Example:
Syntax:
Creates a linear segment between two 2D points. The new object is given the name. The object is drawn in the 2D view.
Example:
Syntax:
Prints 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.
Example:
Syntax:
Prints 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.
Example:
This section describes commands that make possible to use Inspector.
Syntax:
Starts inspection tool. Options:
Example:
Example:
Example:
The following chapters explain how to extend Test Harness with custom commands and how to activate them using a plug-in mechanism.
Custom 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.
Example:
For examples of existing commands refer to Open CASCADE Technology (e.g. GeomliteTest.cxx).
To become available in the Test Harness the custom command must be registered in it. This should be done as follows.
Example:
All 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.
This exported function PLUGINFACTORY() must be implemented only once per library.
For 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.
Example:
As 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 (;:;). For every created plug-in there must be a key. For better readability and comprehension it is recommended to have some meaningful name. Thus, 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. For 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.
Examples (file MyDrawPlugin):
For other examples of the plug-in resource file refer to the Plug-in resource file chapter above or to the $CASROOT/src/DrawPlugin file shipped with Open CASCADE Technology.
Loading a plug-in and activating its commands is described in the Activation of the commands implemented in the plug-in chapter.
The procedure consists in defining the system variables and using the pload commands in the Test Harness session.
Example: