Open Cascade Modeling algorithm--round and chamfer

Source: Internet
Author: User

Original: Open Cascade modeling algorithm--round and chamfer

Modeling algorithm--round and chamfer modeling algorithms fillets and chamfers

Eryar@163. com First, round Fillet constructor  1. Brepfilletapi_makefillet

Use the class Brepfilletapi_makefillet to add a round to the shape. The round is made with a smooth surface instead of a corner edge. Use the following methods:

L First, given a shape that needs to be rounded;

L Then, by Adding the parameters that describe the round, the parameters required for the round include one edge edge and radius radius. Of course, edge edge must be shared by two face faces. An inverted circle replaces the original edge with a smooth round surface transition.

L Finally, you perform the round operation by asking the result.

Note: Adding an inverted circle two times does not make an error, because only the last round that was added is retained.

Figure 1. filleting two edges using RADIUS r1 and R2

Here is a cuboid that will create a round, with a size of a,b,C, and a circular radius of R.

Figure 2. filleting a box

The code below shows the parameters for creating the round cuboid as shown in the previous illustration, respectively:

a = m,b = A,c = %,r = Ten:

#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 (ex. R,topods::edge. Current ()); 
        Ex. Next (); 
    }
 
    Return MF. Shape (); 

The following illustration shows a round operation that creates a radius change:

Figure 3. evolutive radius Fillet

Figure 4. evolutive radius fillet a box

The program code looks like this:

Topods_shape Thebox = Brepprimapi_makebox (in);
Brepfilletapi_makefillet Rake (thebox);
Chfi3d_filletshape FSH = chfi3d_rational;
Rake.setfilletshape (FSH);

Tcolgp_array1ofpnt2d Parandrad (1, 6);
Parandrad.setvalue (1, gp_pnt2d (0));
Parandrad.setvalue (2, gp_pnt2d);
Parandrad.setvalue (3, gp_pnt2d);
Parandrad.setvalue (4, GP_PNT2D (130));
Parandrad.setvalue (5, GP_PNT2D (160));
Parandrad.setvalue (6, gp_pnt2d);

Topexp_explorer ex (Thebox, Topabs_edge);
Rake.add (Parandrad, Topods::edge (ex. Current ());
Topods_shape Evolvedbox = Rake.shape ();


2. Brepfilletapi_makefillet2d

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

I ran the program in the sample code, and the program always crashes, the effect of the operation is not known, so also not get the real effect of the picture. List its program code as follows:

PS: I think it should be the problem of topexp_explorer, vertex composition edge when shared use several times, instead of Topexp::mapshapes (Srcface,topabs_vertex,mapvertex);

#include "brepprimapi_makebox.hxx" 
#include "topods_shape.hxx" 
#include "topexp_explorer.hxx" 
Include "Brepfilletapi_makefillet2d.hxx" 
#include "topods.hxx" 
#include "topods_solid.hxx" 
 
Topods_ Shape filletface (const standard_real A, 
     const standard_real B, 
     const standard_real C, 
     const standard_real R ) 
 { 
     Topods_solid Box = Brepprimapi_makebox (a,b,c); 
     Topexp_explorer Ex1 (box,topabs_face); 
  
     Const topods_face& F = Topods::face (Ex1. Current ()); 
     BREPFILLETAPI_MAKEFILLET2D MF (F); 
     Topexp_explorer ex2 (F, Topabs_vertex); 
  
     while (EX2. More ()) 
     { 
         MF. Addfillet (Topods::vertex) (EX2. Current ()), r); 
         Ex2. Next (); 
     } 
  
     While ... 
     Return MF. Shape (); 
 }
 


Two, chamfer Chamfer constructor 1. Brepfilletapi_makechamfer

The use of class Brepfilletapi_makechamfer is similar to Brepfilletapi_makefillet , but slightly different:

A) The surfaces created are ruledand not smooth;

b) The Add syntax for selecting edges requires one or two distances, one edgeand one face (Contiguou Sto the Edge);

ADD (Dist, E, F);

ADD (d1, D2, E, F); With D1 in the face F.

Figure 5. Creating a chamfer

Figure 6. The box with Chamfers

The program code looks like this:

Topods_shape Thebox = Brepprimapi_makebox (130,200,170); 
Brepfilletapi_makechamfer MC (thebox); 
Toptools_indexeddatamapofshapelistofshape M; 
Topexp::mapshapesandancestors (thebox,topabs_edge,topabs_face,m); 

For (Standar1d_integer i;i<m.extent (); i++) 
{ 
   Topods_edge E = Topods::edge (M.findkey (i)); 
   Topods_face F = Topods::face (M.findfromindex (i). (a)); 
   Mc. ADD (15,15,e,f); 
} 

Topods_shape Chanfrenedbox = MC. Shape ();  



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.