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