0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / BRepTest / BRepTest_CheckCommands.cxx
CommitLineData
b311480e 1// Created on: 1996-02-23
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1996-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
973c2be1 8// This library is free software; you can redistribute it and / or modify it
9// under the terms of the GNU Lesser General Public version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
b311480e 16
7fd59977 17#include <BRepTest.hxx>
18#ifdef HAVE_CONFIG_H
19# include <config.h>
20#endif
21
22#include <BRepAlgo.hxx>
23#include <BRepCheck_Analyzer.hxx>
24#include <BRepCheck_Result.hxx>
25#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
26#include <TopoDS_Iterator.hxx>
27#include <TopExp_Explorer.hxx>
28#include <TopTools_DataMapOfShapeListOfShape.hxx>
29#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
30#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
31#include <TopTools_ListOfShape.hxx>
32#include <TopTools_ListIteratorOfListOfShape.hxx>
33#include <DBRep_DrawableShape.hxx>
34#include <Draw_SequenceOfDrawable3D.hxx>
35#include <BRepCheck.hxx>
36#include <BRepCheck_Edge.hxx>
37#include <Draw_Interpretor.hxx>
38#include <Draw_Appli.hxx>
39#include <Draw.hxx>
40#include <DBRep.hxx>
41#include <BRepTest.hxx>
42#include <GeometryTest.hxx>
43#include <Precision.hxx>
44#include <LocalAnalysis.hxx>
45#include <LocalAnalysis_SurfaceContinuity.hxx>
46#include <Geom_Surface.hxx>
47#include <Geom_Curve.hxx>
48#include <Geom2d_TrimmedCurve.hxx>
49#include <Geom2d_Curve.hxx>
50#include <DrawTrSurf.hxx>
51#include <GeomAbs_Shape.hxx>
52#include <TopoDS.hxx>
53#include <TopExp.hxx>
54#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
55#include <TopTools_MapOfShape.hxx>
56#include <TopTools_MapIteratorOfMapOfShape.hxx>
57#include <TopoDS_Shape.hxx>
58#include <TopoDS_Edge.hxx>
59#include <TopoDS_Face.hxx>
60#include <BRep_Tool.hxx>
61
62#include <TopOpeBRepTool_PurgeInternalEdges.hxx>
63//#include <TopOpeBRepTool_FuseEdges.hxx>
64#include <BRepLib_FuseEdges.hxx>
65
66#include <TopTools_HSequenceOfShape.hxx>
67#include <BRep_Builder.hxx>
68#include <TopoDS_Compound.hxx>
69#include <TColStd_HArray1OfInteger.hxx>
70
71#include <Standard_ErrorHandler.hxx>
72#include <Standard_Failure.hxx>
73
7fd59977 74#include <stdio.h>
7fd59977 75#ifdef HAVE_STRINGS_H
76# include <strings.h>
77#endif
78
79static char* checkfaultyname = NULL;
80Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
81{
82 if (checkfaultyname != NULL) {
83 free(checkfaultyname);
84 checkfaultyname = NULL;
85 }
86 if (name == NULL) {
87 checkfaultyname = (char*)malloc(strlen("faulty_")+1);
88 strcpy(checkfaultyname,"faulty_");
89 }
90 else {
91 checkfaultyname = (char*)malloc(strlen(name)+1);
92 strcpy(checkfaultyname,name);
93 }
94}
95
96
97static TopTools_DataMapOfShapeListOfShape theMap;
98static Standard_Integer nbfaulty = 0;
99static Draw_SequenceOfDrawable3D lfaulty;
100
101Standard_IMPORT Standard_Integer BRepCheck_Trace(const Standard_Integer phase);
102
103//=======================================================================
104//function : FindNamed
105//=======================================================================
106static Standard_Boolean FindNamed(const TopoDS_Shape& S,
107 char*& Name)
108{
109 for (Standard_Integer i = 1 ;i <= lfaulty.Length(); i++) {
110 Handle(DBRep_DrawableShape) DS =
111 Handle(DBRep_DrawableShape)::DownCast(lfaulty(i));
112 if (DS->Shape().IsSame(S)) {
113 Name = (char*)DS->Name();
114 return Standard_True;
115 }
116 }
117 return Standard_False;
118}
119
120
121//=======================================================================
122//function : Contains
123//=======================================================================
124static Standard_Boolean Contains(const TopTools_ListOfShape& L,
125 const TopoDS_Shape& S)
126{
127 TopTools_ListIteratorOfListOfShape it;
128 for (it.Initialize(L); it.More(); it.Next()) {
129 if (it.Value().IsSame(S)) {
130 return Standard_True;
131 }
132 }
133 return Standard_False;
134}
135
136
137
138//=======================================================================
139//function : PrintSub
140//=======================================================================
141static void PrintSub(Standard_OStream& OS,
142 const BRepCheck_Analyzer& Ana,
143 const TopoDS_Shape& S,
144 const TopAbs_ShapeEnum Subtype)
145
146{
147 char* Name;
148 BRepCheck_ListIteratorOfListOfStatus itl;
149 TopExp_Explorer exp;
150 for (exp.Init(S,Subtype); exp.More(); exp.Next()) {
151 const Handle(BRepCheck_Result)& res = Ana.Result(exp.Current());
152 const TopoDS_Shape& sub = exp.Current();
153 for (res->InitContextIterator();
154 res->MoreShapeInContext();
155 res->NextShapeInContext()) {
156 if (res->ContextualShape().IsSame(S) &&
157 !Contains(theMap(sub),S)) {
158 theMap(sub).Append(S);
159 itl.Initialize(res->StatusOnShape());
160 if (itl.Value() != BRepCheck_NoError) {
161 if (!FindNamed(sub,Name)) {
162 nbfaulty++;
163 Name = (char*)malloc(18*sizeof(char));
91322f44 164 Sprintf(Name,"%s%d",checkfaultyname,nbfaulty);
7fd59977 165 DBRep::Set(Name,sub);
166 lfaulty.Append(Draw::Get((Standard_CString&)Name));
167 }
168 OS << "Shape " << Name << " ";
169 if (!FindNamed(S,Name)) {
170 nbfaulty++;
171 Name = (char*)malloc(18*sizeof(char));
91322f44 172 Sprintf(Name,"%s%d",checkfaultyname,nbfaulty);
7fd59977 173 DBRep::Set(Name,S);
174 lfaulty.Append(Draw::Get((Standard_CString&)Name));
175 }
176 OS << " on shape " << Name << " :\n";
177 for (;itl.More(); itl.Next()) {
178 BRepCheck::Print(itl.Value(),OS);
179 }
180 }
181 break;
182 }
183 }
184 }
185}
186
187
188//=======================================================================
189//function : Print
190//=======================================================================
191static void Print(Standard_OStream& OS,
192 const BRepCheck_Analyzer& Ana,
193 const TopoDS_Shape& S)
194{
195 for (TopoDS_Iterator iter(S); iter.More(); iter.Next()) {
196 Print(OS,Ana,iter.Value());
197 }
198
199 char* Name;
200 TopAbs_ShapeEnum styp = S.ShapeType();
201 BRepCheck_ListIteratorOfListOfStatus itl;
202 if (!Ana.Result(S).IsNull() && !theMap.IsBound(S)) {
203 itl.Initialize(Ana.Result(S)->Status());
204 if (itl.Value() != BRepCheck_NoError) {
205 if (!FindNamed(S,Name)) {
206 nbfaulty++;
207 Name = (char*)malloc(18*sizeof(char));
91322f44 208 Sprintf(Name,"%s%d",checkfaultyname,nbfaulty);
7fd59977 209 DBRep::Set(Name,S);
210 lfaulty.Append(Draw::Get((Standard_CString&)Name));
211 }
212 OS << "On Shape " << Name << " :\n";
213
214 for (;itl.More(); itl.Next()) {
215 BRepCheck::Print(itl.Value(),OS);
216 }
217 }
218 }
219 if (!theMap.IsBound(S)) {
220 TopTools_ListOfShape thelist;
221 theMap.Bind(S, thelist);
222 }
223
224 switch (styp) {
225 case TopAbs_EDGE:
226 PrintSub(OS,Ana,S,TopAbs_VERTEX);
227 break;
228 case TopAbs_FACE:
229 PrintSub(OS,Ana,S,TopAbs_WIRE);
230 PrintSub(OS,Ana,S,TopAbs_EDGE);
231 PrintSub(OS,Ana,S,TopAbs_VERTEX);
232 break;
233 case TopAbs_SHELL:
234// PrintSub(OS,Ana,S,TopAbs_FACE);
235 break;
236 case TopAbs_SOLID:
237// PrintSub(OS,Ana,S,TopAbs_EDGE);
238 PrintSub(OS,Ana,S,TopAbs_SHELL);
239 break;
240 default:
241 break;
242 }
243
244}
245
246//=======================================================================
247//function : computetolerance
248//purpose :
249//=======================================================================
250static Standard_Integer computetolerance(Draw_Interpretor& di,
251 Standard_Integer narg, const char** a)
252{
253 if (narg < 2) {
254 //cout << "Usage: computetolerance shape" << endl;
255 di << "Usage: computetolerance shape" << "\n";
256 return 1;
257 }
258 TopoDS_Shape S = DBRep::Get(a[1]);
259 Standard_Real tol;
260 if (S.ShapeType() == TopAbs_EDGE) {
261 BRepCheck_Edge bce(TopoDS::Edge(S));
262 tol=bce.Tolerance();
263 //cout<< "Tolerance de " << (void*) &(*S.TShape()) << " : " << tol << endl;
264 Standard_SStream aSStream1;
265 aSStream1<< "Tolerance de " << (void*) &(*S.TShape()) << " : " << tol << "\n";
266 di << aSStream1;
267 }
268 else {
269 TopTools_MapOfShape theEdges;
270 TopExp_Explorer exp;
271 for (exp.Init(S, TopAbs_EDGE); exp.More(); exp.Next()) {
272 if (theEdges.Add(exp.Current())) {
273 BRepCheck_Edge bce(TopoDS::Edge(exp.Current()));
274 tol=bce.Tolerance();
275 //cout<< "Tolerance de " << (void*) &(*exp.Current().TShape()) << " : " << tol << "\n";
276 Standard_SStream aSStream2;
277 aSStream2<< "Tolerance de " << (void*) &(*exp.Current().TShape()) << " : " << tol << "\n";
278 di << aSStream2;
279 }
280 }
281 //cout << endl;
282 di << "\n";
283 }
284 return 0;
285}
286
287//=======================================================================
288//function : checksection
289//purpose : Checks the closure of a section line
290//=======================================================================
291static Standard_Integer checksection(Draw_Interpretor& di,
292 Standard_Integer narg, const char** a)
293{
294 if (narg < 2) {
295 return 1;
296 }
297 TopoDS_Shape S = DBRep::Get(a[1]);
298 TopTools_MapOfShape theVertices;
299 TopExp_Explorer exp;
300 for (exp.Init(S, TopAbs_VERTEX); exp.More(); exp.Next()) {
301 if (!theVertices.Add(exp.Current()))
302 theVertices.Remove(exp.Current());
303 }
304 //cout << " nb alone Vertices : " << theVertices.Extent() << endl;
305 di << " nb alone Vertices : " << theVertices.Extent() << "\n";
306 char Name[32];
307 Standard_Integer ipp=0;
308 TopTools_MapIteratorOfMapOfShape itvx;
309 for (itvx.Initialize(theVertices); itvx.More(); itvx.Next()) {
310 ipp++;
91322f44 311 Sprintf(Name,"alone_%d",ipp);
7fd59977 312 DBRep::Set(Name, itvx.Key());
313 //cout << Name << " " ;
314 di << Name << " " ;
315 }
316 //cout << endl;
317 di << "\n";
318 return 0;
319}
320//=======================================================================
321
322//=======================================================================
323//function : checkdiff
324//purpose : Checks the differences beetween a result and his arguments
325//=======================================================================
326static Standard_Integer checkdiff(Draw_Interpretor& di,
327 Standard_Integer narg, const char** a)
328{
329 const char* syntaxe = "checkdiff arg1 [arg2..argn] result [closedSolid (0/1)] [geomCtrl (1/0)]";
330 if (narg < 3) {
331 if (narg==2) {
91322f44 332 Standard_Integer bcrtrace=Draw::Atoi(a[narg-1]);
7fd59977 333 bcrtrace=BRepCheck_Trace(bcrtrace);
334 //cout << "BRepCheck_Trace : " << bcrtrace << endl;
335 di << "BRepCheck_Trace : " << bcrtrace << "\n";
336 //cout << syntaxe << endl;
337 di << syntaxe << "\n";
338 return 0;
339 }
340 //cout << syntaxe << endl;
341 di << syntaxe << "\n";
342 return 1;
343 }
344
345 Standard_Integer lastArg=narg-2;
346 Standard_Boolean closedSolid = Standard_False;
347 Standard_Boolean geomCtrl = Standard_True;
348 TopoDS_Shape resu = DBRep::Get(a[narg-1]);
349 if (resu.IsNull()) {
350 if (narg < 4) {
351 //cout << syntaxe << endl;
352 di << syntaxe << "\n";
353 return 1;
354 }
91322f44 355 closedSolid=Draw::Atoi(a[narg-1]);
7fd59977 356 resu = DBRep::Get(a[narg-2]);
357 lastArg=narg-3;
358 if (resu.IsNull()) {
359 if (narg < 5) {
360 //cout << syntaxe << endl;
361 di << syntaxe << "\n";
362 return 1;
363 }
364 geomCtrl=closedSolid;
91322f44 365 closedSolid=Draw::Atoi(a[narg-2]);
7fd59977 366 resu = DBRep::Get(a[narg-3]);
367 lastArg=narg-4;
368 if (resu.IsNull()) {
369 //cout << syntaxe << endl;
370 di << syntaxe << "\n";
371 return 1;
372 }
373 }
374 }
375
376 TopTools_ListOfShape lesArgs;
377 for (Standard_Integer id=1; id <=lastArg; id++) {
378 lesArgs.Append(DBRep::Get(a[id]));
379 }
380
381 if (BRepAlgo::IsValid(lesArgs, resu, closedSolid, geomCtrl)) {
382 //cout << "Difference is Valid." << endl;
383 di << "Difference is Valid." << "\n";
384 } else {
385 //cout << "error : Difference is Not Valid !" << endl;
386 di << "error : Difference is Not Valid !" << "\n";
387 }
388
389 return 0;
390}
391//=======================================================================
392
393// Modified by skv - Tue Apr 27 13:38:44 2004 Begin
394//=======================================================================
395//function : CHK
396//purpose : Checks a shape
397//=======================================================================
398
399// static Standard_Integer CHK(Draw_Interpretor& theCommands,
400// Standard_Integer narg, const char** a)
401// {
402// if (narg < 2) {
403// return 1;
404// }
405
406// Standard_Boolean doprint = Standard_True;
407// if (narg == 3) { if (!strcmp(a[2],"-short")) doprint = Standard_False; }
408
409// TopoDS_Shape S = DBRep::Get(a[1]);
410// if (S.IsNull()) {
411// cout<<"not a topological shape"<<endl;
412// return 1;
413// }
414
415// Standard_Boolean GeomCtrl = Standard_True;
416// if (!strcasecmp(a[0],"CHECKTOPSHAPE")) {
417// GeomCtrl = Standard_False;
418// }
419
420// BRepCheck_Analyzer ana(S,GeomCtrl);
421// if (ana.IsValid()) {
422// theCommands<<"This shape seems to be valid";
423// }
424// else {
425// theMap.Clear();
426// nbfaulty = 0;
427// lfaulty.Clear();
428// theMap.Clear();
429// if (doprint) {
430// Print(cout,ana,S);
431// cout<<"\n";
432// theMap.Clear();
433// if (nbfaulty !=0)
434// cout<<"Faulty shapes in variables "<<checkfaultyname<<"1 to "<<checkfaultyname<<nbfaulty<<" \n";
435// cout<<endl;
436// }
437// else {
438// theCommands<<"This shape has faulty shapes";
439// }
440// }
441// return 0;
442// }
443
444//=======================================================================
445//function : ContextualDump
446//purpose : Contextual (modeling) style of output.
447//=======================================================================
448
449//void ContextualDump(const BRepCheck_Analyzer &theAna,
450// const TopoDS_Shape &theShape)
451void ContextualDump(Draw_Interpretor& theCommands,
452 const BRepCheck_Analyzer &theAna,
453 const TopoDS_Shape &theShape)
454{
455 theMap.Clear();
456 nbfaulty = 0;
457 lfaulty.Clear();
458
459 //Print(cout, theAna, theShape);
460 Standard_SStream aSStream;
461 Print(aSStream, theAna, theShape);
462 theCommands << aSStream;
463 //cout<<"\n";
464 theCommands<<"\n";
465 theMap.Clear();
466
467 if (nbfaulty !=0)
468 theCommands<<"Faulty shapes in variables "<<checkfaultyname<<"1 to "<<checkfaultyname<<nbfaulty<<" \n";
469 //cout<<"Faulty shapes in variables "<<checkfaultyname<<"1 to "<<checkfaultyname<<nbfaulty<<" \n";
470
471 //cout<<endl;
472 theCommands<<"\n";
473}
474
475
476//=======================================================================
477//function : FillProblems
478// purpose : auxilary for StructuralDump
479//=======================================================================
480static void FillProblems(const BRepCheck_Status stat,
481 Handle(TColStd_HArray1OfInteger)& NbProblems)
482{
483 switch (stat) {
484 case BRepCheck_InvalidPointOnCurve:
485 NbProblems->SetValue(1,NbProblems->Value(1)+1); break;
486 case BRepCheck_InvalidPointOnCurveOnSurface:
487 NbProblems->SetValue(2,NbProblems->Value(2)+1); break;
488 case BRepCheck_InvalidPointOnSurface:
489 NbProblems->SetValue(3,NbProblems->Value(3)+1); break;
490 case BRepCheck_No3DCurve:
491 NbProblems->SetValue(4,NbProblems->Value(4)+1); break;
492 case BRepCheck_Multiple3DCurve:
493 NbProblems->SetValue(5,NbProblems->Value(5)+1); break;
494 case BRepCheck_Invalid3DCurve:
495 NbProblems->SetValue(6,NbProblems->Value(6)+1); break;
496 case BRepCheck_NoCurveOnSurface:
497 NbProblems->SetValue(7,NbProblems->Value(7)+1); break;
498 case BRepCheck_InvalidCurveOnSurface:
499 NbProblems->SetValue(8,NbProblems->Value(8)+1); break;
500 case BRepCheck_InvalidCurveOnClosedSurface:
501 NbProblems->SetValue(9,NbProblems->Value(9)+1); break;
502 case BRepCheck_InvalidSameRangeFlag:
503 NbProblems->SetValue(10,NbProblems->Value(10)+1); break;
504 case BRepCheck_InvalidSameParameterFlag:
505 NbProblems->SetValue(11,NbProblems->Value(11)+1); break;
506 case BRepCheck_InvalidDegeneratedFlag:
507 NbProblems->SetValue(12,NbProblems->Value(12)+1); break;
508 case BRepCheck_FreeEdge:
509 NbProblems->SetValue(13,NbProblems->Value(13)+1); break;
510 case BRepCheck_InvalidMultiConnexity:
511 NbProblems->SetValue(14,NbProblems->Value(14)+1); break;
512 case BRepCheck_InvalidRange:
513 NbProblems->SetValue(15,NbProblems->Value(15)+1); break;
514 case BRepCheck_EmptyWire:
515 NbProblems->SetValue(16,NbProblems->Value(16)+1); break;
516 case BRepCheck_RedundantEdge:
517 NbProblems->SetValue(17,NbProblems->Value(17)+1); break;
518 case BRepCheck_SelfIntersectingWire:
519 NbProblems->SetValue(18,NbProblems->Value(18)+1); break;
520 case BRepCheck_NoSurface:
521 NbProblems->SetValue(19,NbProblems->Value(19)+1); break;
522 case BRepCheck_InvalidWire:
523 NbProblems->SetValue(20,NbProblems->Value(20)+1); break;
524 case BRepCheck_RedundantWire:
525 NbProblems->SetValue(21,NbProblems->Value(21)+1); break;
526 case BRepCheck_IntersectingWires:
527 NbProblems->SetValue(22,NbProblems->Value(22)+1); break;
528 case BRepCheck_InvalidImbricationOfWires:
529 NbProblems->SetValue(23,NbProblems->Value(23)+1); break;
530 case BRepCheck_EmptyShell:
531 NbProblems->SetValue(24,NbProblems->Value(24)+1); break;
532 case BRepCheck_RedundantFace:
533 NbProblems->SetValue(25,NbProblems->Value(25)+1); break;
534 case BRepCheck_UnorientableShape:
535 NbProblems->SetValue(26,NbProblems->Value(26)+1); break;
536 case BRepCheck_NotClosed:
537 NbProblems->SetValue(27,NbProblems->Value(27)+1); break;
538 case BRepCheck_NotConnected:
539 NbProblems->SetValue(28,NbProblems->Value(28)+1); break;
540 case BRepCheck_SubshapeNotInShape:
541 NbProblems->SetValue(29,NbProblems->Value(29)+1); break;
542 case BRepCheck_BadOrientation:
543 NbProblems->SetValue(30,NbProblems->Value(30)+1); break;
544 case BRepCheck_BadOrientationOfSubshape:
545 NbProblems->SetValue(31,NbProblems->Value(31)+1); break;
546 case BRepCheck_CheckFail:
547 NbProblems->SetValue(32,NbProblems->Value(32)+1); break;
548 default:
549 break;
550 }
551}
552
553
554//=======================================================================
555//function : GetProblemSub
556// purpose : auxilary for StructuralDump
557//=======================================================================
558static void GetProblemSub(const BRepCheck_Analyzer& Ana,
559 const TopoDS_Shape& Shape,
560 Handle(TopTools_HSequenceOfShape)& sl,
561 Handle(TColStd_HArray1OfInteger)& NbProblems,
562 const TopAbs_ShapeEnum Subtype)
563{
564 BRepCheck_ListIteratorOfListOfStatus itl;
565 TopExp_Explorer exp;
566 for (exp.Init(Shape,Subtype); exp.More(); exp.Next()) {
567 const Handle(BRepCheck_Result)& res = Ana.Result(exp.Current());
568
569 const TopoDS_Shape& sub = exp.Current();
570 for (res->InitContextIterator();
571 res->MoreShapeInContext();
572 res->NextShapeInContext()) {
573 if (res->ContextualShape().IsSame(Shape) &&
574 !Contains(theMap(sub),Shape)) {
575 theMap(sub).Append(Shape);
576 itl.Initialize(res->StatusOnShape());
577
578 if (itl.Value() != BRepCheck_NoError) {
579 Standard_Integer ii = 0;
580
581 for(ii=1; ii<=sl->Length(); ii++)
582 if(sl->Value(ii).IsSame(sub)) break;
583
584 if(ii>sl->Length()) {
585 sl->Append(sub);
586 FillProblems(itl.Value(),NbProblems);
587 }
588 for(ii=1; ii<=sl->Length(); ii++)
589 if(sl->Value(ii).IsSame(Shape)) break;
590 if(ii>sl->Length()) {
591 sl->Append(Shape);
592 FillProblems(itl.Value(),NbProblems);
593 }
594 }
595 break;
596 }
597 }
598 }
599}
600
601
602//=======================================================================
603//function : GetProblemShapes
604// purpose : auxilary for StructuralDump
605//=======================================================================
606static void GetProblemShapes(const BRepCheck_Analyzer& Ana,
607 const TopoDS_Shape& Shape,
608 Handle(TopTools_HSequenceOfShape)& sl,
609 Handle(TColStd_HArray1OfInteger)& NbProblems)
610{
611 for (TopoDS_Iterator iter(Shape); iter.More(); iter.Next()) {
612 GetProblemShapes(Ana,iter.Value(),sl, NbProblems);
613 }
614 TopAbs_ShapeEnum styp = Shape.ShapeType();
615 BRepCheck_ListIteratorOfListOfStatus itl;
616 if (!Ana.Result(Shape).IsNull() && !theMap.IsBound(Shape)) {
617 itl.Initialize(Ana.Result(Shape)->Status());
618
619 if (itl.Value() != BRepCheck_NoError) {
620 sl->Append(Shape);
621 FillProblems(itl.Value(),NbProblems);
622 }
623 }
624 if (!theMap.IsBound(Shape)) {
625 TopTools_ListOfShape thelist;
626 theMap.Bind(Shape, thelist);
627 }
628
629 switch (styp) {
630 case TopAbs_EDGE:
631 GetProblemSub(Ana, Shape, sl, NbProblems, TopAbs_VERTEX);
632 break;
633 case TopAbs_FACE:
634 GetProblemSub(Ana, Shape, sl, NbProblems, TopAbs_WIRE);
635 GetProblemSub(Ana, Shape, sl, NbProblems, TopAbs_EDGE);
636 GetProblemSub(Ana, Shape, sl, NbProblems, TopAbs_VERTEX);
637 break;
638 case TopAbs_SHELL:
639 break;
640 case TopAbs_SOLID:
641 GetProblemSub(Ana, Shape, sl, NbProblems, TopAbs_SHELL);
642 break;
643 default:
644 break;
645 }
646
647}
648
649//=======================================================================
650//function : StructuralDump
651//purpose : Structural (data exchange) style of output.
652//=======================================================================
653
654//void StructuralDump(const BRepCheck_Analyzer &theAna,
655// const Standard_CString ShName,
656// const Standard_CString Pref,
657// const TopoDS_Shape &theShape)
658void StructuralDump(Draw_Interpretor& theCommands,
659 const BRepCheck_Analyzer &theAna,
660 const Standard_CString ShName,
661 const Standard_CString Pref,
662 const TopoDS_Shape &theShape)
663{
664 Standard_Integer i;
665 //cout << "StructuralDump" << endl;
666 //cout << " -- The Shape " << ShName << " has problems :"<<endl;
667 //cout<<" Check Count"<<endl;
668 //cout<<" ------------------------------------------------"<<endl;
669 theCommands << " -- The Shape " << ShName << " has problems :"<<"\n";
670 theCommands<<" Check Count"<<"\n";
671 theCommands<<" ------------------------------------------------"<<"\n";
672
673 Handle(TColStd_HArray1OfInteger) NbProblems = new TColStd_HArray1OfInteger(1,32);
674 for(i=1; i<=32; i++) NbProblems->SetValue(i,0);
675 Handle(TopTools_HSequenceOfShape) sl,slv,sle,slw,slf,sls,slo;
676 sl = new TopTools_HSequenceOfShape();
677 theMap.Clear();
678 GetProblemShapes(theAna, theShape, sl, NbProblems);
679 theMap.Clear();
680
681 if(NbProblems->Value(1)>0)
682 theCommands<<" Invalid Point on Curve ................... "<<NbProblems->Value(1)<<"\n";
683 //cout<<" Invalid Point on Curve ................... "<<NbProblems->Value(1)<<endl;
684 if(NbProblems->Value(2)>0)
685 theCommands<<" Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<"\n";
686 //cout<<" Invalid Point on CurveOnSurface .......... "<<NbProblems->Value(2)<<endl;
687 if(NbProblems->Value(3)>0)
688 theCommands<<" Invalid Point on Surface ................. "<<NbProblems->Value(3)<<"\n";
689 //cout<<" Invalid Point on Surface ................. "<<NbProblems->Value(3)<<endl;
690 if(NbProblems->Value(4)>0)
691 theCommands<<" No 3D Curve .............................. "<<NbProblems->Value(4)<<"\n";
692 //cout<<" No 3D Curve .............................. "<<NbProblems->Value(4)<<endl;
693 if(NbProblems->Value(5)>0)
694 theCommands<<" Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<"\n";
695 //cout<<" Multiple 3D Curve ........................ "<<NbProblems->Value(5)<<endl;
696 if(NbProblems->Value(6)>0)
697 theCommands<<" Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<"\n";
698 //cout<<" Invalid 3D Curve ......................... "<<NbProblems->Value(6)<<endl;
699 if(NbProblems->Value(7)>0)
700 theCommands<<" No Curve on Surface ...................... "<<NbProblems->Value(7)<<"\n";
701 //cout<<" No Curve on Surface ...................... "<<NbProblems->Value(7)<<endl;
702 if(NbProblems->Value(8)>0)
703 theCommands<<" Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<"\n";
704 //cout<<" Invalid Curve on Surface ................. "<<NbProblems->Value(8)<<endl;
705 if(NbProblems->Value(9)>0)
706 theCommands<<" Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<"\n";
707 //cout<<" Invalid Curve on closed Surface .......... "<<NbProblems->Value(9)<<endl;
708 if(NbProblems->Value(10)>0)
709 theCommands<<" Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<"\n";
710 //cout<<" Invalid SameRange Flag ................... "<<NbProblems->Value(10)<<endl;
711 if(NbProblems->Value(11)>0)
712 theCommands<<" Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<"\n";
713 //cout<<" Invalid SameParameter Flag ............... "<<NbProblems->Value(11)<<endl;
714 if(NbProblems->Value(12)>0)
715 theCommands<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<"\n";
716 //cout<<" Invalid Degenerated Flag ................. "<<NbProblems->Value(12)<<endl;
717 if(NbProblems->Value(13)>0)
718 theCommands<<" Free Edge ................................ "<<NbProblems->Value(13)<<"\n";
719 //cout<<" Free Edge ................................ "<<NbProblems->Value(13)<<endl;
720 if(NbProblems->Value(14)>0)
721 theCommands<<" Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<"\n";
722 //cout<<" Invalid MultiConnexity ................... "<<NbProblems->Value(14)<<endl;
723 if(NbProblems->Value(15)>0)
724 theCommands<<" Invalid Range ............................ "<<NbProblems->Value(15)<<"\n";
725 //cout<<" Invalid Range ............................ "<<NbProblems->Value(15)<<endl;
726 if(NbProblems->Value(16)>0)
727 theCommands<<" Empty Wire ............................... "<<NbProblems->Value(16)<<"\n";
728 //cout<<" Empty Wire ............................... "<<NbProblems->Value(16)<<endl;
729 if(NbProblems->Value(17)>0)
730 theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<"\n";
731 //cout<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<endl;
732 if(NbProblems->Value(18)>0)
733 theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<"\n";
734 //cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<endl;
735 if(NbProblems->Value(19)>0)
736 theCommands<<" No Surface ............................... "<<NbProblems->Value(19)<<"\n";
737 //cout<<" No Surface ............................... "<<NbProblems->Value(19)<<endl;
738 if(NbProblems->Value(20)>0)
739 theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<"\n";
740 //cout<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
741 if(NbProblems->Value(21)>0)
742 theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<"\n";
743 //cout<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<endl;
744 if(NbProblems->Value(22)>0)
745 theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<"\n";
746 //cout<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<endl;
747 if(NbProblems->Value(23)>0)
748 theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<"\n";
749 //cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<endl;
750 if(NbProblems->Value(24)>0)
751 theCommands<<" Empty Shell .............................. "<<NbProblems->Value(24)<<"\n";
752 //cout<<" Empty Shell .............................. "<<NbProblems->Value(24)<<endl;
753 if(NbProblems->Value(25)>0)
754 theCommands<<" Redundant Face ........................... "<<NbProblems->Value(25)<<"\n";
755 //cout<<" Redundant Face ........................... "<<NbProblems->Value(25)<<endl;
756 if(NbProblems->Value(26)>0)
757 theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<"\n";
758 //cout<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<endl;
759 if(NbProblems->Value(27)>0)
760 theCommands<<" Not Closed ............................... "<<NbProblems->Value(27)<<"\n";
761 //cout<<" Not Closed ............................... "<<NbProblems->Value(27)<<endl;
762 if(NbProblems->Value(28)>0)
763 theCommands<<" Not Connected ............................ "<<NbProblems->Value(28)<<"\n";
764 //cout<<" Not Connected ............................ "<<NbProblems->Value(28)<<endl;
765 if(NbProblems->Value(29)>0)
766 theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<"\n";
767 //cout<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<endl;
768 if(NbProblems->Value(30)>0)
769 theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<"\n";
770 //cout<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<endl;
771 if(NbProblems->Value(31)>0)
772 theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<"\n";
773 //cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<endl;
774 if(NbProblems->Value(32)>0)
775 theCommands<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<"\n";
776 //cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
777
778 //cout<<" ------------------------------------------------"<<endl;
779 //cout<<"*** Shapes with problems : "<<sl->Length()<<endl;
780 //cout<<endl;
781 theCommands<<" ------------------------------------------------"<<"\n";
782 theCommands<<"*** Shapes with problems : "<<sl->Length()<<"\n";
783
784 slv = new TopTools_HSequenceOfShape();
785 sle = new TopTools_HSequenceOfShape();
786 slw = new TopTools_HSequenceOfShape();
787 slf = new TopTools_HSequenceOfShape();
788 sls = new TopTools_HSequenceOfShape();
789 slo = new TopTools_HSequenceOfShape();
790
791 for(i=1; i<=sl->Length(); i++) {
792 TopoDS_Shape shi = sl->Value(i);
793 TopAbs_ShapeEnum sti = shi.ShapeType();
794 switch (sti) {
795 case TopAbs_VERTEX : slv->Append (shi); break;
796 case TopAbs_EDGE : sle->Append (shi); break;
797 case TopAbs_WIRE : slw->Append (shi); break;
798 case TopAbs_FACE : slf->Append (shi); break;
799 case TopAbs_SHELL : sls->Append (shi); break;
800 case TopAbs_SOLID : slo->Append (shi); break;
801 default : break;
802 }
803 }
804
805 BRep_Builder B;
806 if(slv->Length()>0) {
807 TopoDS_Compound comp;
808 B.MakeCompound(comp);
809 Standard_Integer nb = slv->Length();
810 for(i=1; i<=nb; i++)
811 B.Add(comp,slv->Value(i));
812 char aName[20];
91322f44 813 Sprintf(aName,"%s_v",Pref);
7fd59977 814 DBRep::Set(aName,comp);
815 //cout<<"VERTEX"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
816 if (nb > 9)
817 theCommands<<"VERTEX"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
818 else
819 theCommands<<"VERTEX"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
820 }
821 if(sle->Length()>0) {
822 TopoDS_Compound comp;
823 B.MakeCompound(comp);
824 Standard_Integer nb = sle->Length();
825 for(i=1; i<=nb; i++)
826 B.Add(comp,sle->Value(i));
827 char aName[20];
91322f44 828 Sprintf(aName,"%s_e",Pref);
7fd59977 829 DBRep::Set(aName,comp);
830 //cout<<"EDGE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
831 if (nb > 9)
832 theCommands<<"EDGE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
833 else
834 theCommands<<"EDGE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
835 }
836 if(slw->Length()>0) {
837 TopoDS_Compound comp;
838 B.MakeCompound(comp);
839 Standard_Integer nb = slw->Length();
840 for(i=1; i<=nb; i++)
841 B.Add(comp,slw->Value(i));
842 char aName[20];
91322f44 843 Sprintf(aName,"%s_w",Pref);
7fd59977 844 DBRep::Set(aName,comp);
845 //cout<<"WIRE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
846 if (nb > 9)
847 theCommands<<"WIRE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
848 else
849 theCommands<<"WIRE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
850 }
851 if(slf->Length()>0) {
852 TopoDS_Compound comp;
853 B.MakeCompound(comp);
854 Standard_Integer nb = slf->Length();
855 for(i=1; i<=nb; i++)
856 B.Add(comp,slf->Value(i));
857 char aName[20];
91322f44 858 Sprintf(aName,"%s_f",Pref);
7fd59977 859 DBRep::Set(aName,comp);
860 //cout<<"FACE"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
861 if (nb > 9)
862 theCommands<<"FACE"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
863 else
864 theCommands<<"FACE"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
865 }
866 if(sls->Length()>0) {
867 TopoDS_Compound comp;
868 B.MakeCompound(comp);
869 Standard_Integer nb = sls->Length();
870 for(i=1; i<=nb; i++)
871 B.Add(comp,sls->Value(i));
872 char aName[20];
91322f44 873 Sprintf(aName,"%s_s",Pref);
7fd59977 874 DBRep::Set(aName,comp);
875 //cout<<"SHELL"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
876 if (nb > 9)
877 theCommands<<"SHELL"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
878 else
879 theCommands<<"SHELL"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
880 }
881 if(slo->Length()>0) {
882 TopoDS_Compound comp;
883 B.MakeCompound(comp);
884 Standard_Integer nb = slo->Length();
885 for(i=1; i<=nb; i++)
886 B.Add(comp,slo->Value(i));
887 char aName[20];
91322f44 888 Sprintf(aName,"%s_o",Pref);
7fd59977 889 DBRep::Set(aName,comp);
890 //cout<<"SOLID"<<" : "<<(nb > 9 ? "" : " ")<<nb<<" Items -> compound named "<<aName<<endl;
891 if (nb > 9)
892 theCommands<<"SOLID"<<" : "<<""<<nb<<" Items -> compound named "<<aName<<"\n";
893 else
894 theCommands<<"SOLID"<<" : "<<" "<<nb<<" Items -> compound named "<<aName<<"\n";
895 }
896}
897
898//=======================================================================
899//function : checkshape
900//purpose : Checks a shape
901//=======================================================================
902
903static Standard_Integer checkshape(Draw_Interpretor& theCommands,
904 Standard_Integer narg, const char** a)
905{
906 if (narg == 1) {
907 //cout << endl;
908 //cout << "Usage : checkshape [-top] shape [result] [-short]" << endl;
909 //cout << endl;
910 //cout << "Where :" << endl;
911 //cout << " -top - check topology only." << endl;
912 //cout << " shape - the name of the shape to test." << endl;
913 //cout << " result - the prefix of the output shape names. If it is used, structural" << endl;
914 //cout << " output style will be used. Otherwise - contextual one." << endl;
915 //cout << " -short - short description of check." << endl;
916 theCommands << "\n";
917 theCommands << "Usage : checkshape [-top] shape [result] [-short]" << "\n";
918 theCommands << "\n";
919 theCommands << "Where :" << "\n";
920 theCommands << " -top - check topology only." << "\n";
921 theCommands << " shape - the name of the shape to test." << "\n";
922 theCommands << " result - the prefix of the output shape names. If it is used, structural" << "\n";
923 theCommands << " output style will be used. Otherwise - contextual one." << "\n";
924 theCommands << " -short - short description of check." << "\n";
925
926 return 0;
927 }
928
929 if (narg > 5) {
930 //cout << "Invalid number of args!!!" << endl;
931 //cout << "No args to have help." << endl;
932 theCommands << "Invalid number of args!!!" << "\n";
933 theCommands << "No args to have help." << "\n";
934
935 return 1;
936 }
937
938 Standard_Boolean aGeomCtrl = Standard_True;
939 Standard_Integer aCurInd = 1;
940
941 if (!strcmp(a[1],"-top")) {
942 aGeomCtrl = Standard_False;
943 aCurInd++;
944 }
945
946 if (aCurInd > narg - 1) {
947 //cout << "Invalid number of args!!!" << endl;
948 //cout << "No args to have help." << endl;
949 theCommands << "Invalid number of args!!!" << "\n";
950 theCommands << "No args to have help." << "\n";
951
952 return 1;
953 }
954
955 Standard_CString aShapeName = a[aCurInd];
956 TopoDS_Shape aShape = DBRep::Get(aShapeName);
957
958 if (aShape.IsNull()) {
959 //cout << a[aCurInd] << " is not a topological shape!!!" << endl;
960 theCommands << a[aCurInd] << " is not a topological shape!!!" << "\n";
961
962 return 1;
963 }
964
965 Standard_Boolean IsShortDump = Standard_False;
966 Standard_Boolean IsContextDump = Standard_True;
967 Standard_Integer aBackInd = narg - 1;
968
969 if (aCurInd < aBackInd) {
970 if (!strcmp(a[aBackInd],"-short")) {
971 IsShortDump = Standard_True;
972 aBackInd--;
973 }
974 }
975
976 if (aCurInd < aBackInd - 1) {
977 //cout << "Invalid number of args!!!" << endl;
978 //cout << "No args to have help." << endl;
979 theCommands << "Invalid number of args!!!" << "\n";
980 theCommands << "No args to have help." << "\n";
981
982 return 1;
983 } else if (aCurInd < aBackInd) {
984 IsContextDump = Standard_False;
985 }
986
987 try {
988 OCC_CATCH_SIGNALS
989 BRepCheck_Analyzer anAna(aShape,aGeomCtrl);
990 Standard_Boolean isValid = anAna.IsValid();
991
992 if (isValid) {
993 if (IsContextDump) {
994 theCommands << "This shape seems to be valid";
995 } else {
996 theCommands << " -- The Shape " << aShapeName << " looks OK";
997 }
998 } else {
999 if (IsShortDump) {
1000 theCommands<<"This shape has faulty shapes";
1001 } else {
1002 if (IsContextDump) {
1003 //ContextualDump(anAna, aShape);
1004 ContextualDump(theCommands, anAna, aShape);
1005 } else {
1006 Standard_CString aPref = a[aCurInd+1];
1007 //StructuralDump(anAna, aShapeName, aPref, aShape);
1008 StructuralDump(theCommands, anAna, aShapeName, aPref, aShape);
1009 }
1010 }
1011 }
1012 }
1013 catch(Standard_Failure) {
1014 theCommands<<"checkshape exception : ";
1015 theCommands << Standard_Failure::Caught()->GetMessageString();
1016 theCommands<<"\n";
1017 return 1;
1018 }
1019
1020 return 0;
1021}
1022// Modified by skv - Tue Apr 27 13:38:24 2004 End
1023/***************************************************************/
1024static void InitEpsSurf(Standard_Real& epsnl,Standard_Real& epsdis, Standard_Real& epsangk1,
1025 Standard_Real& epsangk2, Standard_Real& epsangn1,
1026 Standard_Real& perce,Standard_Real& maxlen )
1027{
1028 epsnl = 0.001;
1029 epsdis = 0.001;
1030 epsangk1 = 0.001 ;
1031 epsangk2 = 0.001;
1032 epsangn1 = 0.001 ;
1033 perce = 0.01;
1034 maxlen = 10000 ;
1035}
1036
1037static Standard_Integer shapeG1continuity (Draw_Interpretor& di, Standard_Integer n, const char** a)
1038
1039{ Standard_Real epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen;
1040 Standard_Integer nbeval;
1041 InitEpsSurf(epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen);
1042 Standard_Boolean ISG1=Standard_True;
1043 if (n<4) return 1;
1044 TopoDS_Face face1,face2;
1045 Standard_Real f1,f2,l1,l2;
1046 TopoDS_Shape shape = DBRep::Get(a[1],TopAbs_SHAPE);
1047 if (shape.IsNull()) return 1;
1048 TopoDS_Shape edge = DBRep::Get(a[2],TopAbs_EDGE);
1049 if (edge.IsNull()) return 1;
1050// calcul des deux faces
1051 TopTools_IndexedDataMapOfShapeListOfShape lface;
1052 TopExp::MapShapesAndAncestors(shape,TopAbs_EDGE,TopAbs_FACE,lface);
1053 const TopTools_ListOfShape& lfac = lface.FindFromKey(edge);
1054
1055 Standard_Integer nelem= lfac.Extent();
1056 if(nelem!=2) return 1;
1057 TopTools_ListIteratorOfListOfShape It;
1058 It.Initialize(lfac);
1059 face1=TopoDS::Face(It.Value());
1060 It.Next();
1061 face2=TopoDS::Face(It.Value());
1062
1063// calcul des deux pcurves
1064 const Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface
1065 (TopoDS::Edge(edge),face1,f1,l1);
1066 if (c1.IsNull()) return 1;
1067 const Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface
1068 (TopoDS::Edge(edge),face2,f2,l2);
1069 if (c2.IsNull()) return 1;
1070
1071 Handle(Geom2d_Curve) curv1= new Geom2d_TrimmedCurve(c1,f1,l1);
1072
1073 Handle(Geom2d_Curve) curv2= new Geom2d_TrimmedCurve(c2,f2,l2);
1074
1075// calcul dees deux surfaces
1076 TopLoc_Location L1,L2;
1077 TopoDS_Face aLocalFace = face1;
1078 const Handle(Geom_Surface)& s1 = BRep_Tool::Surface(aLocalFace,L1);
1079// const Handle(Geom_Surface)& s1 =
1080// BRep_Tool::Surface(TopoDS::Face(face1),L1);
1081 if (s1.IsNull()) return 1;
1082 aLocalFace = face2;
1083 const Handle(Geom_Surface)& s2 = BRep_Tool::Surface(aLocalFace,L2);
1084// const Handle(Geom_Surface)& s2 =
1085// BRep_Tool::Surface(TopoDS::Face(face2),L2);
1086 if (s2.IsNull()) return 1;
1087
1088
1089 Handle(Geom_Surface) surf1 = Handle(Geom_Surface)::
1090 DownCast(s1->Transformed(L1.Transformation()));
1091 if (surf1.IsNull()) return 1;
1092 Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::
1093 DownCast(s2->Transformed(L2.Transformation()));
1094 if (surf2.IsNull()) return 1;
1095
1096
1097
91322f44 1098 nbeval = (Standard_Integer ) Draw::Atof( a[3]);
7fd59977 1099
1100 switch(n)
91322f44 1101 { case 7 : epsG1 = Draw::Atof(a[6]);
1102 case 6 : epsC0 = Draw::Atof(a[5]);
1103 case 5 : epsnl = Draw::Atof(a[4]);
7fd59977 1104 case 4 : {} break;
1105 default : return 1;
1106 }
1107
1108
1109 Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
1110 Standard_Boolean isconti = Standard_True;
1111 Standard_Boolean isdone = Standard_True;
1112 pard1 = curv1->FirstParameter();
1113 parf1 = curv1->LastParameter();
1114 Standard_Real MaxG0Value=0, MaxG1Angle=0;
1115 U = Min( pard1,parf1);
1116 Uf = Max (pard1,parf1);
1117
1118 deltaU = Abs(parf1- pard1)/nbeval;
1119
1120 do
1121 { if ( nb == nbeval)
1122 { LocalAnalysis_SurfaceContinuity res(curv1, curv2, Uf,surf1, surf2, GeomAbs_G1, epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1123 isdone = res.IsDone();
1124 if ( isdone) { isconti = res.IsG1();
1125 if (isconti)
1126 {if (res.C0Value()>MaxG0Value) MaxG0Value = res.C0Value();
1127 if (res.G1Angle ()>MaxG1Angle) MaxG1Angle = res.G1Angle();}}
1128 else isconti = Standard_False;}
1129
1130 else {LocalAnalysis_SurfaceContinuity res (curv1, curv2, (U+nb*deltaU ), surf1,surf2, GeomAbs_G1,epsnl,epsC0, epsC1, epsC2, epsG1,
1131 percent,maxlen);
1132 isdone = res.IsDone();
1133 if ( isdone) { isconti = res.IsG1();
1134 if ( nb == 0) { MaxG0Value = res.C0Value();
1135 MaxG1Angle = res.G1Angle();}
1136 if (res.C0Value()> MaxG0Value) MaxG0Value = res.C0Value();
1137 if (res.G1Angle()> MaxG1Angle) MaxG1Angle= res.G1Angle();;}
1138
1139 else isconti = Standard_False;}
1140 if (!isconti) ISG1=Standard_False;
1141 nb++;
1142
1143 }
1144 while ((nb<nbeval)&& isdone );
1145
1146 //if (!isdone) { cout<<" Problem in computation "<<endl; return 1;}
1147 //if (ISG1)
1148 // {cout<<" the continuity is G1 "<<endl;}
1149 //else { cout<<" the continuity is not G1 "<<endl;}
1150 //cout<<"MaxG0Value :"<< MaxG0Value << endl;
1151 //cout<<"MaxG1Angle:"<< MaxG1Angle << endl;
1152 if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
1153 if (ISG1)
1154 {di<<" the continuity is G1 "<<"\n";}
1155 else { di<<" the continuity is not G1 "<<"\n";}
1156 di<<"MaxG0Value :"<< MaxG0Value << "\n";
1157 di<<"MaxG1Angle:"<< MaxG1Angle << "\n";
1158 return 0;
1159}
1160/*****************************************************************************/
1161static Standard_Integer shapeG0continuity (Draw_Interpretor& di, Standard_Integer n, const char** a)
1162
1163{ Standard_Real epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen;
1164 Standard_Integer nbeval;
1165 Standard_Boolean ISG0;
1166 InitEpsSurf(epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1167
1168 if (n<4) return 1;
1169 TopoDS_Face face1,face2;
1170 Standard_Real f1,f2,l1,l2;
1171 TopoDS_Shape shape = DBRep::Get(a[1],TopAbs_SHAPE);
1172 if (shape.IsNull()) return 1;
1173 TopoDS_Shape edge = DBRep::Get(a[2],TopAbs_EDGE);
1174 if (edge.IsNull()) return 1;
1175// calcul des deux faces
1176 TopTools_IndexedDataMapOfShapeListOfShape lface;
1177 TopExp::MapShapesAndAncestors(shape,TopAbs_EDGE,TopAbs_FACE,lface);
1178 const TopTools_ListOfShape& lfac = lface.FindFromKey(edge);
1179
1180 Standard_Integer nelem= lfac.Extent();
1181 if(nelem!=2) return 1;
1182 TopTools_ListIteratorOfListOfShape It;
1183 It.Initialize(lfac);
1184 face1=TopoDS::Face(It.Value());
1185 It.Next();
1186 face2=TopoDS::Face(It.Value());
1187
1188// calcul des deux pcurves
1189 const Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface
1190 (TopoDS::Edge(edge),face1,f1,l1);
1191 if (c1.IsNull()) return 1;
1192 const Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface
1193 (TopoDS::Edge(edge),face2,f2,l2);
1194 if (c2.IsNull()) return 1;
1195
1196 Handle(Geom2d_Curve) curv1= new Geom2d_TrimmedCurve(c1,f1,l1);
1197
1198 Handle(Geom2d_Curve) curv2= new Geom2d_TrimmedCurve(c2,f2,l2);
1199
1200// calcul des deux surfaces
1201 TopLoc_Location L1,L2;
1202 TopoDS_Face aLocalFace = face1;
1203 const Handle(Geom_Surface)& s1 = BRep_Tool::Surface(aLocalFace,L1);
1204// const Handle(Geom_Surface)& s1 =
1205// BRep_Tool::Surface(TopoDS::Face(face1),L1);
1206 if (s1.IsNull()) return 1;
1207 aLocalFace = face2;
1208 const Handle(Geom_Surface)& s2 = BRep_Tool::Surface(aLocalFace,L2);
1209// const Handle(Geom_Surface)& s2 =
1210// BRep_Tool::Surface(TopoDS::Face(face2),L2);
1211 if (s2.IsNull()) return 1;
1212
1213
1214 Handle(Geom_Surface) surf1 = Handle(Geom_Surface)::
1215 DownCast(s1->Transformed(L1.Transformation()));
1216 if (surf1.IsNull()) return 1;
1217 Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::
1218 DownCast(s2->Transformed(L2.Transformation()));
1219 if (surf2.IsNull()) return 1;
1220
1221
1222
91322f44 1223 nbeval = (Standard_Integer ) Draw::Atof( a[3]);
7fd59977 1224
1225 switch(n)
91322f44 1226 { case 6 : epsC0 = Draw::Atof(a[5]);
1227 case 5 : epsnl = Draw::Atof(a[4]);
7fd59977 1228 case 4 : {} break;
1229 default : return 1;
1230 }
1231
1232
1233 Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
1234 Standard_Boolean isconti = Standard_True;
1235 Standard_Boolean isdone = Standard_True;
1236 pard1 = curv1->FirstParameter();
1237 parf1 = curv1->LastParameter();
1238 Standard_Real MaxG0Value=0;
1239 U = Min( pard1,parf1);
1240 Uf = Max (pard1,parf1);
1241
1242 deltaU = Abs(parf1- pard1)/nbeval;
1243 ISG0=Standard_True;
1244 do
1245 { if ( nb == nbeval)
1246 { LocalAnalysis_SurfaceContinuity res (curv1, curv2, Uf,surf1, surf2, GeomAbs_C0,epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1247 isdone = res.IsDone();
1248 if ( isdone) { isconti = res.IsC0( );
1249 if (isconti)
1250 if (res.C0Value()>MaxG0Value) MaxG0Value= res.C0Value();}
1251 else isconti = Standard_False;}
1252
1253 else {LocalAnalysis_SurfaceContinuity res (curv1, curv2, (U+nb*deltaU), surf1, surf2, GeomAbs_C0,epsnl,epsC0, epsC1, epsC2, epsG1, percent,maxlen );
1254 isdone = res.IsDone();
1255 if ( isdone) { isconti = res.IsC0() ;
1256 if ( nb == 0) { MaxG0Value = res.C0Value();}
1257 if (res.C0Value()> MaxG0Value) MaxG0Value = res.C0Value();}
1258
1259 else isconti = Standard_False;}
1260
1261 nb++;
1262 if (!isconti) ISG0=Standard_False;
1263
1264 }
1265 while ((nb<nbeval)&& isdone );
1266
1267 //f (!isdone) { cout<<" Problem in computation "<<endl; return 1;}
1268 //if (ISG0)
1269 // {cout<<" the continuity is G0 "<<endl;}
1270
1271 //else { cout<<" the continuity is not G0 "<<endl;}
1272 //cout<<"MaxG0Value :"<< MaxG0Value << endl;
1273 if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
1274 if (ISG0)
1275 {di<<" the continuity is G0 "<<"\n";}
1276
1277 else { di<<" the continuity is not G0 "<<"\n";}
1278 di<<"MaxG0Value :"<< MaxG0Value << "\n";
1279 return 0;
1280}
1281/*****************************************************************************************/
1282static Standard_Integer shapeG2continuity (Draw_Interpretor& di, Standard_Integer n, const char** a)
1283
1284{ Standard_Real epsnl,epsC0, epsC1, epsC2, epsG1, percent,maxlen;
1285 Standard_Boolean ISG2=Standard_True;
1286 Standard_Integer nbeval;
1287 Standard_Real MaxG0Value=0,MaxG1Angle=0,MaxG2Curvature=0;
1288 InitEpsSurf(epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1289
1290 if (n<4) return 1;
1291 TopoDS_Face face1,face2;
1292 Standard_Real f1,f2,l1,l2;
1293 TopoDS_Shape shape = DBRep::Get(a[1],TopAbs_SHAPE);
1294 if (shape.IsNull()) return 1;
1295 TopoDS_Shape edge = DBRep::Get(a[2],TopAbs_EDGE);
1296 if (edge.IsNull()) return 1;
1297// calcul des deux faces
1298 TopTools_IndexedDataMapOfShapeListOfShape lface;
1299 TopExp::MapShapesAndAncestors(shape,TopAbs_EDGE,TopAbs_FACE,lface);
1300 const TopTools_ListOfShape& lfac = lface.FindFromKey(edge);
1301
1302 Standard_Integer nelem= lfac.Extent();
1303 if(nelem!=2) return 1;
1304 TopTools_ListIteratorOfListOfShape It;
1305 It.Initialize(lfac);
1306 face1=TopoDS::Face(It.Value());
1307 It.Next();
1308 face2=TopoDS::Face(It.Value());
1309// calcul des deux pcurves
1310 const Handle(Geom2d_Curve) c1 = BRep_Tool::CurveOnSurface
1311 (TopoDS::Edge(edge),face1,f1,l1);
1312 if (c1.IsNull()) return 1;
1313 const Handle(Geom2d_Curve) c2 = BRep_Tool::CurveOnSurface
1314 (TopoDS::Edge(edge),face2,f2,l2);
1315 if (c2.IsNull()) return 1;
1316
1317 Handle(Geom2d_Curve) curv1= new Geom2d_TrimmedCurve(c1,f1,l1);
1318
1319 Handle(Geom2d_Curve) curv2= new Geom2d_TrimmedCurve(c2,f2,l2);
1320
1321// calcul des deux surfaces
1322 TopLoc_Location L1,L2;
1323 TopoDS_Face aLocalFace = face1;
1324 const Handle(Geom_Surface)& s1 = BRep_Tool::Surface(aLocalFace,L1);
1325// const Handle(Geom_Surface)& s1 =
1326// BRep_Tool::Surface(TopoDS::Face(face1),L1);
1327 if (s1.IsNull()) return 1;
1328 aLocalFace = face2;
1329 const Handle(Geom_Surface)& s2 = BRep_Tool::Surface(aLocalFace,L2);
1330// const Handle(Geom_Surface)& s2 =
1331// BRep_Tool::Surface(TopoDS::Face(face2),L2);
1332 if (s2.IsNull()) return 1;
1333
1334
1335 Handle(Geom_Surface) surf1 = Handle(Geom_Surface)::
1336 DownCast(s1->Transformed(L1.Transformation()));
1337 if (surf1.IsNull()) return 1;
1338 Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::
1339 DownCast(s2->Transformed(L2.Transformation()));
1340 if (surf2.IsNull()) return 1;
1341
1342
1343
91322f44 1344 nbeval = (Standard_Integer ) Draw::Atof( a[3]);
7fd59977 1345
1346 switch(n)
1347 {
91322f44 1348 case 9 : maxlen = Draw::Atof(a[8]);
1349 case 8 : percent = Draw::Atof(a[7]);
1350 case 7 : epsG1 = Draw::Atof(a[6]);
1351 case 6 : epsC0 = Draw::Atof(a[5]);
1352 case 5 : epsnl = Draw::Atof(a[4]);
7fd59977 1353 case 4 : {} break;
1354 default : return 1;
1355 }
1356
1357
1358 Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
1359 Standard_Boolean isconti = Standard_True;
1360 Standard_Boolean isdone = Standard_True;
1361 pard1 = curv1->FirstParameter();
1362 parf1 = curv1->LastParameter();
1363 U = Min( pard1,parf1);
1364 Uf = Max (pard1,parf1);
1365
1366 deltaU = Abs(parf1- pard1)/nbeval;
1367
1368 do
1369 { if ( nb == nbeval)
1370 { LocalAnalysis_SurfaceContinuity res (curv1, curv2, Uf,surf1, surf2, GeomAbs_G2,epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1371 isdone = res.IsDone();
1372 if (isdone){isconti = res.IsG2();
1373 if (isconti)
1374 {if(res.C0Value()>MaxG0Value) MaxG0Value=res.C0Value();
1375 if(res.G1Angle()>MaxG1Angle) MaxG1Angle=res.G1Angle();
1376 if(res.G2CurvatureGap()>MaxG2Curvature)
1377 MaxG2Curvature=res.G2CurvatureGap();
1378 }}
1379 else isconti = Standard_False;}
1380
1381 else { LocalAnalysis_SurfaceContinuity res (curv1, curv2, (U+nb*deltaU), surf1,surf2, GeomAbs_G2,epsnl,epsC0, epsC1, epsC2, epsG1,percent,maxlen );
1382 isdone = res.IsDone();
1383 if ( isdone) {isconti = res.IsG2();
1384 if (nb==0){MaxG0Value=res.C0Value();
1385 MaxG1Angle=res.G1Angle();
1386 MaxG2Curvature=res.G2CurvatureGap();}
1387 if(res.C0Value()>MaxG0Value)
1388 MaxG0Value=res.C0Value();
1389 if(res.G1Angle()>MaxG1Angle)
1390 MaxG1Angle=res.G1Angle();
1391 if(res.G2CurvatureGap()>MaxG2Curvature)
1392 MaxG2Curvature=res.G2CurvatureGap();}
1393 else isconti = Standard_False;}
1394
1395 nb++;
1396 if (!isconti) ISG2=Standard_False;
1397
1398 }
1399 while ((nb<nbeval)&& isdone );
1400
1401 //if (!isdone) { cout<<" Problem in computation "<<endl; return 1;}
1402 //if (ISG2)
1403 //cout<<" the continuity is G2 "<<endl;
1404 //else cout<<" the continuity is not G2 "<<endl;
1405 //cout<<"MaxG0Value :"<< MaxG0Value << endl;
1406 //cout<<"MaxG1Angle:"<< MaxG1Angle << endl;
1407 //cout<<"MaxG2Curvature:"<<MaxG2Curvature<<endl;
1408 if (!isdone) { di<<" Problem in computation "<<"\n"; return 1;}
1409 if (ISG2)
1410 di<<" the continuity is G2 "<<"\n";
1411 else di<<" the continuity is not G2 "<<"\n";
1412 di<<"MaxG0Value :"<< MaxG0Value << "\n";
1413 di<<"MaxG1Angle:"<< MaxG1Angle << "\n";
1414 di<<"MaxG2Curvature:"<<MaxG2Curvature<<"\n";
1415 return 0;
1416}
1417
1418
1419//=======================================================================
1420//function : clintedge
1421//purpose :
1422//=======================================================================
1423static Standard_Integer clintedge(Draw_Interpretor& di,
1424 Standard_Integer narg, const char** a)
1425{
1426 char newname[255];
1427
1428 if (narg < 2) {
1429 //cout << "Usage: clintedge shape" << endl;
1430 di << "Usage: clintedge shape" << "\n";
1431 return 1;
1432 }
1433 TopoDS_Shape S = DBRep::Get(a[1]);
1434
1435 TopTools_DataMapOfShapeListOfShape mymap;
1436 TopOpeBRepTool_PurgeInternalEdges mypurgealgo(S);
773f53f1 1437 Standard_Integer nbedges = mypurgealgo.NbEdges();
1438 if (nbedges > 0)
1439 {
7fd59977 1440 //cout<<nbedges<<" internal (or external) edges to be removed"<<endl;
1441 di<<nbedges<<" internal (or external) edges to be removed"<<"\n";
1442
1443 Standard_Integer i = 1;
1444 char* temp = newname;
1445
91322f44 1446 Sprintf(newname,"%s_%d",a[1],i);
7fd59977 1447 DBRep::Set(temp,mypurgealgo.Shape());
1448 //cout<<newname<<" ";
1449 di<<newname<<" ";
1450
1451 //cout<<endl;
1452 di<<"\n";
1453 }
1454 else
1455 di << "no internal (or external) edges"<<"\n";
1456 //cout << "no internal (or external) edges"<<endl;
1457
1458 return 0;
1459}
1460
1461
1462//=======================================================================
1463//function : facintedge
1464//purpose :
1465//=======================================================================
1466static Standard_Integer facintedge(Draw_Interpretor& di,
1467 Standard_Integer narg, const char** a)
1468{
1469 char newname[255];
1470
1471 if (narg < 2) {
1472 //cout << "Usage: facintedge shape" << endl;
1473 di << "Usage: facintedge shape" << "\n";
1474 return 1;
1475 }
1476 TopoDS_Shape S = DBRep::Get(a[1]);
1477
1478 TopTools_DataMapOfShapeListOfShape mymap;
1479 TopOpeBRepTool_PurgeInternalEdges mypurgealgo(S);
1480 mypurgealgo.Faces(mymap);
1481
1482 Standard_Integer i = 1;
1483 char* temp = newname;
1484
1485 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itFacEdg;
1486 for (itFacEdg.Initialize(mymap); itFacEdg.More(); itFacEdg.Next()) {
91322f44 1487 Sprintf(newname,"%s_%d",a[1],i);
7fd59977 1488 DBRep::Set(temp,itFacEdg.Key());
1489 //cout<<newname<<" ";
1490 di<<newname<<" ";
1491 i++;
1492 }
1493
1494 //cout<<endl;
1495 di<<"\n";
1496
1497 return 0;
1498}
1499
1500//=======================================================================
1501//function : fuseedge
1502//purpose :
1503//=======================================================================
1504static Standard_Integer fuseedge(Draw_Interpretor& di,
1505 Standard_Integer narg, const char** a)
1506{
1507 char newname[255];
1508
1509 if (narg < 2) {
1510 //cout << "Usage: fuseedge shape" << endl;
1511 di << "Usage: fuseedge shape" << "\n";
1512 return 1;
1513 }
1514 TopoDS_Shape S = DBRep::Get(a[1]);
1515
1516 TopTools_DataMapOfIntegerListOfShape mymap;
1517 //TopOpeBRepTool_FuseEdges myfusealgo(S);
1518 BRepLib_FuseEdges myfusealgo(S);
1519 myfusealgo.SetConcatBSpl();
1520 Standard_Integer nbvertices;
1521 nbvertices = myfusealgo.NbVertices();
1522
1523 if (nbvertices > 0) {
1524
1525 //cout<<nbvertices<<" vertices to be removed"<<endl;
1526 di<<nbvertices<<" vertices to be removed"<<"\n";
1527
1528 Standard_Integer i = 1;
1529 char* temp = newname;
1530
91322f44 1531 Sprintf(newname,"%s_%d",a[1],i);
7fd59977 1532 DBRep::Set(temp,myfusealgo.Shape());
1533 //cout<<newname<<" ";
1534 di<<newname<<" ";
1535
1536 //cout<<endl;
1537 di<<"\n";
1538 }
1539 else
1540 di << "no vertices to remove"<<"\n";
1541 //cout << "no vertices to remove"<<endl;
1542
1543 return 0;
1544}
1545
1546
1547//=======================================================================
1548//function : listfuseedge
1549//purpose :
1550//=======================================================================
1551static Standard_Integer listfuseedge(Draw_Interpretor& di,
1552 Standard_Integer narg, const char** a)
1553{
1554 char newname[255];
1555
1556 if (narg < 2) {
1557 //cout << "Usage: listfuseedge shape" << endl;
1558 di << "Usage: listfuseedge shape" << "\n";
1559 return 1;
1560 }
1561 TopoDS_Shape S = DBRep::Get(a[1]);
1562
1563 TopTools_DataMapOfIntegerListOfShape mymap;
1564 BRepLib_FuseEdges myfusealgo(S);
1565 myfusealgo.Edges(mymap);
1566
1567 Standard_Integer i;
1568 char* temp = newname;
1569
1570 TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape itLstEdg;
1571 for (itLstEdg.Initialize(mymap); itLstEdg.More(); itLstEdg.Next()) {
1572 const Standard_Integer& iLst = itLstEdg.Key();
1573 const TopTools_ListOfShape& LmapEdg = mymap.Find(iLst);
1574 TopTools_ListIteratorOfListOfShape itEdg;
1575 i = 1;
1576 for (itEdg.Initialize(LmapEdg); itEdg.More(); itEdg.Next()) {
91322f44 1577 Sprintf(newname,"%s_%d_%d",a[1],iLst,i);
7fd59977 1578 DBRep::Set(temp,itEdg.Value());
1579 //cout<<newname<<" ";
1580 di<<newname<<" ";
1581 i++;
1582 }
1583
1584 }
1585
1586 //cout<<endl;
1587 di<<"\n";
1588
1589 return 0;
1590}
1591
1592
1593
1594//=======================================================================
1595//function : CheckCommands
1596//purpose :
1597//=======================================================================
1598
1599void BRepTest::CheckCommands(Draw_Interpretor& theCommands)
1600{
1601 static Standard_Boolean done = Standard_False;
1602 if (done) return;
1603 done = Standard_True;
1604
1605 BRepTest_CheckCommands_SetFaultyName("faulty_");
1606 DBRep::BasicCommands(theCommands);
1607
1608 const char* g = "TOPOLOGY Check commands";
1609
1610// Modified by skv - Tue Apr 27 13:35:35 2004 Begin
1611 theCommands.Add("checkshape",
1612 "checkshape : no args to have help",
1613 __FILE__,
1614 checkshape,
1615 g);
1616// theCommands.Add("checkshape",
1617// "checks the validity of a shape : checkshape name,\n short description of check : checkshape name -short",
1618// __FILE__,
1619// CHK,
1620// g);
1621// theCommands.Add("checktopshape",
1622// "checks the topological validity of a shape : checktopshape name",
1623// __FILE__,
1624// CHK,
1625// g);
1626// Modified by skv - Tue Apr 27 13:35:39 2004 End
1627
1628 theCommands.Add("checksection",
1629 "checks the closure of a section : checksection name",
1630 __FILE__,
1631 checksection,
1632 g);
1633
1634 theCommands.Add("checkdiff",
1635 "checks the validity of the diff beetween the shapes arg1..argn and result :\n checkdiff arg1 [arg2..argn] result [closedSolid (1/0)] [geomCtrl (1/0)]",
1636 __FILE__,
1637 checkdiff,
1638 g);
1639
1640g = "TOPOLOGY Analysis of shapes ";
1641
1642theCommands.Add("shapeG0continuity",
1643 "shapeG0continuity shape edge nbeval [epsnul [epsG0]]",
1644 __FILE__,
1645 shapeG0continuity, g);
1646
1647theCommands.Add("shapeG1continuity",
1648 "shapeG1continuity shape edge nbeval [epsnul [epsG0 [epsG1]]]",
1649 __FILE__,
1650 shapeG1continuity ,g);
1651theCommands.Add("shapeG2continuity",
1652 "shapeG2continuity shape edge nbeval [epsnul [epsG0 [epsG1 [maxlen [perce]]]]]",
1653 __FILE__,
1654 shapeG2continuity,g);
1655
1656theCommands.Add("computetolerance",
1657 "computetolerance shape",
1658 __FILE__,
1659 computetolerance,g);
1660
1661theCommands.Add("clintedge",
1662 "clintedge shape",
1663 __FILE__,
1664 clintedge,g);
1665
1666theCommands.Add("facintedge",
1667 "facintedge shape",
1668 __FILE__,
1669 facintedge,g);
1670
1671theCommands.Add("fuseedge",
1672 "fuseedge shape",
1673 __FILE__,
1674 fuseedge,g);
1675
1676theCommands.Add("listfuseedge",
1677 "listfuseedge shape",
1678 __FILE__,
1679 listfuseedge,g);
1680}
1681