Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation


My first application
  • Profile - defining support points
  • Profile - defining the geometry
  • Profile - defining the topology
  • Profile - completing the profile
  • Body - prism the profile
  • Body - applying fillets
  • Body - adding the neck
  • Body - creating a hollowed solid
  • Threading - creating surfaces
  • Threading - defining 2D curves
  • Threading - building edges and wires
  • Threading - creation and building the resulting compound


  • Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
    Technical overview
    Areas of use
    Advantages
    FAQ
    Screenshots
    Shape factory
    Shape gallery
    Demonstrations
    What's new
    System requirements
    Download Center
    Public license
    Documentation
    Getting started
    Forums
    Open Source community
    Training and e-learning
    A-la Carte Support
    Value-added software
    Complementary Components
    Customer Corner
    Company Profile
    Marketing Materials
    Contact Us
    News
    Home / Developer Corner / Getting started / My first application / Profile - completing the profile

    Profile - completing the profile

    Once the first part of your wire is created you need to compute the complete profile.

    simple way to do this is to:

    - compute a new wire by reflecting the existing one.
    - add the reflected wire to the initial one.


     



    To apply a transformation on shapes (including wires), you first need to define the properties of a 3D geometric transformation by using the gp_Trsf class. This affinity transformation can be a translation, a rotation, a scale, a reflection or a combination of these.

    In our case, we need to define a reflection with respect to the X axis of the global coordinate system. An axis, defined with the gp_Ax1 class, is built out of a point and a direction (3D unitary vector). There are two ways to define this axis.

    The first way is to define it from scratch, using its geometric definition:

    - X axis is located at (0 , 0 , 0) - use the gp_Pnt class.
    - X axis direction is (1 , 0 , 0) - use the gp_Dir class. A gp_Dir instance is created out of its X, Y and Z coordinates.


    gp_Pnt aOrigin(0 , 0 , 0);
    gp_Dir xDir(1 , 0 , 0);
    gp_Ax1 xAxis(aOrigin , xDir);


    The second and simplest way is to use the geometric constants defined in the gp package (origin, main directions and axis of the global coordinate system). To get the X axis, just call the gp::OX method:


    gp_Ax1 xAxis = gp::OX();


    As previously explained, the property of a 3D geometric transformation is defined with the gp_Trsf class. There are two different ways to use this class:

    - by defining a transformation matrix from scratch
    - by using the appropriate methods corresponding to the required transformation (SetTranslation for a translation, SetMirror for a reflection, etc.): the matrix is automatically computed.

    As the simplest approach is always the best, you should use the SetMirror method with the axis as the center of symmetry.


    gp_Trsf aTrsf;
    aTrsf.SetMirror(xAxis);



    You now have all necessary data to apply the transformation with the BRepBuilderAPI_Transform class by specifying:

    - the shape on which the transformation must be applied.
    - the geometric transformation


    BRepBuilderAPI_Transform aBRepTrsf(aWire , aTrsf);


    BRepBuilderAPI_Transform does not modify the nature of the shape: the result of the reflected wire remains a wire. But the function-like call or the BRepBuilderAPI_Transform::Shape method returns a TopoDS_Shape object:


    TopoDS_Shape aMirroredShape = aBRepTrsf.Shape();


    What you need is a method to consider the resulting reflected shape as a wire. The TopoDS global functions provides this kind of service by casting a shape into its real type. To cast the transformed wire, use the TopoDS::Wire method.


    TopoDS_Wire aMirroredWire = TopoDS::Wire(aBRepTrsf.Shape());


    The bottle's profile is almost finished. You have created two wires : aWire and aMirroredWire. You need to concatenate them to compute a single shape. To do this, you use the BRepBuilderAPI_MakeWire class as follows:

    - create an instance of BRepBuilderAPI_MakeWire.
    - add all edges of the two wires by using the Add method on this object.


    BRepBuilderAPI_MakeWire mkWire;

    mkWire.Add(aWire);
    mkWire.Add(aMirroredWire);

    TopoDS_Wire myWireProfile = mkWire.Wire();

    next step
    previous step

     
     

    © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map