• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            eryar

            PipeCAD - Plant Piping Design Software.
            RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
            posts - 603, comments - 590, trackbacks - 0, articles - 0

            OpenCASCADE Extended Data Exchange - XDE

            Posted on 2018-07-29 19:43 eryar 閱讀(4502) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            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的樹結構。



            為了方便大家在移動端也能看到我的博文和討論交流,現已注冊微信公眾號,歡迎大家掃描下方二維碼關注。
            Shing Liu(eryar@163.com)
            国产精品久久永久免费| 国产精品免费看久久久| 狠色狠色狠狠色综合久久 | 亚洲综合久久综合激情久久| 久久久精品人妻一区二区三区四| 国产成人精品免费久久久久| 国产精品久久久久久五月尺| 久久人人爽爽爽人久久久| 久久精品国产精品青草 | 久久影院综合精品| 一本一本久久A久久综合精品| 久久天天躁狠狠躁夜夜躁2O2O| 久久精品国产色蜜蜜麻豆| 久久福利青草精品资源站免费| 国产精品久久免费| 久久国产精品久久国产精品| 久久国产一区二区| 久久久99精品一区二区| 狠狠色丁香久久婷婷综合五月| 亚洲午夜久久久久久久久久| 久久久久99精品成人片直播| 精品一区二区久久| 久久996热精品xxxx| 国产99精品久久| 嫩草影院久久国产精品| 亚洲va中文字幕无码久久不卡| 国产成人精品久久综合| 久久国产欧美日韩精品| 色综合久久天天综合| 无码国内精品久久人妻麻豆按摩| 国产精品久久久久久久久免费| 97精品国产97久久久久久免费| 久久天天躁狠狠躁夜夜2020| 精品国产乱码久久久久久郑州公司| 国产精品久久国产精品99盘 | 亚洲精品乱码久久久久久蜜桃 | 亚洲国产成人乱码精品女人久久久不卡| 无码国内精品久久综合88| 国产精品久久久久久福利69堂| 久久久久黑人强伦姧人妻| 伊人久久精品无码av一区|