OCCT-Tutorials_and_Demos_02:Draw:Demo_Scripts

Tutorials and Demos 02

原文链接: https://dev.opencascade.org/doc/overview/html/samples__draw_scripts.html

Draw: Demo Scripts 绘制:演示脚本

All demo scripts are provided with OCCT sources and locate in CASROOT/samples/tcl. To play around them please follow the steps below:

所有演示脚本都提供了OCCT源,并位于CASROOT/samples/tcl中。要绕过它们,请遵循以下步骤:

  1. Start DRAWEXE
  2. Type cd …/… to return to the root directory
  3. Type cd samples/tcl to reach the DrawResources directory
  4. Type source <demo_file> to run the demonstration file provided with Open CASCADE. The following demonstration files are available:
    • DataExchangeDemo.tcl: demonstrates sample sequence of operations with writing and reading IGES file
    • ModelingDemo.tcl: demonstrates creation of simple shape and displaying it in HLR mode
    • VisualizationDemo.tcl: demonstrates use of 3d viewer
    • cad.tcl: creates solid shape looking like abbreviation “CAD”
    • bottle.tcl: creates bottle as in OCCT Tutorial
    • drill.tcl: creates twist drill bit shape
    • cutter.tcl: creates milling cutter shape
    • xde.tcl: demonstrates creation of simple assembly in XDE
    • materials.tcl: demonstrates visual properties of materials supported by 3d viewer
    • raytrace.tcl: demonstrates use of ray tracing display in 3d viewer
    • dimensions.tcl: demonstrates use of dimensions, clipping, and capping in 3d viewer
  1. 启动DRAWEXE
  2. 键入cd…/。。返回到根目录
  3. 键入cd samples/tcl以访问DrawResources目录
  4. 键入source<demo_file>以运行OpenCASCADE提供的演示文件。以下演示文件可用:
    • DataExchangeDemo.tcl:演示写入和读取IGES文件的示例操作序列
    • ModelingDemo.tcl:演示创建简单形状并以HLR模式显示
    • VisualizationDemo.tcl:演示如何使用3d查看器
    • cad.tcl:创建类似缩写“cad”的实体形状
    • bottle.tcl:创建OCCT教程中的瓶子
    • drill.tcl:创建麻花钻头形状
    • cutter.tcl:创建铣刀形状
    • xde.tcl:演示在xde中创建简单程序集
    • materials.tcl:演示三维查看器支持的材质的视觉特性
    • raytrace.tcl:演示在3d查看器中使用光线跟踪显示
    • dimensions.tcl:演示在三维查看器中使用尺寸、剪裁和封口

Draw is a command interpreter based on TCL and a graphical system used for testing and demonstrating OCCT modeling libraries.

Draw是一个基于TCL的命令解释器,是一个用于测试和演示OCCT建模库的图形系统。

Draw can be used interactively to create, display and modify objects such as curves, surfaces and topological shapes.

可以交互使用Draw来创建、显示和修改对象,如曲线、曲面和拓扑形状。

Scripts can be written to customize Draw and perform tests. New types of objects and new commands can be added using C++ programming language.

可以编写脚本来自定义Draw并执行测试。可以使用C++编程语言添加新类型的对象和新命令。

Draw contains:

绘图包含:

  • A command interpreter based on TCL command language.

  • A 2D an 3D graphic viewer with support of operations such as zoom, pan, rotation and full-screen views.

  • An optional set of geometric commands to create and modify curves and surfaces and to use OCCT geometry algorithms.

  • A set of topological commands to create and modify BRep shapes and to use OCCT topology algorithms.

  • A set of graphic commands for view and display operations including Mesh Visualization Service.

  • A set of Application framework commands for handling of files and attributes.

  • A set of Data Exchange commands for translation of files from various formats (IGES,STEP) into OCCT shapes.

  • A set of Shape Healing commands: check of overlapping edges, approximation of a shape to BSpline, etc.

  • 基于TCL命令语言的命令解释器。

  • 支持缩放、平移、旋转和全屏视图等操作的2D或3D图形查看器。

  • 一组可选的几何命令,用于创建和修改曲线和曲面以及使用OCCT几何算法。

  • 一组拓扑命令,用于创建和修改BRep形状并使用OCCT拓扑算法。

  • 一组用于查看和显示操作的图形命令,包括网格可视化服务。

  • 用于处理文件和属性的一组应用程序框架命令。

  • 一组数据交换命令,用于将文件从各种格式(IGES、STEP)转换为OCCT形状。

  • 一组形状修复命令:检查重叠边、将形状近似为B样条线等。

You can add new custom test harness commands to Draw in order to test or demonstrate a new functionality, which you are developing.

您可以向Draw添加新的自定义测试线束命令,以测试或演示正在开发的新功能。

Currently DRAW Test Harness is a single executable called DRAWEXE.

目前,DRAW测试线束是一个名为DRAWEXE的可执行文件。

Commands grouped in toolkits can be loaded at run-time thereby implementing dynamically loaded plug-ins. Thus you can work only with the commands that suit your needs adding the commands dynamically without leaving the Test Harness session.

