OpenCASCADE Performance Test算法
Abstract. Use the Draw Test Harness to test the performance of OpenCASCADE by Tcl scripts. From the test result, you will check whether the OpenCASCADE meet your need. 测试
Key Words. OpenCASCADE, Performance Test, Draw Test Harness, Tcl/Tkspa
1. Introduction rest
OpenCASCADE开发平台提供了3D曲面和实体造型,CAD数据交换及可视化的功能。做为C++的开发库,OpenCASCADE最适于处理3D造型的CAD,制造、测量(CAM)及数值仿真(CAE)等软件的开发。 code
Draw Test Harness使用Tcl封装了OpenCASCADE的不少命令,经过编写Tcl脚本,能够方便地测试OpenCASCADE相应的功能。 orm
本文主要介绍使用Tcl/Tk脚本在Draw Test Harness中测试OpenCASCADE的网格及可视化的性能。 blog
Figure 1.1 Test 1000 Spheresip
2.Mesh Test ci
实体形状显示须要被网格化,网格化速度的快慢直接影响显示的速度。因此先测试一下OpenCASCADE的网格剖分算法的速度。相应的Tcl脚本以下所示:
# # Copyright (c) 2014 eryar All Rights Reserved. # # File : testocc.tcl # Author : eryar@163.com # Date : 2014-09-25 18:10 # Version : 1.0v # # Description : Test the OpenCASCADE performance. # pload MODELING VISUALIZATION set shapeCount 100 set count 10 set distance 5000 #psphere s 3.0 #restore data/occ/CrankArm.brep s #restore data/occ/Moto.brep s restore data/occ/F1.brep s puts "\nMeshing the $shapeCount shapes..." chrono aTimer start for {set i 0} {$i < $shapeCount} {incr i 1} { copy s s$i set dx [expr ($i%$count)*$distance] set dy [expr ($i/$count)*$distance] set dz 0.0 ttranslate s$i $dx $dy $dz # mesh the shape incmesh s$i 1 1 } chrono aTimer show
下面对上述代码进行简单分析:
v 用pload命令加载所须要的建模及可视化模块;
v 用restore命令加载一个brep文件到形状变量s;
v 用chrono打开一个计时器aTimer;
v 用ttranslate来阵列复制形状s获得的形状;
v 用incmesh来对形状进行网格化;
Figure 2.1 Mesh 100 F1
上述Tcl测试了网格化100辆F1赛车的时间如上图所示。能够修改上述Tcl脚本代码,来测试网格化10000个球所须要的时间。
3.Display Test
网格化以后能够显示出形状了。下面的Tcl脚本测试了OpenCASCADE的显示性能:
puts "\nDisplaying the $shapeCount shapes..." chrono aTimer start for {set i 0} {$i < $shapeCount} {incr i 1} { vdisplay s$i } chrono aTimer show chrono aTimer stop vsetdispmode 1 vfit puts "\nShow the frame rate..." vfps
显示效果以下图所示:
Figure 3.1 Hundreds of F1
其中命令vfps是显示当前视图的帧频数的。100辆F1的帧数有26,速度还行,稍有卡滞。
4. Conclusion
根据上述Tcl脚本能够看出OpenCASCADE的网格及可视化的性能还能够。能够修改上述代码,来测试显示10000个球体所须要的时间。
最后给出上述Tcl测试用的模型数据及Tcl脚本完整代码供下载使用。
PDF Version and Tcl Script: OpenCASCADE Performance Test