FeaturesAPI_DuplicatedFaces::FeaturesAPI_DuplicatedFaces(
const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theObject,
- const ModelHighAPI_Integer& theTransparency,
const ModelHighAPI_Double& theTolerance,
const std::string & theNameGroup)
:ModelHighAPI_Interface(theFeature)
{
if (initialize()) {
fillAttribute(theObject, myobjectselected);
- fillAttribute(theTransparency, mytransparency);
fillAttribute(theTolerance, mytolerance);
fillAttribute(theNameGroup, mygroupname);
anAttrObject = aBase->selection(FeaturesPlugin_GroupDuplicatedFaces::OBJECT_ID());
theDumper << aBase << " = model.getDuplicatedFaces(" << aDocName << ", " << anAttrObject;
- theDumper << ", " << aBase->integer(FeaturesPlugin_GroupDuplicatedFaces::TRANSPARENCY_ID());
theDumper << ", " << aBase->real(FeaturesPlugin_GroupDuplicatedFaces::TOLERANCE_ID());
theDumper << ", " << aBase->string(FeaturesPlugin_GroupDuplicatedFaces::GROUP_NAME_ID());
theDumper << ")" << std::endl;
//=================================================================================================
DuplicatedFacesPtr getDuplicatedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& theObject,
- const ModelHighAPI_Integer& theTransparency,
const ModelHighAPI_Double& theTolerance,
const std::string & theNameGroup)
{
aDuplicatedFaces.reset(new FeaturesAPI_DuplicatedFaces(aFeature,
theObject,
- theTransparency,
theTolerance,
theNameGroup));
FEATURESAPI_EXPORT
explicit FeaturesAPI_DuplicatedFaces(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const ModelHighAPI_Selection& theobject,
- const ModelHighAPI_Integer& theTransparency,
const ModelHighAPI_Double& theTolerance,
const std::string & theNameGroup);
FEATURESAPI_EXPORT
virtual ~FeaturesAPI_DuplicatedFaces();
- INTERFACE_4(FeaturesPlugin_GroupDuplicatedFaces::ID(),
+ INTERFACE_3(FeaturesPlugin_GroupDuplicatedFaces::ID(),
objectselected, FeaturesPlugin_GroupDuplicatedFaces::OBJECT_ID(),
ModelAPI_AttributeSelection,
/** object selected*/,
- transparency, FeaturesPlugin_GroupDuplicatedFaces::TRANSPARENCY_ID(),
- ModelAPI_AttributeInteger,
- /** transparency*/,
tolerance, FeaturesPlugin_GroupDuplicatedFaces::TOLERANCE_ID(),
ModelAPI_AttributeDouble,
/** tolerance*/,
FEATURESAPI_EXPORT
DuplicatedFacesPtr getDuplicatedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Selection& theObject,
- const ModelHighAPI_Integer& theTransparency,
const ModelHighAPI_Double& theTolerance,
const std::string & theNameGroup);
data()->addAttribute(TOLERANCE_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TRANSPARENCY_ID());
+
}
AttributeSelectionPtr ancompSolidAttr = selection(OBJECT_ID());
ResultPtr aResult = ancompSolidAttr->context();
- double aTranparency = integer(TRANSPARENCY_ID())->value()/100.0;
- ModelAPI_Tools::setTransparency(aResult, aTranparency);
-
- ResultBodyPtr aResultBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- std::list<ResultPtr> allRes;
- ModelAPI_Tools::allSubs(aResultBody, allRes);
- std::list<ResultPtr>::iterator aRes;
- for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
- ModelAPI_Tools::setTransparency(*aRes, aTranparency);
+ if(integer(TRANSPARENCY_ID())->isInitialized()){
+ double aTranparency = integer(TRANSPARENCY_ID())->value()/100.0;
+ ModelAPI_Tools::setTransparency(aResult, aTranparency);
+
+
+ ResultBodyPtr aResultBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
+ std::list<ResultPtr> allRes;
+ ModelAPI_Tools::allSubs(aResultBody, allRes);
+ std::list<ResultPtr>::iterator aRes;
+ for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
+ ModelAPI_Tools::setTransparency(*aRes, aTranparency);
+ }
}
}
}
model.selection("SOLID", "Box_3_1")]
Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
### Create Duplicated_faces
- Duplicated_faces_1 = model.getDuplicatedFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), 50, 0.001, "mygroup")
+ Duplicated_faces_1 = model.getDuplicatedFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), 0.001, "mygroup")
model.do()
# Check results
**TUI Command**:
-.. py:function:: model.getDuplicatedFaces(Part_doc, shape, transparency, tolerance, nameGroup)
+.. py:function:: model.getDuplicatedFaces(Part_doc, shape, tolerance, nameGroup)
:param part: The current part object.
:param object: A composolid or compound in format *model.selection("Type", shape)*.
- :param number: value of the transparency.
:param number: value of the tolerance.
:param string: name of group created.
:return: Created group.
model.selection("SOLID", "Box_3_1")]
Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
### Create Duplicated_faces
-Duplicated_faces_1 = model.getDuplicatedFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), 50, 0.001, "mygroup")
+Duplicated_faces_1 = model.getDuplicatedFaces(Part_1_doc, model.selection("COMPOUND", "Compound_1_1"), 0.001, "mygroup")
model.do()
model.end()
<doublevalue id="tolerance"
label="Tolerance"
min="0"
- step="0.001"
- default="0.001">
+ step="0.00001"
+ default="1e-7">
</doublevalue>
<optionalbox id="create_group" title="Create group" show_title="true">
<stringvalue id="group_name" label="Group Name"/>
<doublevalue id="tolerance"
label="Tolerance"
min="0"
- step="0.001"
- default="0.001">
+ step="0.00001"
+ default="1e-7">
</doublevalue>
<stringvalue id="group_name" label="Group Name"/>
</source>