/* Each element of the compound should be a Block */
NOT_BLOCK,
- /* An element is a potential block, but has degenerated edge(s). */
- DEGENERATED_EDGE,
-
- /* An element is a potential block, but has seam edge(s). */
- SEAM_EDGE,
+ /* An element is a potential block, but has degenerated and/or seam edge(s). */
+ EXTRA_EDGE,
/* A connection between two Blocks should be an entire face or an entire edge */
INVALID_CONNECTION,
* - A connection between two Blocks should be an entire quadrangle face or an entire edge.
* - The compound should be connexe.
* - The glue between two quadrangle faces should be applied.
+ * \note Single block is also accepted as a valid compound of blocks.
* \param theCompound The compound to check.
* \return TRUE, if the given shape is a compound of blocks.
* \return theErrors Structure, containing discovered errors and incriminated sub-shapes.
string PrintBCErrors (in GEOM_Object theCompound,
in BCErrors theErrors);
+ /*!
+ * Remove all seam and degenerated edges from \a theShape.
+ * Unite faces and edges, sharing one surface.
+ * \param theShape The compound or single solid to remove irregular edges from.
+ * \return Improved shape.
+ */
+ GEOM_Object RemoveExtraEdges (in GEOM_Object theShape);
+
+ /*!
+ * Check, if the given shape is a blocks compound.
+ * Fix all detected errors.
+ * \note Single block can be also fixed by this method.
+ * \param theCompound The compound to check and improve.
+ * \return Improved compound.
+ */
+ GEOM_Object CheckAndImprove (in GEOM_Object theCompound);
+
/*!
* Get all the blocks, contained in the given compound.
* \param theCompound The compound to explode.
#include "ShHealOper_Sewing.hxx"
#include "NMTAlgo_Splitter1.hxx"
+#include "BlockFix_BlockFixAPI.hxx"
+
+#include "utilities.h"
#include <TNaming_CopyShape.hxx>
} else {
}
- } else { // Multi-transformations
+ } else { // Multi-transformations and compound improving
- TopoDS_Shape aMulti;
- GEOMImpl_IBlockTrsf aCI (aFunction);
- Handle(GEOM_Function) aRefShape = aCI.GetOriginal();
- TopoDS_Shape aBlockIni = aRefShape->GetValue();
- if (aBlockIni.IsNull()) {
- Standard_NullObject::Raise("Null Block");
- }
+ if (aType == BLOCK_REMOVE_EXTRA ||
+ aType == BLOCK_COMPOUND_IMPROVE) {
+
+ GEOMImpl_IBlockTrsf aCI (aFunction);
+ Handle(GEOM_Function) aRefShape = aCI.GetOriginal();
+ TopoDS_Shape aBlockOrComp = aRefShape->GetValue();
+ if (aBlockOrComp.IsNull()) {
+ Standard_NullObject::Raise("Null Shape given");
+ }
+
+ if (aType == BLOCK_REMOVE_EXTRA) {
- // Copy block to avoid problems (PAL6706)
- TColStd_IndexedDataMapOfTransientTransient aMap;
- TopoDS_Shape aBlock;
- TNaming_CopyShape::CopyTool(aBlockIni, aMap, aBlock);
+ BlockFix_BlockFixAPI aTool;
+ //aTool.Tolerance() = toler;
+ aTool.SetShape(aBlockOrComp);
+ aTool.Perform();
- // Block tolerance in vertices
- Standard_Real aTol = prec;
- TopExp_Explorer expV (aBlock, TopAbs_VERTEX);
- TopTools_MapOfShape mapShape;
- for (; expV.More(); expV.Next()) {
- if (mapShape.Add(expV.Current())) {
- TopoDS_Vertex aV = TopoDS::Vertex(expV.Current());
- aTol = Max(BRep_Tool::Tolerance(aV), aTol);
+ aShape = aTool.Shape();
+ if (aShape == aBlockOrComp) {
+ MESSAGE("No modifications have been done");
+ }
+
+ } else { // aType == BLOCK_COMPOUND_IMPROVE
}
- }
- if (aType == BLOCK_MULTI_TRANSFORM_1D) {
- // Retrieve a faces by Ids
- Standard_Integer aFace1Id = aCI.GetFace1U();
- Standard_Integer aFace2Id = aCI.GetFace2U();
- TopoDS_Shape aFace1, aFace2;
- if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1Id, aFace1)) {
- Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
+ } else if (aType == BLOCK_MULTI_TRANSFORM_1D ||
+ aType == BLOCK_MULTI_TRANSFORM_2D) {
+
+ TopoDS_Shape aMulti;
+ GEOMImpl_IBlockTrsf aCI (aFunction);
+ Handle(GEOM_Function) aRefShape = aCI.GetOriginal();
+ TopoDS_Shape aBlockIni = aRefShape->GetValue();
+ if (aBlockIni.IsNull()) {
+ Standard_NullObject::Raise("Null Block");
}
- if (aFace1.ShapeType() != TopAbs_FACE) {
- Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
+
+ // Copy block to avoid problems (PAL6706)
+ TColStd_IndexedDataMapOfTransientTransient aMap;
+ TopoDS_Shape aBlock;
+ TNaming_CopyShape::CopyTool(aBlockIni, aMap, aBlock);
+
+ // Block tolerance in vertices
+ Standard_Real aTol = prec;
+ TopExp_Explorer expV (aBlock, TopAbs_VERTEX);
+ TopTools_MapOfShape mapShape;
+ for (; expV.More(); expV.Next()) {
+ if (mapShape.Add(expV.Current())) {
+ TopoDS_Vertex aV = TopoDS::Vertex(expV.Current());
+ aTol = Max(BRep_Tool::Tolerance(aV), aTol);
+ }
}
- if (aFace2Id > 0) {
- if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2Id, aFace2)) {
+ if (aType == BLOCK_MULTI_TRANSFORM_1D) {
+ // Retrieve a faces by Ids
+ Standard_Integer aFace1Id = aCI.GetFace1U();
+ Standard_Integer aFace2Id = aCI.GetFace2U();
+ TopoDS_Shape aFace1, aFace2;
+ if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1Id, aFace1)) {
Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
}
- if (aFace2.ShapeType() != TopAbs_FACE) {
+ if (aFace1.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
}
- }
- Standard_Integer aNbIter = aCI.GetNbIterU();
+ if (aFace2Id > 0) {
+ if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2Id, aFace2)) {
+ Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
+ }
+ if (aFace2.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
+ }
+ }
- MultiTransformate1D(aBlock, aFace1, aFace2, aNbIter, aMulti);
+ Standard_Integer aNbIter = aCI.GetNbIterU();
- } else if (aType == BLOCK_MULTI_TRANSFORM_2D) {
- // Retrieve a faces by Ids
- Standard_Integer aFace1UId = aCI.GetFace1U();
- Standard_Integer aFace2UId = aCI.GetFace2U();
- Standard_Integer aFace1VId = aCI.GetFace1V();
- Standard_Integer aFace2VId = aCI.GetFace2V();
+ MultiTransformate1D(aBlock, aFace1, aFace2, aNbIter, aMulti);
- TopoDS_Shape aFace1U, aFace2U, aFace1V, aFace2V;
- if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1UId, aFace1U) ||
- !GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1VId, aFace1V)) {
- Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
- }
+ } else { // aType == BLOCK_MULTI_TRANSFORM_2D
+ // Retrieve a faces by Ids
+ Standard_Integer aFace1UId = aCI.GetFace1U();
+ Standard_Integer aFace2UId = aCI.GetFace2U();
+ Standard_Integer aFace1VId = aCI.GetFace1V();
+ Standard_Integer aFace2VId = aCI.GetFace2V();
- if (aFace1U.ShapeType() != TopAbs_FACE ||
- aFace1V.ShapeType() != TopAbs_FACE) {
- Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
- }
-
- if (aFace2UId > 0) {
- if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2UId, aFace2U)) {
+ TopoDS_Shape aFace1U, aFace2U, aFace1V, aFace2V;
+ if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1UId, aFace1U) ||
+ !GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace1VId, aFace1V)) {
Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
}
- if (aFace2U.ShapeType() != TopAbs_FACE) {
+ if (aFace1U.ShapeType() != TopAbs_FACE ||
+ aFace1V.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
}
- }
- if (aFace2VId > 0) {
- if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2VId, aFace2V)) {
- Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
+ if (aFace2UId > 0) {
+ if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2UId, aFace2U)) {
+ Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
+ }
+
+ if (aFace2U.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
+ }
}
- if (aFace2V.ShapeType() != TopAbs_FACE) {
- Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
+ if (aFace2VId > 0) {
+ if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2VId, aFace2V)) {
+ Standard_NullObject::Raise("Can not retrieve a sub-shape with given Id");
+ }
+
+ if (aFace2V.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
+ }
}
- }
- Standard_Integer aNbIterU = aCI.GetNbIterU();
- Standard_Integer aNbIterV = aCI.GetNbIterV();
+ Standard_Integer aNbIterU = aCI.GetNbIterU();
+ Standard_Integer aNbIterV = aCI.GetNbIterV();
- MultiTransformate2D(aBlock,
- aFace1U, aFace2U, aNbIterU,
- aFace1V, aFace2V, aNbIterV, aMulti);
+ MultiTransformate2D(aBlock,
+ aFace1U, aFace2U, aNbIterU,
+ aFace1V, aFace2V, aNbIterV, aMulti);
+ }
- } else {
- return 0;
- }
+ if (aMulti.IsNull()) {
+ StdFail_NotDone::Raise("Multi-transformation failed");
+ }
- if (aMulti.IsNull()) {
- StdFail_NotDone::Raise("Multi-transformation failed");
+ // Glue faces of the multi-block
+ aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol);
+
+ } else { // unknown function type
return 0;
}
-
- // Glue faces of the multi-block
- aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol);
}
if (aShape.IsNull()) return 0;
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
+#include "BlockFix_CheckTool.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
void AddBlocksFrom (const TopoDS_Shape& theShape,
TopTools_ListOfShape& BLO,
TopTools_ListOfShape& NOT,
- TopTools_ListOfShape& DEG,
- TopTools_ListOfShape& SEA)
+ TopTools_ListOfShape& EXT)
{
TopAbs_ShapeEnum aType = theShape.ShapeType();
switch (aType) {
{
TopoDS_Iterator It (theShape);
for (; It.More(); It.Next()) {
- AddBlocksFrom(It.Value(), BLO, NOT, DEG, SEA);
+ AddBlocksFrom(It.Value(), BLO, NOT, EXT);
+ }
+ }
+ break;
+ case TopAbs_SOLID:
+ {
+ // Check, if there are seam or degenerated edges
+ BlockFix_CheckTool aTool;
+ aTool.SetShape(theShape);
+ aTool.Perform();
+ if (aTool.NbPossibleBlocks() > 0) {
+ EXT.Append(theShape);
+ } else {
+ // Count faces and edges in each face to recognize blocks
+ TopTools_MapOfShape mapFaces;
+ Standard_Integer nbFaces = 0;
+ Standard_Boolean hasNonQuadr = Standard_False;
+ TopExp_Explorer expF (theShape, TopAbs_FACE);
+
+ for (; expF.More(); expF.Next()) {
+ if (mapFaces.Add(expF.Current())) {
+ nbFaces++;
+ if (nbFaces > 6) break;
+
+ // get wire
+ TopoDS_Shape aF = expF.Current();
+ TopExp_Explorer wires (aF, TopAbs_WIRE);
+ if (!wires.More()) {
+ // no wire in the face
+ hasNonQuadr = Standard_True;
+ break;
+ }
+ TopoDS_Shape aWire = wires.Current();
+ wires.Next();
+ if (wires.More()) {
+ // multiple wires in the face
+ hasNonQuadr = Standard_True;
+ break;
+ }
+
+ // Check number of edges in the face
+ Standard_Integer nbEdges = 0;
+ TopTools_MapOfShape mapEdges;
+ TopExp_Explorer expW (aWire, TopAbs_EDGE);
+ for (; expW.More(); expW.Next()) {
+ if (mapEdges.Add(expW.Current())) {
+ nbEdges++;
+ if (nbEdges > 4) break;
+ }
+ }
+ if (nbEdges != 4) {
+ hasNonQuadr = Standard_True;
+ }
+ }
+ }
+
+ if (nbFaces == 6 && !hasNonQuadr) {
+ BLO.Append(theShape);
+ } else {
+ NOT.Append(theShape);
+ }
+ }
+ }
+ break;
+ default:
+ NOT.Append(theShape);
+ }
+}
+
+void AddBlocksFromOld (const TopoDS_Shape& theShape,
+ TopTools_ListOfShape& BLO,
+ TopTools_ListOfShape& NOT,
+ TopTools_ListOfShape& DEG,
+ TopTools_ListOfShape& SEA)
+{
+ TopAbs_ShapeEnum aType = theShape.ShapeType();
+ switch (aType) {
+ case TopAbs_COMPOUND:
+ case TopAbs_COMPSOLID:
+ {
+ TopoDS_Iterator It (theShape);
+ for (; It.More(); It.Next()) {
+ AddBlocksFromOld(It.Value(), BLO, NOT, DEG, SEA);
}
}
break;
TopTools_ListOfShape DEG; // Hexahedral solids, having degenerated edges
TopTools_ListOfShape SEA; // Hexahedral solids, having seam edges
TopTools_ListOfShape BLO; // All blocks from the given compound
- AddBlocksFrom(aBlockOrComp, BLO, NOT, DEG, SEA);
+ AddBlocksFromOld(aBlockOrComp, BLO, NOT, DEG, SEA);
if (NOT.Extent() > 0) {
isCompOfBlocks = Standard_False;
theErrors.push_back(anErr);
}
- if (DEG.Extent() > 0) {
+ if (DEG.Extent() > 0 || SEA.Extent() > 0) {
isCompOfBlocks = Standard_False;
BCError anErr;
- anErr.error = DEGENERATED_EDGE;
- TopTools_ListIteratorOfListOfShape it (DEG);
- for (; it.More(); it.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
+ anErr.error = EXTRA_EDGE;
+
+ TopTools_ListIteratorOfListOfShape itDEG (DEG);
+ for (; itDEG.More(); itDEG.Next()) {
+ anErr.incriminated.push_back(anIndices.FindIndex(itDEG.Value()));
}
- theErrors.push_back(anErr);
- }
- if (SEA.Extent() > 0) {
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = SEAM_EDGE;
- TopTools_ListIteratorOfListOfShape it (SEA);
- for (; it.More(); it.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
+ TopTools_ListIteratorOfListOfShape itSEA (SEA);
+ for (; itSEA.More(); itSEA.Next()) {
+ anErr.incriminated.push_back(anIndices.FindIndex(itSEA.Value()));
}
+
theErrors.push_back(anErr);
}
case NOT_BLOCK:
aDescr += "\nNot a Blocks: ";
break;
- case DEGENERATED_EDGE:
- aDescr += "\nHexahedral solids with degenerated edges: ";
- break;
- case SEAM_EDGE:
- aDescr += "\nHexahedral solids with seam edges: ";
+ case EXTRA_EDGE:
+ aDescr += "\nHexahedral solids with degenerated and/or seam edges: ";
break;
case INVALID_CONNECTION:
aDescr += "\nInvalid connection between two blocks: ";
// 1. Separate blocks from non-blocks
TopTools_ListOfShape NOT; // Not blocks
- TopTools_ListOfShape DEG; // Hexahedral solids, having degenerated edges
- TopTools_ListOfShape SEA; // Hexahedral solids, having seam edges
+ TopTools_ListOfShape EXT; // Hexahedral solids, having degenerated and/or seam edges
TopTools_ListOfShape BLO; // All blocks from the given compound
- AddBlocksFrom(aBlockOrComp, BLO, NOT, DEG, SEA);
+ AddBlocksFrom(aBlockOrComp, BLO, NOT, EXT);
// Report non-blocks
if (NOT.Extent() > 0) {
theErrors.push_back(anErr);
}
- // Report solids, having degenerated edges
- if (DEG.Extent() > 0) {
- isCompOfBlocks = Standard_False;
- BCError anErr;
- anErr.error = DEGENERATED_EDGE;
- TopTools_ListIteratorOfListOfShape it (DEG);
- for (; it.More(); it.Next()) {
- anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
- }
- theErrors.push_back(anErr);
- }
-
- // Report solids, having seam edges
- if (SEA.Extent() > 0) {
+ // Report solids, having degenerated and/or seam edges
+ if (EXT.Extent() > 0) {
isCompOfBlocks = Standard_False;
BCError anErr;
- anErr.error = SEAM_EDGE;
- TopTools_ListIteratorOfListOfShape it (SEA);
+ anErr.error = EXTRA_EDGE;
+ TopTools_ListIteratorOfListOfShape it (EXT);
for (; it.More(); it.Next()) {
anErr.incriminated.push_back(anIndices.FindIndex(it.Value()));
}
return isCompOfBlocks;
}
+//=============================================================================
+/*!
+ * RemoveExtraEdges
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges
+ (Handle(GEOM_Object) theObject)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be fixed
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
+
+ //Add a function
+ Handle(GEOM_Function) aFunction =
+ aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_REMOVE_EXTRA);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL;
+
+ GEOMImpl_IBlockTrsf aTI (aFunction);
+ aTI.SetOriginal(aLastFunction);
+
+ //Compute the fixed shape
+ try {
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Block driver failed to remove extra edges of the given shape");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
+ aDescr += anEntry + " = IBlocksOperations.RemoveExtraEdges(";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += anEntry + ")";
+
+ aFunction->SetDescription(aDescr);
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
+//=============================================================================
+/*!
+ * CheckAndImprove
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBlocksOperations::CheckAndImprove
+ (Handle(GEOM_Object) theObject)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be fixed
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
+
+ //Add a function
+ Handle(GEOM_Function) aFunction =
+ aCopy->AddFunction(GEOMImpl_BlockDriver::GetID(), BLOCK_COMPOUND_IMPROVE);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BlockDriver::GetID()) return NULL;
+
+ GEOMImpl_IBlockTrsf aTI (aFunction);
+ aTI.SetOriginal(aLastFunction);
+
+ //Compute the fixed shape
+ try {
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Block driver failed to improve the given blocks compound");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
+ aDescr += anEntry + " = IBlocksOperations.CheckAndImprove(";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += anEntry + ")";
+
+ aFunction->SetDescription(aDescr);
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
//=============================================================================
/*!
* ExplodeCompoundOfBlocks
enum BCErrorType {
NOT_BLOCK,
- DEGENERATED_EDGE,
- SEAM_EDGE,
+ EXTRA_EDGE,
INVALID_CONNECTION,
NOT_CONNECTED,
NOT_GLUED
TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object) theCompound,
const list<BCError>& theErrors);
+ Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape);
+
+ Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound);
+
// Extract blocks from blocks compounds
Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
(Handle(GEOM_Object) theCompound,
#define BLOCK_TWO_FACES 5
#define BLOCK_MULTI_TRANSFORM_1D 6
#define BLOCK_MULTI_TRANSFORM_2D 7
-#define BLOCK_COMPOUND_GLUE 8
+#define BLOCK_COMPOUND_GLUE 8
+#define BLOCK_REMOVE_EXTRA 9
+#define BLOCK_COMPOUND_IMPROVE 10
// Marker
#define MARKER_CS 1
case GEOMImpl_IBlocksOperations::NOT_BLOCK:
anError->error = GEOM::GEOM_IBlocksOperations::NOT_BLOCK;
break;
- case GEOMImpl_IBlocksOperations::DEGENERATED_EDGE:
- anError->error = GEOM::GEOM_IBlocksOperations::DEGENERATED_EDGE;
- break;
- case GEOMImpl_IBlocksOperations::SEAM_EDGE:
- anError->error = GEOM::GEOM_IBlocksOperations::SEAM_EDGE;
+ case GEOMImpl_IBlocksOperations::EXTRA_EDGE:
+ anError->error = GEOM::GEOM_IBlocksOperations::EXTRA_EDGE;
break;
case GEOMImpl_IBlocksOperations::INVALID_CONNECTION:
anError->error = GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION;
case GEOM::GEOM_IBlocksOperations::NOT_BLOCK:
errStruct.error = GEOMImpl_IBlocksOperations::NOT_BLOCK;
break;
- case GEOM::GEOM_IBlocksOperations::DEGENERATED_EDGE:
- errStruct.error = GEOMImpl_IBlocksOperations::DEGENERATED_EDGE;
- break;
- case GEOM::GEOM_IBlocksOperations::SEAM_EDGE:
- errStruct.error = GEOMImpl_IBlocksOperations::SEAM_EDGE;
+ case GEOM::GEOM_IBlocksOperations::EXTRA_EDGE:
+ errStruct.error = GEOMImpl_IBlocksOperations::EXTRA_EDGE;
break;
case GEOM::GEOM_IBlocksOperations::INVALID_CONNECTION:
errStruct.error = GEOMImpl_IBlocksOperations::INVALID_CONNECTION;
return CORBA::string_dup(aDescr.ToCString());
}
+//=============================================================================
+/*!
+ * RemoveExtraEdges
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theShape == NULL) return aGEOMObject._retn();
+
+ //Get the reference Objects
+ Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
+ (theShape->GetStudyID(), theShape->GetEntry());
+
+ if (aShape.IsNull()) return aGEOMObject._retn();
+
+ //Get the result
+ Handle(GEOM_Object) anObject =
+ GetOperations()->RemoveExtraEdges(aShape);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * CheckAndImprove
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::CheckAndImprove (GEOM::GEOM_Object_ptr theCompound)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (theCompound == NULL) return aGEOMObject._retn();
+
+ //Get the reference Objects
+ Handle(GEOM_Object) aCompound = GetOperations()->GetEngine()->GetObject
+ (theCompound->GetStudyID(), theCompound->GetEntry());
+
+ if (aCompound.IsNull()) return aGEOMObject._retn();
+
+ //Get the result
+ Handle(GEOM_Object) anObject =
+ GetOperations()->CheckAndImprove(aCompound);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* GetBlockNearPoint
char* PrintBCErrors (GEOM::GEOM_Object_ptr theCompound,
const GEOM::GEOM_IBlocksOperations::BCErrors& theErrors);
+ GEOM::GEOM_Object_ptr RemoveExtraEdges (GEOM::GEOM_Object_ptr theShape);
+
+ GEOM::GEOM_Object_ptr CheckAndImprove (GEOM::GEOM_Object_ptr theCompound);
+
// Extract blocks from blocks compounds
GEOM::ListOfGO* ExplodeCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound,
const CORBA::Long theMinNbFaces,