// Created on: 1996-02-23
// Created by: Jacques GOUSSARD
// Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <BRepTest.hxx>
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <BRepAlgo.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Result.hxx>
#include <Precision.hxx>
#include <LocalAnalysis.hxx>
#include <LocalAnalysis_SurfaceContinuity.hxx>
+#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <DrawTrSurf.hxx>
#include <GeomAbs_Shape.hxx>
+#include <TCollection_AsciiString.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopOpeBRepTool_PurgeInternalEdges.hxx>
//#include <TopOpeBRepTool_FuseEdges.hxx>
+#include <BRepLib.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <Standard_Failure.hxx>
#include <stdio.h>
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
+
+//Number of BRepCheck_Statuses in BRepCheck_Status.hxx file
+//(BRepCheck_NoError is not considered, i.e. general status
+//is smaller by one specified in file)
+static const Standard_Integer NumberOfStatus = 36;
static char* checkfaultyname = NULL;
Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
OS << "On Shape " << Name << " :\n";
for (;itl.More(); itl.Next()) {
+ if (itl.Value() != BRepCheck_NoError)
BRepCheck::Print(itl.Value(),OS);
}
}
case TopAbs_EDGE:
PrintSub(OS,Ana,S,TopAbs_VERTEX);
break;
+ case TopAbs_WIRE:
+ PrintSub(OS,Ana,S,TopAbs_EDGE);
+ PrintSub(OS,Ana,S,TopAbs_VERTEX);
+ break;
case TopAbs_FACE:
PrintSub(OS,Ana,S,TopAbs_WIRE);
PrintSub(OS,Ana,S,TopAbs_EDGE);
{
if (narg < 2) {
//cout << "Usage: computetolerance shape" << endl;
- di << "Usage: computetolerance shape" << "\n";
+ di << "Usage: computetolerance shape\n";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[1]);
Standard_Integer narg, const char** a)
{
if (narg < 2) {
+ di << a[0] << " shape [-r <ref_val>]\n";
return 1;
}
+
+ Standard_Integer aCompareValue = -1;
TopoDS_Shape S = DBRep::Get(a[1]);
+
+ for (Standard_Integer anAI = 2; anAI < narg; anAI++)
+ {
+ if (!strcmp(a[anAI], "-r"))
+ {
+ aCompareValue = Draw::Atoi(a[++anAI]);
+ }
+ else
+ {
+ di << "Error: Wrong option" << a[anAI] << "\n";
+ }
+ }
+
TopTools_MapOfShape theVertices;
TopExp_Explorer exp;
for (exp.Init(S, TopAbs_VERTEX); exp.More(); exp.Next()) {
}
//cout << " nb alone Vertices : " << theVertices.Extent() << endl;
di << " nb alone Vertices : " << theVertices.Extent() << "\n";
+
+ if (aCompareValue >= 0)
+ {
+ if (theVertices.Extent() == aCompareValue)
+ {
+ di << "Section is OK\n";
+ }
+ else
+ {
+ di << "Error: "<< aCompareValue << " vertices are expected but " <<
+ theVertices.Extent() << " are found.\n";
+ }
+ }
+
char Name[32];
Standard_Integer ipp=0;
TopTools_MapIteratorOfMapOfShape itvx;
di << syntaxe << "\n";
return 1;
}
- closedSolid=Draw::Atoi(a[narg-1]);
+ closedSolid = Draw::Atoi(a[narg-1]) != 0;
resu = DBRep::Get(a[narg-2]);
lastArg=narg-3;
if (resu.IsNull()) {
return 1;
}
geomCtrl=closedSolid;
- closedSolid=Draw::Atoi(a[narg-2]);
+ closedSolid = Draw::Atoi(a[narg-2]) != 0;
resu = DBRep::Get(a[narg-3]);
lastArg=narg-4;
if (resu.IsNull()) {
if (BRepAlgo::IsValid(lesArgs, resu, closedSolid, geomCtrl)) {
//cout << "Difference is Valid." << endl;
- di << "Difference is Valid." << "\n";
+ di << "Difference is Valid.\n";
} else {
//cout << "error : Difference is Not Valid !" << endl;
- di << "error : Difference is Not Valid !" << "\n";
+ di << "error : Difference is Not Valid !\n";
}
return 0;
static void FillProblems(const BRepCheck_Status stat,
Handle(TColStd_HArray1OfInteger)& NbProblems)
{
- switch (stat) {
- case BRepCheck_InvalidPointOnCurve:
- NbProblems->SetValue(1,NbProblems->Value(1)+1); break;
- case BRepCheck_InvalidPointOnCurveOnSurface:
- NbProblems->SetValue(2,NbProblems->Value(2)+1); break;
- case BRepCheck_InvalidPointOnSurface:
- NbProblems->SetValue(3,NbProblems->Value(3)+1); break;
- case BRepCheck_No3DCurve:
- NbProblems->SetValue(4,NbProblems->Value(4)+1); break;
- case BRepCheck_Multiple3DCurve:
- NbProblems->SetValue(5,NbProblems->Value(5)+1); break;
- case BRepCheck_Invalid3DCurve:
- NbProblems->SetValue(6,NbProblems->Value(6)+1); break;
- case BRepCheck_NoCurveOnSurface:
- NbProblems->SetValue(7,NbProblems->Value(7)+1); break;
- case BRepCheck_InvalidCurveOnSurface:
- NbProblems->SetValue(8,NbProblems->Value(8)+1); break;
- case BRepCheck_InvalidCurveOnClosedSurface:
- NbProblems->SetValue(9,NbProblems->Value(9)+1); break;
- case BRepCheck_InvalidSameRangeFlag:
- NbProblems->SetValue(10,NbProblems->Value(10)+1); break;
- case BRepCheck_InvalidSameParameterFlag:
- NbProblems->SetValue(11,NbProblems->Value(11)+1); break;
- case BRepCheck_InvalidDegeneratedFlag:
- NbProblems->SetValue(12,NbProblems->Value(12)+1); break;
- case BRepCheck_FreeEdge:
- NbProblems->SetValue(13,NbProblems->Value(13)+1); break;
- case BRepCheck_InvalidMultiConnexity:
- NbProblems->SetValue(14,NbProblems->Value(14)+1); break;
- case BRepCheck_InvalidRange:
- NbProblems->SetValue(15,NbProblems->Value(15)+1); break;
- case BRepCheck_EmptyWire:
- NbProblems->SetValue(16,NbProblems->Value(16)+1); break;
- case BRepCheck_RedundantEdge:
- NbProblems->SetValue(17,NbProblems->Value(17)+1); break;
- case BRepCheck_SelfIntersectingWire:
- NbProblems->SetValue(18,NbProblems->Value(18)+1); break;
- case BRepCheck_NoSurface:
- NbProblems->SetValue(19,NbProblems->Value(19)+1); break;
- case BRepCheck_InvalidWire:
- NbProblems->SetValue(20,NbProblems->Value(20)+1); break;
- case BRepCheck_RedundantWire:
- NbProblems->SetValue(21,NbProblems->Value(21)+1); break;
- case BRepCheck_IntersectingWires:
- NbProblems->SetValue(22,NbProblems->Value(22)+1); break;
- case BRepCheck_InvalidImbricationOfWires:
- NbProblems->SetValue(23,NbProblems->Value(23)+1); break;
- case BRepCheck_EmptyShell:
- NbProblems->SetValue(24,NbProblems->Value(24)+1); break;
- case BRepCheck_RedundantFace:
- NbProblems->SetValue(25,NbProblems->Value(25)+1); break;
- case BRepCheck_UnorientableShape:
- NbProblems->SetValue(26,NbProblems->Value(26)+1); break;
- case BRepCheck_NotClosed:
- NbProblems->SetValue(27,NbProblems->Value(27)+1); break;
- case BRepCheck_NotConnected:
- NbProblems->SetValue(28,NbProblems->Value(28)+1); break;
- case BRepCheck_SubshapeNotInShape:
- NbProblems->SetValue(29,NbProblems->Value(29)+1); break;
- case BRepCheck_BadOrientation:
- NbProblems->SetValue(30,NbProblems->Value(30)+1); break;
- case BRepCheck_BadOrientationOfSubshape:
- NbProblems->SetValue(31,NbProblems->Value(31)+1); break;
- case BRepCheck_CheckFail:
- NbProblems->SetValue(32,NbProblems->Value(32)+1); break;
- default:
- break;
- }
+
+ const Standard_Integer anID = static_cast<Standard_Integer> (stat);
+
+ if((NbProblems->Upper() < anID) || (NbProblems->Lower() > anID))
+ return;
+
+ NbProblems->SetValue(anID, NbProblems->Value(anID)+1);
+
}
//cout << " -- The Shape " << ShName << " has problems :"<<endl;
//cout<<" Check Count"<<endl;
//cout<<" ------------------------------------------------"<<endl;
- theCommands << " -- The Shape " << ShName << " has problems :"<<"\n";
- theCommands<<" Check Count"<<"\n";
- theCommands<<" ------------------------------------------------"<<"\n";
+ theCommands << " -- The Shape " << ShName << " has problems :\n";
+ theCommands<<" Check Count\n";
+ theCommands<<" ------------------------------------------------\n";
- Handle(TColStd_HArray1OfInteger) NbProblems = new TColStd_HArray1OfInteger(1,32);
- for(i=1; i<=32; i++) NbProblems->SetValue(i,0);
+ Handle(TColStd_HArray1OfInteger) NbProblems = new
+ TColStd_HArray1OfInteger(1,NumberOfStatus);
+ for(i=1; i<=NumberOfStatus; i++) NbProblems->SetValue(i,0);
Handle(TopTools_HSequenceOfShape) sl,slv,sle,slw,slf,sls,slo;
sl = new TopTools_HSequenceOfShape();
theMap.Clear();
GetProblemShapes(theAna, theShape, sl, NbProblems);
theMap.Clear();
- if(NbProblems->Value(1)>0)
- theCommands<<" Invalid Point on Curve ................... "<<NbProblems->Value(1)<<"\n";
- //cout<<" Invalid Point on Curve ................... "<<NbProblems->Value(1)<<endl;
- if(NbProblems->Value(2)>0)
- theCommands<<" Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<"\n";
- //cout<<" Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<endl;
- if(NbProblems->Value(3)>0)
- theCommands<<" Invalid Point on Surface ................. "<<NbProblems->Value(3)<<"\n";
- //cout<<" Invalid Point on Surface ................. "<<NbProblems->Value(3)<<endl;
- if(NbProblems->Value(4)>0)
- theCommands<<" No 3D Curve .............................. "<<NbProblems->Value(4)<<"\n";
- //cout<<" No 3D Curve .............................. "<<NbProblems->Value(4)<<endl;
- if(NbProblems->Value(5)>0)
- theCommands<<" Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<"\n";
- //cout<<" Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<endl;
- if(NbProblems->Value(6)>0)
- theCommands<<" Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<"\n";
- //cout<<" Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<endl;
- if(NbProblems->Value(7)>0)
- theCommands<<" No Curve on Surface ...................... "<<NbProblems->Value(7)<<"\n";
- //cout<<" No Curve on Surface ...................... "<<NbProblems->Value(7)<<endl;
- if(NbProblems->Value(8)>0)
- theCommands<<" Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<"\n";
- //cout<<" Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<endl;
- if(NbProblems->Value(9)>0)
- theCommands<<" Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<"\n";
- //cout<<" Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<endl;
- if(NbProblems->Value(10)>0)
- theCommands<<" Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<"\n";
- //cout<<" Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<endl;
- if(NbProblems->Value(11)>0)
- theCommands<<" Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<"\n";
- //cout<<" Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<endl;
- if(NbProblems->Value(12)>0)
- theCommands<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<"\n";
- //cout<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<endl;
- if(NbProblems->Value(13)>0)
- theCommands<<" Free Edge ................................ "<<NbProblems->Value(13)<<"\n";
- //cout<<" Free Edge ................................ "<<NbProblems->Value(13)<<endl;
- if(NbProblems->Value(14)>0)
- theCommands<<" Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<"\n";
- //cout<<" Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<endl;
- if(NbProblems->Value(15)>0)
- theCommands<<" Invalid Range ............................ "<<NbProblems->Value(15)<<"\n";
- //cout<<" Invalid Range ............................ "<<NbProblems->Value(15)<<endl;
- if(NbProblems->Value(16)>0)
- theCommands<<" Empty Wire ............................... "<<NbProblems->Value(16)<<"\n";
- //cout<<" Empty Wire ............................... "<<NbProblems->Value(16)<<endl;
- if(NbProblems->Value(17)>0)
- theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<"\n";
- //cout<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<endl;
- if(NbProblems->Value(18)>0)
- theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<"\n";
- //cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<endl;
- if(NbProblems->Value(19)>0)
- theCommands<<" No Surface ............................... "<<NbProblems->Value(19)<<"\n";
- //cout<<" No Surface ............................... "<<NbProblems->Value(19)<<endl;
- if(NbProblems->Value(20)>0)
- theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<"\n";
- //cout<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
- if(NbProblems->Value(21)>0)
- theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<"\n";
- //cout<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<endl;
- if(NbProblems->Value(22)>0)
- theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<"\n";
- //cout<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<endl;
- if(NbProblems->Value(23)>0)
- theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<"\n";
- //cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<endl;
- if(NbProblems->Value(24)>0)
- theCommands<<" Empty Shell .............................. "<<NbProblems->Value(24)<<"\n";
- //cout<<" Empty Shell .............................. "<<NbProblems->Value(24)<<endl;
- if(NbProblems->Value(25)>0)
- theCommands<<" Redundant Face ........................... "<<NbProblems->Value(25)<<"\n";
- //cout<<" Redundant Face ........................... "<<NbProblems->Value(25)<<endl;
- if(NbProblems->Value(26)>0)
- theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<"\n";
- //cout<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<endl;
- if(NbProblems->Value(27)>0)
- theCommands<<" Not Closed ............................... "<<NbProblems->Value(27)<<"\n";
- //cout<<" Not Closed ............................... "<<NbProblems->Value(27)<<endl;
- if(NbProblems->Value(28)>0)
- theCommands<<" Not Connected ............................ "<<NbProblems->Value(28)<<"\n";
- //cout<<" Not Connected ............................ "<<NbProblems->Value(28)<<endl;
- if(NbProblems->Value(29)>0)
- theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<"\n";
- //cout<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<endl;
- if(NbProblems->Value(30)>0)
- theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<"\n";
- //cout<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<endl;
- if(NbProblems->Value(31)>0)
- theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<"\n";
- //cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<endl;
- if(NbProblems->Value(32)>0)
- theCommands<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<"\n";
- //cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
+ Standard_Integer aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurve);
+ if(NbProblems->Value(aProblemID) > 0)
+ theCommands<<" Invalid Point on Curve ................... "<<NbProblems->Value(aProblemID)<<"\n";
- //cout<<" ------------------------------------------------"<<endl;
- //cout<<"*** Shapes with problems : "<<sl->Length()<<endl;
- //cout<<endl;
- theCommands<<" ------------------------------------------------"<<"\n";
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnCurveOnSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPointOnSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Point on Surface ................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_No3DCurve);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" No 3D Curve .............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_Multiple3DCurve);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Multiple 3D Curve ........................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_Invalid3DCurve);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid 3D Curve ......................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_NoCurveOnSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" No Curve on Surface ...................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidCurveOnSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Curve on Surface ................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidCurveOnClosedSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Curve on closed Surface .......... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidSameRangeFlag);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid SameRange Flag ................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidSameParameterFlag);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid SameParameter Flag ............... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidDegeneratedFlag);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_FreeEdge);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Free Edge ................................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidMultiConnexity);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid MultiConnexity ................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidRange);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Range ............................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_EmptyWire);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Empty Wire ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantEdge);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_SelfIntersectingWire);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_NoSurface);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" No Surface ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidWire);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantWire);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_IntersectingWires);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidImbricationOfWires);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_EmptyShell);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Empty Shell .............................. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_RedundantFace);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Redundant Face ........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_UnorientableShape);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_NotClosed);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Not Closed ............................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_NotConnected);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Not Connected ............................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_SubshapeNotInShape);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_BadOrientation);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_BadOrientationOfSubshape);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidToleranceValue);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid tolerance value................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidPolygonOnTriangulation);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid polygon on triangulation.......... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_InvalidImbricationOfShells);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Invalid Imbrication of Shells............. "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_EnclosedRegion);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" Enclosed Region........................... "<<NbProblems->Value(aProblemID)<<"\n";
+
+ aProblemID = static_cast<Standard_Integer>(BRepCheck_CheckFail);
+ if(NbProblems->Value(aProblemID)>0)
+ theCommands<<" checkshape failure........................ "<<NbProblems->Value(aProblemID)<<"\n";
+
+
+
+ theCommands<<" ------------------------------------------------\n";
theCommands<<"*** Shapes with problems : "<<sl->Length()<<"\n";
slv = new TopTools_HSequenceOfShape();
char aName[20];
Sprintf(aName,"%s_v",Pref);
DBRep::Set(aName,comp);
- //cout<<"VERTEX"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"VERTEX : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"VERTEX"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"VERTEX : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"VERTEX"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"VERTEX : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
if(sle->Length()>0) {
TopoDS_Compound comp;
char aName[20];
Sprintf(aName,"%s_e",Pref);
DBRep::Set(aName,comp);
- //cout<<"EDGE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"EDGE : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"EDGE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"EDGE : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"EDGE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"EDGE : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
if(slw->Length()>0) {
TopoDS_Compound comp;
char aName[20];
Sprintf(aName,"%s_w",Pref);
DBRep::Set(aName,comp);
- //cout<<"WIRE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"WIRE : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"WIRE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"WIRE : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"WIRE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"WIRE : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
if(slf->Length()>0) {
TopoDS_Compound comp;
char aName[20];
Sprintf(aName,"%s_f",Pref);
DBRep::Set(aName,comp);
- //cout<<"FACE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"FACE : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"FACE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"FACE : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"FACE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"FACE : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
if(sls->Length()>0) {
TopoDS_Compound comp;
char aName[20];
Sprintf(aName,"%s_s",Pref);
DBRep::Set(aName,comp);
- //cout<<"SHELL"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"SHELL : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"SHELL"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"SHELL : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"SHELL"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"SHELL : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
if(slo->Length()>0) {
TopoDS_Compound comp;
char aName[20];
Sprintf(aName,"%s_o",Pref);
DBRep::Set(aName,comp);
- //cout<<"SOLID"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
+ //cout<<"SOLID : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
if (nb > 9)
- theCommands<<"SOLID"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"SOLID : "<<nb<<" Items -> compound named "<<aName<<"\n";
else
- theCommands<<"SOLID"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
+ theCommands<<"SOLID : "<<nb<<" Items -> compound named "<<aName<<"\n";
}
}
//cout << " output style will be used. Otherwise - contextual one." << endl;
//cout << " -short - short description of check." << endl;
theCommands << "\n";
- theCommands << "Usage : checkshape [-top] shape [result] [-short]" << "\n";
+ theCommands << "Usage : checkshape [-top] shape [result] [-short]\n";
theCommands << "\n";
- theCommands << "Where :" << "\n";
- theCommands << " -top - check topology only." << "\n";
- theCommands << " shape - the name of the shape to test." << "\n";
- theCommands << " result - the prefix of the output shape names. If it is used, structural" << "\n";
- theCommands << " output style will be used. Otherwise - contextual one." << "\n";
- theCommands << " -short - short description of check." << "\n";
+ theCommands << "Where :\n";
+ theCommands << " -top - check topology only.\n";
+ theCommands << " shape - the name of the shape to test.\n";
+ theCommands << " result - the prefix of the output shape names. If it is used, structural\n";
+ theCommands << " output style will be used. Otherwise - contextual one.\n";
+ theCommands << " -short - short description of check.\n";
return 0;
}
if (narg > 5) {
//cout << "Invalid number of args!!!" << endl;
//cout << "No args to have help." << endl;
- theCommands << "Invalid number of args!!!" << "\n";
- theCommands << "No args to have help." << "\n";
+ theCommands << "Invalid number of args!!!\n";
+ theCommands << "No args to have help.\n";
return 1;
}
if (aCurInd > narg - 1) {
//cout << "Invalid number of args!!!" << endl;
//cout << "No args to have help." << endl;
- theCommands << "Invalid number of args!!!" << "\n";
- theCommands << "No args to have help." << "\n";
+ theCommands << "Invalid number of args!!!\n";
+ theCommands << "No args to have help.\n";
return 1;
}
if (aShape.IsNull()) {
//cout << a[aCurInd] << " is not a topological shape!!!" << endl;
- theCommands << a[aCurInd] << " is not a topological shape!!!" << "\n";
+ theCommands << a[aCurInd] << " is not a topological shape!!!\n";
return 1;
}
if (aCurInd < aBackInd - 1) {
//cout << "Invalid number of args!!!" << endl;
//cout << "No args to have help." << endl;
- theCommands << "Invalid number of args!!!" << "\n";
- theCommands << "No args to have help." << "\n";
+ theCommands << "Invalid number of args!!!\n";
+ theCommands << "No args to have help.\n";
return 1;
} else if (aCurInd < aBackInd) {
}
}
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
theCommands<<"checkshape exception : ";
- theCommands << Standard_Failure::Caught()->GetMessageString();
+ theCommands << anException.GetMessageString();
theCommands<<"\n";
return 1;
}
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- { case 7 : epsG1 = Draw::Atof(a[6]);
- case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
+ {
+ case 7 : epsG1 = Draw::Atof(a[6]);
+ Standard_FALLTHROUGH
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
//else { cout<<" the continuity is not G1 "<<endl;}
//cout<<"MaxG0Value :"<< MaxG0Value << endl;
//cout<<"MaxG1Angle:"<< MaxG1Angle << endl;
- if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
+ if (!isdone) { di<<" Problem in computation \n"; return 1;}
if (ISG1)
- {di<<" the continuity is G1 "<<"\n";}
- else { di<<" the continuity is not G1 "<<"\n";}
+ {di<<" the continuity is G1 \n";}
+ else { di<<" the continuity is not G1 \n";}
di<<"MaxG0Value :"<< MaxG0Value << "\n";
di<<"MaxG1Angle:"<< MaxG1Angle << "\n";
return 0;
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- { case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
-
+ {
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
Standard_Boolean isconti = Standard_True;
//else { cout<<" the continuity is not G0 "<<endl;}
//cout<<"MaxG0Value :"<< MaxG0Value << endl;
- if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
+ if (!isdone) { di<<" Problem in computation \n"; return 1;}
if (ISG0)
- {di<<" the continuity is G0 "<<"\n";}
+ {di<<" the continuity is G0 \n";}
- else { di<<" the continuity is not G0 "<<"\n";}
+ else { di<<" the continuity is not G0 \n";}
di<<"MaxG0Value :"<< MaxG0Value << "\n";
return 0;
}
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- {
- case 9 : maxlen = Draw::Atof(a[8]);
- case 8 : percent = Draw::Atof(a[7]);
- case 7 : epsG1 = Draw::Atof(a[6]);
- case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
+ {
+ case 9 : maxlen = Draw::Atof(a[8]);
+ Standard_FALLTHROUGH
+ case 8 : percent = Draw::Atof(a[7]);
+ Standard_FALLTHROUGH
+ case 7 : epsG1 = Draw::Atof(a[6]);
+ Standard_FALLTHROUGH
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
//cout<<"MaxG0Value :"<< MaxG0Value << endl;
//cout<<"MaxG1Angle:"<< MaxG1Angle << endl;
//cout<<"MaxG2Curvature:"<<MaxG2Curvature<<endl;
- if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
+ if (!isdone) { di<<" Problem in computation \n"; return 1;}
if (ISG2)
- di<<" the continuity is G2 "<<"\n";
- else di<<" the continuity is not G2 "<<"\n";
+ di<<" the continuity is G2 \n";
+ else di<<" the continuity is not G2 \n";
di<<"MaxG0Value :"<< MaxG0Value << "\n";
di<<"MaxG1Angle:"<< MaxG1Angle << "\n";
di<<"MaxG2Curvature:"<<MaxG2Curvature<<"\n";
if (narg < 2) {
//cout << "Usage: clintedge shape" << endl;
- di << "Usage: clintedge shape" << "\n";
+ di << "Usage: clintedge shape\n";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[1]);
if (nbedges > 0)
{
//cout<<nbedges<<" internal (or external) edges to be removed"<<endl;
- di<<nbedges<<" internal (or external) edges to be removed"<<"\n";
+ di<<nbedges<<" internal (or external) edges to be removed\n";
Standard_Integer i = 1;
char* temp = newname;
di<<"\n";
}
else
- di << "no internal (or external) edges"<<"\n";
+ di << "no internal (or external) edges\n";
//cout << "no internal (or external) edges"<<endl;
return 0;
if (narg < 2) {
//cout << "Usage: facintedge shape" << endl;
- di << "Usage: facintedge shape" << "\n";
+ di << "Usage: facintedge shape\n";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[1]);
if (narg < 2) {
//cout << "Usage: fuseedge shape" << endl;
- di << "Usage: fuseedge shape" << "\n";
+ di << "Usage: fuseedge shape\n";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[1]);
if (nbvertices > 0) {
//cout<<nbvertices<<" vertices to be removed"<<endl;
- di<<nbvertices<<" vertices to be removed"<<"\n";
+ di<<nbvertices<<" vertices to be removed\n";
Standard_Integer i = 1;
char* temp = newname;
di<<"\n";
}
else
- di << "no vertices to remove"<<"\n";
+ di << "no vertices to remove\n";
//cout << "no vertices to remove"<<endl;
return 0;
if (narg < 2) {
//cout << "Usage: listfuseedge shape" << endl;
- di << "Usage: listfuseedge shape" << "\n";
+ di << "Usage: listfuseedge shape\n";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[1]);
return 0;
}
+//=======================================================================
+//function : tolsphere
+//purpose :
+//=======================================================================
+static Standard_Integer tolsphere(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n != 2)
+ {
+ di << "use toolsphere shape\n";
+ return 1;
+ }
+ TopoDS_Shape aS = DBRep::Get(a[1]);
+ if (aS.IsNull())
+ {
+ di << "No such shape " << a[1] << "\n";
+ return 1;
+ }
+
+ TopTools_IndexedMapOfShape aMapV;
+ TopExp::MapShapes(aS, TopAbs_VERTEX, aMapV);
+ for (Standard_Integer i = 1; i <= aMapV.Extent(); i++)
+ {
+ const TopoDS_Vertex& aV = TopoDS::Vertex(aMapV.FindKey(i));
+ Standard_Real aRadius = BRep_Tool::Tolerance(aV);
+ gp_Pnt aCenter = BRep_Tool::Pnt(aV);
+ Handle(Geom_Surface) aSph = new Geom_SphericalSurface(gp_Ax2(aCenter,gp::DZ()), aRadius);
+ TCollection_AsciiString aName(a[1]);
+ aName = aName + "_v" + i;
+ DrawTrSurf::Set(aName.ToCString(), aSph);
+ di << aName << " ";
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : validrange
+//purpose :
+//=======================================================================
+static Standard_Integer validrange(Draw_Interpretor& di,
+ Standard_Integer narg, const char** a)
+{
+ if (narg < 2)
+ {
+ di << "usage: validrange edge [(out) u1 u2]";
+ return 1;
+ }
+
+ TopoDS_Edge aE = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE, true));
+ if (aE.IsNull())
+ return 1;
+
+ Standard_Real u1, u2;
+ if (BRepLib::FindValidRange(aE, u1, u2))
+ {
+ if (narg > 3)
+ {
+ Draw::Set(a[2], u1);
+ Draw::Set(a[3], u2);
+ }
+ else
+ {
+ di << u1 << " " << u2;
+ }
+ }
+ else
+ di << "edge has no valid range";
+ return 0;
+}
//=======================================================================
//function : CheckCommands
// Modified by skv - Tue Apr 27 13:35:39 2004 End
theCommands.Add("checksection",
- "checks the closure of a section : checksection name",
+ "checks the closure of a section : checksection name [-r <RefVal>]\n"
+ "\"-r\" - allowed number of allone vertices.",
__FILE__,
checksection,
g);
"listfuseedge shape",
__FILE__,
listfuseedge,g);
+theCommands.Add("tolsphere", "toolsphere shape\n"
+ "\t\tshows vertex tolerances by drawing spheres",
+ __FILE__, tolsphere, g);
+theCommands.Add("validrange",
+ "validrange edge [(out) u1 u2]\n"
+ "\t\tcomputes valid range of the edge, and\n"
+ "\t\tprints first and last values or sets the variables u1 and u2",
+ __FILE__, validrange, g);
}