Salome HOME
Merge branch 'V9_11_BR'
authorjfa <jfa@opencascade.com>
Wed, 19 Jul 2023 14:56:13 +0000 (15:56 +0100)
committerjfa <jfa@opencascade.com>
Wed, 19 Jul 2023 14:56:13 +0000 (15:56 +0100)
28 files changed:
doc/salome/examples/kind_of_shape.py [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_kind_of_shape.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_measurement_tools.doc
idl/GEOM_Gen.idl
src/GEOMAlgo/CMakeLists.txt
src/GEOMAlgo/GEOMAlgo_KindOfName.hxx
src/GEOMAlgo/GEOMAlgo_KindOfPeriod.hxx [new file with mode: 0644]
src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx
src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/GEOMGUI/GEOM_msg_ja.ts
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx
src/GEOMUtils/GEOMUtils.cxx
src/GEOMUtils/GEOMUtils.hxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_SWIG/geomBuilder.py
src/MeasureGUI/MeasureGUI_WhatisDlg.cxx
test/data/KindOfShape_Curve10.brep [new file with mode: 0755]
test/data/KindOfShape_Curve3.brep [new file with mode: 0755]
test/data/KindOfShape_Curve4.brep [new file with mode: 0755]
test/data/KindOfShape_Curve6.brep [new file with mode: 0755]
test/data/KindOfShape_Curve9.brep [new file with mode: 0755]
test/test_kind_of_shape.py [new file with mode: 0644]
test/tests.set

diff --git a/doc/salome/examples/kind_of_shape.py b/doc/salome/examples/kind_of_shape.py
new file mode 100644 (file)
index 0000000..b2f9db8
--- /dev/null
@@ -0,0 +1,63 @@
+# Sample: KindOfShape method for Edges
+
+import salome
+from inspect import getfile
+from os.path import abspath, dirname, join
+salome.salome_init_without_session()
+import GEOM
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(50, 100, 0)
+Vertex_3 = geompy.MakeVertex(-10, 60, 0)
+Vertex_4 = geompy.MakeVertex(0, 100, 0)
+Vertex_5 = geompy.MakeVertex(-100, 100, 0)
+Vertex_6 = geompy.MakeVertex(-100, 0, 0)
+Vertex_7 = geompy.MakeVertex(-200, 0, 0)
+Vertex_8 = geompy.MakeVertex(-200, 100, 0)
+
+# create some curves
+Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
+Circle_1 = geompy.MakeCircle(Vertex_2, OZ, 50)
+Ellipse_1 = geompy.MakeEllipse(Vertex_1, OZ, 200, 100, Line_1)
+Arc_1 = geompy.MakeArc(Vertex_2, Vertex_3, Vertex_1)
+Curve_1 = geompy.MakeCurveParametric("t", "50*sin(t)", "0", 0, 360, 30, GEOM.Interpolation, True)
+Curve_2 = geompy.MakeCurveParametric("-t", "50*cos(t)", "t", 0, 360, 14, GEOM.Bezier, True)
+Curve_5 = geompy.MakeInterpol([Vertex_1, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8], False, False)
+Curve_7 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_7, Vertex_8], True)
+Curve_8 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_1, Vertex_4], False)
+
+# show information for all curves
+props = geompy.KindOfShape(Line_1)
+print("KindOfShape(Line_1): ", props)
+# [SEGMENT, 0.,0.,0., 50.,100.,0.]
+props = geompy.KindOfShape(Circle_1)
+print("KindOfShape(Circle_1): ", props)
+# [CIRCLE, 50.,100.,0., 0.,0.,1., 50.]
+props = geompy.KindOfShape(Ellipse_1)
+print("KindOfShape(Ellipse_1): ", props)
+# [ELLIPSE, 0.,0.,0., 0.,0.,1., 200., 100., 0.44721,0.89443,0., 0.44721,0.89443,0.]
+props = geompy.KindOfShape(Arc_1)
+print("KindOfShape(Arc_1): ", props)
+# [ARC_CIRCLE, 47.5,38.75,0., 0.,0.,1., 61.301, 50.,100.,0., 0.,0.,0.]
+props = geompy.KindOfShape(Curve_1)
+print("KindOfShape(Curve_1): ", props)
+# [CRV_BSPLINE, 0, 3, 33, 31, 0, 31, 0.,0.,0.,..., 4,1,...,1,4]
+props = geompy.KindOfShape(Curve_2)
+print("KindOfShape(Curve_2): ", props)
+# [CRV_BEZIER, 15, 0, 0.,50.,0.,...,-360.,-14.18455,360.]
+props = geompy.KindOfShape(Curve_5)
+print("KindOfShape(Curve_5): ", props)
+# [CRV_BSPLINE, 0, 3, 8, 6, 0, 6, 0.,0.,0.,..., 100.,0.,0.,100.,200.,300.,400.,500., 4,1,1,1,1,4]
+props = geompy.KindOfShape(Curve_7)
+print("KindOfShape(Curve_7): ", props)
+# [CRV_BEZIER, 5, 0, -100.,100.,0., -100.,0.,0., -200.,0.,0., -200.,100.,0., -100.,100.,0.]
+props = geompy.KindOfShape(Curve_8)
+print("KindOfShape(Curve_8): ", props)
+# [CRV_BEZIER, 4, 0, -100.,100.,0., -100.,0.,0., 0.,0.,0., 0.,100.,0.]
diff --git a/doc/salome/gui/GEOM/input/tui_kind_of_shape.doc b/doc/salome/gui/GEOM/input/tui_kind_of_shape.doc
new file mode 100644 (file)
index 0000000..f8219bb
--- /dev/null
@@ -0,0 +1,7 @@
+/*!
+
+\page tui_kind_of_shape_page Get information about a shape
+
+\tui_script{kind_of_shape.py}
+
+*/
index 59eea50df2afec3b7a1b2eb4b942017886a62b7d..e0ce0be618ac18881d7d0ddbd39e753f0a00a82f 100644 (file)
@@ -24,6 +24,7 @@
 <li>\subpage tui_check_conformity_page</li>
 <li>\subpage tui_shape_proximity_page</li>
 <li>\subpage tui_xyz_to_uv_page</li>
+<li>\subpage tui_kind_of_shape_page</li>
 </ul>
 
 */
index cb327ef930060c799bd56554fe0798f0225ede46..7907cde35940c73aa950860bd6a5abd3391cde85 100644 (file)
@@ -4305,6 +4305,14 @@ module GEOM
       LINE,         
       /*! segment */
       SEGMENT,      
+      /*! B-Spline curve */
+      CRV_BSPLINE,  
+      /*! Bezier curve */
+      CRV_BEZIER,  
+      /*! hyperbola */
+      HYPERBOLA,  
+      /*! parabola */
+      PARABOLA,  
       /*! other edge */
       EDGE,       
       // VERTEX
index f33f40ce1bf486bccc990e75e35b598b1809d4ec..1139c6a0f0636c6c16c6b56edcd14a47675494b8 100644 (file)
@@ -83,6 +83,7 @@ SET(GEOMAlgo_HEADERS
   GEOMAlgo_KindOfClosed.hxx
   GEOMAlgo_KindOfDef.hxx
   GEOMAlgo_KindOfName.hxx
+  GEOMAlgo_KindOfPeriod.hxx
   GEOMAlgo_KindOfShape.hxx
   GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
   GEOMAlgo_ListIteratorOfListOfPnt.hxx
index 4f91102dbfbc1b3c062dfc237ac219b2ed8adac4..08235ebb0b7080ec7c69e60c70bfff85b7791a1d 100644 (file)
@@ -45,7 +45,11 @@ GEOMAlgo_KN_RECTANGLE,
 GEOMAlgo_KN_TRIANGLE,
 GEOMAlgo_KN_QUADRANGLE,
 GEOMAlgo_KN_ARCELLIPSE,
-GEOMAlgo_KN_SOLID
+GEOMAlgo_KN_SOLID,
+GEOMAlgo_KN_CURVEBSPLINE,
+GEOMAlgo_KN_CURVEBEZIER,
+GEOMAlgo_KN_HYPERBOLA,
+GEOMAlgo_KN_PARABOLA
 };
 
 #ifndef _Standard_PrimitiveTypes_HeaderFile
diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfPeriod.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfPeriod.hxx
new file mode 100644 (file)
index 0000000..05bb8ed
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef _GEOMAlgo_KindOfPeriod_HeaderFile
+#define _GEOMAlgo_KindOfPeriod_HeaderFile
+
+
+enum GEOMAlgo_KindOfPeriod {
+GEOMAlgo_KP_UNKNOWN,
+GEOMAlgo_KP_PERIODIC,
+GEOMAlgo_KP_NONPERIODIC
+};
+
+#ifndef _Standard_PrimitiveTypes_HeaderFile
+#include <Standard_PrimitiveTypes.hxx>
+#endif
+
+#endif
index cde503050ea8ec3647fc68bbff9c7c92d73d5556..c0758884fb6ecea7003b601f72f57e024b9c3c1a 100644 (file)
@@ -35,7 +35,10 @@ GEOMAlgo_KS_PLANE,
 GEOMAlgo_KS_CIRCLE,
 GEOMAlgo_KS_LINE,
 GEOMAlgo_KS_DEGENERATED,
-GEOMAlgo_KS_BSPLINE
+GEOMAlgo_KS_BSPLINE,
+GEOMAlgo_KS_BEZIER,
+GEOMAlgo_KS_HYPERBOLA,
+GEOMAlgo_KS_PARABOLA
 };
 
 #ifndef _Standard_PrimitiveTypes_HeaderFile
index d221d20ac6a2b93cb2403d1ed679e3a8ae87ef56..c0f8405d73290dfd2560fbae523691fda6a84c0c 100644 (file)
@@ -31,6 +31,8 @@ static
   void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
 static
   void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
+static
+  void DumpKindOfPeriod(const GEOMAlgo_KindOfPeriod aKP);
 static
   void DumpPosition(const gp_Ax3& aAx3);
 static
@@ -72,6 +74,7 @@ void GEOMAlgo_ShapeInfo::Reset()
   myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
   myKindOfName=GEOMAlgo_KN_UNKNOWN;
   myKindOfDef=GEOMAlgo_KD_UNKNOWN;
+  myKindOfPeriod=GEOMAlgo_KP_UNKNOWN;
   //
   myLocation.SetCoord(99., 99., 99.);
   myDirection.SetCoord(1.,0.,0.);
@@ -81,6 +84,15 @@ void GEOMAlgo_ShapeInfo::Reset()
   myLength=-3.;
   myWidth=-3.;
   myHeight=-3.;
+  myDegree=0;
+  myNbPoles=0;
+  myNbKnots=0;
+  myNbWeights=0;
+  myNbMultiplicities=0;
+  myPoles = Handle(TColgp_HArray1OfPnt)();
+  myKnots = Handle(TColStd_HArray1OfReal)();
+  myWeights = Handle(TColStd_HArray1OfReal)();
+  myMultiplicities = Handle(TColStd_HArray1OfInteger)();
 }
 //=======================================================================
 //function : SetType
@@ -208,6 +220,22 @@ GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
   return myKindOfDef;
 }
 //=======================================================================
+//function : SetKindOfPeriod
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetKindOfPeriod(const GEOMAlgo_KindOfPeriod aT)
+{
+  myKindOfPeriod=aT;
+}
+//=======================================================================
+//function : KindOfPeriod
+//purpose  :
+//=======================================================================
+GEOMAlgo_KindOfPeriod GEOMAlgo_ShapeInfo::KindOfPeriod() const
+{
+  return myKindOfPeriod;
+}
+//=======================================================================
 //function : SetLocation
 //purpose  :
 //=======================================================================
@@ -378,6 +406,150 @@ Standard_Real GEOMAlgo_ShapeInfo::Height() const
   return myHeight;
 }
 //=======================================================================
+//function : SetDegree
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetDegree(const Standard_Integer aD)
+{
+  myDegree=aD;
+}
+//=======================================================================
+//function : Degree
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMAlgo_ShapeInfo::Degree() const
+{
+  return myDegree;
+}
+//=======================================================================
+//function : SetNbPoles
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetNbPoles(const Standard_Integer aNb)
+{
+  myNbPoles=aNb;
+}
+//=======================================================================
+//function : NbPoles
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMAlgo_ShapeInfo::NbPoles() const
+{
+  return myNbPoles;
+}
+//=======================================================================
+//function : SetNbKnots
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetNbKnots(const Standard_Integer aNb)
+{
+  myNbKnots=aNb;
+}
+//=======================================================================
+//function : NbKnots
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMAlgo_ShapeInfo::NbKnots() const
+{
+  return myNbKnots;
+}
+//=======================================================================
+//function : SetNbWeights
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetNbWeights(const Standard_Integer aNb)
+{
+  myNbWeights=aNb;
+}
+//=======================================================================
+//function : NbWeights
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMAlgo_ShapeInfo::NbWeights() const
+{
+  return myNbWeights;
+}
+//=======================================================================
+//function : SetNbMultiplicities
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetNbMultiplicities(const Standard_Integer aNb)
+{
+  myNbMultiplicities=aNb;
+}
+//=======================================================================
+//function : NbWeights
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMAlgo_ShapeInfo::NbMultiplicities() const
+{
+  return myNbMultiplicities;
+}
+//=======================================================================
+//function : SetPoles
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetPoles(Handle(TColgp_HArray1OfPnt) P)
+{
+  myPoles = P;
+}
+//=======================================================================
+//function : Poles
+//purpose  :
+//=======================================================================
+Handle(TColgp_HArray1OfPnt) GEOMAlgo_ShapeInfo::Poles() const
+{
+  return myPoles;
+}
+//=======================================================================
+//function : SetKnots
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetKnots(Handle(TColStd_HArray1OfReal) K)
+{
+  myKnots = K;
+}
+//=======================================================================
+//function : Knots
+//purpose  :
+//=======================================================================
+Handle(TColStd_HArray1OfReal) GEOMAlgo_ShapeInfo::Knots() const
+{
+  return myKnots;
+}
+//=======================================================================
+//function : SetWeights
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetWeights(Handle(TColStd_HArray1OfReal) W)
+{
+  myWeights = W;
+}
+//=======================================================================
+//function : Weights
+//purpose  :
+//=======================================================================
+Handle(TColStd_HArray1OfReal) GEOMAlgo_ShapeInfo::Weights() const
+{
+  return myWeights;
+}
+//=======================================================================
+//function : SetMultiplicities
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetMultiplicities(Handle(TColStd_HArray1OfInteger) M)
+{
+  myMultiplicities = M;
+}
+//=======================================================================
+//function : Multiplicities
+//purpose  :
+//=======================================================================
+Handle(TColStd_HArray1OfInteger) GEOMAlgo_ShapeInfo::Multiplicities() const
+{
+  return myMultiplicities;
+}
+//=======================================================================
 //function : TypeToInteger
 //purpose  :
 //=======================================================================
