void FeaturesPlugin_Chamfer::initAttributes()
{
- data()->addAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(FeaturesPlugin_Chamfer::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
+ data()->addAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD(),
+ ModelAPI_AttributeString::typeId());
+ data()->addAttribute(FeaturesPlugin_Chamfer::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList::typeId());
data()->addAttribute(FeaturesPlugin_Chamfer::D1_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(FeaturesPlugin_Chamfer::D2_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(FeaturesPlugin_Chamfer::D_ID(), ModelAPI_AttributeDouble::typeId());
AttributeStringPtr aCreationMethod = string(CREATION_METHOD());
if (!aCreationMethod)
return;
-
- std::list<std::pair<GeomShapePtr, ListOfShape> > aSolidsAndSubs;
+
+ std::list<std::pair<GeomShapePtr, ListOfShape> > aSolidsAndSubs;
std::map<GeomShapePtr, GeomShapePtr> aMapEdgeFace;
-
+
// getting objects and sort them according to parent solids
AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECT_LIST_ID());
for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); ++anObjectsIndex) {
GeomShapePtr anObject = anObjectAttr->value();
if (!anObject)
return;
-
+
ResultPtr aContext = anObjectAttr->context();
GeomShapePtr aParent;
if (aContext.get()) {
}
if (!aParent)
return;
-
+
// searching this parent is already in the list aSolidsAndSubs
std::list<std::pair<GeomShapePtr, ListOfShape> >::iterator aSearch = aSolidsAndSubs.begin();
ListOfShape* aFound;
for (ListOfShape::iterator aEIt = anEdgesAndVertices.begin();
aEIt != anEdgesAndVertices.end(); ++aEIt)
aFound->push_back(*aEIt);
-
+
if (anObject->isFace()) {
for (ListOfShape::iterator aEIt = anEdgesAndVertices.begin();
aEIt != anEdgesAndVertices.end(); ++aEIt) {
}
}
}
-
+
//bool isOption1 = true;
double aD1 = 0.0, aD2 = 0.0, aD = 0.0, anAngle = 0.0;
if (aCreationMethod->value() == CREATION_METHOD_DISTANCE_DISTANCE()) {
aD = real(FeaturesPlugin_Chamfer::D_ID())->value();
anAngle = real(FeaturesPlugin_Chamfer::ANGLE_ID())->value();
}
-
+
// Perform chamfer operation
GeomAlgoAPI_MakeShapeList aMakeShapeList;
std::shared_ptr<GeomAlgoAPI_Chamfer> aChamferBuilder;
int aResultIndex = 0;
std::string anError;
-
-
+
+
std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape anOriginalShapesList, aResultShapesList;
-
+
std::list<std::pair<GeomShapePtr, ListOfShape> >::iterator anIt = aSolidsAndSubs.begin();
for (; anIt != aSolidsAndSubs.end(); ++anIt) {
GeomShapePtr aSolid = anIt->first;
ListOfShape aFilletEdgesAndVertices = anIt->second;
-
+
ListOfShape aFilletEdges = selectEdges(aFilletEdgesAndVertices);
if (aCreationMethod->value() == CREATION_METHOD_DISTANCE_DISTANCE()) {
- aChamferBuilder.reset(new GeomAlgoAPI_Chamfer(aSolid, aFilletEdges, aMapEdgeFace, true, aD1, aD2));
+ aChamferBuilder.reset(new GeomAlgoAPI_Chamfer(
+ aSolid, aFilletEdges, aMapEdgeFace, true, aD1, aD2));
} else {
- aChamferBuilder.reset(new GeomAlgoAPI_Chamfer(aSolid, aFilletEdges, aMapEdgeFace, false, aD, anAngle));
+ aChamferBuilder.reset(new GeomAlgoAPI_Chamfer(
+ aSolid, aFilletEdges, aMapEdgeFace, false, aD, anAngle));
}
-
+
if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aChamferBuilder, getKind(), anError)) {
setError(anError);
return;
}
-
+
GeomShapePtr aResult = unwrapCompound(aChamferBuilder->shape());
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);