OpenCASCADE Extended Data Exchange - XDE

eryar@163.com

Abstract. OpenCASCADE Data Exchange allows developing OCCT-Based applications that can interact with other CAD systems by writing and reading CAD models to and from external data. The exchanges run smoothly regardless of the quality of external data or requirements to its internal representation, for example to the data types, accepted geometric inaccuracies, etc. Data Exchange is organized in a modular way as a set of interfaces that comply with various CAD formats: IGES, STEP, STL, VRML, etc. The interfaces allow software based on OCCT to exchange data with various CAD/PDM software packages, maintaining a good level of interoperability. Extended Data Exchange allows translating additional attributes attached to geometric data(colors, layers, names, materials, etc.)

Key Words. DataExchange, STEP, IGES, XDE, OCAF,

1. Introduction

OpenCASCADE的DataExchange数据交换模块可以通过读写CAD模型数据的方式与其他CAD系统进行交互。标准数据交换(Standardized Data Exchange)的接口可以查询和检查输入文件,转换文件中的CAD模型,正确性检查。目前开源部分支持的文件格式有:

l STEP(AP203:Mechanical Design;AP214:Automotive Design)

l IGES(5.3版本)

l VRML和STL;

Figure 1. 导入的STEP模型

2. Extended Data Exchange(XDE)

扩展的数据交换模块可以转换附加在几何BREP体中其他信息,如颜色、图层,组装结构等,因此提高与其他CAD软件的兼容性。目前包含这些信息的文件格式有IGES和STEP。XDE通过XCAF框架来读写包含颜色、图层等信息的IGES,STEP文件。

Figure 2. 使用XDE导入的模型

3. XDE Basic Terms

为了更好的理解XDE,定义了几个关键术语:

l Shape:单独的模型,不属于任何装配结构(a standalone shape, which does not belong to the assembly structure);

l Instance:其他模型的一个实例化,位置信息可以相同,也可以不同(a replication of another shape with a location that can be the same location or different one);

l Assembly:装配结构;

4. XDE Organization

XDE的基础是XCAF,XCAF是一个基于OCAF(Open CASCADE Technology Application Framework)框架的框架,可用于处理装配信息和其他属性数据。XDE使用OCAF来存储装配结构和属性,所以可以得到装配结构树的每层TopoDS表示。

5. Assemblies

XDE支持装配结构的读写。如下图所示:

Figure 3. 装配结构树

装配结构通过OCAF的Label/SubLabel来组织:

Figure 4. 一个简单的框架模型

类XCAFDoc_ShapeTool来管理Label中的模型属性。

6. Names

XDE支持读写IGES和STEP中的名字数据。这个关闭这个功能以减小文件。

Figure 5. 模型名字

7. Colors and Layers

XDE可以读写模型的颜色数据,使用到的类有:

l 通用颜色:generic color(XCAFDoc_ColorGen)

l 曲面颜色:surface color(XCAFDoc_ColorSurf)

l 曲线颜色:curve color(XCAFDoc_ColorCurv)

Figure 6. XDE颜色

8. Code Example

程序将Draw Test Harness的samples的XDE的例子模型来测试读取装配结构、颜色等信息。首先将例子模型通过命令:WriteStep D d:/rod.step来保存装配结构、颜色等数据到STEP格式。

Figure 7. XDE Samples in Draw Test Harness

Figure 8. Shapes with assembly and color info

使用XDE读取STEP文件代码示例如下:

Handle(XCAFDoc_ColorTool) aColorTool;
Handle(XCAFDoc_ShapeTool) aShapeTool; void visit(const TDF_Label& theLabel)
{
theLabel.EntryDump(std::cout); Handle(TDataStd_Name) aName;
if (theLabel.FindAttribute(TDataStd_Name::GetID(), aName))
{
std::cout << " Name: " << aName->Get() << std::endl;
} if (aColorTool->IsSet(theLabel, XCAFDoc_ColorGen))
{
Quantity_Color aColor;
aColorTool->GetColor(theLabel, aColor); std::cout << " Color: " << Quantity_Color::StringName(aColor.Name()) << std::endl;
} if (aShapeTool->IsShape(theLabel))
{
TopoDS_Shape aShape;
aShapeTool->GetShape(theLabel, aShape);
} for (TDF_ChildIterator c(theLabel); c.More(); c.Next())
{
visit(c.Value());
}
} void readStepXde(const std::string& theStepName)
{
Handle(TDocStd_Document) aDoc;
Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication();
anApp->NewDocument("MDTV-XCAF", aDoc); STEPCAFControl_Reader aStepReader;
aStepReader.SetColorMode(true);
aStepReader.SetNameMode(true); aStepReader.ReadFile(theStepName.c_str()); aStepReader.Transfer(aDoc); TDF_Label aRootLabel = aDoc->Main(); aShapeTool = XCAFDoc_DocumentTool::ShapeTool(aRootLabel);
aColorTool = XCAFDoc_DocumentTool::ColorTool(aRootLabel); visit(aRootLabel); } int main(int argc, char *argv[])
{
readStepXde("D:/rod.STEP"); return ;
}

