• <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

            Open Cascade造型算法——倒圓與倒角

            Posted on 2013-01-20 19:21 eryar 閱讀(5552) 評(píng)論(2)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            造型算法——倒圓與倒角

            Modeling Algorithms Fillets and Chamfers

            eryar@163.com

            一、倒圓Fillet Constructor

            1. BRepFilletAPI_MakeFillet

            使用類BRepFilletAPI_MakeFillet來為形狀添加倒圓。倒圓是用光滑面來代替角邊。使用方法如下:

            l 首先,給定一個(gè)需要倒圓的形狀;

            l 然后,通過Add方法來添加描述倒圓的參數(shù),倒圓所需的參數(shù)包括一個(gè)邊edge和半徑radius。當(dāng)然,邊edge必須由兩個(gè)面face所共有。倒圓會(huì)將原來的邊替換成光滑的圓面過渡。

            l 最后,通過詢問結(jié)果來執(zhí)行倒圓操作。

            注:添加一個(gè)倒圓兩次并不會(huì)出錯(cuò),因?yàn)橹槐A袅俗詈笠淮翁淼牡箞A。

            Figure 1. Filleting two edges using radius r1 and r2

            Figure 1. Filleting two edges using radius r1 and r2

            下面給出一個(gè)將創(chuàng)建一個(gè)倒圓的長(zhǎng)方體,其尺寸分別為abc,倒圓半徑r

            Figure 2. Filleting a box

            Figure 2. Filleting a box

            代碼如下所示,創(chuàng)建上圖所示的倒圓的長(zhǎng)方體的參數(shù)分別為:

            a = 100b = 60c = 80r = 10

            #include <TopoDS_Shape.hxx> 
            
            #include <TopoDS.hxx> 
            
            #include <BRepPrimAPI_MakeBox.hxx> 
            
            #include <TopoDS_Solid.hxx> 
            
            #include <BRepFilletAPI_MakeFillet.hxx> 
            
            #include <TopExp_Explorer.hxx> 
            
             
            
            TopoDS_Shape FilletedBox(const Standard_Real a, 
            
                  const Standard_Real b, 
            
                  const Standard_Real c, 
            
                  const Standard_Real r) 
            
            { 
            
                TopoDS_Solid Box = BRepPrimAPI_MakeBox(a,b,c); 
            
                BRepFilletAPI_MakeFillet MF(Box); 
            
             
            
                // add all the edges to fillet 
            
                TopExp_Explorer ex(Box,TopAbs_EDGE); 
            
                while (ex.More()) 
            
                { 
            
                    MF.Add(r,TopoDS::Edge(ex.Current())); 
            
                    ex.Next(); 
            
                }
            
             
            
                return MF.Shape(); 
            
            } 
            

            如下圖所示為創(chuàng)建一個(gè)半徑變化的倒圓操作:

            Figure 3. Evolutive radius fillet

            Figure 4. Evolutive radius fillet a box

            程序代碼如下所示:

              1:     TopoDS_Shape theBox = BRepPrimAPI_MakeBox(200, 200, 200);
            
              2:     BRepFilletAPI_MakeFillet Rake(theBox);
            
              3:     ChFi3d_FilletShape FSH = ChFi3d_Rational;
            
              4:     Rake.SetFilletShape(FSH);
            
              5:  
            
              6:     TColgp_Array1OfPnt2d parAndRad(1, 6);
            
              7:     parAndRad.SetValue(1, gp_Pnt2d(0, 10));
            
              8:     parAndRad.SetValue(2, gp_Pnt2d(50, 20));
            
              9:     parAndRad.SetValue(3, gp_Pnt2d(70, 20));
            
             10:     parAndRad.SetValue(4, gp_Pnt2d(130, 60));
            
             11:     parAndRad.SetValue(5, gp_Pnt2d(160, 30));
            
             12:     parAndRad.SetValue(6, gp_Pnt2d(200, 20));
            
             13:  
            
             14:     TopExp_Explorer ex(theBox, TopAbs_EDGE);
            
             15:     Rake.Add(parAndRad, TopoDS::Edge(ex.Current()));
            
             16:     TopoDS_Shape evolvedBox = Rake.Shape();
            
             17: 

            2. BRepFilletAPI_MakeFillet2d

            BRepFilletAPI_MakeFillet2d is used to construct fillets and chamfers on planar faces.

            我按照示例代碼運(yùn)行了一下程序,結(jié)果程序總是崩潰,其操作的效果不得而知,所以也得不到真實(shí)的效果圖。將其程序代碼列出如下所示:

              1: #include “BRepPrimAPI_MakeBox.hxx” 
            
              2: #include “TopoDS_Shape.hxx” 
            
              3: #include “TopExp_Explorer.hxx” 
            
              4: #include “BRepFilletAPI_MakeFillet2d.hxx” 
            
              5: #include “TopoDS.hxx” 
            
              6: #include “TopoDS_Solid.hxx” 
            
              7:  
            
              8: TopoDS_Shape FilletFace(const Standard_Real a, 
            
              9:     const Standard_Real b, 
            
             10:     const Standard_Real c, 
            
             11:     const Standard_Real r) 
            
             12: { 
            
             13:     TopoDS_Solid Box = BRepPrimAPI_MakeBox (a,b,c); 
            
             14:     TopExp_Explorer ex1(Box,TopAbs_FACE); 
            
             15:  
            
             16:     const TopoDS_Face& F = TopoDS::Face(ex1.Current()); 
            
             17:     BRepFilletAPI_MakeFillet2d MF(F); 
            
             18:     TopExp_Explorer ex2(F, TopAbs_VERTEX); 
            
             19:  
            
             20:     while (ex2.More()) 
            
             21:     { 
            
             22:         MF.AddFillet(TopoDS::Vertex(ex2.Current()),r); 
            
             23:         ex2.Next(); 
            
             24:     } 
            
             25:  
            
             26:     // while... 
            
             27:     return MF.Shape(); 
            
             28: }
            
             29: 

            二、倒角Chamfer Constructor

            1BRepFilletAPI_MakeChamfer

            BREpFilletAPI_MakeChamfer的使用方法與BRepFilletAPI_MakeFillet大致類似,但稍有不同:

            a) The surfaces created are ruled and not smooth;

            b) The Add syntax for selecting edges requires one or two distances, one edge and one face(contiguous to the edge);

            Add(dist, E, F);

            Add(d1, d2, E, F); with d1 on the face F.

            Figure 5. Creating a chamfer

            Figure 6. The box with chamfers

            程序代碼如下所示:

              1: TopoDS_Shape theBox = BRepPrimAPI_MakeBox(130,200,170); 
            
              2: BRepFilletAPI_MakeChamfer MC(theBox); 
            
              3: TopTools_IndexedDataMapOfShapeListOfShape M; 
            
              4: TopExp::MapShapesAndAncestors(theBox,TopAbs_EDGE,TopAbs_FACE,M); 
            
              5:  
            
              6: for (Standar1d_Integer i;i<M.Extent();i++) 
            
              7: { 
            
              8:     TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); 
            
              9:     TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); 
            
             10:     MC.Add(15,15,E,F); 
            
             11: } 
            
             12:  
            
             13: TopoDS_Shape ChanfrenedBox = MC.Shape();  
            
             14: 

             

            Feedback

            # re: Open Cascade造型算法&mdash;&mdash;倒圓與倒角  回復(fù)  更多評(píng)論   

            2013-01-23 22:37 by javaxxz.com
            您的網(wǎng)站做的非常專業(yè)。誠與貴站交換鏈接。Java學(xué)習(xí)者論壇http://www.javaxxz.com 有意請(qǐng)回復(fù)郵箱:admin@javaxxz.com

            # re: Open Cascade造型算法&mdash;&mdash;倒圓與倒角  回復(fù)  更多評(píng)論   

            2014-02-12 23:14 by eryar
            感謝seumonkey指出BRepFilletAPI_MakeFillet2d造型算法示例中錯(cuò)誤:
            http://blog.csdn.net/fcqwin/article/details/17204707
            久久中文骚妇内射| 青青青伊人色综合久久| 久久精品蜜芽亚洲国产AV| 99久久国产热无码精品免费 | 久久久久香蕉视频| AV无码久久久久不卡蜜桃| a级毛片无码兔费真人久久| 久久久久久久久66精品片| 国产午夜免费高清久久影院| 精品久久国产一区二区三区香蕉| 色综合久久无码五十路人妻| 热99re久久国超精品首页| 亚洲中文字幕无码久久2020| 国产亚洲精午夜久久久久久| 久久久久亚洲AV无码专区首JN| 美女写真久久影院| 国产成人久久精品激情| 97久久国产露脸精品国产| 久久久99精品成人片中文字幕| 国产精品岛国久久久久| 亚洲av日韩精品久久久久久a | 99久久综合狠狠综合久久止| 久久久久亚洲国产| 久久精品国产精品亜洲毛片 | 青青草原综合久久大伊人| 韩国三级中文字幕hd久久精品| 国内精品伊人久久久久av一坑| 欧美性猛交xxxx免费看久久久| 国产精品综合久久第一页| 东京热TOKYO综合久久精品| 久久婷婷激情综合色综合俺也去| 久久这里的只有是精品23| 欧美无乱码久久久免费午夜一区二区三区中文字幕| 久久99精品国产麻豆| 精品久久人妻av中文字幕| 少妇人妻88久久中文字幕| 亚洲av成人无码久久精品| 无码国产69精品久久久久网站| 亚洲精品乱码久久久久久自慰 | 国产ww久久久久久久久久| 青青国产成人久久91网|