myDy = theDy;
myDz = theDz;
myMethodType = MethodType::BOX_DIM;
+ headError = "Box builder with dimensions";
}
//=================================================================================================
myFirstPoint = theFirstPoint;
mySecondPoint = theSecondPoint;
myMethodType = MethodType::BOX_POINTS;
+ headError = "Box builder with two points";
+}
+
+//=================================================================================================
+GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theOx, const double theOy, const double theOz,
+ const double theDx, const double theDy, const double theDz)
+{
+ myOx = theOx;
+ myOy = theOy;
+ myOz = theOz;
+ myDx = theDx;
+ myDy = theDy;
+ myDz = theDz;
+ myMethodType = MethodType::BOX_POINT_DIMS;
+ headError = "Box builder with coordinates and dimensions";
}
//=================================================================================================
bool GeomAlgoAPI_Box::check()
{
- if (myMethodType == MethodType::BOX_DIM) {
+ if (myMethodType == MethodType::BOX_DIM || myMethodType == MethodType::BOX_POINT_DIMS) {
if (myDx < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dx is null or negative.";
+ myError = headError + " :: Dx is null or negative.";
return false;
} else if (myDy < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dy is null or negative.";
+ myError = headError + " :: Dy is null or negative.";
return false;
} else if (myDz < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dz is null or negative.";
+ myError = headError + " :: Dz is null or negative.";
return false;
}
} else if (myMethodType == MethodType::BOX_POINTS) {
if (!myFirstPoint.get()) {
- myError = "Box builder with points :: the first point is not valid.";
+ myError = headError + " :: the first point is not valid.";
return false;
}
if (!mySecondPoint.get()) {
- myError = "Box builder with points :: the second point is not valid.";
+ myError = headError + " :: the second point is not valid.";
return false;
}
if (myFirstPoint->distance(mySecondPoint) < Precision::Confusion()) {
- myError = "Box builder with points :: the distance between the two points is null.";
+ myError = headError + " :: the distance between the two points is null.";
return false;
}
double aDiffX = myFirstPoint->x() - mySecondPoint->x();
fabs(aDiffY) < Precision::Confusion() ||
fabs(aDiffZ) < Precision::Confusion()) {
myError =
- "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.";
+ headError + " :: the points belong both to one of the OXY, OYZ or OZX planes.";
return false;
}
} else {
buildWithDimensions();
} else if (myMethodType == MethodType::BOX_POINTS) {
buildWithPoints();
+ } else if (myMethodType == MethodType::BOX_POINT_DIMS) {
+ buildWithPointAndDims();
} else {
myError = "Box builder :: Method not implemented.";
return;
// Test the algorithm
if (!aBoxMaker->IsDone()) {
- myError = "Box builder with dimensions :: algorithm failed.";
+ myError = headError + " :: algorithm failed.";
return;
}
// Test on the shapes
if (!aShape.get() || aShape->isNull()) {
- myError = "Box builder with dimensions :: resulting shape is null.";
+ myError = headError + " :: resulting shape is null.";
return;
}
// Test the algorithm
if(!aBoxMaker->IsDone()) {
- myError = "Box builder with two points :: algorithm failed.";
+ myError = headError + " :: algorithm failed.";
return;
}
// Tests on the shape
if (!aShape.get() || aShape->isNull()) {
- myError = "Box builder with two points :: resulting shape is null.";
+ myError = headError + " :: resulting shape is null.";
return;
}
setDone(true);
}
+//=================================================================================================
+void GeomAlgoAPI_Box::buildWithPointAndDims()
+{
+ // Construct points from cordinates and dimensions to use the method with two points
+ myFirstPoint =
+ std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(myOx - myDx, myOy - myDy, myOz - myDz));
+ mySecondPoint =
+ std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(myOx + myDx, myOy + myDy, myOz + myDz));
+
+ buildWithPoints();
+}
+
//=================================================================================================
void GeomAlgoAPI_Box::prepareNamingFaces()
{
enum MethodType {
BOX_DIM, ///< Box with dimensions
BOX_POINTS, ///< Box with points
+ BOX_POINT_DIMS, ///<Box with coordinates of a point and dimensions
};
GEOMALGOAPI_EXPORT GeomAlgoAPI_Box();
/// \param theSecondPoint The other extremity of the diagonal
GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
std::shared_ptr<GeomAPI_Pnt> theSecondPoint);
+
+ /// Creates a box using coordinates of a point (the center of gravity) andthe dimensions.
+ /// \param theOx The X coordinate of the point
+ /// \param theOy The Y coordinate of the point
+ /// \param theOz The Z coordinate of the point
+ /// \param theDx The dimension on X
+ /// \param theDy The dimension on Y
+ /// \param theDz The dimension on Z
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Box(const double theOx, const double theOy, const double theOz,
+ const double theDx, const double theDy, const double theDz);
/// Checks if data for the box construction is OK.
GEOMALGOAPI_EXPORT bool check();
void buildWithDimensions();
/// Builds the box with two points
void buildWithPoints();
+ /// Buils the box with coordinates of a point and dimensions
+ void buildWithPointAndDims();
+ double myOx; /// X coordinate of the center to create a box.
+ double myOy; /// Y coordinate of the center to create a box.
+ double myOz; /// Z coordinate of the center to create a box.
double myDx; /// Dimension on X to create a box.
double myDy; /// Dimension on Y to create a box.
double myDz; /// Dimension Z to create a box.
std::shared_ptr<GeomAPI_Pnt> myFirstPoint; /// First point to create a box.
std::shared_ptr<GeomAPI_Pnt> mySecondPoint; /// Second point to create a box.
MethodType myMethodType; /// Type of method used.
+ std::string headError; /// Head of the error message according to the method
};
setPoints(theFirstPoint, theSecondPoint);
}
+//==================================================================================================
+PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz,
+ const ModelHighAPI_Double& theHalfX,
+ const ModelHighAPI_Double& theHalfY,
+ const ModelHighAPI_Double& theHalfZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ {
+ fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS(), creationMethod());
+ fillAttribute(theOx, ox());
+ fillAttribute(theOy, oy());
+ fillAttribute(theOz, oz());
+ fillAttribute(theHalfX, halfdx());
+ fillAttribute(theHalfY, halfdy());
+ fillAttribute(theHalfZ, halfdz());
+ execute();
+ }
+}
+
//==================================================================================================
PrimitivesAPI_Box::~PrimitivesAPI_Box()
{
execute();
}
+//==================================================================================================
+void PrimitivesAPI_Box::setOrigin(const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz)
+{
+ fillAttribute(theOx, ox());
+ fillAttribute(theOy, oy());
+ fillAttribute(theOz, oz());
+
+ execute();
+}
+
+//==================================================================================================
+void PrimitivesAPI_Box::setHalfLengths(const ModelHighAPI_Double& theHalfLengthX,
+ const ModelHighAPI_Double& theHalfLengthY,
+ const ModelHighAPI_Double& theHalfLengthZ)
+{
+ fillAttribute(theHalfLengthX, halfdx());
+ fillAttribute(theHalfLengthY, halfdy());
+ fillAttribute(theHalfLengthZ, halfdz());
+
+ execute();
+}
+
//==================================================================================================
void PrimitivesAPI_Box::dump(ModelHighAPI_Dumper& theDumper) const
{
AttributeSelectionPtr anAttrSecondPnt =
aBase->selection(PrimitivesPlugin_Box::POINT_SECOND_ID());
theDumper << ", " << anAttrFirstPnt << ", " << anAttrSecondPnt;
+ } else if (aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_ONE_POINT_AND_DIMS()) {
+ AttributeDoublePtr anAttrOx = aBase->real(PrimitivesPlugin_Box::OX_ID());
+ AttributeDoublePtr anAttrOy = aBase->real(PrimitivesPlugin_Box::OY_ID());
+ AttributeDoublePtr anAttrOz = aBase->real(PrimitivesPlugin_Box::OZ_ID());
+ AttributeDoublePtr anAttrHalfLengthX = aBase->real(PrimitivesPlugin_Box::HALF_DX_ID());
+ AttributeDoublePtr anAttrHalfLengthY = aBase->real(PrimitivesPlugin_Box::HALF_DY_ID());
+ AttributeDoublePtr anAttrHalfLengthZ = aBase->real(PrimitivesPlugin_Box::HALF_DZ_ID());
+ theDumper << ", " << anAttrOx << ", " << anAttrOy << ", " << anAttrOz;
+ theDumper << ", " << anAttrHalfLengthX << ", " << anAttrHalfLengthY;
+ theDumper << ", " << anAttrHalfLengthZ;
}
theDumper << ")" << std::endl;
{
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Box::ID());
return BoxPtr(new PrimitivesAPI_Box(aFeature, theFirstPoint, theSecondPoint));
-}
\ No newline at end of file
+}
+
+//==================================================================================================
+BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz,
+ const ModelHighAPI_Double& theHalfLengthX,
+ const ModelHighAPI_Double& theHalfLengthY,
+ const ModelHighAPI_Double& theHalfLengthZ)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Box::ID());
+ return BoxPtr(new PrimitivesAPI_Box(aFeature, theOx, theOy, theOz, theHalfLengthX,
+ theHalfLengthY, theHalfLengthZ));
+}
const ModelHighAPI_Selection& theFirstPoint,
const ModelHighAPI_Selection& theSecondPoint);
+ /// Constructor with values.
+ PRIMITIVESAPI_EXPORT
+ explicit PrimitivesAPI_Box(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz,
+ const ModelHighAPI_Double& theHalfX,
+ const ModelHighAPI_Double& theHalfY,
+ const ModelHighAPI_Double& theHalfZ);
+
/// Destructor.
PRIMITIVESAPI_EXPORT
virtual ~PrimitivesAPI_Box();
- INTERFACE_6(PrimitivesPlugin_Box::ID(),
+ INTERFACE_12(PrimitivesPlugin_Box::ID(),
creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(),
ModelAPI_AttributeString, /** Creation method */,
dx, PrimitivesPlugin_Box::DX_ID(),
firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(),
ModelAPI_AttributeSelection, /** First point */,
secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(),
- ModelAPI_AttributeSelection, /** Second point */)
+ ModelAPI_AttributeSelection, /** Second point */,
+ ox, PrimitivesPlugin_Box::OX_ID(),
+ ModelAPI_AttributeDouble, /** X coordinate for origin*/,
+ oy, PrimitivesPlugin_Box::OY_ID(),
+ ModelAPI_AttributeDouble, /** Y coordinate for origin*/,
+ oz, PrimitivesPlugin_Box::OZ_ID(),
+ ModelAPI_AttributeDouble, /** Z coordinate for origin*/,
+ halfdx, PrimitivesPlugin_Box::HALF_DX_ID(),
+ ModelAPI_AttributeDouble, /** Half length in X*/,
+ halfdy, PrimitivesPlugin_Box::HALF_DY_ID(),
+ ModelAPI_AttributeDouble, /** Half length in Y*/,
+ halfdz, PrimitivesPlugin_Box::HALF_DZ_ID(),
+ ModelAPI_AttributeDouble, /** Half length in Z*/)
/// Set dimensions
PRIMITIVESAPI_EXPORT
void setPoints(const ModelHighAPI_Selection& theFirstPoint,
const ModelHighAPI_Selection& theSecondPoint);
+ /// Set origin point
+ PRIMITIVESAPI_EXPORT
+ void setOrigin(const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz);
+
+ /// Set half lengths
+ PRIMITIVESAPI_EXPORT
+ void setHalfLengths(const ModelHighAPI_Double& theHalfLengthX,
+ const ModelHighAPI_Double& theHalfLengthY,
+ const ModelHighAPI_Double& theHalfLengthZ);
+
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
virtual void dump(ModelHighAPI_Dumper& theDumper) const;
const ModelHighAPI_Selection& theFirstPoint,
const ModelHighAPI_Selection& theSecondPoint);
-#endif // PRIMITIVESAPI_BOX_H_
\ No newline at end of file
+/// \ingroup CPPHighAPI
+/// \brief Create primitive Box feature.
+PRIMITIVESAPI_EXPORT
+BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theOx,
+ const ModelHighAPI_Double& theOy,
+ const ModelHighAPI_Double& theOz,
+ const ModelHighAPI_Double& theHalfLengthX,
+ const ModelHighAPI_Double& theHalfLengthY,
+ const ModelHighAPI_Double& theHalfLengthZ);
+
+#endif // PRIMITIVESAPI_BOX_H_
{
data()->addAttribute(PrimitivesPlugin_Box::CREATION_METHOD(), ModelAPI_AttributeString::typeId());
+ // Data for the first mode
data()->addAttribute(PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble::typeId());
+ // Data for the second mode
data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(),
ModelAPI_AttributeSelection::typeId());
data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND_ID(),
ModelAPI_AttributeSelection::typeId());
+
+ // Data for the third mode
+ data()->addAttribute(PrimitivesPlugin_Box::OX_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(PrimitivesPlugin_Box::OY_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(PrimitivesPlugin_Box::OZ_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(PrimitivesPlugin_Box::HALF_DX_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(PrimitivesPlugin_Box::HALF_DY_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(PrimitivesPlugin_Box::HALF_DZ_ID(), ModelAPI_AttributeDouble::typeId());
}
//=================================================================================================
if (aMethodType == CREATION_METHOD_BY_TWO_POINTS())
createBoxByTwoPoints();
+
+ if (aMethodType == CREATION_METHOD_BY_ONE_POINT_AND_DIMS())
+ createBoxByOnePointAndDims();
}
//=================================================================================================
setResult(aResultBox, aResultIndex);
}
+//=================================================================================================
+void PrimitivesPlugin_Box::createBoxByOnePointAndDims()
+{
+ // Getting dx, dy and dz
+ double aDx = real(PrimitivesPlugin_Box::HALF_DX_ID())->value();
+ double aDy = real(PrimitivesPlugin_Box::HALF_DY_ID())->value();
+ double aDz = real(PrimitivesPlugin_Box::HALF_DZ_ID())->value();
+
+ // Getting point coordinates
+ double x = real(PrimitivesPlugin_Box::OX_ID())->value();
+ double y = real(PrimitivesPlugin_Box::OY_ID())->value();
+ double z = real(PrimitivesPlugin_Box::OZ_ID())->value();
+
+ std::shared_ptr<GeomAlgoAPI_Box> aBoxAlgo;
+ aBoxAlgo = std::shared_ptr<GeomAlgoAPI_Box>(new GeomAlgoAPI_Box(x,y,z,aDx,aDy,aDz));
+
+ // These checks should be made to the GUI for the feature but
+ // the corresponding validator does not exist yet.
+ if (!aBoxAlgo->check()) {
+ setError(aBoxAlgo->getError());
+ return;
+ }
+
+ // Build the box
+ aBoxAlgo->build();
+
+ // Check if the creation of the box
+ if(!aBoxAlgo->isDone()) {
+ // The error is not displayed in a popup window. It must be in the message console.
+ setError(aBoxAlgo->getError());
+ return;
+ }
+ if(!aBoxAlgo->checkValid("Box builder with one point and dimensions")) {
+ // The error is not displayed in a popup window. It must be in the message console.
+ setError(aBoxAlgo->getError());
+ return;
+ }
+
+ int aResultIndex = 0;
+ ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
+ loadNamingDS(aBoxAlgo, aResultBox);
+ setResult(aResultBox, aResultIndex);
+}
+
//=================================================================================================
void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
std::shared_ptr<ModelAPI_ResultBody> theResultBox)
* \brief Feature for creation of a box primitive using various methods.
*
* Box creates a cuboid - Parallelepiped with 6 rectangular faces. It can be built via two
- * methods : using two points that define a diagonal, or using 3 lengths that define the
+ * methods : using two points that define a diagonal, a point that define a center and 3 lengths
+ * that define the half-lengths on X, Y and Z-axes, or using 3 lengths that define the
* rectangular dimensions.
*/
class PrimitivesPlugin_Box : public ModelAPI_Feature
return MY_CREATION_METHOD_ID;
}
+ /// Attribute name for creation method
+ inline static const std::string& CREATION_METHOD_BY_ONE_POINT_AND_DIMS()
+ {
+ static const std::string MY_CREATION_METHOD_ID("BoxByOnePointAndDims");
+ return MY_CREATION_METHOD_ID;
+ }
+
/// Attribute name of first point
inline static const std::string& POINT_FIRST_ID()
{
static const std::string MY_DZ_ID("dz");
return MY_DZ_ID;
}
+
+ /// Attribute name of the first coordinate of the center
+ inline static const std::string& OX_ID()
+ {
+ static const std::string MY_OX_ID("ox");
+ return MY_OX_ID;
+ }
+
+ /// Attribute name of the second coordinate of the center
+ inline static const std::string& OY_ID()
+ {
+ static const std::string MY_OY_ID("oy");
+ return MY_OY_ID;
+ }
+
+ /// Attribute name of the third coordinate of the center
+ inline static const std::string& OZ_ID()
+ {
+ static const std::string MY_OZ_ID("oz");
+ return MY_OZ_ID;
+ }
+
+ /// Attribute name of the half-length on X axis
+ inline static const std::string& HALF_DX_ID()
+ {
+ static const std::string MY_HALF_DX_ID("half_dx");
+ return MY_HALF_DX_ID;
+ }
+
+ /// Attribute name of the half-length on Y axis
+ inline static const std::string& HALF_DY_ID()
+ {
+ static const std::string MY_HALF_DY_ID("half_dy");
+ return MY_HALF_DY_ID;
+ }
+
+ /// Attribute name of the half-length on Z axis
+ inline static const std::string& HALF_DZ_ID()
+ {
+ static const std::string MY_HALF_DZ_ID("half_dz");
+ return MY_HALF_DZ_ID;
+ }
/// Returns the kind of a feature
PRIMITIVESPLUGIN_EXPORT virtual const std::string& getKind()
///Perform the creation of the box using three cordinates
void createBoxByDimensions();
+ ///Perform the creation of the box using a center and three half-lenths
+ void createBoxByOnePointAndDims();
+
};
shape_types="vertex">
</shape_selector>
</box>
+ <box id="BoxByOnePointAndDims" title="By one point and dimensions" icon="icons/Primitives/box_pt_dxyz_32x32.png">
+ <groupbox title="Origin">
+ <doublevalue
+ id="ox"
+ label="OX"
+ step="1."
+ default="0."
+ tooltip="Enter the coordinate X for the origin">
+ </doublevalue>
+ <doublevalue
+ id="oy"
+ label="OY"
+ step="1."
+ default="0."
+ tooltip="Enter the coordinate Y for the origin">
+ </doublevalue>
+ <doublevalue
+ id="oz"
+ label="OZ"
+ step="1."
+ default="0."
+ tooltip="Enter the coordinate Z for the origin">
+ </doublevalue>
+ </groupbox>
+ <groupbox title="Half-lengths">
+ <doublevalue
+ id="half_dx"
+ label="DX"
+ step="1."
+ default="20."
+ tooltip="Enter the half length in X">
+ <validator id="GeomValidators_Positive" parameters="0"/>
+ </doublevalue>
+ <doublevalue
+ id="half_dy"
+ label="DY"
+ step="1."
+ default="20."
+ tooltip="Enter the half length in Y">
+ <validator id="GeomValidators_Positive" parameters="0"/>
+ </doublevalue>
+ <doublevalue
+ id="half_dz"
+ label="DZ"
+ step="1."
+ default="20."
+ tooltip="Enter the half length in Z">
+ <validator id="GeomValidators_Positive" parameters="0"/>
+ </doublevalue>
+ </groupbox>
+ </box>
</toolbox>
</source>
--- /dev/null
+
+ .. _tui_create_boxptdim:
+
+Create Box coordinates of a point and dimensions
+================================================
+
+.. literalinclude:: examples/box3.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/box3.py>`
+
#. select in the Main Menu *Primitives - > Box* item or
#. click |box.icon| **Box** button in the toolbar:
-There are 2 algorithms for creation of a Box:
+There are 3 algorithms for creation of a Box:
.. figure:: images/box_dxyz_32x32.png
:align: left
**By two points**
+.. figure:: images/box_pt_dxyz_32x32.png
+ :align: left
+ :height: 24px
+
+**By coordinates of a point and dimensions**
+
--------------------------------------------------------------------------------
By dimensions
:param object: Second vertex of diagonal.
:return: Result object.
-**Arguments**: Part + 2 selected points (opposite vertices of the box)
-
Result
""""""
Created boxes
**See Also** a sample TUI Script of :ref:`tui_create_boxpnt` operation.
+
+By coordinates of a point and dimensions
+----------------------------------------
+
+Box is created by dimensions along X, Y, Z axis starting from the point of coordinates (x,y,z).
+
+.. figure:: images/Box_ptAndDims.png
+ :align: center
+
+Input fields:
+
+- **OX**, **OY**, **OZ** define coordinates of the center of box.
+- **DX**, **DY**, **DZ** define dimensions (hafl length) of the box along the corresponding coordinate axes.
+
+**TUI Command**:
+
+.. py:function:: model.addBox(Part_doc, OX, OY, OZ, DX, DY, DZ)
+
+ :param part: The current part object.
+ :param real: X coordinate of the center point
+ :param real: Y coordinate of the center point
+ :param real: Z coordinate of the center point
+ :param real: Half size along X.
+ :param real: Half size along Y.
+ :param real: Half size along Z.
+ :return: Result object.
+
+Result
+""""""
+
+A solid box whose point coordinates are the center and the dimensions are half lengths on one side and the other on the axes relative to the center.
+
+.. figure:: images/Box3.png
+ :align: center
+
+ Created boxes
+
+**See Also** a sample TUI Script of :ref:`tui_create_boxptdim` operation.
--- /dev/null
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 0, 0, 0, 20, 20, 20)
+model.do()
+model.end()