Novice Guide

Modeling with OCCT: Key differences 使用OCCT建模:主要差异

Open CASCADE Technology (OCCT) is an object-oriented C++ framework designed for rapid production of sophisticated CAD/CAM/CAE applications. In other words, it provides endless possibilities for raw 2D and 3D modeling in C++ environment. Unlike end-user software, it is used by the application developers and therefore strongly differs from the most popular CAD/CAM/CAE software packages. OCCT provides building blocks enough for modeling, editing, visualization, and data interoperability of 2D and 3D objects.

Open CASCADE Technology(OCCT)是一个面向对象的C++框架,旨在快速生成复杂的CAD / CAM / CAE应用程序。换句话说,它为C++环境中的原始2D和3D建模提供了无限的可能性。与最终用户软件不同,它由应用程序开发人员使用,因此与最流行的 CAD/CAM/CAE 软件包有很大不同。OCCT 提供了足够的构建块,用于 2D 和 3D 对象的建模、编辑、可视化和数据对接。

By using OCCT, users can create the objects of their desire (or edit already existing ones) using raw code commands. It is a more complicated process than using GUI-based software, but it provides much more flexibility than even script-based manipulations that are available within existing CAD/CAM/CAE applications. However, to fully grasp the possibilities of OCCT it is best for the user to have previous experience in C++ at least at a basic level.

通过使用 OCCT,用户可以使用原始代码命令创建他们想要的对象(或编辑已经存在的对象)。这是一个比使用基于 GUI 的软件更复杂的过程,但相较现有 CAD/CAM/CAE 应用程序中可用的基于脚本的操作,它具有更多的灵活性。无论如何,为了充分掌握OCCT的潜在能力,用户最好至少具有C++基本水平的经验。

Understanding the principles 理解原理

If you don't have any programming skills, grasping the full magnitude of OCCT workflow is still an option. The documentation for OCCT contains several entry points for new users. It will not explain all OCCT classes but will help to comprehend the workflow and help start thinking in terms of Open CASCADE Technology.

如果您没有任何编程技能,掌握OCCT工作流程的全部内容仍然是一种选择。OCCT 的文档包含了几个新手入门的内容点,它不会解释OCCT所有的类,但将有助于理解工作流程,并帮助您开始以Open CASCADE Technology的方式去思考。

The most basic workflow is described in the OCCT Tutorial - this is an excellent starting point for new users. In this tutorial you will create a solid model step-by-step using different classes and methods. Each step of the tutorial contains code snippets and images.

“OCCT 教程”中描述了最基本的工作流程 - 这对新用户来说是一个很好的起点。在该教程中,您将使用不同的类和方法来一步一步的创建实体模型,每个步骤的引导内容都包含代码片段和图像。

The basics involved in the modeling process are explained. When the basics of OCCT are clear, the next logical step is to check out sample applications and examine those that suit your needs. For these, the best starting point is OCCTOverview located in /samples/qt subfolder of OCCT installation.

文档阐述了建模过程中涉及的基础知识。当OCCT的基础知识清晰后,下一个合乎逻辑的步骤是查看“应用程序示例”,并检查适合您需求的应用程序。对于这些,最好的起点是OCCTOverview,位于OCCT installation的子文件夹 /samples/qt。

This sample provides code examples for several actions as well as visualization of these code snippets output. The Overview interface is dynamically changing based on selected Category at the menu. Additional menu buttons will appear, providing users with subcategories and relevant commands to select one of the actions. The result will appear in the viewer window, the code will appear at the top right, and in several cases the output will be produced at the bottom right window.

此示例提供多个操作的代码示例,以及这些代码段输出的可视化效果。整体界面会根据菜单中选定的“类别”动态变化。其他菜单按钮也将出现,为用户提供子类别和相关命令以选择其中一项操作。结果将显示在查看器窗口中,代码将显示在右上角,在某些情况下,输出将在右下角窗口中生成。

The 3D viewer window has a row of preset interface buttons to customize the visual output.

Those buttons can be grouped into three types, left to right:

  • View controls: Fit all and Isometric, will center the view and reset the camera angles respectively;

  • Display mode customization: HLR, e.g. "Hidden line removal" (works only when shading is disabled) can be turned on and off; solid models may be displayed either in Shading or Wireframe modes. Transparency level may be set for models in shading mode;

  • The last four buttons in a row are beautifiers enabling Ray-tracing engine and configuring it's parameters.

3D 查看器窗口有一排预设界面按钮,用于自定义视觉输出。

这些按钮可以分为三种类型,从左到右:

  • 视图控制:全部拟合等距,分别是使视图居中和重置相机角度;

  • 显示模式自定义:例如HLR,“Hidden line removal,隐藏线去除”(仅在禁用阴影时有效)可以打开和关闭;实体模型可以以“着色”或“线框”模式显示。可以为着色模式下的模型设置透明度级别;

  • 最后四个按钮是美化器,用于启用光线追踪引擎并配置其参数。

At the bottom left of the screen the orientation cube (trihedron) is located. The trihedron interactively shows the position of the camera in relation to the XYZ axis of the displayed data. The sides of the trihedron are labeled to help with orientation. Click on a side of the box to orient the camera view along the preferred axis.

The 2D viewer window lacks most of these elements and only have Fit all button.