程序运行结果如下图所示:

Figure 9. 使用XDE读取STEP装配结构、颜色、名字等

9. Conclusion

使用XDE模块支持STEP和IGES中的装配结构、颜色、名字等信息的读写,提高与其他CAD系统数据交换效果。

XDE主要使用OCAF框架来处理装配结构、属性信息,所以要使用XDE,必须理解OCAF的框架,OCAF框架也是一个基于Label的树结构。

OpenCASCADE Extended Data Exchange - XDE的更多相关文章

  1. OpenCASCADE Data Exchange - 3D PDF

    OpenCASCADE Data Exchange - 3D PDF eryar@163.com Abstract. Today most 3D engineering model data are ...

  2. Open Cascade Data Exchange STL

    Open Cascade Data Exchange STL eryar@163.com 摘要Abstract:介绍了三维数据交换格式STL的组成,以及Open Cascade中对STL的读写.并将O ...

  3. AVEVA Model Data Exchange Exports Structure Models

    AVEVA Model Data Exchange Exports Structure Modelseryar@163.com Use Model Data Exchange Addin to exp ...

  4. Extended Data Type Properties [AX 2012]

    Extended Data Type Properties [AX 2012] This topic has not yet been rated - Rate this topic Updated: ...

  5. 【12c】扩展数据类型(Extended Data Types)-- MAX_STRING_SIZE

    [12c]扩展数据类型(Extended Data Types)-- MAX_STRING_SIZE 在12c中,与早期版本相比,诸如VARCHAR2, NAVARCHAR2以及 RAW这些数据类型的 ...

  6. Oracle 12C 新特性之扩展数据类型(extended data type)

    Oracle 12C 新特性-扩展数据类型,在12c中,与早期版本相比,诸如VARCHAR2, NAVARCHAR2以及 RAW这些数据类型的大小会从4K以及2K字节扩展至32K字节.只要可能,扩展字 ...

  7. Overview of OpenCascade Library

    Overview of OpenCascade Library eryar@163.com 摘要Abstract:对OpenCascade库的功能及其实现做简要介绍. 关键字Key Words:Ope ...

  8. OpenCascade简介

    OpenCascade简介   Overview of OpenCascade Library eryar@163.com 摘要Abstract:对OpenCascade库的功能及其实现做简要介绍. ...

  9. Open CASCADE Technology(OCCT)概述

    OCCT模块结构图 基础类: Foundation Classes module underlies all other OCCT classes; 模型数据: Modeling Data modul ...

随机推荐

  1. js中如何取精度

    js中如何取精度 一.总结 一句话总结:其实round()函数去经度会有误差,直接用num.toFixed(2)简单方便. toFixed()方法会按照指定的小数返回数值的字符串表示.var num ...

  2. PermissionError: [Errno 13] in python

    出现该错误,首先尝试以管理员身份运行 cmd.exe 程序,然后关闭所有的与 python 相关的进程. 1. open 打开一个文件夹(目录),而不是文件 这一错误一般发生在使用 open函数对文件 ...

  3. HDU 4786Fibonacci Tree(最小生成树)

    Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...

  4. python 3.x 写 shell sed 替换功能

    shell sed 替换功能 f1 = open('yesterday','r',encoding='utf-8') f2 = open('yesterday2','w',encoding='utf- ...

  5. 集合TreeSet的使用

    集合中的TreeSet是集合体系结构中的底层实现,是Collection的孙子,Set的儿子.TreeSet除拥有父接口的特点外,还有其自身的特点.下面就看看TreeSet的排序是怎么实现的.从它的构 ...

  6. Surfaces

    For Developers‎ > ‎Design Documents‎ > ‎Chromium Graphics // Chrome GPU‎ > ‎ Surfaces Goals ...

  7. Playing With Stones UVALive - 5059 Nim SG函数 打表找规律

    Code: #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; ll ...

  8. 怎样只接受固定长度数组为参数 & 数组形参

    注意,对于多维数组的情况.

  9. HDU Victor and World (最短路+状态压缩)

    题目链接:传送门 题意: n个城市m条路.刚開始在点1,求把每一个城市都遍历一边最后回到1的花费的最小值. 分析: ​​+n​2​​∗2​n​​). 转自Bestcode. 以下说说我的状态转移,首先 ...

  10. c3p0出现 An attempt by a client to checkout a Connection has timed out

    java.sql.SQLException: An attempt by a client to checkout a Connection has timed out. at com.mchange ...