• <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)
            国产激情久久久久影院小草| 国产激情久久久久影院老熟女免费| 久久综合久久鬼色| 国产精品久久新婚兰兰| 久久精品水蜜桃av综合天堂| 成人精品一区二区久久久| 中文字幕久久亚洲一区| 国产精品一久久香蕉国产线看观看| 久久精品国产亚洲Aⅴ蜜臀色欲| 国产精品99久久久精品无码| 国产精品热久久无码av| …久久精品99久久香蕉国产| 99久久免费国产精品特黄| 一本久久久久久久| 国内精品久久久久久99| 久久久久人妻一区二区三区 | 97精品伊人久久大香线蕉app| 亚洲欧洲中文日韩久久AV乱码| 青青草国产精品久久| 久久99精品久久只有精品 | 久久99热这里只有精品国产| 久久99精品久久久久久噜噜| 国内精品久久久久影院免费| 日韩AV无码久久一区二区| 亚洲国产日韩欧美综合久久| 久久久久这里只有精品| 国产香蕉97碰碰久久人人| 久久亚洲精品中文字幕三区| 国内精品久久久久| 久久这里只精品国产99热| 精品久久久久久久无码| 久久精品国产亚洲av麻豆小说| 久久久av波多野一区二区| 久久精品aⅴ无码中文字字幕重口| 人妻精品久久无码区| 久久人人爽人人爽人人片av高请| 久久婷婷五月综合国产尤物app | 亚洲AV伊人久久青青草原| 国产三级观看久久| 色婷婷综合久久久久中文字幕| 亚洲精品97久久中文字幕无码|