mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-29 10:50:35 +05:00
0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape
- Change Partition operation: MakePartition instead of MakeHalfPartition because result was not a block - Add exception catch
This commit is contained in:
parent
9da0aeceb7
commit
307d55f904
@ -1045,89 +1045,89 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(/*std::vector<GEOM_IO
|
|||||||
theShapes.push_back(aPlnOXZ);
|
theShapes.push_back(aPlnOXZ);
|
||||||
|
|
||||||
// Partition
|
// Partition
|
||||||
Handle(GEOM_Object) Part0 = aBooleanOperations->MakeHalfPartition(theShape, face_t);
|
// Handle(GEOM_Object) Part0 = aBooleanOperations->MakeHalfPartition(theShape, face_t);
|
||||||
if (Part0.IsNull()) {
|
// if (Part0.IsNull()) {
|
||||||
std::cerr << "Impossible to build partition between TShape and 1st face" << std::endl;
|
// std::cerr << "Impossible to build partition between TShape and 1st face" << std::endl;
|
||||||
SetErrorCode("Impossible to build partition between TShape and 1st face");
|
// SetErrorCode("Impossible to build partition between TShape and 1st face");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
Part0->GetLastFunction()->SetDescription("");
|
// Part0->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
Handle(GEOM_Object) Te3 ;
|
|
||||||
if (isNormal) {
|
|
||||||
if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()) {
|
|
||||||
std::cerr << "External radius are identical: we do not make partition with plane OXZ" << std::endl;
|
|
||||||
Te3 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOZ);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
|
|
||||||
if (Part1.IsNull()) {
|
|
||||||
std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
|
|
||||||
SetErrorCode("Impossible to build partition between TShape and plane OXZ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Part1->GetLastFunction()->SetDescription("");
|
|
||||||
Te3 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
|
|
||||||
}
|
|
||||||
if (Te3.IsNull()) {
|
|
||||||
std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
|
|
||||||
SetErrorCode("Impossible to build partition between TShape and plane OZ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Te3->GetLastFunction()->SetDescription("");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()){ // We should never go here
|
|
||||||
SetErrorCode("Impossible to build TShape");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
|
|
||||||
if (Part1.IsNull()) {
|
|
||||||
std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
|
|
||||||
SetErrorCode("Impossible to build partition between TShape and plane OXZ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Part1->GetLastFunction()->SetDescription("");
|
|
||||||
Handle(GEOM_Object) Part2 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
|
|
||||||
if (Part2.IsNull()) {
|
|
||||||
std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
|
|
||||||
SetErrorCode("Impossible to build partition between TShape and plane OZ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Part2->GetLastFunction()->SetDescription("");
|
|
||||||
Te3 = aBooleanOperations->MakeHalfPartition(Part2, face_t2);
|
|
||||||
if (Te3.IsNull()) {
|
|
||||||
std::cerr << "Impossible to build partition between TShape and 2nd face" << std::endl;
|
|
||||||
SetErrorCode("Impossible to build partition between TShape and 2nd face");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Te3->GetLastFunction()->SetDescription("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient;
|
|
||||||
// Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient;
|
|
||||||
// Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient;
|
|
||||||
// Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient;
|
|
||||||
// Handle(TColStd_HArray1OfInteger) theMaterials;
|
|
||||||
// partitionShapes->Append(theShape);
|
|
||||||
// theTools->Append(aPlnOZ);
|
|
||||||
// theTools->Append(aPlnOXZ);
|
|
||||||
// theTools->Append(face_t);
|
|
||||||
// if (!isNormal)
|
|
||||||
// theTools->Append(face_t2);
|
|
||||||
//
|
//
|
||||||
// Handle(GEOM_Object) Te3 = aBooleanOperations->MakePartition(partitionShapes, theTools, theKeepInside, theRemoveInside, TopAbs_SOLID, false, theMaterials, 0, false);
|
// Handle(GEOM_Object) Te3 ;
|
||||||
|
// if (isNormal) {
|
||||||
|
// if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()) {
|
||||||
|
// std::cerr << "External radius are identical: we do not make partition with plane OXZ" << std::endl;
|
||||||
|
// Te3 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOZ);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
|
||||||
|
// if (Part1.IsNull()) {
|
||||||
|
// std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
|
||||||
|
// SetErrorCode("Impossible to build partition between TShape and plane OXZ");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Part1->GetLastFunction()->SetDescription("");
|
||||||
|
// Te3 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
|
||||||
|
// }
|
||||||
// if (Te3.IsNull()) {
|
// if (Te3.IsNull()) {
|
||||||
// SetErrorCode("Impossible to build partition of TShape");
|
// std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
|
||||||
// Handle(GEOM_Object) aCompound = aShapesOperations->MakeCompound(theShapes);
|
// SetErrorCode("Impossible to build partition between TShape and plane OZ");
|
||||||
// TopoDS_Shape aCompoundShape = aCompound->GetValue();
|
|
||||||
// theShape->GetLastFunction()->SetValue(aCompoundShape);
|
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// Te3->GetLastFunction()->SetDescription("");
|
// Te3->GetLastFunction()->SetDescription("");
|
||||||
//
|
// }
|
||||||
|
// else {
|
||||||
|
// if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()){ // We should never go here
|
||||||
|
// SetErrorCode("Impossible to build TShape");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
|
||||||
|
// if (Part1.IsNull()) {
|
||||||
|
// std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
|
||||||
|
// SetErrorCode("Impossible to build partition between TShape and plane OXZ");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Part1->GetLastFunction()->SetDescription("");
|
||||||
|
// Handle(GEOM_Object) Part2 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
|
||||||
|
// if (Part2.IsNull()) {
|
||||||
|
// std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
|
||||||
|
// SetErrorCode("Impossible to build partition between TShape and plane OZ");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Part2->GetLastFunction()->SetDescription("");
|
||||||
|
// Te3 = aBooleanOperations->MakeHalfPartition(Part2, face_t2);
|
||||||
|
// if (Te3.IsNull()) {
|
||||||
|
// std::cerr << "Impossible to build partition between TShape and 2nd face" << std::endl;
|
||||||
|
// SetErrorCode("Impossible to build partition between TShape and 2nd face");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// Te3->GetLastFunction()->SetDescription("");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HArray1OfInteger) theMaterials;
|
||||||
|
partitionShapes->Append(theShape);
|
||||||
|
theTools->Append(aPlnOZ);
|
||||||
|
theTools->Append(aPlnOXZ);
|
||||||
|
theTools->Append(face_t);
|
||||||
|
if (!isNormal)
|
||||||
|
theTools->Append(face_t2);
|
||||||
|
|
||||||
|
Handle(GEOM_Object) Te3 = aBooleanOperations->MakePartition(partitionShapes, theTools, theKeepInside, theRemoveInside, TopAbs_SOLID, false, theMaterials, 0, false);
|
||||||
|
if (Te3.IsNull()) {
|
||||||
|
SetErrorCode("Impossible to build partition of TShape");
|
||||||
|
// Handle(GEOM_Object) aCompound = aShapesOperations->MakeCompound(theShapes);
|
||||||
|
// TopoDS_Shape aCompoundShape = aCompound->GetValue();
|
||||||
|
// theShape->GetLastFunction()->SetValue(aCompoundShape);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Te3->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
|
|
||||||
TopoDS_Shape aShape = Te3->GetValue();
|
TopoDS_Shape aShape = Te3->GetValue();
|
||||||
theShape->GetLastFunction()->SetValue(aShape);
|
theShape->GetLastFunction()->SetValue(aShape);
|
||||||
@ -1636,17 +1636,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap
|
|||||||
try {
|
try {
|
||||||
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
|
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
|
||||||
}
|
}
|
||||||
catch (Standard_Failure) {
|
|
||||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
|
||||||
SetErrorCode(aFail->GetMessageString());
|
|
||||||
try {
|
|
||||||
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges);
|
|
||||||
}
|
|
||||||
catch (Standard_Failure) {
|
catch (Standard_Failure) {
|
||||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
SetErrorCode(aFail->GetMessageString());
|
SetErrorCode(aFail->GetMessageString());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (aChamfer.IsNull()) {
|
||||||
|
SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
aChamfer->GetLastFunction()->SetDescription("");
|
aChamfer->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
@ -1853,8 +1850,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap
|
|||||||
try {
|
try {
|
||||||
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
|
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (Standard_Failure) {
|
||||||
aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges);
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (aChamfer.IsNull()) {
|
||||||
|
SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
aChamfer->GetLastFunction()->SetDescription("");
|
aChamfer->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
@ -2041,7 +2044,19 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
|
Handle(GEOM_Object) aFillet;
|
||||||
|
try {
|
||||||
|
aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (aFillet.IsNull()) {
|
||||||
|
SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
aFillet->GetLastFunction()->SetDescription("");
|
aFillet->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
TopoDS_Shape aFilletShape = aFillet->GetValue();
|
TopoDS_Shape aFilletShape = aFillet->GetValue();
|
||||||
@ -2230,7 +2245,19 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
|
Handle(GEOM_Object) aFillet;
|
||||||
|
try {
|
||||||
|
aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (aFillet.IsNull()) {
|
||||||
|
SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
aFillet->GetLastFunction()->SetDescription("");
|
aFillet->GetLastFunction()->SetDescription("");
|
||||||
|
|
||||||
TopoDS_Shape aFilletShape = aFillet->GetValue();
|
TopoDS_Shape aFilletShape = aFillet->GetValue();
|
||||||
|
Loading…
Reference in New Issue
Block a user