+//=================================================================================================
+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);
+}
+