From 9f6931fb8abfe46a4c62a7436a912715904ff41b Mon Sep 17 00:00:00 2001 From: ibs Date: Thu, 31 Oct 2013 13:52:27 +0400 Subject: [PATCH] 0024277: DRAW command that shows coordinates of a vertex "getcoords" command added "getcoords" moved to BRepTest/BRepTest_BasicCommands --- src/BRepTest/BRepTest_BasicCommands.cxx | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/BRepTest/BRepTest_BasicCommands.cxx b/src/BRepTest/BRepTest_BasicCommands.cxx index 5fc30b7c3e..30697b72b5 100755 --- a/src/BRepTest/BRepTest_BasicCommands.cxx +++ b/src/BRepTest/BRepTest_BasicCommands.cxx @@ -370,6 +370,34 @@ static Standard_Integer boundingstr(Draw_Interpretor& di,Standard_Integer n,cons return 0; } +//======================================================================= +//function : getcoords +//purpose : +//======================================================================= +static Standard_Integer getcoords(Draw_Interpretor& di,Standard_Integer n,const char** a) +{ + if(n < 2) + return 1; + + for (Standard_Integer i = 1; i < n; i++) + { + const TopoDS_Shape aShape = DBRep::Get (a[i]); + + if (aShape.IsNull()) + continue; + + if (aShape.ShapeType() == TopAbs_VERTEX) + { + const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape); + gp_Pnt aPnt = BRep_Tool::Pnt(aVertex); + + di << a[i] << " (x,y,z) : " << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n"; + } + } + + return 0; +} + //======================================================================= //function : bounding //purpose : @@ -879,6 +907,11 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands) __FILE__, orientsolid,g); + theCommands.Add("getcoords", + "getcoords vertex1 vertex 2... ; shows coords of input vertices", + __FILE__, + getcoords,g); + theCommands.Add("bounding", "bounding shape [ xmin ymin zmin xmax ymax zmax] ; draw bounds", __FILE__, -- 2.20.1