X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FBRepTest%2FBRepTest_SurfaceCommands.cxx;h=72ec47096c22c9bbcc8140be22fafeaf94de5fb4;hp=cf26e9411e35be3d0b51048e6cd157a7affbad64;hb=7693827d4a3127ac7e571af418a9fcdd42551ce3;hpb=97f3106c05d5052297bac39ed571c85c0ac32350 diff --git a/src/BRepTest/BRepTest_SurfaceCommands.cxx b/src/BRepTest/BRepTest_SurfaceCommands.cxx index cf26e9411e..72ec47096c 100644 --- a/src/BRepTest/BRepTest_SurfaceCommands.cxx +++ b/src/BRepTest/BRepTest_SurfaceCommands.cxx @@ -42,6 +42,8 @@ #include #include #include +#include +#include #ifdef _WIN32 //#define strcasecmp strcmp Already defined @@ -404,6 +406,66 @@ static Standard_Integer sewing (Draw_Interpretor& theDi, return 0; } +//======================================================================= +//function : fastsewing +//purpose : +//======================================================================= +Standard_Integer fastsewing (Draw_Interpretor& theDI, + Standard_Integer theNArg, + const char** theArgVal) +{ + if(theNArg < 3) + { + // 0 1 2 3 4 + theDI << "Use: fastsewing result [-tol ] \n"; + return 1; + } + + BRepBuilderAPI_FastSewing aFS; + + Standard_Integer aStartIndex = 2; + + if(!strcmp(theArgVal[aStartIndex], "-tol")) + { + aFS.SetTolerance(Draw::Atof (theArgVal[aStartIndex+1])); + aStartIndex = 4; + } + + for(Standard_Integer i = aStartIndex; i < theNArg; i++) + { + TopoDS_Shape aS = DBRep::Get(theArgVal[i]); + + if(!aFS.Add(aS)) + { + theDI << "Face is not added. See statuses.\n"; + } + } + + BRepBuilderAPI_FastSewing::FS_VARStatuses aStatus = aFS.GetStatuses(); + + if(aStatus) + { + theDI << "Error: There are some problems while adding (" << + (static_cast(aStatus)) << ")\n"; + aFS.GetStatuses(&cout); + } + + aFS.Perform(); + + aStatus = aFS.GetStatuses(); + + if(aStatus) + { + theDI << "Error: There are some problems while performing (" << + (static_cast(aStatus)) << ")\n"; + aFS.GetStatuses(&cout); + } + + DBRep::Set(theArgVal[1], aFS.GetResult()); + + return 0; +} + //======================================================================= // continuity //======================================================================= @@ -508,5 +570,8 @@ void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands) theCommands.Add("encoderegularity", "encoderegularity shape [tolerance (in degree)]", __FILE__,encoderegularity, g); + + theCommands.Add ("fastsewing", "fastsewing result [-tol ] ", + __FILE__, fastsewing, g); }