The Geometry category of the Overview focuses on primitive objects like dots, lines (including vectors) or planes. These objects will appear in the viewer after the subcategory is selected. This section will demonstrate these entities both in 2D and 3D view mode and provide basic examples of parametric creation and data analysis.

立方体(三面体)位于屏幕的左下角。三面体以交互方式显示相机相对于所显示数据的 XYZ 轴的位置。三面体的侧面被标记以帮助定向。点击框的一侧可沿首选轴定向摄像机视图。

2D 查看器窗口缺少大部分这些元素,只有“方向立方体(三面体)位于”按钮。

概述文档中的“几何”类别侧重于基本对象,如点、线(包括矢量)或平面,这些对象在子类别被选择后会显示在查看器中。本节将在 2D 和 3D 视图模式下演示这些实体,并提供参数化创建和数据分析的基本示例。

The usage of the functions shown in the Overview is described more thoroughly at the Modeling data section of the documentation. Additionally, Modeling Algorithms are used in more complex cases.

The Topology section of the Overview demonstrates the functions used in 3D operations. Multiple use cases are provided, including different object intersections, modifying and calculations. Some of these use cases are described in the documentation, such as Inspector usage.

概述文档中所示函数的用法在文档的“建模数据”章节中进行了更全面的描述。此外,“建模算法”被用于更复杂的情况。

概述文档中的“拓扑”章节演示了 3D 操作中使用的函数,提供了多个应用示例,包括不同对象的交集、修改和计算。其中一些示例在文档中进行了描述,例如“检测器”的用法。

The subsections are grouped as shown on the screenshot before. Most shapes and primitive objects are introduced and then followed by a set of operations and interactions.

The Triangulation segment allows computing the number of triangles on a shape.

This may be inspected via Poly_Triangulation Class Reference - a part of the Reference manual, an overall Open CASCADE code guide that may be used to inspect the key points in classes and their connections.

这些小节按前面屏幕截图所示进行分组。介绍了大多数形状和基本对象,然后是一组操作和交互。

三角测量允许计算三角形数量。

这可以通过"Poly_Triangulation类参考"(见"参考手册") 进行检查。"参考手册"是一个完整的Open CASCADE编码指南,可用于检查类中的关键点及其连接。

The triangulation uses some of Mesh-related classes - see full description at Mesh documentation section.

The Data exchange section provides examples of how to export and import files of several different formats.

三角测量使用了一些与网格相关的类,完整描述请参阅“网格”章节。

数据交换”章节提供了如何导出和导入几种不同格式的文件的示例。

The OCAF section gives an introduction for the Open CASCADE Application Framework functionality. To test these functions, create an object first (box or cylinder). After that, the object may be modified and saved. Actions are recorded and may be undone or redone.

OCAF”章节介绍了“Open CASCADE 应用框架”的功能。若要测试这些功能,请先创建一个对象(框或圆柱体)。之后,可以修改并保存对象。操作将被记录下来,可以撤消或重做。

Viewers section demonstrates examples of the 2D and 3D visualization outputs. Check Visualization section of the documentation for a detailed description. In addition to these two samples, there are much more that might be of use to a new user based on their particular use case.

Check Readme files in the sample directories to learn more about samples compilation.

Note: source code for OCCTOverview is stored at 'samples/qt/OCCTOverview/src' folder in your OCCT root, and the source code files for examples presented in subsections are stored at 'samples/OCCTOverview/code folder'. Several utility classes that are not presented in the example window may be found in example source code files.

The overall classes introduction may be found in the Foundation Classes section of the documentation. The "Introduction" section contains short descriptions of the most massive entries in the documentation.

查看器”章节演示了 2D 和 3D 可视化输出的示例。有关详细说明,请查看文档的“可视化” 章节。除了这两个示例之外,还为新手用户提供了更多可能对新用户有用的特定示例。

检查示例目录中的自述文件以了解有关示例编译的详细信息。

注意: OCCTOverview的源代码存储在 OCCT 根目录的“samples/qt/OCCTOverview/src”文件夹中,各小节中示例的源代码文件存储在“samples/OCCTOverview/code folder”中。示例窗口中未显示的一些工具类可以在示例源代码文件中找到。

整体类的介绍可以在概述文档的“基础类”章节中找到。“引言”章节对文献中的一些重要条目做了简短描述。

Additional assistance 其它支持

There are several places that may be of use for new users.

The first one is Training & E-learning page that lists available trainings and describes their specifics.

The second one is the Overview documentation (this document is a part of it) - here you can find information that suits most of the use cases. This may seem overwhelming at first, but if you have the clear understanding of what do you seek, you will most likely find the required information.

Aside from the Overview documentation itself, the Reference manual is present. Use it to check classes descriptions, dependencies and examples. Additionally, there is a Forum where you can contact the OCCT community and developers.

有几个地方可能对新手有帮助。

第一个是Training & E-learning页面,里面列出了可用的培训,并描述了培训课程的详情。

第二个是概述文档(本文档也是其中一部分) - 在这里,您可以找到适合大多数使用场景的信息。刚开始您可能会不知所措,但如果您清楚地知道自己要寻求的内容,您很可能会在这里找到所需的信息。

除了概述文档,还有参考手册,您可以使用它来了解类描述、依赖项和示例。

此外,还有一个论坛,您可以在其中联系OCCT社区和开发人员。