@@ -711,6 +883,7 @@ void GEOMAlgo_ShapeInfo::DumpEdge()const
   GEOMAlgo_KindOfName aKN;
   GEOMAlgo_KindOfBounds aKB;
   GEOMAlgo_KindOfClosed aKC;
+  GEOMAlgo_KindOfPeriod aKP;
   //
   aNbV=NbSubShapes(TopAbs_VERTEX);
   aKS=KindOfShape();
@@ -770,6 +943,84 @@ void GEOMAlgo_ShapeInfo::DumpEdge()const
     myPnt2.Coord(aX, aY, aZ);
     printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
   }
+  else if (aKN==GEOMAlgo_KN_CURVEBSPLINE) {
+    aKP=KindOfPeriod();
+    DumpKindOfPeriod(aKP);
+    printf("  Degree    : %d\n", myDegree);
+    printf("  NbPoles   : %d\n", myNbPoles);
+    printf("  NbKnots   : %d\n", myNbKnots);
+    printf("  NbWeights : %d\n", myNbWeights);
+    printf("  NbMultis  : %d\n", myNbMultiplicities);
+
+    if (aKB == GEOMAlgo_KB_TRIMMED) {
+      myPnt1.Coord(aX, aY, aZ);
+      printf("  Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
+      myPnt2.Coord(aX, aY, aZ);
+      printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
+    }
+
+    Standard_Integer i;
+    if (myNbPoles > 0 && !myPoles.IsNull() && myPoles->Length() == myNbPoles) {
+      bool aHasWeight = (myNbWeights == myNbPoles);
+      printf("  Poles\n");
+      for (i=1; i<=myNbPoles; i++) {
+        const gp_Pnt &aP = myPoles->Value(i);
+        if (aHasWeight)
+          printf("  %3d : %.3lf %.3lf %.3lf  %.3lf\n", i, aP.X(), aP.Y(), aP.Z(), myWeights->Value(i));
+        else
+          printf("  %3d : %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z());
+      }
+    }
+
+    if (myNbKnots > 0 && !myKnots.IsNull() && myKnots->Length() == myNbKnots) {
+      bool aHasMulti = (myNbMultiplicities == myNbKnots);
+      printf("  Knots\n");
+      for (i=1; i<=myNbKnots; i++) {
+        if (aHasMulti)
+          printf("  %3d : %.3lf  %.3lf\n", i, myKnots->Value(i), myMultiplicities->Value(i));
+        else
+          printf("  %3d : %.3lf\n", i, myKnots->Value(i));
+      }
+    }
+    
+  }
+  else if (aKN==GEOMAlgo_KN_CURVEBEZIER) {
+    aKP=KindOfPeriod();
+    DumpKindOfPeriod(aKP);
+    printf("  Degree    : %d\n", myDegree);
+    printf("  NbPoles   : %d\n", myNbPoles);
+    printf("  NbWeights : %d\n", myNbWeights);
+    if (aKB == GEOMAlgo_KB_TRIMMED) {
+      myPnt1.Coord(aX, aY, aZ);
+      printf("  Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
+      myPnt2.Coord(aX, aY, aZ);
+      printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
+    }
+
+    Standard_Integer i;
+    if (myNbPoles > 0 && !myPoles.IsNull() && myPoles->Length() == myNbPoles) {
+      bool aHasWeight = (myNbWeights == myNbPoles);
+      printf("  Poles\n");
+      for (i=1; i<=myNbPoles; i++) {
+        const gp_Pnt &aP = myPoles->Value(i);
+        if (aHasWeight)
+          printf("  %3d : %.3lf %.3lf %.3lf  %.3lf\n", i, aP.X(), aP.Y(), aP.Z(), myWeights->Value(i));
+        else
+          printf("  %3d : %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z());
+      }
+    }
+  }
+  else if (aKN==GEOMAlgo_KN_HYPERBOLA) {
+    DumpLocation (myLocation);
+    DumpPosition (myPosition);
+    printf("  Radius1   : %.3lf\n", myRadius1);
+    printf("  Radius2   : %.3lf\n", myRadius2);
+  }
+  else if (aKN==GEOMAlgo_KN_PARABOLA) {
+    DumpLocation (myLocation);
+    DumpPosition (myPosition);
+    printf("  Focal     : %.3lf\n", myRadius1);
+  }
   printf("\n");
 }
 //=======================================================================
@@ -869,7 +1120,10 @@ void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS)
     "KS_CIRCLE",
     "KS_LINE",
     "KS_DEGENERATED",
-    "KS_BSPLINE"
+    "KS_BSPLINE",
+    "KS_BEZIER",
+    "KS_HYPERBOLA",
+    "KS_PARABOLA"
     };
   int i;
   //
@@ -903,7 +1157,11 @@ void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
     "KN_TRIANGLE",
     "KN_QUADRANGLE",
     "KN_ARCELLIPSE",
-    "KN_SOLID"
+    "KN_SOLID",
+    "KN_CURVEBSPLINE",
+    "KN_CURVEBEZIER",
+    "KN_HYPERBOLA",
+    "KN_PARABOLA"
     };
   int i;
   //
@@ -919,10 +1177,26 @@ void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
   const char *pStr[]={
     "KD_UNKNOWN",
     "KD_SPECIFIED",
-    "KB_ARBITRARY"
+    "KD_ARBITRARY"
   };
   int i;
   //
   i=(Standard_Integer)aKD;
   printf(" KindOfDef: %s\n", pStr[i]);
 }
+//=======================================================================
+//function : DumpKindOfPeriod
+//purpose  :
+//=======================================================================
+void DumpKindOfPeriod(const GEOMAlgo_KindOfPeriod aKP)
+{
+  const char *pStr[]={
+    "KP_UNKNOWN",
+    "KP_PERIODIC",
+    "KP_NONPERIODIC"
+  };
+  int i;
+  //
+  i=(Standard_Integer)aKP;
+  printf(" KindOfPeriod: %s\n", pStr[i]);
+}
index 4d6ceb87fb56ffb83b4d3f420dd267fb64cdf14d..85241ddfcc04a2c88a5fb949a09a1e2b2f75e7a0 100644 (file)
 #include <GEOMAlgo_KindOfBounds.hxx>
 #include <GEOMAlgo_KindOfClosed.hxx>
 #include <GEOMAlgo_KindOfDef.hxx>
+#include <GEOMAlgo_KindOfPeriod.hxx>
+
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
 
 
 //=======================================================================
@@ -99,6 +104,12 @@ class GEOMAlgo_ShapeInfo
   Standard_EXPORT
     GEOMAlgo_KindOfDef KindOfDef() const;
 
+  Standard_EXPORT
+    void SetKindOfPeriod(const GEOMAlgo_KindOfPeriod aT) ;
+
+  Standard_EXPORT
+    GEOMAlgo_KindOfPeriod KindOfPeriod() const;
+
   Standard_EXPORT
     void SetLocation(const gp_Pnt& aP) ;
 
@@ -162,6 +173,60 @@ class GEOMAlgo_ShapeInfo
   Standard_EXPORT
     Standard_Real Height() const;
 
+  Standard_EXPORT
+    void SetDegree(const Standard_Integer aDeg) ;
+
+  Standard_EXPORT
+    Standard_Integer Degree() const;
+
+  Standard_EXPORT
+    void SetNbPoles(const Standard_Integer aNb) ;
+
+  Standard_EXPORT
+    Standard_Integer NbPoles() const;
+
+  Standard_EXPORT
+    void SetNbKnots(const Standard_Integer aNb) ;
+
+  Standard_EXPORT
+    Standard_Integer NbKnots() const;
+
+  Standard_EXPORT
+    void SetNbWeights(const Standard_Integer aNb) ;
+
+  Standard_EXPORT
+    Standard_Integer NbWeights() const;
+
+  Standard_EXPORT
+    void SetNbMultiplicities(const Standard_Integer aNb) ;
+
+  Standard_EXPORT
+    Standard_Integer NbMultiplicities() const;
+
+  Standard_EXPORT
+    void SetPoles(Handle(TColgp_HArray1OfPnt) P) ;
+
+  Standard_EXPORT
+    Handle(TColgp_HArray1OfPnt) Poles() const;
+
+  Standard_EXPORT
+    void SetKnots(Handle(TColStd_HArray1OfReal) K) ;
+
+  Standard_EXPORT
+    Handle(TColStd_HArray1OfReal) Knots() const;
+
+  Standard_EXPORT
+    void SetWeights(Handle(TColStd_HArray1OfReal) W) ;
+
+  Standard_EXPORT
+    Handle(TColStd_HArray1OfReal) Weights() const;
+
+  Standard_EXPORT
+    void SetMultiplicities(Handle(TColStd_HArray1OfInteger) M) ;
+
+  Standard_EXPORT
+    Handle(TColStd_HArray1OfInteger) Multiplicities() const;
+
   Standard_EXPORT
     void Dump() const;
 
@@ -208,6 +273,16 @@ class GEOMAlgo_ShapeInfo
   Standard_Real myHeight;
   gp_Pnt myPnt1;
   gp_Pnt myPnt2;
+  GEOMAlgo_KindOfPeriod myKindOfPeriod;
   Standard_Integer myNbTypes;
+  Standard_Integer myNbKnots;
+  Standard_Integer myNbPoles;
+  Standard_Integer myNbWeights;
+  Standard_Integer myNbMultiplicities;
+  Standard_Integer myDegree;
+  Handle(TColgp_HArray1OfPnt)      myPoles;
+  Handle(TColStd_HArray1OfReal)    myKnots;
+  Handle(TColStd_HArray1OfReal)    myWeights;
+  Handle(TColStd_HArray1OfInteger) myMultiplicities;
 };
 #endif
index 4ba1ec7902a9794f28df07e3ebf4afb775745caa..849b5a0c20091b00d381c7107a31f3cff571bf0b 100644 (file)
 #include <gp_Cone.hxx>
 #include <gp_Torus.hxx>
 #include <gp_Pln.hxx>
+#include <gp_Hypr.hxx>
+#include <gp_Parab.hxx>
 
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_BSplineCurve.hxx>
+#include <Geom_BezierCurve.hxx>
 
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAdaptor_Surface.hxx>
@@ -525,45 +528,122 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
   }
   // BSplineCurve
   if (aCT==GeomAbs_BSplineCurve) {
-    Standard_Integer aNbKnots, aNbPoles, aDegree;
+    Standard_Integer aNbKnots, aNbPoles, aNbWeights, aNbMultiplicities, aDegree, i;
     Standard_Real aLength;
     gp_XYZ aXYZ1, aXYZ2, aXYZc;
     Handle(Geom_BSplineCurve) aBSp;
     //
     aBSp=aGAC.BSpline();
-    aNbKnots=aBSp->NbKnots();
-    aNbPoles=aBSp->NbPoles();
-    aDegree =aBSp->Degree();
-    if (!(aDegree==1 && aNbKnots==2 && aNbPoles==2)) {
-      return; // unallowed B-Spline curve
+    aDegree = aBSp->Degree();
+    aNbPoles = aBSp->NbPoles();
+    aNbKnots = aBSp->NbKnots();
+    aNbWeights = (aBSp->IsRational() ? aNbPoles : 0);
+    aNbMultiplicities = (aBSp->KnotDistribution() == GeomAbs_Uniform ? 0 : aNbKnots);
+    if (aDegree==1 && aNbKnots==2 && aNbPoles==2) {
+      // This is a single line segment
+      aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
+      aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
+      //
+      aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+      aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT);
+      aGAC.D0(aT1, aP1);
+      aGAC.D0(aT2, aP2);
+      aInfo.SetPnt1(aP1);
+      aInfo.SetPnt2(aP2);
+      //
+      aLength=aP1.Distance(aP2);
+      aInfo.SetLength(aLength);
+      //
+      aXYZ1=aP1.XYZ();
+      aXYZ2=aP2.XYZ();
+      aXYZc=aXYZ1+aXYZ2;
+      aXYZc.Multiply(0.5);
+      aPc.SetXYZ(aXYZc);
+      aInfo.SetLocation(aPc);
+      //
+      if ( aLength >= gp::Resolution() ) {
+        gp_Vec aVec(aPc, aP2);
+        gp_Dir aDir(aVec);
+        aInfo.SetDirection(aDir);
+      }
     }
-    //
-    aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
-    aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
-    //
+    else {
+      // We have a higher degree B-Spline curve
+      aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
+      aInfo.SetKindOfName(GEOMAlgo_KN_CURVEBSPLINE);
+      aInfo.SetKindOfPeriod(aBSp->IsPeriodic() ? GEOMAlgo_KP_PERIODIC : GEOMAlgo_KP_NONPERIODIC);
+      aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+      aInfo.SetKindOfClosed(aBSp->IsClosed() ? GEOMAlgo_KC_CLOSED : GEOMAlgo_KC_NOTCLOSED);
+      aGAC.D0(aT1, aP1);
+      aGAC.D0(aT2, aP2);
+      aInfo.SetPnt1(aP1);
+      aInfo.SetPnt2(aP2);
+      //
+      aInfo.SetDegree(aDegree);
+      aInfo.SetNbKnots(aNbKnots);
+      aInfo.SetNbPoles(aNbPoles);
+      aInfo.SetNbWeights(aNbWeights);
+      aInfo.SetNbMultiplicities(aNbMultiplicities);
+      // Fill the poles
+      Handle(TColgp_HArray1OfPnt) poles = new TColgp_HArray1OfPnt(1, aNbPoles);
+      for (i=1; i<=aNbPoles; i++)
+        poles->SetValue(i, aBSp->Pole(i));
+      aInfo.SetPoles(poles);
+      // Fill the knots
+      Handle(TColStd_HArray1OfReal) knots = new TColStd_HArray1OfReal(1, aNbKnots);
+      for (i=1; i<=aNbKnots; i++)
+        knots->SetValue(i, aBSp->Knot(i));
+      aInfo.SetKnots(knots);
+      // Fill the weights
+      if (aNbWeights > 0) {
+        Handle(TColStd_HArray1OfReal) weights = new TColStd_HArray1OfReal(1, aNbWeights);
+        for (i=1; i<=aNbWeights; i++)
+          weights->SetValue(i, aBSp->Weight(i));
+        aInfo.SetWeights(weights);
+      }
+      // Fill the multiplicities
+      if (aNbMultiplicities > 0) {
+        Handle(TColStd_HArray1OfInteger) mults = new TColStd_HArray1OfInteger(1, aNbMultiplicities);
+        for (i=1; i<=aNbMultiplicities; i++)
+          mults->SetValue(i, aBSp->Multiplicity(i));
+        aInfo.SetMultiplicities(mults);
+      }
+    }
+  }//if (aCT==GeomAbs_BSplineCurve) {
+  // Bezier
+  else if (aCT==GeomAbs_BezierCurve) {
+    Standard_Integer aNbPoles, aNbWeights, aDegree, i;
+    Handle(Geom_BezierCurve) aBC;
+    aBC=aGAC.Bezier();
+    aNbPoles = aBC->NbPoles();
+    aNbWeights = (aBC->IsRational() ? aNbPoles : 0);
+    aDegree = aBC->Degree();
+    aInfo.SetKindOfShape(GEOMAlgo_KS_BEZIER);
+    aInfo.SetKindOfName(GEOMAlgo_KN_CURVEBEZIER);
+    aInfo.SetKindOfPeriod(aBC->IsPeriodic() ? GEOMAlgo_KP_PERIODIC : GEOMAlgo_KP_NONPERIODIC);
     aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
-    aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT);
+    aInfo.SetKindOfClosed(aBC->IsClosed() ? GEOMAlgo_KC_CLOSED : GEOMAlgo_KC_NOTCLOSED);
     aGAC.D0(aT1, aP1);
     aGAC.D0(aT2, aP2);
     aInfo.SetPnt1(aP1);
     aInfo.SetPnt2(aP2);
     //
