Check and improve shapes with seam and/or degenerated edges

This commit is contained in:
jfa 2004-12-29 14:15:49 +00:00
parent 267d9aad80
commit b940d97c7d
7 changed files with 417 additions and 140 deletions

View File

@ -1104,11 +1104,8 @@ module GEOM
/* 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,
@ -1142,6 +1139,7 @@ module GEOM
* - 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.
@ -1159,6 +1157,23 @@ module GEOM
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.

View File

@ -14,6 +14,9 @@ using namespace std;
#include "ShHealOper_Sewing.hxx"
#include "NMTAlgo_Splitter1.hxx"
#include "BlockFix_BlockFixAPI.hxx"
#include "utilities.h"
#include <TNaming_CopyShape.hxx>
@ -456,113 +459,141 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
} 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) {
// 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 (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 (aFace1.ShapeType() != TopAbs_FACE) {
Standard_TypeMismatch::Raise("Sub-shape with given Id is not a face");
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 (aFace2Id > 0) {
if (!GEOMImpl_ILocalOperations::GetSubShape(aBlock, aFace2Id, aFace2)) {
if (aType == BLOCK_REMOVE_EXTRA) {
BlockFix_BlockFixAPI aTool;
//aTool.Tolerance() = toler;
aTool.SetShape(aBlockOrComp);
aTool.Perform();
aShape = aTool.Shape();
if (aShape == aBlockOrComp) {
MESSAGE("No modifications have been done");
}
} else { // aType == BLOCK_COMPOUND_IMPROVE
}
} 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");
}
// 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 (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();
MultiTransformate2D(aBlock,
aFace1U, aFace2U, aNbIterU,
aFace1V, aFace2V, aNbIterV, aMulti);
}
Standard_Integer aNbIterU = aCI.GetNbIterU();
Standard_Integer aNbIterV = aCI.GetNbIterV();
if (aMulti.IsNull()) {
StdFail_NotDone::Raise("Multi-transformation failed");
}
MultiTransformate2D(aBlock,
aFace1U, aFace2U, aNbIterU,
aFace1V, aFace2V, aNbIterV, aMulti);
// Glue faces of the multi-block
aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol);
} else {
} else { // unknown function type
return 0;
}
if (aMulti.IsNull()) {
StdFail_NotDone::Raise("Multi-transformation failed");
return 0;
}
// Glue faces of the multi-block
aShape = GEOMImpl_GlueDriver::GlueFaces(aMulti, aTol);
}
if (aShape.IsNull()) return 0;

View File

@ -16,6 +16,7 @@ using namespace std;
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "BlockFix_CheckTool.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
@ -1662,8 +1663,7 @@ Standard_Boolean GEOMImpl_IBlocksOperations::IsCompoundOfBlocks
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) {
@ -1672,7 +1672,89 @@ void AddBlocksFrom (const TopoDS_Shape& theShape,
{
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;
@ -1999,7 +2081,7 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocksOld
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;
@ -2012,25 +2094,21 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocksOld
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()));
}
theErrors.push_back(anErr);
}
anErr.error = EXTRA_EDGE;
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 itDEG (DEG);
for (; itDEG.More(); itDEG.Next()) {
anErr.incriminated.push_back(anIndices.FindIndex(itDEG.Value()));
}
TopTools_ListIteratorOfListOfShape itSEA (SEA);
for (; itSEA.More(); itSEA.Next()) {
anErr.incriminated.push_back(anIndices.FindIndex(itSEA.Value()));
}
theErrors.push_back(anErr);
}
@ -2149,11 +2227,8 @@ TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors
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: ";
@ -2203,10 +2278,9 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
// 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) {
@ -2220,24 +2294,12 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
theErrors.push_back(anErr);
}
// Report solids, having degenerated edges
if (DEG.Extent() > 0) {
// Report solids, having degenerated and/or seam edges
if (EXT.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) {
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()));
}
@ -2377,6 +2439,114 @@ Standard_Boolean GEOMImpl_IBlocksOperations::CheckCompoundOfBlocks
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

View File

@ -85,8 +85,7 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
enum BCErrorType {
NOT_BLOCK,
DEGENERATED_EDGE,
SEAM_EDGE,
EXTRA_EDGE,
INVALID_CONNECTION,
NOT_CONNECTED,
NOT_GLUED
@ -106,6 +105,10 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
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,

View File

@ -202,7 +202,9 @@
#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

View File

@ -657,11 +657,8 @@ CORBA::Boolean GEOM_IBlocksOperations_i::CheckCompoundOfBlocks
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;
@ -726,11 +723,8 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
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;
@ -758,6 +752,64 @@ char* GEOM_IBlocksOperations_i::PrintBCErrors
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

View File

@ -91,6 +91,10 @@ class GEOM_IBlocksOperations_i :
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,