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