Files
OCCT/dox/samples/draw_scripts.md
Pasukhin Dmitry bec9558832 Documentation - Modernize for OCCT 8.0.0, GitHub workflow, and vcpkg build system (#1256)
- Migration from dev.opencascade.org/Mantis/Gitolite infrastructure to GitHub-native
  workflow (Pull Requests, Issues, GitHub Actions CI/CD).
- OCCT 8.0.0 upgrade guide with detailed notes on TCol* typedef deprecation, BSpline
  weight accessors, evaluation hierarchy refactoring (EvalD0/D1/D2/D3/DN), Handle
  out-parameter deprecation, Standard_Mutex → std::mutex, PLib value types, BRepGraph,
  TopoDS_TShape redesign, math wrapper deprecation, mesh factory registry, and more.
- Build system modernization: C++17 requirement, VS2022/GCC8+/Clang7+ compilers,
  vcpkg integration, CMake-driven documentation targets replacing legacy gendoc.
- Removed obsolete documentation: Mantis workflow, access levels, issue lifecycle,
  pre-7.1.0 upgrade history (archived at dev.opencascade.org/doc), in-tree Inspector
  and DFBrowser documentation, 3rd-party build guide (outsourced to vcpkg/upstream).
- INSTALL_DIR_RESOURCE directory now correctly described in the install tree layout.
- Obsolete BUILD_PATCH CMake option removed from documentation.
- Code examples modernized: occ::handle<> syntax, NCollection_*<T> templates, BRepAdaptor_Curve,
  IsDone() checks, null-handle guards, native C++ types over Standard_* typedefs,
  Append() over Appends(), correct variable names.
- Code block language tags: .php → .tcl for Tcl scripts, .glsl for shader listings.
- IGES translator: deprecated API calls updated (SetReadVisible + TransferRoots),
  IDT_ message API replaced with Message_Messenger, thread-safety warning added.
- DE_Wrapper: STEP thread-safety note (per-reader), IGES unsupported for concurrency.
- Removed Mantis tracker link from GitHub issue template config.
- Removed DFBROWSER and INSPECTOR entries from DrawPlugin resource file.
- Tcl reference URL updated (tcl.tk → tcl-lang.org).
2026-05-03 09:15:03 +01:00

3.6 KiB

Draw: Demo Scripts

All demo scripts are shipped with OCCT sources under the resources/samples/tcl directory. To run them:

  1. Source the build environment script env.sh (Linux/macOS) or env.bat (Windows) generated next to DRAWEXE in the build / install bin/ directory.

  2. Launch DRAWEXE.

  3. From the DRAW prompt, source any demo script by absolute or $CASROOT-relative path, for example:

    source $env(CASROOT)/resources/samples/tcl/bottle.tcl
    

A few representative demos:

  • DataExchangeDemo.tcl: writes and reads an IGES file
  • ModelingDemo.tcl: creates a simple shape and displays it in HLR mode
  • VisualizationDemo.tcl: exercises the 3D viewer
  • bottle.tcl: builds the bottle from the OCCT Tutorial
  • cad.tcl, drill.tcl, cutter.tcl: solid modeling examples
  • xde.tcl: creates a simple assembly in XDE
  • materials.tcl, raytrace.tcl, vis_pbr_spheres.tcl, pathtrace_*.tcl: visualization, materials, ray-tracing and PBR demos
  • dimensions.tcl: dimensions, clipping and capping in the 3D viewer

For the full up-to-date list, see the contents of the resources/samples/tcl/ directory.

Draw is a command interpreter based on TCL and a graphical system used for testing and demonstrating OCCT modeling libraries. It can be used interactively to create, display, and modify objects such as curves, surfaces, and topological shapes. Draw also provides a scriptable environment for OCCT tests and demonstrations.

Draw includes:

  • a TCL command interpreter;
  • 2D and 3D viewers with zoom, pan, rotation, and fit operations;
  • geometric and topological commands for OCCT modeling algorithms;
  • graphic commands for view and display operations;
  • OCAF, data exchange, and shape healing commands loaded by plug-ins.

Commands grouped in toolkits can be loaded at run time with pload. The plug-in mechanism and instructions for extending Draw are described in @ref occt_user_guides__test_harness. Draw Test Harness is also used by the OCCT automated testing system; see @ref occt_contribution__tests "Automated Test System" for details.

Experimenting with Draw Test Harness

Running Draw

On Linux:

  • Launch DRAWEXE executable. The Draw[1]> prompt appears in the command window.

Type pload ALL

On Windows:

Launch Draw executable from Open CASCADE Technology\DRAW Test Harness item of the Start\Programs menu. The Draw[1]> prompt appears in the command window.

Type pload ALL

Creating your first geometric objects

  1. In the command window, type axo to create an axonometric view
  2. Type box b -10 -10 -10 20 20 20 to create a cube b of size 20, parallel to the X Y Z axis and centered on the origin. The cube will be displayed in the axonometric view in wireframe mode.
  3. Type fit to fill the viewer with the cube
  4. Type pcylinder c 2 30 to create a cylinder c of radius 2 and height 30. The cylinder will be displayed in addition to the cube

Manipulating the view

  1. Type clear to erase the view
  2. Type donly c to display the cylinder only
  3. Type donly b to display the cube only
  4. Type hlr hlr b to display the cube in the hidden line removal mode

Running demonstration files

Use source $env(CASROOT)/resources/samples/tcl/<demo_file> from the DRAW prompt, replacing <demo_file> with the name of the demonstration script.

Getting Help

  1. Type help to see all available commands
  2. Type help <command_name> to find out the arguments for a given command