Hello World of OpenCascade
Hello World of OpenCascade
摘要Abstract:以一个经典的Hello World程序为例开始对开源几何造型内核OpenCascade的学习。
关键字Key Words:OpenCascade、Qt、Hello World
一、引言 Introduction
OpenCascade编译成功后,看着大量的代码,无从下手。本文以Hello World程序为例,详细说明使用OpenCascade进行编程需要注意的事项,以便对OpenCascade做进一步学习。
选择的编程工具为Qt Creator,因为其也是开源的,其版本信息如下图所示:

Figure 1.1 About Qt Creator
二、Hello World of OpenCascade
1. 新建工程:在Qt Creator中创建一个新的工程,选择Non-Qt Project -> Plain C++ Project,如下图所示:
![]()
Figure 2.1 Create a Plain C++ project in Qt Creator
2. 在工程文件中添加头文件路径及所需要用到的库文件,如下图所示:
![]()
Figure 2.2 Set header file path and library
3. 程序的源代码如下所示:
/*
eryar All Rights Reserved.
*
* File : Main.cpp
* Author : eryar@163.com
* Date : 2013-08-22 18:52
* Version : 1.0v
*
* Description : Hello World program of OpenCascade.
*
*/
#include <iostream>
// OpenCascade library.
#define WNT
#include <Standard_CString.hxx>
int main(void)
{
Standard_CString strHelloWorld("Hello World!");
Standard_CString strHelloOcct("Hello OpenCascade!");
std::cout << strHelloWorld << std::endl;
std::cout << strHelloOcct << std::endl;
;
}
4. 程序输出结果如下图所示:
![]()
Figure 2.3 Program output
5. 程序代码说明:
l #include <iostream>:使用了C++的标准输入输出,如:std::cout;
l #define WNT:告知OpenCascade程序运行在Windows平台上。若不设置,当编译器为MSVC时,会出现如下编译错误:
// check if WNT macro is not defined but compiler is MSVC
#if defined(_MSC_VER) && !defined(WNT)
#error "Wrong compiler options has been detected. Add /DWNT option for proper compilation!!!!!"
#endif
l #include <Standard_CString.hxx>:使用OpenCascade中的字符串;
l 使用了两个字符串变量分别输出“Hello World!”和“Hello OpenCascade!”;
三、结论 Conclusion
在Qt Creator中以一个简单的示例程序,详细说明了在Windows平台使用OpenCascade开发需要注意的事项,为进一步研究、学习、使用OpenCascade奠定基础。
PDF Version: Hello World of OpenCascade
Hello World of OpenCascade的更多相关文章
- OpenCASCADE AIS Manipulator
OpenCASCADE AIS Manipulator eryar@163.com Abstract. OpenCASCADE7.1.0 introduces new built-in interac ...
- Convert BSpline Curve to Arc Spline in OpenCASCADE
Convert BSpline Curve to Arc Spline in OpenCASCADE eryar@163.com Abstract. The paper based on OpenCA ...
- OpenCASCADE Shape Location
OpenCASCADE Shape Location eryar@163.com Abstract. The TopLoc package of OpenCASCADE gives resources ...
- OpenCASCADE BRep Projection
OpenCASCADE BRep Projection eryar@163.com 一网友发邮件问我下图所示的效果如何在OpenCASCADE中实现,我的想法是先构造出螺旋线,再将螺旋线投影到面上. ...
- OpenCASCADE Expression Interpreter by Flex & Bison
OpenCASCADE Expression Interpreter by Flex & Bison eryar@163.com Abstract. OpenCASCADE provide d ...
- OpenCASCADE Data Exchange - 3D PDF
OpenCASCADE Data Exchange - 3D PDF eryar@163.com Abstract. Today most 3D engineering model data are ...
- OpenCASCADE Interpolations and Approximations
OpenCASCADE Interpolations and Approximations eryar@163.com Abstract. In modeling, it is often requi ...
- OpenCASCADE Ring Type Spring Modeling
OpenCASCADE Ring Type Spring Modeling eryar@163.com Abstract. The general method to directly create ...
- OpenCASCADE Interpolation - Lagrange
OpenCASCADE Interpolation - Lagrange eryar@163.com Abstract. Power basis polynomial is the most simp ...
- OpenGL Shader in OpenCASCADE
OpenGL Shader in OpenCASCADE eryar@163.com Abstract. As implementation of one of the strategic steps ...
随机推荐
- hdu3068马拉车
其实马拉车还真是最好理解的算法(感觉初中的时候好像讲过类似的,但是当时就没有认真听) 没想到一个简单的优化能变成O(n),感觉碉堡 不说了,马拉车裸题,我在写的时候只保留了id,没保留mx,希望能形成 ...
- 弱省互测#2 t2
题意 给两个树,大小分别为n和m,现在两棵树各选一些点(包括1),使得这棵树以1号点为根同构(同构就是每个点的孩子数目相同),求最大的同构树.(n, m<=500) 分析 我们从两棵树中各取出一 ...
- python实现最简单的计算器功能源码
import re def calc(formula): formula = re.sub(' ', '', formula) formula_ret = 0 match_brackets = re. ...
- 我的window10
前言 这个一时半会写不完,也比较耗费时间,留着以后,每周更新一些新的技巧. 折腾了3天多时间的成果——>window10 的全新桌面,不比苹果差!不要说 windows 不能用 mac . 既然 ...
- Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...
- 如何通过倾斜摄影数据手动配置s3c索引文件?
如何通过倾斜摄影数据手动配置s3c索引文件? 大家知道,倾斜摄影数据最常见的是OSGB格式,并且是由一个一个的Tile分级文件夹构成的Data文件夹.结构一般如下图所示: 那么,如何才能把模型的各个瓦 ...
- Metaio在Unity3D中报错 Start: failed to load tracking configuration: TrackingConfigGenerated.xml 解决方法
报错:Start: failed to load tracking configuration: TrackingConfigGenerated.xml Start: failed to load t ...
- WCF 程序入门
WCF是微软公司推出的符合SOA思想的分布式应用程序技术框架和编程模型,是建立在消息通信这一概念基础上运行的一个运行时服务系统. WCF编程模型的目标是实现以下两个实体之间的通信:WCF服务端和WCF ...
- nodejs 模块恩仇录
anywhere 一句话:随时随地将你的当前目录变成一个静态文件服务器的根目录. 安装 npm install anywhere -g anywhere -h localhost -p 8060 fa ...
- Java演算法之快速排序法
1 * 快速排序法(Quick Sort),遞迴版本. 2 * 3 * @param array 傳入要排序的陣列 4 * @param start 傳入要排序的開始位置 5 * @param end ...