//==================================================================================================
void OperaAPI_Volume::setMedium(const ModelHighAPI_Double& theMedium)
{
- fillAttribute(OperaPlugin_Volume::MEDIUM(), medium());
+ fillAttribute(OperaPlugin_Volume::MEDIUM_ID(), medium());
execute();
}
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- AttributeStringPtr anAttrMedium = aBase->string(OperaPlugin_Volume::MEDIUM());
+ AttributeStringPtr anAttrMedium = aBase->string(OperaPlugin_Volume::MEDIUM_ID());
theDumper << aBase << " = model.addVolume(" << aDocName << ", " << anAttrMedium << ", ";
AttributeSelectionListPtr anAttrList = aBase->selectionList(OperaPlugin_Volume::VOLUME_LIST_ID());
virtual ~OperaAPI_Volume();
INTERFACE_2(OperaPlugin_Volume::ID(),
- medium, OperaPlugin_Volume::MEDIUM(),
+ medium, OperaPlugin_Volume::MEDIUM_ID(),
ModelAPI_AttributeString, /** Volume medium */,
volumeList, OperaPlugin_Volume::VOLUME_LIST_ID(),
ModelAPI_AttributeSelectionList, /** Group list*/)
if(${HAVE_SALOME})
enable_testing()
- set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/CollectionPlugin")
+ set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/OperaPlugin")
install(FILES CTestTestfileInstall.cmake
DESTINATION ${TEST_INSTALL_DIRECTORY}
if (theFeatureID == OperaPlugin_Volume::ID()) {
return FeaturePtr(new OperaPlugin_Volume);
} else {
- // else if (theFeatureID == OperaPlugin_addNode::ID()){
- // return FeaturePtr(new OperaPlugin_addNode);
return FeaturePtr();
}
}
void OperaPlugin_Volume::initAttributes()
{
// Get Medium
- data()->addAttribute(MEDIUM(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(MEDIUM_ID(), ModelAPI_AttributeString::typeId());
// Get Objects
data()->addAttribute(VOLUME_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
//=================================================================================================
void OperaPlugin_Volume::execute()
{
- std::string aCopiesMedium = string(MEDIUM())->value();
+ std::string aCopiesMedium = string(MEDIUM_ID())->value();
if (aCopiesMedium.empty())
{
setError("Error: Medium cannot be empty.");
static const std::string MY_VOLUME_ID("Volume");
return MY_VOLUME_ID;
}
- inline static const std::string& MEDIUM()
+ inline static const std::string& MEDIUM_ID()
{
static const std::string MY_MEDIUM_ID("medium");
return MY_MEDIUM_ID;
Volume_1 = model.addVolume(Part_1_doc, "Air", [model.selection("SOLID", "Box_1_1")])
### Create a volume from the cylinder and the sphere
-Volume_2 = model.addVolume(Part_1_doc, "Concrete", [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Sphere_1_1")])
+Volume_2 = model.addVolume(Part_1_doc, "Eau", [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Sphere_1_1")])
#Checks
from GeomAPI import GeomAPI_Shape
--- /dev/null
+
+ .. tui_create_volume:
+
+Create Box by points
+====================
+
+.. literalinclude:: examples/volume.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/volume.py>`
.. |Volume_button.icon| image:: images/Volume_button.png
+Volume
+-------------
+
Volume feature creates a box solid.
To create a Volume in the active part:
#. select in the Main Menu *Opera - > Volume* item or
#. click |Volume_button.icon| **Volume** button in the toolbar:
---------------------------------------------------------------------------------
-
-by Medium and Solids
--------------
-
Volume is created by a Medium value and a list of solids
.. figure:: images/Volume_create.png
**TUI Command**:
-.. py:function:: model.addVolume(Part_doc, MEDIUM, VOLUME_LIST)
+.. py:function:: model.addVolume(Part_doc, MediumString, model.selection["SOLID", "...", ...])
:param part: The current part object.
- :param real: Medium name.
- :param real: List of solids.
+ :param string: Medium name.
+ :param list: List of solids.
:return: Result object.
Result
.. figure:: images/Volume1.png
:align: center
+
+**See Also** a sample TUI Script of :ref:`tui_create_volume` operation.
<plugin>
<workbench id="Opera" document="Part">
<group id="Opera">
- <feature
- id="Volume"
+ <feature id="Volume"
title="Volume"
tooltip="Create a volume"
icon="icons/Opera/Volume.png"