OpenCascade Draw Test Harness
OpenCascade Draw Test Harness
Abstract. Draw is a command interpreter based on Tcl/Tk and a graphical system used to test and demonstrate OpenCascade modeling libraries. It provides a flexible and easy to use means of testing and demonstrating the OCCT modeling libraries. By a given command of Tcl, you can find the implentation code for that command by OpenCascade, the code could be as a demo to use of OCC modeling libraries. So this is the most effectively way of use OpenCascade.
Key words. OpenCascade, Tcl/Tk, Testing, Scripts
1. Introduction
Draw Test Harness提供了灵活和易于使用的方式来测试、演示OpenCascade的建模算法。可用来交互的创建、显示和修改曲线、曲面及拓朴形状。你也可以自己写Tcl脚本来自定义Draw或使用脚本来实现自动化测试。也可以为Draw添加新的自定义的命令。
因为Draw是基于Tcl/Tk脚本的,所以可以根据OpenCascade自定义的命令名称来找到相关的实现,这个实现应该是使用OpenCascade最有效的方式,也是官方使用OpenCascade的方式,具有很好的参考价值。
还可在Draw 中使用Tcl脚本来实现概念建模,如果结果和预期一致,可再把Tcl命令相对应的C++代码写到程序中,提高编程效率。
本文主要介绍如何根据OpenCascade中实现的命令找到相关的实现代码,作为编程时的参考,避免了用C++代码来实现一些功能时自己来摸索,从而浪费不必要的时间。
2. Using Tcl/Tk
先给出Draw中使用脚本出来的效果的例子,再介绍找出命令实现代码的方法。如下图所示为用脚本在Draw中产生的效果:
Figure 2.1 A blend test in Draw Test Harness
其实现的脚本如下所示:
pload ALL vinit
vgrid vsetgradientbg vzbufftrihedron # run a test
source tests/blend/begin
source tests/blend/buildevol/a2 vsetdispmode
vdisplay result
vfit
Figure 2.2 Tcl script
将上述脚本代码保存到samples/tcl文件夹下,文件名为init.tcl,再启动Draw,输入命令:
Figure 2.3 Use the Tcl file
3. Find code from Draw Test
因为Draw是基于Tcl/Tk实现的解释器,所以根据Tcl中自定义命令的方法,可以找出OpenCascade中这些命令的实现代码。更方便的做法是直接输入命令名称,再在所有的源代码中搜索相关文件即可。如上述脚本中的vgrid命令,是打开、关闭栅格,可以直接搜索vgrid,得到结果如下所示:
Figure 3.1 Find command in Files
Figure 3.2 Find Result of the Command
得到相关的代码使用方法如下图所示:
Figure 3.3 The Command function code
依此类推,其他Draw中的命令都可以找到相关的实现代码,这些代码都可作为编程的依据,有助于OpenCascade的正确、高效使用。
4. Conclusion
从上可知,如果需要OpenCascade的什么功能,可以先在Draw Test Harness中试试看,如果在Draw Test Harness中可以实现,再找出其实现那个命令的代码,再参考代码实现所需要功能即可。这样编程使用OpenCascade应该是轻松和高效的,因为Tcl是解释执行,不像C++那样需要编译时间。
5. References
1. Tcl and the Tk Toolkit
2. Practical Programming in Tcl and Tk
3. Tcl/Tk A Developer’s Guide
4. OpenCascade Test Harness User’s Guide
5. http://sourceforge.net/projects/tcl/
PDF Version: OpenCascade Draw Test Harness
OpenCascade Draw Test Harness的更多相关文章
- OpenCASCADE Shape Location
OpenCASCADE Shape Location eryar@163.com Abstract. The TopLoc package of OpenCASCADE gives resources ...
- OpenCASCADE Ring Type Spring Modeling
OpenCASCADE Ring Type Spring Modeling eryar@163.com Abstract. The general method to directly create ...
- OpenCASCADE PCurve of Topological Face
OpenCASCADE PCurve of Topological Face eryar@163.com Abstract. OpenCASCADE provides a class BRepBuil ...
- OpenCASCADE General Transformation
OpenCASCADE General Transformation eryar@163.com Abstract. OpenCASCADE provides a general transforma ...
- OpenNURBS to OpenCASCADE
OpenNURBS to OpenCASCADE eryar@163.com Abstract. The OpenNURBS initiative provides CAD/CAM/CAE and c ...
- OpenCASCADE DataExchange DWG
OpenCASCADE DataExchange DWG eryar@163.com Abstract. DWG is a file format created in the 70’s for th ...
- OpenCascade Chinese Text Rendering
OpenCascade Chinese Text Rendering eryar@163.com Abstract. OpenCascade uses advanced text rendering ...
- OpenCascade Ruled Surface
OpenCascade Ruled Surface eryar@163.com Abstract. A ruled surface is formed by moving a line connect ...
- Create New Commands in Tcl
Create New Commands in Tcl eryar@163.com 摘要Abstract:Tcl/Tk脚本可以很容易实现用户自定义的命令,方便的创建图形化的用户界面GUI,所以Tcl和T ...
随机推荐
- eclipse安装hibernate-Tools
启动eclipse 选择Help -> About Eclipse 记住自己的eclipse版本 访问http://download.jboss.org/jbosstools/updates/s ...
- 【转】bash 参数展开(Parameter Expansion)
转自:http://www.360doc.com/content/13/0513/20/9437165_285204629.shtml ${parameter} 取parameter的值 ${para ...
- IT
http://www.cnblogs.com/TomXu/archive/2011/12/19/2291448.html " 经常从Recruiter那里得到抱怨:“汤姆,为什么面试者每次回 ...
- 如何在Web引用中使用项目自定义的类
这个是老架构了,不推荐现在这么用,维护一个老项目记录一下. 项目中WebService和客户端是在一个解决方案下,实体类是一个公用的Project,如果使用Web引用自动生成的类会缺少一些实体类定义的 ...
- requirejs 打包 添加版本号收集资料 待测试
https://www.npmjs.org/package/rjs-optimhttps://www.npmjs.org/package/grunt-requirejs-md5指定js版本号 但不是M ...
- HDU 5008 Boring String Problem(后缀数组+二分)
题目链接 思路 想到了,但是木写对啊....代码 各种bug,写的乱死了.... 输出最靠前的,比较折腾... #include <cstdio> #include <cstring ...
- PLSQL配置新的oracle实例
在Win环境下的Oracle中,D:\Oracle\product\10.1.0\db_1\NETWORK\ADMIN\tnsnames.ora文件很重要,它作用是:本地命名的配置.本地名可以用简单的 ...
- C#中的null与void
一.null: 1.明义,null是什么意思? null是指一个变量没有指向具体对象的有效引用. 这句话什么意思呢?意思就是 1).能够使用null修饰的是变量: 2).主要指的是引用. 那么这就引出 ...
- 命令行操作svn和git和git
前几天在写代码的时候电脑突然坏掉,老大交代的任务没完成,非常痛恨自己用svn或者git保存代码,相信很多程序员遇到过,硬盘坏掉,存在硬盘中的代码丢失,无法找回的问题,svn和git可谓程序员界的福音, ...
- aspnet webapi 跨域请求 405错误
跨域,请求按要求配置完毕之后,options预请求老是报错.原因是webapi 默认的web.config有配置 <handlers> <remove name="Exte ...