可以在运行时加载工具包中分组的命令,从而实现动态加载的插件。因此,您只能使用符合您需要的命令,动态添加命令,而无需离开测试线束会话。

Declaration of available plug-ins is done through 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.

可用插件的声明是通过特殊的资源文件完成的。pload命令根据指定的资源文件加载插件,并激活插件中实现的命令。

The whole process of using the plug-in mechanism as well as the instructions for extending Test Harness is described in the Draw Test Harness.

绘制测试线束中描述了使用插件机制的整个过程以及扩展测试线束的说明。

Draw Test Harness provides an environment for OCCT automated testing system. Check its Automated Testing System for details.

绘制测试线束为OCCT自动测试系统提供了一个环境。有关详细信息,请查看其自动测试系统。

Remarks:

  • The DRAWEXE executable is delivered with the installation procedure on Windows platform only.
  • To start it, launch DRAWEXE executable from Open CASCADE Technology/Draw Test Harness item of the Start\Programs menu.

评论:

  • DRAWEXE可执行文件仅随Windows平台上的安装过程一起提供。
  • 要启动它,请从“开始\程序”菜单的“打开CASCADE技术/绘制测试线束”项启动DRAWEXE可执行文件。

Experimenting with Draw Test Harness 使用拉伸测试线束进行实验

Running Draw 运行绘图

On Linux:

  • If OCCT was built by Code::Blocks use $CASROOT/draw.sh file to launch DRAWEXE executable.

  • 如果OCCT是由Code::Blocks构建的,则使用$CASROOT/draw.sh文件启动DRAWEXE可执行文件。

Draw[1]> prompt appears in the command window

Type pload ALL

On Windows:

Launch Draw executable from Open CASCADE Technology\Test Harness\Draw Test Harness item of the Start\Programs menu or Use $CASROOT\draw.bat file to launch DRAWEXE executable.

从“开始”\“程序”菜单的“Open CASCADE Technology\Test Harness\Draw Test Harness”项启动Draw可执行文件,或使用$CASROOT\Draw.bat文件启动DRAWEXE可执行文件。

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
  1. 在命令窗口中,键入axo以创建轴测视图
  2. 键入框b-10-10-10-20 20 20,创建大小为20的立方体b,平行于X Y Z轴并以原点为中心。立方体将以线框模式显示在轴测视图中。
  3. 键入fit以使查看器充满立方体
  4. 键入pcylinder c 2 30以创建半径为2、高度为30的圆柱体c。除了立方体外,还将显示圆柱体

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
  1. 键入clear清除视图
  2. 键入donly c仅显示气缸
  3. 键入donly b以仅显示立方体
  4. 键入hlr-hlr-b以隐藏线删除模式显示立方体

Running demonstration files

  1. Type cd …/… to return to the root directory
  2. Type cd samples/tcl to reach the DrawResources directory
  3. Type source <demo_file> to run the demonstration file provided with Open CASCADE. The following demonstration files are available:
    • DataExchangeDemo.tcl: demonstrates sample sequence of operations with writing and reading IGES file
    • ModelingDemo.tcl: demonstrates creation of simple shape and displaying it in HLR mode
    • VisualizationDemo.tcl: demonstrates use of 3d viewer
    • cad.tcl: creates solid shape looking like abbreviation “CAD”
    • bottle.tcl: creates bottle as in OCCT Tutorial
    • drill.tcl: creates twist drill bit shape
    • cutter.tcl: creates milling cutter shape
    • xde.tcl: demonstrates creation of simple assembly in XDE
    • materials.tcl: demonstrates visual properties of materials supported by 3d viewer
    • raytrace.tcl: demonstrates use of ray tracing display in 3d viewer
    • dimensions.tcl: demonstrates use of dimensions, clipping, and capping in 3d viewer
  1. 键入cd…/。。返回到根目录
  2. 键入cd samples/tcl以访问DrawResources目录
  3. 键入source<demo_file>以运行OpenCASCADE提供的演示文件。以下演示文件可用:
    • DataExchangeDemo.tcl:演示写入和读取IGES文件的示例操作序列
    • ModelingDemo.tcl:演示创建简单形状并以HLR模式显示
    • VisualizationDemo.tcl:演示如何使用3d查看器
    • cad.tcl:创建类似缩写“cad”的实体形状
    • bottle.tcl:创建OCCT教程中的瓶子
    • drill.tcl:创建麻花钻头形状
    • cutter.tcl:创建铣刀形状
    • xde.tcl:演示在xde中创建简单程序集
    • materials.tcl:演示三维查看器支持的材质的视觉特性
    • raytrace.tcl:演示在3d查看器中使用光线跟踪显示
    • dimensions.tcl:演示在三维查看器中使用尺寸、剪裁和封口

Getting Help

  1. Type help to see all available commands

  2. Type help <command_name> to find out the arguments for a given command

  3. 键入help以查看所有可用命令

  4. 键入help<command_name>以查找给定命令的参数