-    aLength=aP1.Distance(aP2);
-    aInfo.SetLength(aLength);
-    //
-    aXYZ1=aP1.XYZ();
-    aXYZ2=aP2.XYZ();
-    aXYZc=aXYZ1+aXYZ2;
-    aXYZc.Multiply(0.5);
-    aPc.SetXYZ(aXYZc);
-    aInfo.SetLocation(aPc);
-    //
-    if ( aLength >= gp::Resolution() ) {
-      gp_Vec aVec(aPc, aP2);
-      gp_Dir aDir(aVec);
-      aInfo.SetDirection(aDir);
+    aInfo.SetDegree(aDegree);
+    aInfo.SetNbPoles(aNbPoles);
+    aInfo.SetNbWeights(aNbWeights);
+    // Fill the poles
+    Handle(TColgp_HArray1OfPnt) poles = new TColgp_HArray1OfPnt(1, aNbPoles);
+    for (i=1; i<=aNbPoles; i++)
+      poles->SetValue(i, aBC->Pole(i));
+    aInfo.SetPoles(poles);
+    // Fill the weights
+    if (aNbWeights > 0) {
+      Handle(TColStd_HArray1OfReal) weights = new TColStd_HArray1OfReal(1, aNbWeights);
+      for (i=1; i<=aNbWeights; i++)
+        weights->SetValue(i, aBC->Weight(i));
+      aInfo.SetWeights(weights);
     }
-  }
+  }// if (aCT==GeomAbs_BezierCurve) {
   // Line
   else if (aCT==GeomAbs_Line) {
     Standard_Boolean bInf1, bInf2;
@@ -684,13 +764,50 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
     else {
       aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
       aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE);
-      //
-      gp_Vec aVecX(aP, aP1);
-      gp_Dir aDirX(aVecX);
-      gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX);
-      aInfo.SetPosition(aAx2new);
     }
   }// else if (aCT==GeomAbs_Ellipse) {
+  // Hyperbola
+  else if (aCT==GeomAbs_Hyperbola) {
+    gp_Hypr aHyp;
+    aHyp=aGAC.Hyperbola();
+    aP=aHyp.Location();
+    aAx2=aHyp.Position();
+    aR1=aHyp.MajorRadius();
+    aR2=aHyp.MinorRadius();
+    aInfo.SetKindOfShape(GEOMAlgo_KS_HYPERBOLA);
+    aInfo.SetKindOfName(GEOMAlgo_KN_HYPERBOLA);
+    aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+    aInfo.SetLocation(aP);
+    aInfo.SetPosition(aAx2);
+    aInfo.SetRadius1(aR1);
+    aInfo.SetRadius2(aR2);
+    //
+    aGAC.D0(aT1, aP1);
+    aGAC.D0(aT2, aP2);
+    aInfo.SetPnt1(aP1);
+    aInfo.SetPnt2(aP2);
+    //
+  }// if (aCT==GeomAbs_Hyperbola) {
+  // Parabola
+  else if (aCT==GeomAbs_Parabola) {
+    gp_Parab aPara;
+    aPara=aGAC.Parabola();
+    aP=aPara.Location();
+    aAx2=aPara.Position();
+    aR1=aPara.Focal();
+    aInfo.SetKindOfShape(GEOMAlgo_KS_PARABOLA);
+    aInfo.SetKindOfName(GEOMAlgo_KN_PARABOLA);
+    aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
+    aInfo.SetLocation(aP);
+    aInfo.SetPosition(aAx2);
+    aInfo.SetRadius1(aR1);
+    //
+    aGAC.D0(aT1, aP1);
+    aGAC.D0(aT2, aP2);
+    aInfo.SetPnt1(aP1);
+    aInfo.SetPnt2(aP2);
+    //
+  }// if (aCT==GeomAbs_Parabola) {
   //
   FillSubShapes(aS);
 }
@@ -807,7 +924,10 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
     GeomAbs_Line,
     GeomAbs_Circle,
     GeomAbs_Ellipse,
-    GeomAbs_BSplineCurve 
+    GeomAbs_BSplineCurve,
+    GeomAbs_BezierCurve,
+    GeomAbs_Hyperbola,
+    GeomAbs_Parabola
   };
   //
   bRet=Standard_False;
index ef60422441f336c2573bee02f52d93374018b31f..ba2b35507af1c3335a795b87c48b83ab96b96288 100644 (file)
@@ -515,6 +515,14 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_CREATE_SINGLE_SOLID</source>
         <translation>Create a single solid</translation>
     </message>
+    <message>
+        <source>GEOM_CRV_BEZIER</source>
+        <translation>Bézier Curve</translation>
+    </message>
+    <message>
+        <source>GEOM_CRV_BSPLINE</source>
+        <translation>B-Spline Curve</translation>
+    </message>
     <message>
         <source>GEOM_CURVE</source>
         <translation>Curve</translation>
@@ -555,6 +563,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_D2</source>
         <translation>D2 :</translation>
     </message>
+    <message>
+        <source>GEOM_DEGREE</source>
+        <translation>Degree :</translation>
+    </message>
     <message>
         <source>GEOM_DETECT</source>
         <translation>Detect</translation>
@@ -864,6 +876,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_FILLING_TOL_3D</source>
         <translation>Tol. 3D :</translation>
     </message>
+    <message>
+        <source>GEOM_FOCAL_LENGTH</source>
+        <translation>Focal Length :</translation>
+    </message>
     <message>
         <source>GEOM_FREE_BOUNDARIES</source>
         <translation>Free boundaries</translation>
@@ -948,6 +964,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_HOLES</source>
         <translation>Holes</translation>
     </message>
+    <message>
+        <source>GEOM_HYPERBOLA</source>
+        <translation>Hyperbola</translation>
+    </message>
     <message>
         <source>GEOM_INIT_SHAPE</source>
         <translation>Initial shape</translation>
@@ -988,6 +1008,14 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_KEEP_OBJECT</source>
         <translation>Keep Object</translation>
     </message>
+    <message>
+        <source>GEOM_KNOT_I</source>
+        <translation>Knot #%1 :</translation>
+    </message>
+    <message>
+        <source>GEOM_KNOTS</source>
+        <translation>Knots</translation>
+    </message>
     <message>
         <source>GEOM_LENGTH</source>
         <translation>Length :</translation>
@@ -1224,10 +1252,30 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_NODES</source>
         <translation>Nodes</translation>
     </message>
+    <message>
+        <source>GEOM_NON_PERIODIC</source>
+        <translation>Non-Periodic</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_KNOTS</source>
+        <translation>Number of knots :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_MULTIS</source>
+        <translation>Number of multiplicities :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_POLES</source>
+        <translation>Number of poles :</translation>
+    </message>
     <message>
         <source>GEOM_NUM_SPLIT_POINTS</source>
         <translation>Number of splitting points</translation>
     </message>
+    <message>
+        <source>GEOM_NUM_WEIGHTS</source>
+        <translation>Number of weights :</translation>
+    </message>
     <message>
         <source>GEOM_OBJECT</source>
         <translation>Object</translation>
@@ -1256,10 +1304,34 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_OFFSET_TITLE</source>
         <translation>Offset Surface</translation>
     </message>
+    <message>
+        <source>GEOM_PARABOLA</source>
+        <translation>Parabola</translation>
+    </message>
+    <message>
+        <source>GEOM_PARAMETERS</source>
+        <translation>Parameters</translation>
+    </message>
     <message>
         <source>GEOM_PATTERN</source>
         <translation>Division pattern</translation>
     </message>
+    <message>
+        <source>GEOM_PERIODIC</source>
+        <translation>Periodic</translation>
+    </message>
+    <message>
+        <source>GEOM_PERIODICITY</source>
+        <translation>Periodicity : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLE_I</source>
+        <translation>Pole #%1 : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLES</source>
+        <translation>Poles</translation>
+    </message>
     <message>
         <source>GEOM_PROJECTION_ON_FACE</source>
         <translation>Projection on Face</translation>
index b58f0550b41a0b04c9f6c0061e77a01904ff5759..b611742232736ea7d01955d7bf40dcb55ccb651a 100644 (file)
@@ -515,6 +515,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_CREATE_SINGLE_SOLID</source>
         <translation>Créer un solide unique</translation>
     </message>
+    <message>
+        <source>GEOM_CRV_BEZIER</source>
+        <translation>Courbe de Bézier</translation>
+    </message>
+    <message>
+        <source>GEOM_CRV_BSPLINE</source>
+        <translation>Courbe B-Spline</translation>
+    </message>
     <message>
         <source>GEOM_CURVE</source>
         <translation>Courbe</translation>
@@ -555,6 +563,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_D2</source>
         <translation>D2 :</translation>
     </message>
+    <message>
+        <source>GEOM_DEGREE</source>
+        <translation>Degré :</translation>
+    </message>
     <message>
         <source>GEOM_DETECT</source>
         <translation>Détecter</translation>
@@ -864,6 +876,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_FILLING_TOL_3D</source>
         <translation>Tol. 3D :</translation>
     </message>
+    <message>
+        <source>GEOM_FOCAL_LENGTH</source>
+        <translation>Distance Focale :</translation>
+    </message>
     <message>
         <source>GEOM_FREE_BOUNDARIES</source>
         <translation>Contours libres</translation>
@@ -948,6 +964,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_HOLES</source>
         <translation>Trous</translation>
     </message>
+    <message>
+        <source>GEOM_HYPERBOLA</source>
+        <translation>Hyperbole</translation>
+    </message>
     <message>
         <source>GEOM_INIT_SHAPE</source>
         <translation>Objet d&apos;origine</translation>
@@ -988,6 +1008,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_KEEP_OBJECT</source>
         <translation>Garder l&apos;objet</translation>
     </message>
+    <message>
+        <source>GEOM_KNOT_I</source>
+        <translation>Noeud #%1 :</translation>
+    </message>
+    <message>
+        <source>GEOM_KNOTS</source>
+        <translation>Noeuds</translation>
+    </message>
     <message>
         <source>GEOM_LENGTH</source>
         <translation>Longueur :</translation>
@@ -1224,10 +1252,30 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_NODES</source>
         <translation>Noeuds</translation>
     </message>
+    <message>
+        <source>GEOM_NON_PERIODIC</source>
+        <translation>Non Périodique</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_KNOTS</source>
+        <translation>Nombre de Noeuds :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_MULTIS</source>
+        <translation>Nombre de Multiplicités :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_POLES</source>
+        <translation>Nombre de Pôles :</translation>
+    </message>
     <message>
         <source>GEOM_NUM_SPLIT_POINTS</source>
         <translation>Nombre de points de découpe</translation>
     </message>
+    <message>
+        <source>GEOM_NUM_WEIGHTS</source>
+        <translation>Nombre de Poids :</translation>
+    </message>
     <message>
         <source>GEOM_OBJECT</source>
         <translation>Objet</translation>
@@ -1256,10 +1304,34 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_OFFSET_TITLE</source>
         <translation>Décaler une surface</translation>
     </message>
+    <message>
+        <source>GEOM_PARABOLA</source>
+        <translation>Parabole</translation>
+    </message>
+    <message>
+        <source>GEOM_PARAMETERS</source>
+        <translation>Paramètres</translation>
+    </message>
     <message>
         <source>GEOM_PATTERN</source>
         <translation>Schema de découpe</translation>
     </message>
+    <message>
+        <source>GEOM_PERIODIC</source>
+        <translation>Périodique</translation>
+    </message>
+    <message>
+        <source>GEOM_PERIODICITY</source>
+        <translation>Périodicité : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLE_I</source>
+        <translation>Pôle #%1 : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLES</source>
+        <translation>Pôles</translation>
+    </message>
     <message>
         <source>GEOM_PROJECTION_ON_FACE</source>
         <translation>Projection sur une face</translation>
index 6fbd8f6ef66747ab7637fe88cf32520099e612bc..a485d6a7d45fc643f9fa95dd553dd214f093a260 100644 (file)
       <source>GEOM_CREATE_SINGLE_SOLID</source>
       <translation>1 つのソリッドを作成します。</translation>
     </message>
