mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0028347: Reuse OCCT implementation for producing end-user documentation for Products
Updated destination directory for generated by gendoc proc pdf files. Added additional option "-update_images_size" for gendoc procedure to update width of images in *.md files during pdf generation for @figure alias. Documentation was updated to use alias @figure instead of outdated @image Added support of svg image format in procedure OCCDoc_UpdateImagesSize. Added generation of overview for product components. Added generation of products refman/chm for each component.
This commit is contained in:
@@ -18,8 +18,7 @@ From a programming standpoint, Open CASCADE Technology is designed to enhance yo
|
||||
|
||||
To illustrate the use of classes provided in the 3D geometric modeling toolkits, you will create a bottle as shown:
|
||||
|
||||
@image html /tutorial/images/tutorial_image001.png
|
||||
@image latex /tutorial/images/tutorial_image001.png
|
||||
@figure{/tutorial/images/tutorial_image001.png}
|
||||
|
||||
In the tutorial we will create, step-by-step, a function that will model a bottle as shown above. You will find the complete source code of this tutorial, including the very function *MakeBottle* in the distribution of Open CASCADE Technology. The function body is provided in the file samples/qt/Tutorial/src/MakeBottle.cxx.
|
||||
|
||||
@@ -35,8 +34,7 @@ We first define the bottle specifications as follows:
|
||||
|
||||
In addition, we decide that the bottle's profile (base) will be centered on the origin of the global Cartesian coordinate system.
|
||||
|
||||
@image html /tutorial/images/tutorial_image002.png
|
||||
@image latex /tutorial/images/tutorial_image002.png
|
||||
@figure{/tutorial/images/tutorial_image002.png}
|
||||
|
||||
This modeling requires four steps:
|
||||
|
||||
@@ -85,8 +83,7 @@ Standard_Real xValue1 = aPnt1.X();
|
||||
@subsection OCCT_TUTORIAL_SUB2_2 Profile: Defining the Geometry
|
||||
With the help of the previously defined points, you can compute a part of the bottle's profile geometry. As shown in the figure below, it will consist of two segments and one arc.
|
||||
|
||||
@image html /tutorial/images/tutorial_image004.png
|
||||
@image latex /tutorial/images/tutorial_image004.png
|
||||
@figure{/tutorial/images/tutorial_image004.png}
|
||||
|
||||
To create such entities, you need a specific data structure, which implements 3D geometric objects. This can be found in the Geom package of Open CASCADE Technology.
|
||||
In Open CASCADE Technology a package is a group of classes providing related functionality. The classes have names that start with the name of a package they belong to. For example, *Geom_Line* and *Geom_Circle* classes belong to the *Geom* package. The *Geom* package implements 3D geometric objects: elementary curves and surfaces are provided as well as more complex ones (such as *Bezier* and *BSpline*).
|
||||
@@ -142,8 +139,7 @@ Referring to the previous table, to build the profile, you will create:
|
||||
* Three edges out of the previously computed curves.
|
||||
* One wire with these edges.
|
||||
|
||||
@image html /tutorial/images/tutorial_image005.png
|
||||
@image latex /tutorial/images/tutorial_image005.png
|
||||
@figure{/tutorial/images/tutorial_image005.png}
|
||||
|
||||
However, the *TopoDS* package provides only the data structure of the topological entities. Algorithm classes available to compute standard topological objects can be found in the *BRepBuilderAPI* package.
|
||||
To create an edge, you use the BRepBuilderAPI_MakeEdge class with the previously computed curves:
|
||||
@@ -181,8 +177,7 @@ Once the first part of your wire is created you need to compute the complete pro
|
||||
* compute a new wire by reflecting the existing one.
|
||||
* add the reflected wire to the initial one.
|
||||
|
||||
@image html /tutorial/images/tutorial_image006.png
|
||||
@image latex /tutorial/images/tutorial_image006.png
|
||||
@figure{/tutorial/images/tutorial_image006.png}
|
||||
|
||||
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 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 has a direction (3D unitary vector). There are two ways to define this axis.
|
||||
@@ -265,8 +260,7 @@ To compute the main body of the bottle, you need to create a solid shape. The si
|
||||
| Face | Solid |
|
||||
| Shell | Compound of Solids |
|
||||
|
||||
@image html /tutorial/images/tutorial_image007.png
|
||||
@image latex /tutorial/images/tutorial_image007.png
|
||||
@figure{/tutorial/images/tutorial_image007.png}
|
||||
|
||||
Your current profile is a wire. Referring to the Shape/Generates table, you need to compute a face out of its wire to generate a solid.
|
||||
To create a face, use the *BRepBuilderAPI_MakeFace* class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, *BRepBuilderAPI_MakeFace* computes a face out of a surface and one or more wires.
|
||||
@@ -303,8 +297,7 @@ For our purposes, we will specify that fillets must be:
|
||||
* applied on all edges of the shape
|
||||
* have a radius of *myThickness* / 12
|
||||
|
||||
@image html /tutorial/images/tutorial_image008.png
|
||||
@image latex /tutorial/images/tutorial_image008.png
|
||||
@figure{/tutorial/images/tutorial_image008.png}
|
||||
|
||||
To apply fillets on the edges of a shape, you use the *BRepFilletAPI_MakeFillet* class. This class is normally used as follows:
|
||||
|
||||
@@ -360,8 +353,7 @@ Once this is done, you perform the last step of the procedure by asking for the
|
||||
|
||||
To add a neck to the bottle, you will create a cylinder and fuse it to the body. The cylinder is to be positioned on the top face of the body with a radius of *myThickness* / 4. and a height of *myHeight* / 10.
|
||||
|
||||
@image html /tutorial/images/tutorial_image009.png
|
||||
@image latex /tutorial/images/tutorial_image009.png
|
||||
@figure{/tutorial/images/tutorial_image009.png}
|
||||
|
||||
To position the cylinder, you need to define a coordinate system with the *gp_Ax2* class defining a right-handed coordinate system from a point and two directions - the main (Z) axis direction and the X direction (the Y direction is computed from these two).
|
||||
To align the neck with the center of the top face, being in the global coordinate system (0, 0, *myHeight*), with its normal on the global Z axis, your local coordinate system can be defined as follows:
|
||||
@@ -403,8 +395,7 @@ In Open CASCADE Technology, a hollowed solid is called a *Thick* *Solid* and is
|
||||
* Create a parallel wall W2 from W1 at a distance D. If D is positive, W2 will be outside the initial solid, otherwise it will be inside.
|
||||
* Compute a solid from the two walls W1 and W2.
|
||||
|
||||
@image html /tutorial/images/tutorial_image010.png
|
||||
@image latex /tutorial/images/tutorial_image010.png
|
||||
@figure{/tutorial/images/tutorial_image010.png}
|
||||
|
||||
To compute a thick solid, you create an instance of the *BRepOffsetAPI_MakeThickSolid* class by giving the following information:
|
||||
|
||||
@@ -509,8 +500,7 @@ As a first step, you compute these cylindrical surfaces. You are already familia
|
||||
|
||||
Using the same coordinate system *neckAx2* used to position the neck, you create two cylindrical surfaces *Geom_CylindricalSurface* with the following radii:
|
||||
|
||||
@image html /tutorial/images/tutorial_image011.png
|
||||
@image latex /tutorial/images/tutorial_image011.png
|
||||
@figure{/tutorial/images/tutorial_image011.png}
|
||||
|
||||
Notice that one of the cylindrical surfaces is smaller than the neck. There is a good reason for this: after the thread creation, you will fuse it with the neck. So, we must make sure that the two shapes remain in contact.
|
||||
|
||||
@@ -535,8 +525,7 @@ P(U, V) = O + R * (cos(U) * xDir + sin(U) * yDir) + V * zDir, where :
|
||||
* R is the radius of the cylindrical surface.
|
||||
* U range is [0, 2PI] and V is infinite.
|
||||
|
||||
@image html /tutorial/images/tutorial_image012.png
|
||||
@image latex /tutorial/images/tutorial_image012.png
|
||||
@figure{/tutorial/images/tutorial_image012.png}
|
||||
|
||||
The advantage of having such parameterized geometries is that you can compute, for any (U, V) parameters of the surface:
|
||||
|
||||
@@ -545,8 +534,7 @@ The advantage of having such parameterized geometries is that you can compute, f
|
||||
|
||||
There is another advantage of these parametric equations: you can consider a surface as a 2D parametric space defined with a (U, V) coordinate system. For example, consider the parametric ranges of the neck's surface:
|
||||
|
||||
@image html /tutorial/images/tutorial_image013.png
|
||||
@image latex /tutorial/images/tutorial_image013.png
|
||||
@figure{/tutorial/images/tutorial_image013.png}
|
||||
|
||||
Suppose that you create a 2D line on this parametric (U, V) space and compute its 3D parametric curve. Depending on the line definition, results are as follows:
|
||||
|
||||
@@ -561,16 +549,14 @@ The helicoidal curve type is exactly what you need. On the neck's surface, the e
|
||||
* In V parameter: between 0 and myHeighNeck for the height description
|
||||
* In U parameter: between 0 and 2PI for the angle description. But, since a cylindrical surface is U periodic, you can decide to extend this angle evolution to 4PI as shown in the following drawing:
|
||||
|
||||
@image html /tutorial/images/tutorial_image014.png
|
||||
@image latex /tutorial/images/tutorial_image014.png
|
||||
@figure{/tutorial/images/tutorial_image014.png}
|
||||
|
||||
In this (U, V) parametric space, you will create a local (X, Y) coordinate system to position the curves to be created. This coordinate system will be defined with:
|
||||
|
||||
* A center located in the middle of the neck's cylinder parametric space at (2*PI, myNeckHeight / 2) in U, V coordinates.
|
||||
* A X direction defined with the (2*PI, myNeckHeight/4) vector in U, V coordinates, so that the curves occupy half of the neck's surfaces.
|
||||
|
||||
@image html /tutorial/images/tutorial_image015.png
|
||||
@image latex /tutorial/images/tutorial_image015.png
|
||||
@figure{/tutorial/images/tutorial_image015.png}
|
||||
|
||||
To use 2D primitive geometry types of Open CASCADE Technology for defining a point and a coordinate system, you will once again instantiate classes from gp:
|
||||
|
||||
@@ -586,8 +572,7 @@ To use 2D primitive geometry types of Open CASCADE Technology for defining a poi
|
||||
|
||||
You will now define the curves. As previously mentioned, these thread profiles are computed on two cylindrical surfaces. In the following figure, curves on the left define the base (on *aCyl1* surface) and the curves on the right define the top of the thread's shape (on *aCyl2* surface).
|
||||
|
||||
@image html /tutorial/images/tutorial_image016.png
|
||||
@image latex /tutorial/images/tutorial_image016.png
|
||||
@figure{/tutorial/images/tutorial_image016.png}
|
||||
|
||||
You have already used the *Geom* package to define 3D geometric entities. For 2D, you will use the *Geom2d* package. As for *Geom*, all geometries are parameterized. For example, a *Geom2d_Ellipse* ellipse is defined from:
|
||||
|
||||
@@ -643,8 +628,7 @@ As you did when creating the base profile of the bottle, you can now:
|
||||
* compute the edges of the neck's threading.
|
||||
* compute two wires out of these edges.
|
||||
|
||||
@image html /tutorial/images/tutorial_image017.png
|
||||
@image latex /tutorial/images/tutorial_image017.png
|
||||
@figure{/tutorial/images/tutorial_image017.png}
|
||||
|
||||
Previously, you have built:
|
||||
|
||||
@@ -684,8 +668,7 @@ You have computed the wires of the threading. The threading will be a solid shap
|
||||
There are always faster ways to build a solid when the base topology is defined. You would like to create a solid out of two wires. Open CASCADE Technology provides a quick way to do this by building a loft: a shell or a solid passing through a set of wires in a given sequence.
|
||||
The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, which you use as follows:
|
||||
|
||||
@image html /tutorial/images/tutorial_image018.png
|
||||
@image latex /tutorial/images/tutorial_image018.png
|
||||
@figure{/tutorial/images/tutorial_image018.png}
|
||||
|
||||
* Initialize the algorithm by creating an instance of the class. The first parameter of this constructor must be specified if you want to create a solid. By default, *BRepOffsetAPI_ThruSections* builds a shell.
|
||||
* Add the successive wires using the AddWire method.
|
||||
@@ -715,8 +698,7 @@ You are almost done building the bottle. Use the *TopoDS_Compound* and *BRep_Bui
|
||||
|
||||
Congratulations! Your bottle is complete. Here is the result snapshot of the Tutorial application:
|
||||
|
||||
@image html /tutorial/images/tutorial_image019.png
|
||||
@image latex /tutorial/images/tutorial_image019.png
|
||||
@figure{/tutorial/images/tutorial_image019.png}
|
||||
|
||||
We hope that this tutorial has provided you with a feel for the industrial strength power of Open CASCADE Technology.
|
||||
If you want to know more and develop major projects using Open CASCADE Technology, we invite you to study our training, support, and consulting services on our site at http://www.opencascade.com/content/technology-support. Our professional services can maximize the power of your Open CASCADE Technology applications.
|
||||
|
Reference in New Issue
Block a user