OpenCASCADE Extended Data Exchange - XDE

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;

wps_clip_image-25767

Figure 1. 导入的STEP模型

2. Extended Data Exchange(XDE)

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

wps_clip_image-29842

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支持装配结构的读写。如下图所示:

wps_clip_image-19676

Figure 3. 装配结构树

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

wps_clip_image-18828

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

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

6. Names

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

wps_clip_image-10693

Figure 5. 模型名字

7. Colors and Layers

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

l 通用颜色:generic color(XCAFDoc_ColorGen)

l 曲面颜色:surface color(XCAFDoc_ColorSurf)

l 曲线颜色:curve color(XCAFDoc_ColorCurv)

wps_clip_image-4463

Figure 6. XDE颜色

8. Code Example

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

wps_clip_image-24546

Figure 7. XDE Samples in Draw Test Harness

wps_clip_image-18659

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 0;
}

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

wps_clip_image-8893

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

9. Conclusion

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

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

转载于:https://www.cnblogs.com/opencascade/p/XDE.html

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
毕业设计,基于SpringBoot+Vue+MySQL开发的公寓报修管理系统,源码+数据库+毕业论文+视频演示 现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本公寓报修管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此公寓报修管理系统利用当下成熟完善的Spring Boot框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的MySQL数据库进行程序开发。公寓报修管理系统有管理员,住户,维修人员。管理员可以管理住户信息和维修人员信息,可以审核维修人员的请假信息,住户可以申请维修,可以对维修结果评价,维修人员负责住户提交的维修信息,也可以请假。公寓报修管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。 关键词:公寓报修管理系统;Spring Boot框架;MySQL;自动化;VUE
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值