+    <message>
+        <source>GEOM_CRV_BEZIER</source>
+        <translation>ベジェ曲線</translation>
+    </message>
+    <message>
+        <source>GEOM_CRV_BSPLINE</source>
+        <translation>B-スプライン曲線</translation>
+    </message>
     <message>
       <source>GEOM_CURVE</source>
       <translation>Curve</translation>
       <source>GEOM_D2</source>
       <translation>D2:</translation>
     </message>
+    <message>
+        <source>GEOM_DEGREE</source>
+        <translation>程度 :</translation>
+    </message>
     <message>
       <source>GEOM_DETECT</source>
       <translation>検出</translation>
       <source>GEOM_FILLING_TOL_3D</source>
       <translation>Tol. 3D :</translation>
     </message>
+    <message>
+        <source>GEOM_FOCAL_LENGTH</source>
+        <translation>焦点距離 :</translation>
+    </message>
     <message>
       <source>GEOM_FREE_BOUNDARIES</source>
       <translation>自由境界</translation>
       <source>GEOM_HOLES</source>
       <translation>穴</translation>
     </message>
+    <message>
+        <source>GEOM_HYPERBOLA</source>
+        <translation>双曲線</translation>
+    </message>
     <message>
       <source>GEOM_INIT_SHAPE</source>
       <translation>元のオブジェクト</translation>
       <source>GEOM_KEEP_OBJECT</source>
       <translation>オブジェクトを維持します。</translation>
     </message>
+    <message>
+        <source>GEOM_KNOT_I</source>
+        <translation>結び目 #%1 :</translation>
+    </message>
+    <message>
+        <source>GEOM_KNOTS</source>
+        <translation>結び目</translation>
+    </message>
     <message>
       <source>GEOM_LENGTH</source>
       <translation>長さ:</translation>
       <source>GEOM_NODES</source>
       <translation>節点</translation>
     </message>
+    <message>
+        <source>GEOM_NON_PERIODIC</source>
+        <translation>非定期的</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_KNOTS</source>
+        <translation>ノット数 :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_MULTIS</source>
+        <translation>多重度の数 :</translation>
+    </message>
+    <message>
+        <source>GEOM_NUM_POLES</source>
+        <translation>極数 :</translation>
+    </message>
     <message>
       <source>GEOM_NUM_SPLIT_POINTS</source>
       <translation>分割点の数</translation>
     </message>
+    <message>
+        <source>GEOM_NUM_WEIGHTS</source>
+        <translation>ウェイトの数 :</translation>
+    </message>
     <message>
       <source>GEOM_OBJECT</source>
       <translation>オブジェクト</translation>
       <source>GEOM_OFFSET_TITLE</source>
       <translation>サーフェスをオフセット</translation>
     </message>
+    <message>
+        <source>GEOM_PARABOLA</source>
+        <translation>放物線</translation>
+    </message>
+    <message>
+        <source>GEOM_PARAMETERS</source>
+        <translation>パラメーター</translation>
+    </message>
     <message>
       <source>GEOM_PATTERN</source>
       <translation>加工図</translation>
     </message>
+    <message>
+        <source>GEOM_PERIODIC</source>
+        <translation>定期的</translation>
+    </message>
+    <message>
+        <source>GEOM_PERIODICITY</source>
+        <translation>周期性 : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLE_I</source>
+        <translation>極 #%1 : </translation>
+    </message>
+    <message>
+        <source>GEOM_POLES</source>
+        <translation>極</translation>
+    </message>
     <message>
       <source>GEOM_PROJECTION_ON_FACE</source>
       <translation>面上の投影</translation>
index beac051267e44d3b4f8b9923db2f39b9add50989..7f6fbf71decf454f800d85e6714f580bc9a538fa 100644 (file)
@@ -646,7 +646,7 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape
         break;
       case GEOMAlgo_KN_ELLIPSE:
         {
-          // (+) geompy.kind.ELLIPSE  xc yc zc  dx dy dz  R_1 R_2
+          // (+) geompy.kind.ELLIPSE  xc yc zc  dx dy dz  R_1 R_2  xVx yVx zVx  xVy yVy zVy
           aKind = SK_ELLIPSE;
 
           gp_Pnt aC = anInfo.Location();
@@ -662,11 +662,21 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape
 
           theDoubles->Append(anInfo.Radius1());
           theDoubles->Append(anInfo.Radius2());
+
+          gp_Dir aXD = anAx3.XDirection();
+          theDoubles->Append(aXD.X());
+          theDoubles->Append(aXD.Y());
+          theDoubles->Append(aXD.Z());
+
+          gp_Dir aYD = anAx3.YDirection();
+          theDoubles->Append(aYD.X());
+          theDoubles->Append(aYD.Y());
+          theDoubles->Append(aYD.Z());
         }
         break;
       case GEOMAlgo_KN_ARCELLIPSE:
         {
-          // (+) geompy.kind.ARC_ELLIPSE  xc yc zc  dx dy dz  R_1 R_2  x1 y1 z1  x2 y2 z2
+          // (+) geompy.kind.ARC_ELLIPSE  xc yc zc  dx dy dz  R_1 R_2  x1 y1 z1  x2 y2 z2  xVx yVx zVx  xVy yVy zVy
           aKind = SK_ARC_ELLIPSE;
 
           gp_Pnt aC = anInfo.Location();
@@ -692,6 +702,16 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape
           theDoubles->Append(aP2.X());
           theDoubles->Append(aP2.Y());
           theDoubles->Append(aP2.Z());
+
+          gp_Dir aXD = anAx3.XDirection();
+          theDoubles->Append(aXD.X());
+          theDoubles->Append(aXD.Y());
+          theDoubles->Append(aXD.Z());
+
+          gp_Dir aYD = anAx3.YDirection();
+          theDoubles->Append(aYD.X());
+          theDoubles->Append(aYD.Y());
+          theDoubles->Append(aYD.Z());
         }
         break;
       case GEOMAlgo_KN_LINE:
@@ -727,6 +747,163 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape
           theDoubles->Append(aP2.Z());
         }
         break;
+      case GEOMAlgo_KN_CURVEBSPLINE:
+        {
+          // (+) geompy.kind.CRV_BSPLINE  p d np nk nw nm  x1 y1 z1 ... xnp ynp znp  k1 ... knk  w1 ... wnw  m1 ... mnm
+          aKind = SK_CRV_BSPLINE;
+          Standard_Integer aNbPoles = anInfo.NbPoles();
+          Standard_Integer aNbKnots = anInfo.NbKnots();
+          Standard_Integer aNbWeights = anInfo.NbWeights();
+          Standard_Integer aNbMultiplicities = anInfo.NbMultiplicities();
+
+          theIntegers->Append(anInfo.KindOfPeriod() == GEOMAlgo_KP_PERIODIC ? 1 : 0);
+          theIntegers->Append(anInfo.Degree());
+          theIntegers->Append(aNbPoles);
+          theIntegers->Append(aNbKnots);
+          theIntegers->Append(aNbWeights);
+          theIntegers->Append(aNbMultiplicities);
+          //
+          Standard_Integer i;
+          if (aNbPoles > 0) {
+            Handle(TColgp_HArray1OfPnt) aPoles = anInfo.Poles();
+            if (aPoles.IsNull() || aPoles->Length() != aNbPoles) {
+              SetErrorCode("B-Spline Curve: no or wrong number of poles given");
+              return aKind;
+            }
+            for (i=1; i<=aNbPoles; i++) {
+              const gp_Pnt &aP = aPoles->Value(i);
+              theDoubles->Append(aP.X());
+              theDoubles->Append(aP.Y());
+              theDoubles->Append(aP.Z());
+            }
+          }
+          //
+          if (aNbKnots > 0) {
+            Handle(TColStd_HArray1OfReal) aKnots = anInfo.Knots();
+            if (aKnots.IsNull() || aKnots->Length() != aNbKnots) {
+              SetErrorCode("B-Spline Curve: no or wrong number of knots given");
+              return aKind;
+            }
+            for (i=1; i<=aNbKnots; i++)
+              theDoubles->Append(aKnots->Value(i));
+          }
+          //
+          if (aNbWeights > 0) {
+            Handle(TColStd_HArray1OfReal) aWeights = anInfo.Weights();
+            if (aNbWeights > 0 && (aWeights.IsNull() || aWeights->Length() != aNbWeights)) {
+              SetErrorCode("B-Spline Curve: no or wrong number of weights given");
+              return aKind;
+            }
+            for (i=1; i<=aNbWeights; i++)
+              theDoubles->Append(aWeights->Value(i));
+          }
+          //
+          if (aNbMultiplicities > 0) {
+            Handle(TColStd_HArray1OfInteger) aMults = anInfo.Multiplicities();
+            if (aMults.IsNull() || aMults->Length() != aNbMultiplicities) {
+              SetErrorCode("B-Spline Curve: no or wrong number of multiplicities given");
+              return aKind;
+            }
+            for (i=1; i<=aNbMultiplicities; i++)
+              theIntegers->Append(aMults->Value(i));
+          }
+        }
+        break;
+      case GEOMAlgo_KN_CURVEBEZIER:
+        {
+          // (+) geompy.kind.CRV_BEZIER  np nw  x1 y1 z1 ... xnp ynp znp  w1 ... wnw
+          aKind = SK_CRV_BEZIER;
+          Standard_Integer aNbPoles = anInfo.NbPoles();
+          Standard_Integer aNbWeights = anInfo.NbWeights();
+
+          theIntegers->Append(aNbPoles);
+          theIntegers->Append(aNbWeights);
+          //
+          Standard_Integer i;
+          if (aNbPoles > 0) {
+            Handle(TColgp_HArray1OfPnt) aPoles = anInfo.Poles();
+            if (aPoles.IsNull() || aPoles->Length() != aNbPoles) {
+              SetErrorCode("Bezier Curve: no or wrong number of poles given");
+              return aKind;
+            }
+            for (i=1; i<=aNbPoles; i++) {
+              const gp_Pnt &aP = aPoles->Value(i);
+              theDoubles->Append(aP.X());
+              theDoubles->Append(aP.Y());
+              theDoubles->Append(aP.Z());
+            }
+          }
+          //
+          if (aNbWeights > 0) {
+            Handle(TColStd_HArray1OfReal) aWeights = anInfo.Weights();
+            if (aNbWeights > 0 && (aWeights.IsNull() || aWeights->Length() != aNbWeights)) {
+              SetErrorCode("B-Spline Curve: no or wrong number of weights given");
+              return aKind;
+            }
+            for (i=1; i<=aNbWeights; i++)
+              theDoubles->Append(aWeights->Value(i));
+          }
+        }
+        break;
+      case GEOMAlgo_KN_HYPERBOLA:
+        {
+          // (+) geompy.kind.HYPERBOLA  xc yc zc  dx dy dz  R_1 R_2  xVx yVx zVx  xVy yVy zVy
+          aKind = SK_HYPERBOLA;
+
+          gp_Pnt aC = anInfo.Location();
+          theDoubles->Append(aC.X());
+          theDoubles->Append(aC.Y());
+          theDoubles->Append(aC.Z());
+
+          gp_Ax3 anAx3 = anInfo.Position();
+          gp_Dir aD = anAx3.Direction();
+          theDoubles->Append(aD.X());
+          theDoubles->Append(aD.Y());
+          theDoubles->Append(aD.Z());
+
+          theDoubles->Append(anInfo.Radius1());
+          theDoubles->Append(anInfo.Radius2());
+
+          gp_Dir aXD = anAx3.XDirection();
+          theDoubles->Append(aXD.X());
+          theDoubles->Append(aXD.Y());
+          theDoubles->Append(aXD.Z());
+
+          gp_Dir aYD = anAx3.YDirection();
+          theDoubles->Append(aYD.X());
+          theDoubles->Append(aYD.Y());
+          theDoubles->Append(aYD.Z());
+        }
+        break;
+      case GEOMAlgo_KN_PARABOLA:
+        {
+          // (+) geompy.kind.PARABOLA  xc yc zc  dx dy dz  F  xVx yVx zVx  xVy yVy zVy
+          aKind = SK_PARABOLA;
+
+          gp_Pnt aC = anInfo.Location();
+          theDoubles->Append(aC.X());
+          theDoubles->Append(aC.Y());
+          theDoubles->Append(aC.Z());
+
+          gp_Ax3 anAx3 = anInfo.Position();
+          gp_Dir aD = anAx3.Direction();
+          theDoubles->Append(aD.X());
+          theDoubles->Append(aD.Y());
+          theDoubles->Append(aD.Z());
+
+          theDoubles->Append(anInfo.Radius1());
+
+          gp_Dir aXD = anAx3.XDirection();
+          theDoubles->Append(aXD.X());
+          theDoubles->Append(aXD.Y());
+          theDoubles->Append(aXD.Z());
+
+          gp_Dir aYD = anAx3.YDirection();
+          theDoubles->Append(aYD.X());
+          theDoubles->Append(aYD.Y());
+          theDoubles->Append(aYD.Z());
+        }
+        break;
       default:
         // ??? geompy.kind.EDGE  nb_vertices _curve_type_id_
         // (+) geompy.kind.EDGE  nb_vertices
@@ -2855,8 +3032,8 @@ Handle(TColStd_HArray1OfReal) GEOMImpl_IMeasureOperations::XYZtoUV
   }
 
   // Face tolerance
-  Standard_Real squareTolerance = BRep_Tool::Tolerance(F);
-  squareTolerance = squareTolerance * squareTolerance;
+  Standard_Real aTol = BRep_Tool::Tolerance(F);
+  Standard_Real squareTolerance = aTol * aTol;
 
   // Compute parameters
   Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
@@ -2872,19 +3049,25 @@ Handle(TColStd_HArray1OfReal) GEOMImpl_IMeasureOperations::XYZtoUV
     gp_Pnt aP (theXYZlist->Value(iCLower + iP * 3),
                theXYZlist->Value(iCLower + iP * 3 + 1),
                theXYZlist->Value(iCLower + iP * 3 + 2));
