• <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 閱讀(4607) 評(píng)論(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數(shù)據(jù)交換模塊可以通過讀寫CAD模型數(shù)據(jù)的方式與其他CAD系統(tǒng)進(jìn)行交互。標(biāo)準(zhǔn)數(shù)據(jù)交換(Standardized Data Exchange)的接口可以查詢和檢查輸入文件,轉(zhuǎn)換文件中的CAD模型,正確性檢查。目前開源部分支持的文件格式有:

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

            l IGES(5.3版本)

            l VRML和STL;

            wps_clip_image-25767

            Figure 1. 導(dǎo)入的STEP模型

            2. Extended Data Exchange(XDE)

            擴(kuò)展的數(shù)據(jù)交換模塊可以轉(zhuǎn)換附加在幾何BREP體中其他信息,如顏色、圖層,組裝結(jié)構(gòu)等,因此提高與其他CAD軟件的兼容性。目前包含這些信息的文件格式有IGES和STEP。XDE通過XCAF框架來(lái)讀寫包含顏色、圖層等信息的IGES,STEP文件。

            wps_clip_image-29842

            Figure 2. 使用XDE導(dǎo)入的模型

            3. XDE Basic Terms

            為了更好的理解XDE,定義了幾個(gè)關(guān)鍵術(shù)語(yǔ):

            l Shape:?jiǎn)为?dú)的模型,不屬于任何裝配結(jié)構(gòu)(a standalone shape, which does not belong to the assembly structure);

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

            l Assembly:裝配結(jié)構(gòu);

            4. XDE Organization

            XDE的基礎(chǔ)是XCAF,XCAF是一個(gè)基于OCAF(Open CASCADE Technology Application Framework)框架的框架,可用于處理裝配信息和其他屬性數(shù)據(jù)。XDE使用OCAF來(lái)存儲(chǔ)裝配結(jié)構(gòu)和屬性,所以可以得到裝配結(jié)構(gòu)樹的每層TopoDS表示。

            5. Assemblies

            XDE支持裝配結(jié)構(gòu)的讀寫。如下圖所示:

            wps_clip_image-19676

            Figure 3. 裝配結(jié)構(gòu)樹

            裝配結(jié)構(gòu)通過OCAF的Label/SubLabel來(lái)組織:

            wps_clip_image-18828

            Figure 4. 一個(gè)簡(jiǎn)單的框架模型 

            類XCAFDoc_ShapeTool來(lái)管理Label中的模型屬性。

            6. Names

            XDE支持讀寫IGES和STEP中的名字?jǐn)?shù)據(jù)。這個(gè)關(guān)閉這個(gè)功能以減小文件。

            wps_clip_image-10693

            Figure 5. 模型名字

            7. Colors and Layers

            XDE可以讀寫模型的顏色數(shù)據(jù),使用到的類有:

            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

            程序?qū)raw Test Harness的samples的XDE的例子模型來(lái)測(cè)試讀取裝配結(jié)構(gòu)、顏色等信息。首先將例子模型通過命令:WriteStep D d:/rod.step來(lái)保存裝配結(jié)構(gòu)、顏色等數(shù)據(jù)到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;
            }

            程序運(yùn)行結(jié)果如下圖所示:

            wps_clip_image-8893

            Figure 9. 使用XDE讀取STEP裝配結(jié)構(gòu)、顏色、名字等

            9. Conclusion

            使用XDE模塊支持STEP和IGES中的裝配結(jié)構(gòu)、顏色、名字等信息的讀寫,提高與其他CAD系統(tǒng)數(shù)據(jù)交換效果。

            XDE主要使用OCAF框架來(lái)處理裝配結(jié)構(gòu)、屬性信息,所以要使用XDE,必須理解OCAF的框架,OCAF框架也是一個(gè)基于Label的樹結(jié)構(gòu)。



            為了方便大家在移動(dòng)端也能看到我的博文和討論交流,現(xiàn)已注冊(cè)微信公眾號(hào),歡迎大家掃描下方二維碼關(guān)注。
            Shing Liu(eryar@163.com)
            国产精品久久波多野结衣| 日韩电影久久久被窝网| 97久久精品人妻人人搡人人玩| 青青草国产精品久久| 国产三级精品久久| 久久一日本道色综合久久| 久久国产成人亚洲精品影院| 久久精品天天中文字幕人妻 | 66精品综合久久久久久久| 久久精品aⅴ无码中文字字幕不卡| 国产成人精品久久免费动漫| 久久久久久国产精品无码下载| 久久国产精品免费一区| 国产午夜电影久久| 精品久久久久久无码人妻蜜桃| 四虎国产精品免费久久5151| 亚洲乱码中文字幕久久孕妇黑人| 伊人久久综在合线亚洲2019| 久久99免费视频| 色8激情欧美成人久久综合电| 热久久视久久精品18| 一本色道久久88精品综合| 久久精品国产久精国产思思| 国产一区二区三区久久精品| 国産精品久久久久久久| 国产69精品久久久久APP下载| 久久精品免费一区二区| 久久精品国产99国产电影网 | yy6080久久| 99久久国语露脸精品国产| 伊人色综合久久天天人守人婷| 99久久国产亚洲综合精品| 99精品国产在热久久无毒不卡| 久久激情五月丁香伊人| 久久精品国产亚洲AV大全| 久久久久久青草大香综合精品| 国产午夜福利精品久久2021| 99久久精品国产一区二区 | 思思久久好好热精品国产| 久久国产亚洲精品麻豆| 精品久久久久久久久中文字幕|