没有合适的资源?快使用搜索试试~ 我知道了~
OpenCASCADE提供的官方引导教程:画瓶子的PDF。通过这个PDF可以了解OpenCASCADE中的常用类和静态函数的使用方法。例如DynamicType函数。
资源推荐
资源详情
资源评论
Open CASCADE Technology
7.4.0.beta
Tutorial
September 26, 2019
CONTENTS 1
Contents
1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 The Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Model Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Building the Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 Defining Support Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Profile: Defining the Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Profile: Defining the Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 Profile: Completing the Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Building the Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1 Prism the Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Applying Fillets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Adding the Neck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Creating a Hollowed Solid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Building the Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1 Creating Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Defining 2D Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3 Building Edges and Wires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Creating Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 Building the Resulting Compound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
(c) Open CASCADE 2019
1.3 Model Specifications 2
1 Overview
This tutorial will teach you how to use Open CASCADE Technology services to model a 3D object. The purpose
of this tutorial is not to describe all Open CASCADE Technology classes but to help you start thinking in terms of
Open CASCADE Technology as a tool.
1.1 Prerequisites
This tutorial assumes that you have experience in using and setting up C++. From a programming standpoint, Open
CASCADE Technology is designed to enhance your C++ tools with 3D modeling classes, methods and functions.
The combination of all these resources will allow you to create substantial applications.
1.2 The Model
To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown:
In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the
complete source code of this tutorial, including the very function MakeBottle in the distribution of Open CASCADE
Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx.
1.3 Model Specifications
We first define the bottle specifications as follows:
Object Parameter Parameter Name Parameter Value
Bottle height MyHeight 70mm
Bottle width MyWidth 50mm
Bottle thickness MyThickness 30mm
In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate
system.
(c) Open CASCADE 2019
1.3 Model Specifications 3
This modeling requires four steps:
• build the bottle's Profile
• build the bottle's Body
• build the Threading on the bottle's neck
• build the result compound
(c) Open CASCADE 2019
2 Building the Profile 4
2 Building the Profile
2.1 Defining Support Points
To create the bottle's profile, you first create characteristic points with their coordinates as shown below in the (XOY)
plane. These points will be the supports that define the geometry of the profile.
(-myWidth / 2., 0 , 0)
(myWidth / 2., 0 , 0)
(-myWidth / 2., -myThickness / 4. , 0)
(myWidth / 2., myThickness / 4. , 0)
(0 , -myThickness / 2. , 0)
There are two classes to describe a 3D Cartesian point from its X, Y and Z coordinates in Open CASCADE
Technology:
• the primitive geometric gp_Pnt class
• the transient Geom_CartesianPoint class manipulated by handle
A handle is a type of smart pointer that provides automatic memory management. To choose the best class for this
application, consider the following:
• gp_Pnt is manipulated by value. Like all objects of its kind, it will have a limited lifetime.
• Geom_CartesianPoint is manipulated by handle and may have multiple references and a long lifetime.
Since all the points you will define are only used to create the profile's curves, an object with a limited lifetime will
do. Choose the gp_Pnt class. To instantiate a gp_Pnt object, just specify the X, Y, and Z coordinates of the points
in the global Cartesian coordinate system:
gp_Pnt aPnt1(-myWidth / 2., 0, 0);
gp_Pnt aPnt2(-myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt3(0, -myThickness / 2., 0);
gp_Pnt aPnt4(myWidth / 2., -myThickness / 4., 0);
gp_Pnt aPnt5(myWidth / 2., 0, 0);
Once your objects are instantiated, you can use methods provided by the class to access and modify its data. For
example, to get the X coordinate of a point:
Standard_Real xValue1 = aPnt1.X();
2.2 Profile: Defining the Geometry
With the help of the previously defined points, you can compute a part of the bottle's profile geometry. As shown in
the figure below, it will consist of two segments and one arc.
(c) Open CASCADE 2019
剩余22页未读,继续阅读
资源评论
蜗牛在听雨
- 粉丝: 146
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功