TopExp::MapShapes(aShape, anIndices);
Handle(TColStd_HArray1OfInteger) anArray;
- Standard_Integer nbAllSubShape = anIndices.Extent();
-
TopTools_ListIteratorOfListOfShape itSub (listShape);
TCollection_AsciiString anAsciiList, anEntry;
for (int index = 1; itSub.More(); itSub.Next(), ++index)
Standard_Real tab_aWhat[4], tab_aWhere[4];
Standard_Real dl_l = 1e-3;
Standard_Real min_l, Tol_1D, Tol_2D, Tol_3D, Tol_Mass;
- gp_Pnt aPnt, aPnt_aWhat;
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Bnd_Box BoundingBox;
+ gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2];
GProp_GProps aProps;
// Find the iType of the aWhat shape
else if ( compType == TopAbs_SOLID || compType == TopAbs_COMPSOLID) iType = TopAbs_SOLID;
}
else {
- cout << endl;
- cout << "WARNING : shape to be extracted is of unknown type !" << endl;
- cout << endl;
+ SetErrorCode("Error: An attempt to extract a shape of not supported type.");
+ return NULL;
}
TopExp_Explorer Exp_aWhat( aWhat, TopAbs_ShapeEnum( iType ) );
TopExp_Explorer Exp_Edge( aWhere, TopAbs_EDGE );
// Find the shortest edge in theShapeWhere shape
+ BRepBndLib::Add(aWhere, BoundingBox);
+ BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ min_l = fabs(aXmax - aXmin);
+ if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin);
+ if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin);
+ min_l /= dl_l;
for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) {
- BRepGProp::LinearProperties(Exp_Edge.Current(), aProps);
- if ( ! nbEdge ) min_l = aProps.Mass();
- if ( aProps.Mass() < min_l ) min_l = aProps.Mass();
+ TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX);
+ for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) {
+ aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) );
+ tab_Pnt[nbVertex] = aPnt;
+ }
+ if ( not tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) {
+ BRepGProp::LinearProperties(Exp_Edge.Current(), aProps);
+ if ( aProps.Mass() < min_l ) min_l = aProps.Mass();
+ }
}
// Compute tolerances
if ( fabs( aWhat_Mass - aWhere_Mass ) <= Tol_Mass ) break;
}
+ if (aModifiedList.Extent() == 0) { // Not found any Results
+ SetErrorCode(NOT_FOUND_ANY);
+ return NULL;
+ }
+
aModifiedArray = new TColStd_HArray1OfInteger (1, aModifiedList.Extent());
TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList);
for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++)
if(!coincide) return false;
+ if (BRep_Tool::Degenerated(theEdge1))
+ if (BRep_Tool::Degenerated(theEdge2)) return true;
+ else return false;
+ else
+ if (BRep_Tool::Degenerated(theEdge2)) return false;
+
double U11, U12, U21, U22;
Handle(Geom_Curve) C1 = BRep_Tool::Curve(theEdge1, U11, U12);
Handle(Geom_Curve) C2 = BRep_Tool::Curve(theEdge2, U21, U22);