]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020098: EDF 899 GEOM : Point on curve/surface with X,Y,Z coordinates.
authorptv <ptv@opencascade.com>
Thu, 27 Aug 2009 13:02:59 +0000 (13:02 +0000)
committerptv <ptv@opencascade.com>
Thu, 27 Aug 2009 13:02:59 +0000 (13:02 +0000)
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/geompyDC.py

index f79e653088fb88f716cfa528579be1c16cff8aca..278d9090df9c92c7c85d3de0f18882419b677937 100644 (file)
@@ -154,6 +154,36 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakePointOnCurveByCoord
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByCoord
+                  (GEOM::GEOM_Object_ptr theCurve, 
+                   CORBA::Double theXParameter,
+                   CORBA::Double theYParameter,
+                   CORBA::Double theZParameter)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference curve
+  Handle(GEOM_Object) aReference = GetObjectImpl(theCurve);
+  if (aReference.IsNull()) return aGEOMObject._retn();
+
+  //Create the point
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakePointOnCurveByCoord(aReference, theXParameter,
+                                             theYParameter, theZParameter);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakePointOnSurface
@@ -182,6 +212,36 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurface
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakePointOnSurfaceByCoord
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurfaceByCoord
+                                             (GEOM::GEOM_Object_ptr theSurface,
+                                              CORBA::Double theXParameter,
+                                              CORBA::Double theYParameter,
+                                              CORBA::Double theZParameter)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference surface
+  Handle(GEOM_Object) aReference = GetObjectImpl(theSurface);
+  if (aReference.IsNull()) return aGEOMObject._retn();
+
+  //Create the point
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakePointOnSurfaceByCoord(aReference, theXParameter,
+                                               theYParameter, theZParameter);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 
 //=============================================================================
 /*!
index 0cf59342f14e631f347681fe6fd876cad94ec77d..7910c4e172f576b9b365644ae134ce95c7fc0eb6 100644 (file)
@@ -54,10 +54,20 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i :
    GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve,
                                           CORBA::Double theParameter);
 
+   GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve,
+                                                  CORBA::Double theXParameter,
+                                                  CORBA::Double theYParameter,
+                                                  CORBA::Double theZParameter);
+
    GEOM::GEOM_Object_ptr MakePointOnSurface (GEOM::GEOM_Object_ptr theSurface,
                                             CORBA::Double theUParameter,
                                             CORBA::Double theVParameter);
 
+   GEOM::GEOM_Object_ptr MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theSurface,
+                                                    CORBA::Double theXParameter,
+                                                    CORBA::Double theYParameter,
+                                                    CORBA::Double theZParameter);
+
    GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theLine1,
                                                       GEOM::GEOM_Object_ptr theLine2);
 
index 6c8dc843f78233baaea20fea2f71f5eb317a0341..2762674fed62f3dbd53d1db0a1fe47146f51995f 100644 (file)
@@ -574,6 +574,58 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the
   return anObj;
 }
 
+//=============================================================================
+//  MakePointOnCurveByCoord
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
+                                                              CORBA::Double theXParameter,
+                                                              CORBA::Double theYParameter,
+                                                              CORBA::Double theZParameter)
+{
+  beginService( " GEOM_Superv_i::MakePointOnCurveByCoord" );
+  MESSAGE("GEOM_Superv_i::MakePointOnCurveByCoord");
+  getBasicOp();
+  GEOM::GEOM_Object_ptr anObj =
+    myBasicOp->MakePointOnCurveByCoord(theRefCurve, theXParameter,
+                                theYParameter, theZParameter);
+  endService( " GEOM_Superv_i::MakePointOnCurveByCoord" );
+  return anObj;
+}
+
+//=============================================================================
+//  MakePointOnSurface:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnSurface (GEOM::GEOM_Object_ptr theRefSurface,
+                                                         CORBA::Double theUParameter,
+                                                         CORBA::Double theVParameter)
+{
+  beginService( " GEOM_Superv_i::MakePointOnSurface" );
+  MESSAGE("GEOM_Superv_i::MakePointOnSurface");
+  getBasicOp();
+  GEOM::GEOM_Object_ptr anObj =
+    myBasicOp->MakePointOnSurface(theRefSurface, theUParameter, theVParameter);
+  endService( " GEOM_Superv_i::MakePointOnSurface" );
+  return anObj;
+}
+
+//=============================================================================
+//  MakePointOnSurfaceByCoord
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theRefSurface,
+                                                                CORBA::Double theXParameter,
+                                                                CORBA::Double theYParameter,
+                                                                CORBA::Double theZParameter)
+{
+  beginService( " GEOM_Superv_i::MakePointOnSurfaceByCoord" );
+  MESSAGE("GEOM_Superv_i::MakePointOnSurfaceByCoord");
+  getBasicOp();
+  GEOM::GEOM_Object_ptr anObj =
+    myBasicOp->MakePointOnSurfaceByCoord(theRefSurface, theXParameter,
+                                theYParameter, theZParameter);
+  endService( " GEOM_Superv_i::MakePointOnSurfaceByCoord" );
+  return anObj;
+}
+
 //=============================================================================
 //  MakePointOnLinesIntersection:
 //=============================================================================
index 5198fa024d46fc38945c35fdabf0a05bca9a763b..1ed69ad457733c7a262eb494d189b5f3c174b239 100644 (file)
@@ -148,6 +148,17 @@ public:
                                                CORBA::Double theZ);
   GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
                                          CORBA::Double theParameter);
+  GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
+                                                 CORBA::Double theXParameter,
+                                                 CORBA::Double theYParameter,
+                                                 CORBA::Double theZParameter);
+  GEOM::GEOM_Object_ptr MakePointOnSurface (GEOM::GEOM_Object_ptr theRefSurface,
+                                            CORBA::Double theUParameter,
+                                            CORBA::Double theVParameter);
+  GEOM::GEOM_Object_ptr MakePointOnSurfaceByCoord (GEOM::GEOM_Object_ptr theRefSurface,
+                                                   CORBA::Double theXParameter,
+                                                   CORBA::Double theYParameter,
+                                                   CORBA::Double theZParameter);
   GEOM::GEOM_Object_ptr MakePointOnLinesIntersection (GEOM::GEOM_Object_ptr theRefLine1,
                                                      GEOM::GEOM_Object_ptr theRefLine2);
   GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
index 0d6ff0bd64cc7e1a6098ae9af37eb4a1c258c9a2..60a52f4336e80c64f4932ad313f738a4f5f6ca25 100644 (file)
@@ -109,6 +109,7 @@ def TestAll (geompy, math):
 
   #Test point on curve creation
   p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
+  p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
 
   #Test point on lines intersection
   p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
@@ -176,6 +177,7 @@ def TestAll (geompy, math):
 
   #Test point on surface creation
   p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr
+  p_on_face2 = geompy.MakeVertexOnSurface(Face, 0., 0., 0.) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr
 
   # Test plane from existing face creation
   Plane2 = geompy.MakePlaneFace(Face, trimsize)      #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
@@ -323,6 +325,8 @@ def TestAll (geompy, math):
   id_Sketcher3d = geompy.addToStudy(Sketcher3d, "Sketcher 3D")
 
   id_p_on_arc  = geompy.addToStudy(p_on_arc,  "Vertex on Arc (0.25)")
+  id_p_on_arc2 =  geompy.addToStudy(p_on_arc2, "Vertex on Arc at(100, -10, 10)" )
+  
   id_p_on_l1l2 = geompy.addToStudy(p_on_l1l2, "Vertex on Lines Intersection")
 
   id_tan_on_arc  = geompy.addToStudy(tan_on_arc, "Tangent on Arc (0.7)")
@@ -359,6 +363,7 @@ def TestAll (geompy, math):
   id_Shell    = geompy.addToStudy(Shell,    "Shell")
 
   id_p_on_face = geompy.addToStudy(p_on_face, "Vertex on Face (0.1, 0.8)")
+  id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on Face at(0., 0., 0.)")
 
   id_Prism1   = geompy.addToStudy(Prism1,     "Prism by Two Pnt")
   id_Shell1   = geompy.addToStudy(Shell1,   "Shell from Prism1 faces")
index 154d154574dd32a6fbad89f2127696228083ccad..0b6d23665977e49dfcbfe230b37e2bf66f11f267 100644 (file)
@@ -366,6 +366,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters)
             return anObj
 
+        ## Create a point by projection give coordinates on the given curve
+        #  @param theRefCurve The referenced curve.
+        #  @param theX X-coordinate in 3D space
+        #  @param theY Y-coordinate in 3D space
+        #  @param theZ Z-coordinate in 3D space
+        #  @return New GEOM_Object, containing the created point.
+        #
+        #  @ref tui_creation_point "Example"
+        def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
+            # Example: see GEOM_TestAll.py
+            theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
+            anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
+            RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
+            anObj.SetParameters(Parameters)
+            return anObj
+
         ## Create a point, corresponding to the given parameters on the
         #    given surface.
         #  @param theRefSurf The referenced surface.
@@ -382,6 +398,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             anObj.SetParameters(Parameters);
             return anObj
 
+        ## Create a point by projection give coordinates on the given surface
+        #  @param theRefSurf The referenced surface.
+        #  @param theX X-coordinate in 3D space
+        #  @param theY Y-coordinate in 3D space
+        #  @param theZ Z-coordinate in 3D space
+        #  @return New GEOM_Object, containing the created point.
+        #
+        #  @ref swig_MakeVertexOnSurfaceByCoord "Example"
+        def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
+            theX, theY, theZ, Parameters = ParseParameters(theX, theY, theZ)
+            # Example: see GEOM_TestAll.py
+            anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
+            RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
+            anObj.SetParameters(Parameters);
+            return anObj
+
         ## Create a point on intersection of two lines.
         #  @param theRefLine1, theRefLine2 The referenced lines.
         #  @return New GEOM_Object, containing the created point.