-    Standard_Real U, V;
-    gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V);
-    if (aP.SquareDistance(aPonF) < squareTolerance) {
-      if (isNormalized) {
-        // Normalize parameters to be in [0, 1]
-        U = (U - U1) / dU;
-        V = (V - V1) / dV;
+    try { // as GEOMUtils::ProjectPointOnFace can throw exceptions
+      Standard_Real U, V;
+      gp_Pnt aPonF = GEOMUtils::ProjectPointOnFace(aP, F, U, V, aTol);
+      if (aP.SquareDistance(aPonF) < squareTolerance) {
+        if (isNormalized) {
+          // Normalize parameters to be in [0, 1]
+          U = (U - U1) / dU;
+          V = (V - V1) / dV;
+        }
+        aRet->SetValue(iP * 2    , U);
+        aRet->SetValue(iP * 2 + 1, V);
+      }
+      else {
+        SetErrorCode("Point too far from face");
+        return aRet;
       }
-      aRet->SetValue(iP * 2    , U);
-      aRet->SetValue(iP * 2 + 1, V);
     }
-    else {
-      SetErrorCode("Point too far from face");
+    catch (Standard_Failure& aFail) {
+      SetErrorCode(aFail.GetMessageString());
       return aRet;
     }
   }
index a05fa304bd4937948219d6486de85da78ee79e8c..d80bef1eb77c93d8645c8dc7d7c408f47db7d035 100644 (file)
@@ -78,6 +78,10 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
     SK_ARC_ELLIPSE,  // arc of ellipse
     SK_LINE,         // infinite segment
     SK_SEGMENT,      // segment
+    SK_CRV_BSPLINE,  // B-Spline curve (open or closed)
+    SK_CRV_BEZIER,   // Bezier curve (open or closed)
+    SK_HYPERBOLA,    // hyperbola
+    SK_PARABOLA,     // parabola
     SK_EDGE,         // other edge
     // VERTEX
     SK_VERTEX,       // vertex
index 07fdcce7d3f4468126426896dbaa092859e2f96d..8e4f1075ac2272d97ba73005e78a367c978c8168 100644 (file)
@@ -1032,7 +1032,8 @@ Standard_Real GEOMUtils::GetMinDistance
 //=======================================================================
 gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
                                      const TopoDS_Shape& theFace,
-                                     double& theU, double& theV)
+                                     double& theU, double& theV,
+                                     const double theTol)
 {
   if (theFace.IsNull() || theFace.ShapeType() != TopAbs_FACE)
     Standard_TypeMismatch::Raise
@@ -1044,7 +1045,7 @@ gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
   BRepTools::UVBounds(aFace, U1, U2, V1, V2);
 
   // projector
-  Standard_Real tol = 1.e-4;        
+  Standard_Real tol = Max(theTol, 1.e-4);
   GeomAPI_ProjectPointOnSurf proj;
   proj.Init(surface, U1, U2, V1, V2, tol);
   proj.Perform(thePoint);
index 644e048522b7ea9c2d1c614154c648f2e8b67cca..5ca3d2e9930237b7ac109fd5594729e86313d53c 100644 (file)
@@ -74,13 +74,13 @@ namespace GEOMUtils
    * \brief Compute numerical functor for the shape.
    *
    * Resulting value can be used to sort out shapes according to some parameter.
-   * 
+   *
    * Returns a pair of two values (dist, functor) where
    * - \a dist is a some value that is computed according to the center of mass of given shape;
    * - \a functor is a numerical functor value
    *
    * The numerical functor is computed according to the shape's topological properties as follows:
-   * - orientation for vertices 
+   * - orientation for vertices
    * - length for edges and wires
    * - area for faces and shells
    * - volume for solids, compounds, compsolids
@@ -161,7 +161,7 @@ namespace GEOMUtils
    * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
    */
   Standard_EXPORT bool CheckTriangulation (const TopoDS_Shape& theShape);
-  
+
   /*!
    * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
    * \param theShape The shape to get type of.
@@ -201,7 +201,7 @@ namespace GEOMUtils
   Standard_EXPORT Standard_Real GetMinDistanceSingular(const TopoDS_Shape& aSh1,
                                                       const TopoDS_Shape& aSh2,
                                                       gp_Pnt& Ptmp1, gp_Pnt& Ptmp2);
-  
+
   /*!
    * \brief Computes minumal distance between two shapes.
    *
@@ -214,7 +214,7 @@ namespace GEOMUtils
   Standard_EXPORT Standard_Real GetMinDistance(const TopoDS_Shape& theShape1,
                                               const TopoDS_Shape& theShape2,
                                               gp_Pnt& thePnt1, gp_Pnt& thePnt2);
-  
+
   /*!
    * \brief Computes normal projection of \a thePoint to \a theFace.
    *
@@ -222,12 +222,14 @@ namespace GEOMUtils
    * \param theFace the face shape
    * \param theU the output U parameter of the point on the face
    * \param theV the output V parameter of the point on the face
+   * \param theTol the tolerance value. Maximum of theTol and 1e-04 will be used for calculation.
    * \retval the projection (3d point) if found, throws an exception otherwise
    */
   Standard_EXPORT gp_Pnt ProjectPointOnFace(const gp_Pnt& thePoint,
                                             const TopoDS_Shape& theFace,
-                                            double& theU, double& theV);
-  
+                                            double& theU, double& theV,
+                                            const double theTol = 1e-04);
+
   /*!
    * \brief Returns the point clicked in 3D view.
    *
@@ -274,7 +276,7 @@ namespace GEOMUtils
    *         operation or \c false otherwise
    */
   Standard_EXPORT bool CheckBOPArguments(const TopoDS_Shape &theShape);
-  
+
   /*!
    * \brief Limit shape tolerance to the given value
    *
@@ -312,13 +314,13 @@ namespace GEOMUtils
 
   /*!
    * \brief Fix curves of the given shape
-   * 
+   *
    * The function checks each curve of the input shape in the following way:
    * - compute deviation of the curve from the underlying surface in a set of points
    *   computed with the certain discretization step value
    * - find maximum tolerance between computed deviation values
    * - limit tolerance of the curve with the computed maximum value
-   * 
+   *
    * \param shape shape being fixed
    * \return \c true if resulting shape is valid
    */
@@ -332,7 +334,7 @@ namespace GEOMUtils
    */
   Standard_EXPORT bool Write( const TopoDS_Shape& shape,
                               const char* fileName );
