#include <Precision.hxx>
#include <LocalAnalysis.hxx>
#include <LocalAnalysis_SurfaceContinuity.hxx>
+#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <DrawTrSurf.hxx>
#include <GeomAbs_Shape.hxx>
+#include <TCollection_AsciiString.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopOpeBRepTool_PurgeInternalEdges.hxx>
//#include <TopOpeBRepTool_FuseEdges.hxx>
+#include <BRepLib.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <TopTools_HSequenceOfShape.hxx>
Standard_Integer narg, const char** a)
{
if (narg < 2) {
+ di << a[0] << " shape [-r <ref_val>]\n";
return 1;
}
+
+ Standard_Integer aCompareValue = -1;
TopoDS_Shape S = DBRep::Get(a[1]);
+
+ for (Standard_Integer anAI = 2; anAI < narg; anAI++)
+ {
+ if (!strcmp(a[anAI], "-r"))
+ {
+ aCompareValue = Draw::Atoi(a[++anAI]);
+ }
+ else
+ {
+ di << "Error: Wrong option" << a[anAI] << "\n";
+ }
+ }
+
TopTools_MapOfShape theVertices;
TopExp_Explorer exp;
for (exp.Init(S, TopAbs_VERTEX); exp.More(); exp.Next()) {
}
//cout << " nb alone Vertices : " << theVertices.Extent() << endl;
di << " nb alone Vertices : " << theVertices.Extent() << "\n";
+
+ if (aCompareValue >= 0)
+ {
+ if (theVertices.Extent() == aCompareValue)
+ {
+ di << "Section is OK\n";
+ }
+ else
+ {
+ di << "Error: "<< aCompareValue << " vertices are expected but " <<
+ theVertices.Extent() << " are found.\n";
+ }
+ }
+
char Name[32];
Standard_Integer ipp=0;
TopTools_MapIteratorOfMapOfShape itvx;
}
}
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
theCommands<<"checkshape exception : ";
- theCommands << Standard_Failure::Caught()->GetMessageString();
+ theCommands << anException.GetMessageString();
theCommands<<"\n";
return 1;
}
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- { case 7 : epsG1 = Draw::Atof(a[6]);
- case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
+ {
+ case 7 : epsG1 = Draw::Atof(a[6]);
+ Standard_FALLTHROUGH
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- { case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
-
+ {
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
Standard_Boolean isconti = Standard_True;
nbeval = (Standard_Integer ) Draw::Atof( a[3]);
switch(n)
- {
- case 9 : maxlen = Draw::Atof(a[8]);
- case 8 : percent = Draw::Atof(a[7]);
- case 7 : epsG1 = Draw::Atof(a[6]);
- case 6 : epsC0 = Draw::Atof(a[5]);
- case 5 : epsnl = Draw::Atof(a[4]);
- case 4 : {} break;
- default : return 1;
- }
+ {
+ case 9 : maxlen = Draw::Atof(a[8]);
+ Standard_FALLTHROUGH
+ case 8 : percent = Draw::Atof(a[7]);
+ Standard_FALLTHROUGH
+ case 7 : epsG1 = Draw::Atof(a[6]);
+ Standard_FALLTHROUGH
+ case 6 : epsC0 = Draw::Atof(a[5]);
+ Standard_FALLTHROUGH
+ case 5 : epsnl = Draw::Atof(a[4]);
+ Standard_FALLTHROUGH
+ case 4 : break;
+ default : return 1;
+ }
Standard_Real pard1, parf1, U, Uf, deltaU, nb = 0;
return 0;
}
+//=======================================================================
+//function : tolsphere
+//purpose :
+//=======================================================================
+static Standard_Integer tolsphere(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n != 2)
+ {
+ di << "use toolsphere shape\n";
+ return 1;
+ }
+
+ TopoDS_Shape aS = DBRep::Get(a[1]);
+ if (aS.IsNull())
+ {
+ di << "No such shape " << a[1] << "\n";
+ return 1;
+ }
+
+ TopTools_IndexedMapOfShape aMapV;
+ TopExp::MapShapes(aS, TopAbs_VERTEX, aMapV);
+ for (Standard_Integer i = 1; i <= aMapV.Extent(); i++)
+ {
+ const TopoDS_Vertex& aV = TopoDS::Vertex(aMapV.FindKey(i));
+ Standard_Real aRadius = BRep_Tool::Tolerance(aV);
+ gp_Pnt aCenter = BRep_Tool::Pnt(aV);
+ Handle(Geom_Surface) aSph = new Geom_SphericalSurface(gp_Ax2(aCenter,gp::DZ()), aRadius);
+ TCollection_AsciiString aName(a[1]);
+ aName = aName + "_v" + i;
+ DrawTrSurf::Set(aName.ToCString(), aSph);
+ di << aName << " ";
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : validrange
+//purpose :
+//=======================================================================
+static Standard_Integer validrange(Draw_Interpretor& di,
+ Standard_Integer narg, const char** a)
+{
+ if (narg < 2)
+ {
+ di << "usage: validrange edge [(out) u1 u2]";
+ return 1;
+ }
+
+ TopoDS_Edge aE = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE, true));
+ if (aE.IsNull())
+ return 1;
+ Standard_Real u1, u2;
+ if (BRepLib::FindValidRange(aE, u1, u2))
+ {
+ if (narg > 3)
+ {
+ Draw::Set(a[2], u1);
+ Draw::Set(a[3], u2);
+ }
+ else
+ {
+ di << u1 << " " << u2;
+ }
+ }
+ else
+ di << "edge has no valid range";
+ return 0;
+}
//=======================================================================
//function : CheckCommands
// Modified by skv - Tue Apr 27 13:35:39 2004 End
theCommands.Add("checksection",
- "checks the closure of a section : checksection name",
+ "checks the closure of a section : checksection name [-r <RefVal>]\n"
+ "\"-r\" - allowed number of allone vertices.",
__FILE__,
checksection,
g);
"listfuseedge shape",
__FILE__,
listfuseedge,g);
+theCommands.Add("tolsphere", "toolsphere shape\n"
+ "\t\tshows vertex tolerances by drawing spheres",
+ __FILE__, tolsphere, g);
+theCommands.Add("validrange",
+ "validrange edge [(out) u1 u2]\n"
+ "\t\tcomputes valid range of the edge, and\n"
+ "\t\tprints first and last values or sets the variables u1 and u2",
+ __FILE__, validrange, g);
}