setPointAndDirection(thePoint, theX, theY, theZ);
}
+ConstructionAPI_Axis::ConstructionAPI_Axis(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setDimensions(theDX, theDY, theDZ);
+}
+
ConstructionAPI_Axis::~ConstructionAPI_Axis()
{
execute();
}
+void ConstructionAPI_Axis::setDimensions(
+ const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ)
+{
+ fillAttribute("AxisByDimensionsCase", creationMethod());
+ fillAttribute(theDX, xDimension());
+ fillAttribute(theDY, yDimension());
+ fillAttribute(theDZ, zDimension());
+
+ execute();
+}
+
//--------------------------------------------------------------------------------------
AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
const ModelHighAPI_Selection & thePoint1,
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ));
}
+
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
+ return AxisPtr(new ConstructionAPI_Axis(aFeature, theDX, theDY, theDZ));
+}
+// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
+
// Name : ConstructionAPI_Axis.h
// Purpose:
//
// History:
// 15/06/16 - Sergey POKHODENKO - Creation of the file
+// 24/06/16 - Clarisse GENRAULT (CEA) - Modification of the file
#ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_
#define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_
const ModelHighAPI_Double & theX,
const ModelHighAPI_Double & theY,
const ModelHighAPI_Double & theZ);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Axis(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ);
/// Destructor
CONSTRUCTIONAPI_EXPORT
virtual ~ConstructionAPI_Axis();
- INTERFACE_7(ConstructionPlugin_Axis::ID(),
+ INTERFACE_10(ConstructionPlugin_Axis::ID(),
creationMethod, ConstructionPlugin_Axis::METHOD(), ModelAPI_AttributeString, /** Creation method */,
firstPoint, ConstructionPlugin_Axis::POINT_FIRST(), ModelAPI_AttributeSelection, /** First point */,
secondPoint, ConstructionPlugin_Axis::POINT_SECOND(), ModelAPI_AttributeSelection, /** Second point */,
cylindricalFace, ConstructionPlugin_Axis::CYLINDRICAL_FACE(), ModelAPI_AttributeSelection, /** Cylindrical face */,
xDirection, ConstructionPlugin_Axis::X_DIRECTION(), ModelAPI_AttributeDouble, /** X direction */,
yDirection, ConstructionPlugin_Axis::Y_DIRECTION(), ModelAPI_AttributeDouble, /** Y direction */,
- zDirection, ConstructionPlugin_Axis::Z_DIRECTION(), ModelAPI_AttributeDouble, /** Z direction */
+ zDirection, ConstructionPlugin_Axis::Z_DIRECTION(), ModelAPI_AttributeDouble, /** Z direction */,
+ xDimension, ConstructionPlugin_Axis::DX(), ModelAPI_AttributeDouble, /** X dimension */,
+ yDimension, ConstructionPlugin_Axis::DY(), ModelAPI_AttributeDouble, /** Y dimension */,
+ zDimension, ConstructionPlugin_Axis::DZ(), ModelAPI_AttributeDouble, /** Z dimension */
)
/// Set points
const ModelHighAPI_Double & theX,
const ModelHighAPI_Double & theY,
const ModelHighAPI_Double & theZ);
+
+ /// Set dimensions
+ CONSTRUCTIONAPI_EXPORT
+ void setDimensions(const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ);
};
//! Pointer on Axis object
const ModelHighAPI_Double & theY,
const ModelHighAPI_Double & theZ);
+/**\ingroup CPPHighAPI
+ * \brief Create Axis feature
+ */
+CONSTRUCTIONAPI_EXPORT
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double & theDX,
+ const ModelHighAPI_Double & theDY,
+ const ModelHighAPI_Double & theDZ);
+
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_ */
--- /dev/null
+import unittest
+
+import ModelAPI
+import ConstructionAPI
+
+class AxisTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.session = ModelAPI.ModelAPI_Session.get()
+ self.doc = self.session.moduleDocument()
+ self.session.startOperation()
+ self.feature = self.doc.addFeature("Axis")
+ self.feature.execute()
+ self.session.finishOperation()
+
+ def tearDown(self):
+ self.session.closeAll()
+
+ def test_ConstructorWithDimensions(self):
+ axis = ConstructionAPI.ConstructionAPI_Axis(self.feature, 10, 50, 100)
+ self.assertEqual(10,axis.xDimension().value())
+ self.assertEqual(50,axis.yDimension().value())
+ self.assertEqual(100,axis.zDimension().value())
+
+if __name__ == "__main__":
+ unittest.main()