-  
+
   /*!
    * \brief Extract single SOLID from COMPSOLID or COMPOUND.
    *
index abac2a69747e1268ca5b0c68843713826b0996e3..1165090d2b33c48ea8ba97efc156f32812cfc73c 100644 (file)
@@ -2854,6 +2854,18 @@ char* GEOM_Gen_i::getObjectInfo(const char* entry)
       case GEOM::GEOM_IKindOfShape::SEGMENT:
         aTypeInfo = "Segment";
         break;
+      case GEOM::GEOM_IKindOfShape::CRV_BSPLINE:
+        aTypeInfo = "Crv BSpline";
+        break;
+      case GEOM::GEOM_IKindOfShape::CRV_BEZIER:
+        aTypeInfo = "Crv Bezier";
+        break;
+      case GEOM::GEOM_IKindOfShape::HYPERBOLA:
+        aTypeInfo = "Hyperbola";
+        break;
+      case GEOM::GEOM_IKindOfShape::PARABOLA:
+        aTypeInfo = "Parabola";
+        break;
       case GEOM::GEOM_IKindOfShape::EDGE:
         aTypeInfo = "Edge";
         break;
index 0320c9c1e82ac4ea1d315e4a28c5dd6b76196a20..a7f96b02995aa4e041cb46db55a3980207a3e1d0 100644 (file)
@@ -683,10 +683,14 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
         #
         #  - CIRCLE:       [xc yc zc  dx dy dz  R]
         #  - ARC_CIRCLE:   [xc yc zc  dx dy dz  R         x1 y1 z1  x2 y2 z2]
-        #  - ELLIPSE:      [xc yc zc  dx dy dz  R_1  R_2]
-        #  - ARC_ELLIPSE:  [xc yc zc  dx dy dz  R_1  R_2  x1 y1 z1  x2 y2 z2]
+        #  - ELLIPSE:      [xc yc zc  dx dy dz  R_1  R_2  v1x v1y v1z  v2x v2y v2z]
+        #  - ARC_ELLIPSE:  [xc yc zc  dx dy dz  R_1  R_2  x1 y1 z1  x2 y2 z2  v1x v1y v1z  v2x v2y v2z]
         #  - LINE:         [xo yo zo  dx dy dz]
         #  - SEGMENT:      [x1 y1 z1  x2 y2 z2]
+        #  - CRV_BSPLINE:  [periodicity degree nb_poles nb_knots nb_weights nb_multiplicities  xi yi zi  ki  wi  mi]
+        #  - CRV_BEZIER:   [nb_poles nb_weights  xi yi zi  wi]
+        #  - HYPERBOLA:    [xc yc zc  dx dy dz  R_1  R_2  v1x v1y v1z  v2x v2y v2z]
+        #  - PARABOLA:     [xc yc zc  dx dy dz  F  v1x v1y v1z  v2x v2y v2z]
         #  - EDGE:                                                 [nb_vertices]
         #
         #  - VERTEX:       [x  y  z]
@@ -11852,6 +11856,10 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
             #if aKind == kind.SOME_KIND:
             #    #  SOME_KIND     int int double int double double
             #    aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
+            if aKind == self.kind.CRV_BSPLINE:
+               aKindTuple = [aKind] + anInts[:6] + aDbls + anInts[6:]
+            elif aKind == self.kind.CRV_BEZIER:
+               aKindTuple = [aKind] + anInts[:2] + aDbls + anInts[2:]
 
             return aKindTuple
 
index 164ca2702d8926c63fd31b0f9c05c3b39b88cc04..16b9d534f6185878a2fd4829b6e8cabc62c8037b 100644 (file)
@@ -263,6 +263,7 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
     return aKindStr;
 
 #define PRINT_DOUBLE(val, tol) QString(" %1").arg( DlgRef::PrintDoubleValue( val, tol ) )
+#define PRINT_INTEGER(val) QString(" %1").arg( val )
 #define TITLE(val) QString("<b>%1</b>").arg(tr(val))
 #define TITLE_I(val, i) QString("<b>%1</b>").arg(tr(val).arg(i))
   switch ( aKind )
@@ -543,7 +544,15 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
       "<br>" + tr( "GEOM_DZ" )             + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
       "<br>" + TITLE( "GEOM_DIMENSIONS" )  +
       "<br>" + tr( "GEOM_RADIUS_MAJOR" )   + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
-      "<br>" + tr( "GEOM_RADIUS_MINOR" )   + PRINT_DOUBLE( aDbls[7], aLenPrecision );
+      "<br>" + tr( "GEOM_RADIUS_MINOR" )   + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_X_AXIS")       + 
+      "<br>" + "Xx :"                      + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+      "<br>" + "Xy :"                      + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+      "<br>" + "Xz :"                      + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_Y_AXIS")       + 
+      "<br>" + "Yx :"                      + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+      "<br>" + "Yy :"                      + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
+      "<br>" + "Yz :"                      + PRINT_DOUBLE( aDbls[13], aLenPrecision );
     break;
   case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE:
     aKindStr = tr( "GEOM_ARC_ELLIPSE" );
@@ -565,7 +574,15 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
       "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
       "<br>" + tr( "GEOM_X_I" ).arg( 2 )    + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
       "<br>" + tr( "GEOM_Y_I" ).arg( 2 )    + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
-      "<br>" + tr( "GEOM_Z_I" ).arg( 2 )    + PRINT_DOUBLE( aDbls[13], aLenPrecision );
+      "<br>" + tr( "GEOM_Z_I" ).arg( 2 )    + PRINT_DOUBLE( aDbls[13], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_X_AXIS")        + 
+      "<br>" + "Xx :"                       + PRINT_DOUBLE( aDbls[14], aLenPrecision ) +
+      "<br>" + "Xy :"                       + PRINT_DOUBLE( aDbls[15], aLenPrecision ) +
+      "<br>" + "Xz :"                       + PRINT_DOUBLE( aDbls[16], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_Y_AXIS")        + 
+      "<br>" + "Yx :"                       + PRINT_DOUBLE( aDbls[17], aLenPrecision ) +
+      "<br>" + "Yy :"                       + PRINT_DOUBLE( aDbls[18], aLenPrecision ) +
+      "<br>" + "Yz :"                       + PRINT_DOUBLE( aDbls[19], aLenPrecision );
     break;
   case GEOM::GEOM_IKindOfShape::LINE:
     aKindStr = tr( "GEOM_LINE" );
@@ -589,6 +606,135 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
       "<br>" + tr( "GEOM_Y_I" ).arg( 2 )         + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
       "<br>" + tr( "GEOM_Z_I" ).arg( 2 )         + PRINT_DOUBLE( aDbls[5], aLenPrecision );
     break;
+  case GEOM::GEOM_IKindOfShape::CRV_BSPLINE:
+    {
+      aKindStr = tr( "GEOM_CRV_BSPLINE" );
+      theParameters = TITLE( "GEOM_PARAMETERS" ) +
+        "<br>" + tr( "GEOM_PERIODICITY" )        + tr( anInts[0] ? "GEOM_PERIODIC" : "GEOM_NON_PERIODIC") +
+        "<br>" + tr( "GEOM_DEGREE" )             + PRINT_INTEGER( anInts[1] ) +
+        "<br>" + tr( "GEOM_NUM_POLES" )          + PRINT_INTEGER( anInts[2] ) +
+        "<br>" + tr( "GEOM_NUM_WEIGHTS" )        + PRINT_INTEGER( anInts[4] ) +
+        "<br>" + tr( "GEOM_NUM_KNOTS" )          + PRINT_INTEGER( anInts[3] ) +
+        "<br>" + tr( "GEOM_NUM_MULTIS" )         + PRINT_INTEGER( anInts[5] ) +
+        "<br>" + TITLE( "GEOM_POLES" );
+      // Show max. 5 poles
+      Standard_Integer i, nb = std::min(5L, (long int)anInts[2]);
+      if (anInts[4] == anInts[2]) {
+        // Each pole has a specific weight associated
+        Standard_Integer widx = anInts[2] * 3 + anInts[3]; // skip poles and knots
+        for (i=0; i<nb; i++) {
+          theParameters +=
+          "<br>" + tr( "GEOM_POLE_I" ).arg( i+1 ) +
+          "("     + PRINT_DOUBLE( aDbls[i*3], aLenPrecision ) +
+          ", "    + PRINT_DOUBLE( aDbls[i*3+1], aLenPrecision ) +
+          ", "    + PRINT_DOUBLE( aDbls[i*3+2], aLenPrecision ) +
+          " )\t" + PRINT_DOUBLE( aDbls[widx+i], aLenPrecision );
+        }
+      } else { 
+        for (i=0; i<nb; i++) {
+          theParameters +=
+          "<br>" + tr( "GEOM_POLE_I" ).arg( i+1 ) + "(" + PRINT_DOUBLE( aDbls[i*3], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+1], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+2], aLenPrecision ) + " )";
+        }
+      }
+      if (nb < anInts[2])
+        theParameters += "<br>...";
+      // Show max. 5 knots
+      theParameters += "<br>" + TITLE( "GEOM_KNOTS" );
+      nb = std::min(5L, (long int)anInts[3]);
+      Standard_Integer kidx = anInts[2] * 3; // skip poles
+      if (anInts[5] == anInts[3]) {
+        // Each knot has a multiplicity associated
+        for (i=0; i<nb; i++) {
+          theParameters +=
+          "<br>" + tr( "GEOM_KNOT_I" ).arg( i+1 ) + PRINT_DOUBLE( aDbls[kidx+i], aLenPrecision ) +
+          "\t" + PRINT_INTEGER( anInts[6+i] );
+        }
+      } else {
+        // Each pole has a uniform weight of 1 (do not show it)
+        for (i=0; i<nb; i++) {
+          theParameters +=
+            "<br>" + tr( "GEOM_POLE_I" ).arg( i+1 ) + PRINT_DOUBLE( aDbls[kidx+i], aLenPrecision );
+        }
+      }
+      if (nb < anInts[3])
+        theParameters = theParameters + "<br>...";
+    }
+    break;
+  case GEOM::GEOM_IKindOfShape::CRV_BEZIER:
+    {
+      aKindStr = tr( "GEOM_CRV_BEZIER" );
+      theParameters = TITLE( "GEOM_PARAMETERS" ) +
+        "<br>" + tr( "GEOM_NUM_POLES" )          + PRINT_INTEGER( anInts[0] ) +
+        "<br>" + tr( "GEOM_NUM_WEIGHTS" )        + PRINT_INTEGER( anInts[1] ) +
+        "<br>" + TITLE( "GEOM_POLES" );
+      Standard_Integer i, nb = std::min(5L, (long int)anInts[0]); // show max. 5 poles
+      if (anInts[1] > 0) {
+        Standard_Integer widx = anInts[2] * 3 + anInts[3];
+        for (i=0; i<nb; i++) {
+          theParameters = theParameters +
+          "<br>" + tr( "GEOM_POLE_I" ).arg( i+1 ) + "(" + PRINT_DOUBLE( aDbls[i*3], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+1], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+2], aLenPrecision ) +
+          ") " + PRINT_DOUBLE( aDbls[widx+i], aLenPrecision );
+        }
+      } else {
+        for (i=0; i<nb; i++) {
+          theParameters = theParameters +
+          "<br>" + tr( "GEOM_POLE_I" ).arg( i+1 ) + "(" + PRINT_DOUBLE( aDbls[i*3], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+1], aLenPrecision ) +
+          ", " + PRINT_DOUBLE( aDbls[i*3+2], aLenPrecision ) + ")";
+        }
+      }
+      if (nb < anInts[0])
+        theParameters = theParameters + "<br>...";
+    }
+    break;
+ case GEOM::GEOM_IKindOfShape::HYPERBOLA:
+    aKindStr = tr( "GEOM_HYPERBOLA" );
+    theParameters = TITLE( "GEOM_CENTER" )    +
+      "<br>" + tr( "GEOM_X_I" ).arg( 0 )      + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+      "<br>" + tr( "GEOM_Y_I" ).arg( 0 )      + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+      "<br>" + tr( "GEOM_Z_I" ).arg( 0 )      + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_NORMAL" )         +
+      "<br>" + tr( "GEOM_DX" )                + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+      "<br>" + tr( "GEOM_DY" )                + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+      "<br>" + tr( "GEOM_DZ" )                + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_DIMENSIONS" )     +
+      "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+      "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_X_AXIS")          + 
+      "<br>" + "Xx :"                         + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+      "<br>" + "Xy :"                         + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+      "<br>" + "Xz :"                         + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_Y_AXIS")          + 
+      "<br>" + "Yx :"                         + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+      "<br>" + "Yy :"                         + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
+      "<br>" + "Yz :"                         + PRINT_DOUBLE( aDbls[13], aLenPrecision );
+    break;
+  case GEOM::GEOM_IKindOfShape::PARABOLA:
+    aKindStr = tr( "GEOM_PARABOLA" );
+    theParameters = TITLE( "GEOM_CENTER" ) +
+      "<br>" + tr( "GEOM_X_I" ).arg( 0 )   + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+      "<br>" + tr( "GEOM_Y_I" ).arg( 0 )   + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+      "<br>" + tr( "GEOM_Z_I" ).arg( 0 )   + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_NORMAL" )      +
+      "<br>" + tr( "GEOM_DX" )             + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+      "<br>" + tr( "GEOM_DY" )             + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+      "<br>" + tr( "GEOM_DZ" )             + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_DIMENSIONS" )  +
+      "<br>" + tr( "GEOM_FOCAL_LENGTH" )   + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_X_AXIS")       + 
+      "<br>" + "Xx :"                      + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+      "<br>" + "Xy :"                      + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+      "<br>" + "Xz :"                      + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+      "<br>" + TITLE( "GEOM_Y_AXIS")       + 
+      "<br>" + "Yx :"                      + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+      "<br>" + "Yy :"                      + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+      "<br>" + "Yz :"                      + PRINT_DOUBLE( aDbls[12], aLenPrecision );
+    break;
+
   case GEOM::GEOM_IKindOfShape::EDGE:
     aKindStr = tr( "GEOM_EDGE" );
     break;
diff --git a/test/data/KindOfShape_Curve10.brep b/test/data/KindOfShape_Curve10.brep
new file mode 100755 (executable)
index 0000000..2efa30d
--- /dev/null
@@ -0,0 +1,55 @@
+DBRep_DrawableShape
+
+CASCADE Topology V1, (c) Matra-Datavision
+Locations 1
+1
+              1               0               0             -50 
+              0               1               0               0 
+              0               0               1               0 
+Curve2ds 2
+8 -132.28756555322954 132.28756555322963
+4 340 315.48573660309904 -1.3586236395872709e-16 -1 1 -1.3586236395872709e-16 13.867504905630716
+8 -132.28756555322954 132.28756555322963
+7 0 0  8 51 8  0.722734247813415 -3.7837266715443717e-13  0.76407411204879916 39.435717075387053  0.81058069772893759 76.054597216847469  0.86333712790747086 109.85664042370627  0.92373293963282777 140.84184669796377  0.99374321759023587 169.01021603675326  1.0759136624494658 194.36174844310153  1.1743082728010958 216.89644391463054  1.3396677297426323 244.00849940395941  1.3878402708536062 251.00657866175425  1.439386042779802 257.60854022571675  1.4946291510977829 263.81438409584047  1.5539262525010975 269.62411027212192  1.6176561781971539 275.03771875456647  1.6861920117449656 280.05520954318069  1.8243112797239756 288.72028409587813  1.8926931818048145 292.46070794446166  1.9652130488717003 295.89785418369655  2.0420563040416813 299.0317228135869  2.1233422404046745 301.86231383413553  2.2090815929216268 304.38962724534059  2.2991315140696154 306.61366304719826  2.4754123375026116 310.21508465816311  2.5607140976241731 311.66355115695944  2.6488254910765074 312.87982073610181  2.7394077559327799 313.86389339558934  2.8319968443872954 314.61576913542166  2.9260166915141053 315.1354479555996  3.0208200192583119 315.42292985612431  3.2818958243631009 315.57496355351697  3.4484415546735363 314.96060920305899  3.6119098712897539 313.63515178789385  3.7687040424752922 311.59859130391851  3.9161881660238578 308.85092775546946  4.0534163229503974 305.39216113899602  4.1801732694165823 301.22229145738459  4.4717398358323992 289.01985958596777  4.623885503080146 280.09841856328421  4.7543429159341031 269.57699564215727  4.8668661357150995 257.45559081924148  4.964650295645697 243.73420410044491  5.0502542944996094 228.41283547898638  5.1257535186641459 211.49148495951397  5.2598175641448162 174.44882012091162  5.318382818223391 154.3275058021172  5.3701242801189952 132.60620958382972  5.416261756368808 109.28493146604946  5.4577162356651003 84.363671448776387  5.4952031821752776 57.842429532010456  5.5292947700852562 29.721205715751502  5.560451059366172 -7.2521427871267128e-13 
+ -132.28756555322954 9 -66.143782776626111 7 -41.339864235399588 7 -19.636435511826431 7 -0.64593537870134909 7 32.587439854281101 7 82.437502703755172 7 132.28756555322963 9
+Curves 1
+4 -24.999999999999982 2.0575957707676544e-16 262.5 -0.83205029433784372 6.8480926667821216e-18 -0.55470019622522904 0.55470019622522904 -4.56539511118808e-18 -0.83205029433784372 -8.2303830830706228e-18 -1 0 13.867504905630716
+Polygon3D 1
+26 1
+1.05830058320163
+150 132.28756555323 0 97.6764398868482 110.759396841464 78.4853401697277 58.510436807218 91.3840450008742 137.234344789173 28.7115945291821 73.2881944989656 181.932608206227 7.37202416257552 56.8964183078122 213.941963756137 -7.22175527456788 42.1642558637433 235.832632911852 -15.8040217387008 30.3248714115974 248.706032608051 -20.4009768941005 21.4453330724881 255.601465341151 -22.8138368710065 14.785679318156 259.22075530651 -24.14696897759 9.23596785621269 261.220453466385 -24.8201198895001 4.24122754046367 262.23017983425 -24.9993546431669 -0.254038743710453 262.49903196475 -24.8151190571547 -4.29977839946716 262.222678585732 -24.3035232838993 -8.34551805522387 261.455284925849 -23.4645673234006 -12.3912577109806 260.196850985101 -22.2982511756587 -16.4369973667373 258.447376763488 -20.8045748406735 -20.482737022494 256.20686226101 -18.3037794360927 -25.8770565635029 252.455669154139 -14.7947442080473 -31.945666047138 247.192116312071 -8.97026991530217 -40.0371453586514 238.455404872953 2.22164292813993 -52.1743643259215 221.66753560779 18.33422439134 -65.8287356641004 197.49866341299 44.2525096789088 -83.2180927917173 158.621235481637 80.0378771853595 -102.487988167082 104.943184221961 112.798901561697 -117.387776860156 55.8016476574539 150 -132.28756555323 0 
+-132.28756555323 -110.759396841464 -91.3840450008742 -73.2881944989656 -56.8964183078122 -42.1642558637433 -30.3248714115974 -21.4453330724881 -14.785679318156 -9.23596785621269 -4.24122754046367 0.254038743710453 4.29977839946716 8.34551805522387 12.3912577109806 16.4369973667373 20.482737022494 25.8770565635029 31.945666047138 40.0371453586514 52.1743643259215 65.8287356641004 83.2180927917173 102.487988167082 117.387776860156 132.28756555323 
+PolygonOnTriangulations 0
+Surfaces 2
+1 200.00000000000003 339.99999999999994 -3.8435068773240004e-14 -0.83205029433784372 6.8480926667821216e-18 -0.55470019622522904 -8.3593263030600021e-17 -1 1.1304431992129413e-16 -0.55470019622522904 1.4042775906991517e-16 0.83205029433784372 
+3 0 0 0 0 0 1 1 0 -0 -0 1 0 200
+-0.5880026035475675
+Triangulations 0
+
+TShapes 3
+Ve
+7.34697470131475e-06
+150 132.28756555323 0
+0 0
+
+0101101
+*
+Ve
+7.34697509667305e-06
+150 -132.28756555323 0
+0 0
+
+0101101
+*
+Ed
+ 7.34697430646774e-06 1 1 0
+1  1 0 -132.28756555323 132.28756555323
+2  1 1 1 -132.28756555323 132.28756555323
+2  2 2 0 -132.28756555323 132.28756555323
+5  1 0
+0
+
+0101000
++3 0 -2 0 *
+
++1 0 
\ No newline at end of file
diff --git a/test/data/KindOfShape_Curve3.brep b/test/data/KindOfShape_Curve3.brep
new file mode 100755 (executable)
index 0000000..a932484
--- /dev/null
@@ -0,0 +1,33 @@
+DBRep_DrawableShape
+
+CASCADE Topology V1, (c) Matra-Datavision
+Locations 0
+Curve2ds 0
+Curves 1
+7 0 1  3 8 9  -100 0 0  -200 200 0  0 100 0  200 200 0  100 0 0  200 -200 0  0 -100 0  -200 -200 0 
+ 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1
+Polygon3D 0
+PolygonOnTriangulations 0
+Surfaces 0
+Triangulations 0
+
+TShapes 2
+Ve
+1e-07
+-150 150 0
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  1 0 0 8
+5  1 0
+0
+
+1101000
++2 0 -2 0 *
+
++1 0 
+0
+
diff --git a/test/data/KindOfShape_Curve4.brep b/test/data/KindOfShape_Curve4.brep
new file mode 100755 (executable)
index 0000000..7fad3b6
--- /dev/null
@@ -0,0 +1,33 @@
+DBRep_DrawableShape
+
+CASCADE Topology V1, (c) Matra-Datavision
+Locations 0
+Curve2ds 0
+Curves 1
+7 1 1  2 3 4  0 0 0  200 100 200  0 100 200  0 0 100
+ 0 1 1 1 2 1 3 1
+Polygon3D 0
+PolygonOnTriangulations 0
+Surfaces 0
+Triangulations 0
+
+TShapes 2
+Ve
+1e-07
+33.3333333333333 66.6666666666667 0
+0 0
+
+0101101
+*
+Ed
+ 1e-07 1 1 0
+1  1 0 0 3
+5  1 0
+0
+
+1101000
++2 0 -2 0 *
+
++1 0 
+0
+
diff --git a/test/data/KindOfShape_Curve6.brep b/test/data/KindOfShape_Curve6.brep
new file mode 100755 (executable)
index 0000000..b06785f
--- /dev/null
@@ -0,0 +1,49 @@
+DBRep_DrawableShape
+
+CASCADE Topology V1, (c) Matra-Datavision
+Locations 0
+Curve2ds 2
+7 0 0  8 44 7  6.28318530717958 126.49110640673518  6.1584073516232243 126.49110640673518  6.03362947549771 125.84803414687136  5.9094150207291705 124.56189114958852  5.7863294117394162 122.64589554676786  5.6648846324858937 120.12650015353393  5.54549772011468 117.04268536994019  5.4284719614072143 113.44462845614626  5.1137001325914317 102.29948970016818  4.921240451124504 93.81454574700183  4.7377118900913047 84.256033707148163  4.5632229512848426 74.030607049062382  4.397033588928025 63.602641482139006  4.2381575906165381 53.449736070906511  4.0854629052390701 44.015856146907062  3.8270272714482192 29.421321131272506  3.7190912160212974 23.78197666484084  3.6134854850770353 18.91633840585564  3.5097056832673843 14.960854402874247  3.4072538769833045 12.021771401705337  3.3056390595825178 10.168633215735099  3.2043733060670294 9.4312912458091382  3.0269139347799494 10.077243798233877  2.9507813920120052 10.976463244287553  2.8743641769089976 12.49412419695426  2.7974558941141368 14.613890317398727  2.7198491058760084 17.307132114094998  2.6413344785686395 20.533686208932011  2.5617010668343156 24.243171506407222  2.3592957337009661 34.577147634830929  2.2348631022484744 41.731770617236798  2.1067313138356951 49.642080465040408  1.9742003309155507 58.066784329999791  1.8365888023656396 66.735079678119746  1.693295859924242 75.365027387261421  1.5439152143595885 83.683090087545125  1.2328868921475886 99.198631136983835  1.0712391290359733 106.39610895952501  0.90340851386281429 112.7848816543119  0.729707051992591 118.1416613048641  0.5509128122380389 122.28495914826635  0.36848476642205696 125.08905695252179  0.18424245000118436 126.49110640673518  4.6694967520238038e-16 126.49110640673518 
+ 3.1415926535897931 9 3.9269908169872401 7 5.3014376029327721 7 6.3322726923919213 7 7.105399009486284 7 8.2650884851278299 7 9.4247779607693793 9
+3 112.04658794368747 -100 -1 0 -0 -1 96.039932523160658 76.25866911626909
+Curves 1
+3 -18.46153846153846 0 64.615384615384627 0.57668319759865538 0 -0.81696786326476167 -0.81696786326476167 -0 -0.57668319759865538 -0 1 0 96.039932523160658 76.25866911626909
+Polygon3D 1
+39 1
+0.610069365987925
+50 -37.2543859613389 112.941176470588 43.5880674292195 -46.673207693842 108.415106420626 35.8151783839059 -55.0683290613502 102.928361212169 26.8518184540995 -62.2556168269867 96.6012836146585 16.8945842588267 -68.077429605628 89.572647712113 6.16187142126587 -72.4060754694873 81.9966151208936 -5.11091558153751 -75.1466126614042 74.03935370715 -19.0435686922269 -76.2565709367343 64.2045397466634 -31.6131968125667 -75.1797477836914 55.3318610734823 -43.8115865103297 -72.1688127271111 46.721233051532 -55.2776554743336 -67.3424016160983 38.6275373122351 -65.6970726091178 -60.8910119307455 31.272654628858 -74.8197631124895 -53.0564119779614 24.8331083911839 -81.8757760289204 -44.907184757395 19.8523933913503 -87.6947660658254 -35.881952129668 15.7448710123585 -92.1632220609244 -26.1567694993995 12.5906667805239 -95.1939777481841 -15.9213462107795 10.4513098248112 -96.7279121120217 -5.37534488336087 9.3685326268082 -96.8033254352886 4.21163276268513 9.31529969273748 -95.8121333802339 12.787305284216 10.014964672776 -93.8304107132644 21.1992270635422 11.4138277318134 -90.8835348341015 29.3396773257139 13.4939754112225 -87.0092426311415 37.104411685954 16.2287699074295 -82.2571472331596 44.393997074804 19.5831901883579 -76.6881026771207 51.1150850508794 23.514280463209 -70.3734246279872 57.181607195538 27.9717002625973 -63.3939771297737 62.5158772815641 32.8983690848656 -55.8391370826644 67.0495861017951 38.2311973534134 -47.8056497068176 70.7246762181899 43.9018943245994 -36.5282980309635 74.2094861469109 51.8623778604964 -22.7234166390356 76.146087275228 61.6070000195043 -8.71892653878124 75.6684949701785 71.4925224432133 3.61800536709324 73.1769658117673 80.200944965007 15.3174483289402 68.8297560753093 88.4593752910166 26.05020979487 62.799522257575 96.0354422081435 35.5474786871062 55.3163994541851 102.73939672031 42.9797313088074 47.4273461692171 107.98569268857 46.7003637557376 42.4780866848608 110.612021474638 50 37.2543859613389 112.941176470588 
+3.65199295515956 3.80022779966159 3.94846264416362 4.09669748866565 4.24493233316769 4.39316717766972 4.54140202217175 4.71980708077055 4.88080315846458 5.04138055183158 5.20080196553975 5.35841938292808 5.51373194832228 5.65351325717705 5.79329456603182 5.9330758748866 6.07285718374137 6.21263849259615 6.33844167056544 6.45166453073781 6.56488739091018 6.67811025108255 6.79133311125491 6.90455597142728 7.01777883159965 7.13100169177202 7.24422455194438 7.35744741211675 7.47067027228912 7.62163408585227 7.79963683278398 7.97847349611623 8.13924058867037 8.29904657771952 8.45721313736856 8.61319385187279 8.7535764949266 8.83397707706311 8.91437765919962 
+PolygonOnTriangulations 0
+Surfaces 2
+3 0 0 0 0 0 1 1 0 -0 -0 1 0 100
+-0.32175055439664219
+1 -110 -100 0 0.57668319759865538 0 -0.81696786326476167 0.81696786326476167 0 0.57668319759865538 0 -1 0 
+Triangulations 0
+
+TShapes 3
+Ve
+1.6322216083449e-06
+50 -37.2543859613389 112.941176470588
+0 0
+
+0101101
+*
+Ve
+1.63222162424756e-06
+50 37.2543859613389 112.941176470588
+0 0
+
+0101101
+*
+Ed
+ 1.63222157819913e-06 1 1 0
+1  1 0 3.65199295515956 8.91437765919962
+2  1 1 0 3.65199295515956 8.91437765919962
+2  2 2 0 3.65199295515956 8.91437765919962
+5  1 0
+0
+
+0101000
++3 0 -2 0 *
+
++1 0 
\ No newline at end of file
diff --git a/test/data/KindOfShape_Curve9.brep b/test/data/KindOfShape_Curve9.brep
new file mode 100755 (executable)
index 0000000..9fda94d
--- /dev/null
@@ -0,0 +1,55 @@
+DBRep_DrawableShape
+
+CASCADE Topology V1, (c) Matra-Datavision
+Locations 1
+1
+              1               0               0             -50 
+              0               1               0               0 
+              0               0               1               0 
+Curve2ds 2
+8 -2.0634370688955608 2.0634370688955608
+5 0 300 0 -1 1 0 75 50
+8 -2.0634370688955608 2.0634370688955608
+7 0 0  8 30 5  4.4597087252426109 -7.8827638990507737e-14  4.4274675210411178 45.022391476982129  4.3906251658136171 83.1913827250537  4.3484672676386253 115.64801319560502  4.3001744812136167 143.29016905790195  4.2448403293528827 166.83324775326764  4.1814869564805122 186.84949414111907  4.1092342892090539 203.79586913150507  3.9664963935124211 228.71119711713283  3.900085050044924 237.86535774408642  3.8282611736143224 245.64790333359178  3.7509977699901356 252.18065382612986  3.6684919050547649 257.55955073830046  3.5812841487561373 261.85774885490838  3.4903020914425427 265.12753377729564  3.2563194678036358 270.81200726266258  3.1100551434960835 271.98170041560661  2.9618503514557233 271.0198041908443  2.8168183221696381 267.93508097017184  2.6804852559453138 262.64304135146085  2.5552929808450244 254.96197593715624  2.4422308683121212 244.599441831039  2.2401505791195655 217.64691353134484  2.151133111136005 201.056918429691  2.074044407871952 180.92093656799989  2.0077408086453943 156.66685047524516  1.9507768946796205 127.55370899959235  1.9018428015583595 92.626546602667077  1.8597479366636549 50.650190411604896  1.8234765819369751 -7.8827638990507737e-14 
+ -2.0634370688955608 9 -1.0317185344477846 7 -0.25792963361194843 7 0.90275371764180579 7 2.0634370688955608 9
+Curves 1
+5 -50 0 300 1 0 0 0 -0 -1 -0 1 -0 75 50
+Polygon3D 1
+18 1
+1.54919336040805
+-50.0000000000001 -193.649167310371 0 -50 -100.162222794724 132.077221708445 -50 -61.3268215618448 181.310477098961 -50 -36.07227484963 207.519081541859 -50 -25.271297143767 215.964670920563 -50 -17.7530285515364 220.412736250131 -50 -10.6855693195119 223.3064009758 -50 -4.95237402527411 224.633007761395 -50 0.880368499625663 224.988375170484 -50 6.72507162583066 224.324641898183 -50 12.661140924837 222.632790528436 -50 18.7692232601295 219.889835732135 -50 25.1323024476704 216.058511990657 -50 34.1631311768744 209.164880434004 -50 49.3313861059531 194.640768206802 -50 77.4246170339179 161.751001897265 -50 124.351140656155 98.9596709349202 -50 193.649167310371 0 
+-2.06343706889556 -1.44508549915884 -1.03285111933436 -0.670146895181744 -0.486059661805338 -0.347994236773033 -0.212117148727491 -0.0988862420228719 0.0176064603481351 0.134099162719142 0.250591865090149 0.367084567461156 0.483577269832163 0.638900872993506 0.871886277735519 1.22136438484854 1.64240072687205 2.06343706889556 
+PolygonOnTriangulations 0
+Surfaces 2
+1 0 0 0 1 0 -0 0 1 0 0 -0 1 
+3 0 0 0 0 0 1 1 0 -0 -0 1 0 200
+-0.5880026035475675
+Triangulations 0
+
+TShapes 3
+Ve
+2.74063527112943e-06
+-50.0000000000001 -193.649167310371 0
+0 0
+
+0101101
+*
+Ve
+2.74063525157436e-06
+-50 193.649167310371 0
+0 0
+
+0101101
+*
+Ed
+ 2.74063516840746e-06 1 1 0
+1  1 0 -2.06343706889556 2.06343706889556
+2  1 1 1 -2.06343706889556 2.06343706889556
+2  2 2 0 -2.06343706889556 2.06343706889556
+5  1 0
+0
+
+0101000
++3 0 -2 0 *
+
++1 0 
\ No newline at end of file
diff --git a/test/test_kind_of_shape.py b/test/test_kind_of_shape.py
new file mode 100644 (file)
index 0000000..2205854
--- /dev/null
@@ -0,0 +1,249 @@
+# Test KindOfShape method for Edges
+
+import math
+import salome
+from inspect import getfile
+from os.path import abspath, dirname, join
+salome.salome_init_without_session()
+import GEOM
+
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+
+def isEqual(v1, v2, tol=1.e-5):
+  return abs(v1 - v2) < tol
+
+def isEqualPoint(p1, p2, tol=1.e-5):
+  return isEqual(p1[0], p2[0], tol) and isEqual(p1[1], p2[1], tol) and isEqual(p1[2], p2[2], tol)
+
+def assertEqualType(props, t):
+  assert (props[0]==t), f"Expected type {t}, but was {props[0]}"
+
+def checkSegment(props, p1, p2):
+  assertEqualType(props, geompy.kind.SEGMENT)
+  p = props[1:4]
+  assert isEqualPoint(p, p1), f"Expected SEGMENT start point ({p1[0]:.4f}, {p1[1]:.4f}, {p1[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, p2), f"Expected SEGMENT end point ({p2[0]:.4f}, {p2[1]:.4f}, {p2[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def checkCircle(props, c, d, r):
+  assertEqualType(props, geompy.kind.CIRCLE)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected CIRCLE center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, d), f"Expected CIRCLE direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], r), f"Expected CIRCLE radius {r:.4f}, but was {props[7]:.4f}"
+
+def checkArcCircle(props, c, d, r, p1, p2):
+  assertEqualType(props, geompy.kind.ARC_CIRCLE)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected ARC_CIRCLE center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, d), f"Expected ARC_CIRCLE direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], r), f"Expected ARC_CIRCLE radius {r:.4f}, but was {props[7]:.4f}"
+  p = props[8:11]
+  assert isEqualPoint(p, p1), f"Expected ARC_CIRCLE start point ({p1[0]:.4f}, {p1[1]:.4f}, {p1[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[11:14]
+  assert isEqualPoint(p, p2), f"Expected ARC_CIRCLE end point ({p2[0]:.4f}, {p2[1]:.4f}, {p2[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def checkEllipse(props, c, d, r1, r2, vx, vy):
+  assertEqualType(props, geompy.kind.ELLIPSE)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected ELLIPSE center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, d), f"Expected ELLIPSE direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], r1), f"Expected ELLIPSE major radius {r1:.4f}, but was {props[7]:.4f}"
+  assert isEqual(props[8], r2), f"Expected ELLIPSE minor radius {r2:.4f}, but was {props[8]:.4f}"
+  p = props[9:12]
+  assert isEqualPoint(p, vx), f"Expected ELLIPSE x-direction ({vx[0]:.4f}, {vx[1]:.4f}, {vx[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[12:15]
+  assert isEqualPoint(p, vy), f"Expected ELLIPSE y-direction ({vy[0]:.4f}, {vy[1]:.4f}, {vy[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def checkArcEllipse(props, c, d, r1, r2, p1, p2, vx, vy):
+  assertEqualType(props, geompy.kind.ARC_ELLIPSE)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected ARC_ELLIPSE center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(props[4:7], d), f"Expected ARC_ELLIPSE direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], r1), f"Expected ARC_ELLIPSE major radius {r1:.4f}, but was {props[7]:.4f}"
+  assert isEqual(props[8], r2), f"Expected ARC_ELLIPSE minor radius {r2:.4f}, but was {props[8]:.4f}"
+  p = props[9:12]
+  assert isEqualPoint(props[9:12], p1), f"Expected ARC_ELLIPSE start point ({p1[0]:.4f}, {p1[1]:.4f}, {p1[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[12:15]
+  assert isEqualPoint(props[12:15], p2), f"Expected ARC_ELLIPSE end point ({p2[0]:.4f}, {p2[1]:.4f}, {p2[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[15:18]
+  assert isEqualPoint(props[15:18], vx), f"Expected ARC_ELLIPSE x-direction ({vx[0]:.4f}, {vx[1]:.4f}, {vx[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[18:21]
+  assert isEqualPoint(props[18:21], vy), f"Expected ARC_ELLIPSE y-direction ({vy[0]:.4f}, {vy[1]:.4f}, {vy[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def checkHyperbola(props, c, d, r1, r2, vx, vy):
+  assertEqualType(props, geompy.kind.HYPERBOLA)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected HYPERBOLA center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, d), f"Expected HYPERBOLA direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], r1), f"Expected HYPERBOLA major radius {r1:.4f}, but was {props[7]:.4f}"
+  assert isEqual(props[8], r2), f"Expected HYPERBOLA minor radius {r2:.4f}, but was {props[8]:.4f}"
+  p = props[9:12]
+  assert isEqualPoint(p, vx), f"Expected HYPERBOLA x-direction ({vx[0]:.4f}, {vx[1]:.4f}, {vx[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[12:15]
+  assert isEqualPoint(p, vy), f"Expected HYPERBOLA y-direction ({vy[0]:.4f}, {vy[1]:.4f}, {vy[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def checkParabola(props, c, d, f, vx, vy):
+  assertEqualType(props, geompy.kind.PARABOLA)
+  p = props[1:4]
+  assert isEqualPoint(p, c), f"Expected PARABOLA center point ({c[0]:.4f}, {c[1]:.4f}, {c[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[4:7]
+  assert isEqualPoint(p, d), f"Expected PARABOLA direction ({d[0]:.4f}, {d[1]:.4f}, {d[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  assert isEqual(props[7], f), f"Expected PARABOLA focal length {f:.4f}, but was {props[7]:.4f}"
+  p = props[8:11]
+  assert isEqualPoint(p, vx), f"Expected PARABOLA x-direction ({vx[0]:.4f}, {vx[1]:.4f}, {vx[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+  p = props[11:14]
+  assert isEqualPoint(p, vy), f"Expected PARABOLA y-direction ({vy[0]:.4f}, {vy[1]:.4f}, {vy[2]:.4f}), but was ({p[0]:.4f}, {p[1]:.4f}, {p[2]:.4f})"
+
+def assertPoles(props, np, pfirst, poles):
+  n = len(poles)
+  assert (n<=np), f"Too much poles given ({n}), but should not be more than {np}"
+  for i in range(0,n-1):
+    p1 = poles[i]
+    p2 = props[pfirst+i*3:pfirst+(i+1)*3]
+    assert isEqualPoint(p1, p2), f"Expected pole #{i+1} ({p1[0]:.4f}, {p1[1]:.4f}, {p1[2]:.4f}), but was ({p2[0]:.4f}, {p2[1]:.4f}, {p2[2]:.4f})"
+
+def assertKnots(props, nk, kfirst, knots):
+  n = len(knots)
+  assert (n<=nk), f"Too much knots given ({n}), but should not be more than {nk}"
+  try:
+    for i in range(0,n-1):
+      assert isEqual(knots[i], props[kfirst+i]), f"Expected knot #{i+1} {knots[i]:.4f}, but was {props[kfirst+i]:.4f}"
+  except:
+    assert("Number of knots does not match expected number")
+
+def assertWeights(props, nw, wfirst, weights):
+  n = len(weights)
+  assert (n<=nw), f"Too much weights given ({n}), but should not be more than {nw}"
+  try:
+    for i in range(0,n-1):
+      assert isEqual(weights[i], props[wfirst+i]), f"Expected weight #{i+1} {weights[i]:.4f}, but was {props[wfirst+i]:.4f}"
+  except:
+    assert("Number of weights does not match expected number")
+
+def assertMultiplicities(props, nm, mfirst, multis):
+  n = len(multis)
+  assert (n<=nm), f"Too much multiplicities given ({n}), but should not be more than {nm}"
+  try:
+    for i in range(0,n-1):
+      assert isEqual(multis[i], props[mfirst+i]), f"Expected multiplicity #{i+1} {multis[i]:.4f}, but was {props[mfirst+i]:.4f}"
+  except:
+    assert("Number of multiplicities does not match expected number")
+
+def checkBSpline(props, period, deg, np, nk, nw, nm, poles=[], knots=[], weights=[], multis=[]):
+  assertEqualType(props, geompy.kind.CRV_BSPLINE)
+  assert (period==props[1]), f"Expected CRV_BSPLINE periodicity ({period}), but was ({props[1]})"
+  assert (deg==props[2]), f"Expected CRV_BSPLINE degree ({deg}), but was ({props[2]})"
+  assert (np==props[3]), f"Expected CRV_BSPLINE number of poles ({np}), but was ({props[3]})"
+  assert (nk==props[4]), f"Expected CRV_BSPLINE number of knots ({nk}), but was ({props[4]})"
+  assert (nw==props[5]), f"Expected CRV_BSPLINE number of weights ({nw}), but was ({props[5]})"
+  assert (nm==props[6]), f"Expected CRV_BSPLINE number of multiplicities ({nm}), but was ({props[6]})"
+  if poles and len(poles):
+    assertPoles(props, np, 7, poles)
+  if knots and len(knots):
+    assertKnots(props, nk, 7+3*np, knots)
+  if weights and len(weights):
+    assertWeights(props, nw, 7+3*np+nk, weights)
+
+def checkBezier(props, np, nw, poles=[]):
+  assertEqualType(props, geompy.kind.CRV_BEZIER)
+  assert (np==props[1]), f"Expected CRV_BEZIER number of poles ({np}), but was ({props[1]})"
+  assert (nw==props[2]), f"Expected CRV_BEZIER number of weights ({nw}), but was ({props[2]})"
+  if poles and len(poles):
+    assertPoles(props, np, 3, poles)
+
+    
+data_dir = abspath(join(dirname(getfile(lambda: None)), 'data'))
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(50, 100, 0)
+Vertex_3 = geompy.MakeVertex(-10, 60, 0)
+Vertex_4 = geompy.MakeVertex(0, 100, 0)
+Vertex_5 = geompy.MakeVertex(-100, 100, 0)
+Vertex_6 = geompy.MakeVertex(-100, 0, 0)
+Vertex_7 = geompy.MakeVertex(-200, 0, 0)
+Vertex_8 = geompy.MakeVertex(-200, 100, 0)
+
+# create or import some curves
+Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
+Circle_1 = geompy.MakeCircle(Vertex_2, OZ, 50)
+Ellipse_1 = geompy.MakeEllipse(Vertex_1, OZ, 200, 100, Line_1)
+Arc_1 = geompy.MakeArc(Vertex_2, Vertex_3, Vertex_1)
+Curve_1 = geompy.MakeCurveParametric("t", "50*sin(t)", "0", 0, 360, 30, GEOM.Interpolation, True)
+Curve_2 = geompy.MakeCurveParametric("-t", "50*cos(t)", "t", 0, 360, 14, GEOM.Bezier, True)
+Curve_3 = geompy.ImportBREP(join(data_dir, "KindOfShape_Curve3.brep"))
+Curve_4 = geompy.ImportBREP(join(data_dir, "KindOfShape_Curve4.brep"))
+Curve_5 = geompy.MakeInterpol([Vertex_1, Vertex_4, Vertex_5, Vertex_6, Vertex_7, Vertex_8], False, False)
+Curve_6 = geompy.ImportBREP(join(data_dir, "KindOfShape_Curve6.brep"))
+Curve_7 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_7, Vertex_8], True)
+Curve_8 = geompy.MakeBezier([Vertex_5, Vertex_6, Vertex_1, Vertex_4], False)
+Curve_9 = geompy.ImportBREP(join(data_dir, "KindOfShape_Curve9.brep"))
+Curve_10 = geompy.ImportBREP(join(data_dir, "KindOfShape_Curve10.brep"))
+
+# check all curves
+props = geompy.KindOfShape(Line_1)
+# [SEGMENT, 0.,0.,0., 50.,100.,0.]
+checkSegment(props, [0,0,0], [50,100,0])
+
+props = geompy.KindOfShape(Circle_1)
+# [CIRCLE, 50.,100.,0., 0.,0.,1., 50.]
+checkCircle(props, [50,100,0], [0,0,1], 50)
+
+props = geompy.KindOfShape(Ellipse_1)
+# [ELLIPSE, 0.,0.,0., 0.,0.,1., 200., 100., 0.44721,0.89443,0., 0.44721,0.89443,0.]
+checkEllipse(props, [0,0,0], [0,0,1], 200, 100, [0.4472136,0.8944272,0], [-0.8944272,0.4472136,0])
+
+props = geompy.KindOfShape(Arc_1)
+# [ARC_CIRCLE, 47.5,38.75,0., 0.,0.,1., 61.301, 50.,100.,0., 0.,0.,0.]
+checkArcCircle(props, [47.5,38.75,0], [0,0,1], 61.301, [50,100,0], [0,0,0])
+
+props = geompy.KindOfShape(Curve_1)
+# [CRV_BSPLINE, 0, 3, 33, 31, 0, 31, 0.,0.,0.,..., 4,1,...,1,4]
+checkBSpline(props, 0, 3, 33, 31, 0, 31, [[0,0,0],[5.246092,-6.374961,0],[10.613646,-25.338811,0],[19.662636,-44.299221,0]], [0,29.39007,51.399444,64.149986], [], [4,1,1,1,1])
+
+props = geompy.KindOfShape(Curve_2)
+# [CRV_BEZIER, 15, 0, 0.,50.,0.,...,-360.,-14.18455,360.]
+checkBezier(props, 15, 0, [[0,50,0],[-25.714286,41.780762,25.714286],[-51.428571,19.825283,51.428571],[-77.142857,-8.648146,77.142857]])
+
+props = geompy.KindOfShape(Curve_3)
+# [CRV_BSPLINE, 1, 3, 8, 9, 0, 0, -100.,0.,0.,..., 0.,1.,2.,3.,4.,5.,6.,7.,8.]
+checkBSpline(props, 1, 3, 8, 9, 0, 0, [[-100,0,0],[-200,200,0],[0,100,0],[200,200,0],[100,0,0],[200,-200,0],[0,-100,0],[-200,-200,0]], [0,1,2,3,4,5,6,7,8])
+
+props = geompy.KindOfShape(Curve_4)
+# [CRV_BSPLINE, 1, 2, 3, 4, 3, 0, 0.,0.,0., 100.,200.,0., 200.,0.,0., 0,1,2,3, 200.,100.,100.]
+checkBSpline(props, 1, 2, 3, 4, 3, 0, [[0,0,0],[100,200,0],[200,0,0]], [0,1,2,3], [200,100,100])
+
+props = geompy.KindOfShape(Curve_5)
+# [CRV_BSPLINE, 0, 3, 8, 6, 0, 6, 0.,0.,0.,..., 100.,0.,0.,100.,200.,300.,400.,500., 4,1,1,1,1,4]
+checkBSpline(props, 0, 3, 8, 6, 0, 6, [[0,0,0],[38.888889,50,0],[23.684211,113.157895,0]], [0,100,200,300,400,500], [], [4,1,1,1,1,4])
+
+props = geompy.KindOfShape(Curve_6)
+# [ARC_ELLIPSE, -18.46154,0.,64.61538, 0.57668,0.,-0.81697, 96.03993, 76.25867, 50.,-37.25439,112.94118, 50.,37.25439,112.94118, -0.81697,0.,-0.57668, 0.,1.,0.]
+checkArcEllipse(props, [-18.46154,0,64.61538], [0.57668,0,-0.81697], 96.03993, 76.25867, [50,-37.25439,112.94118], [50,37.25439,112.94118], [-0.81697,0,-0.57668], [0,1,0])
+
+props = geompy.KindOfShape(Curve_7)
+# [CRV_BEZIER, 5, 0, -100.,100.,0., -100.,0.,0., -200.,0.,0., -200.,100.,0., -100.,100.,0.]
+checkBezier(props, 5, 0, [[-100,100,0],[-100,0,0],[-200,0,0],[-200,100,0],[-100,100,0]])
+
+props = geompy.KindOfShape(Curve_8)
+# [CRV_BEZIER, 4, 0, -100.,100.,0., -100.,0.,0., 0.,0.,0., 0.,100.,0.]
+checkBezier(props, 4, 0, [[-100,100,0],[-100,0,0],[0,0,0],[0,100,0]])
+
+props = geompy.KindOfShape(Curve_9)
+# [HYPERBOLA, -50., 0., 300., 1., 0., 0., 75., 50., 0., 0., -1., 0., 1., 0.]
+checkHyperbola(props, [-50,0,300], [1,0,0], 75, 50, [0,0,-1], [0,1,0])
+
+props = geompy.KindOfShape(Curve_10)
+# [PARABOLA, -25.,0.,262.5, -0.83205,0.,-0.5547, 13.8675, 0.5547,0.,-0.83205, 0.,-1.,0.]
+checkParabola(props, [-25,0,262.5], [-0.83205,0,-0.5547], 13.867505, [0.5547,0,-0.83205], [0,-1,0])
index a1b374f9ed567da5396d77d240ebd35bb582a1ba..defc2286cc1215681cb58ec14184b934251804a1 100644 (file)
@@ -27,6 +27,7 @@ IF(${OpenCASCADE_VERSION}.${OpenCASCADE_SP_VERSION} VERSION_GREATER "7.5.3.3")
       test_point_cloud_on_face.py
       test_CR.py
       test_conformity.py
+      test_kind_of_shape.py
       test_proximity_edge_edge.py
       test_proximity_face_face.py
     )