]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Added tangent plane for face
authorgka <gka@opencascade.com>
Mon, 15 May 2006 13:56:15 +0000 (13:56 +0000)
committergka <gka@opencascade.com>
Mon, 15 May 2006 13:56:15 +0000 (13:56 +0000)
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
src/GEOMImpl/GEOMImpl_IPlane.hxx
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

index cd043a6083b75ed623d4551982e01b828e1e8dc7..44892982fa242a9bda2a98bb1899532e5e1faa2f 100644 (file)
@@ -357,6 +357,20 @@ module GEOM
     GEOM_Object MakeMarker (in double theOX , in double theOY , in double theOZ,
                            in double theXDX, in double theXDY, in double theXDZ,
                            in double theYDX, in double theYDY, in double theYDZ);
+     
+    /*!
+     *  Create a tangent plane to specified face in the point with specified parameters.
+     *  Values of parameters should be between 0. and 1.0
+     *  \param theFace - face for which tangent plane shuold be built. 
+     *  \param theParameterU - value of parameter by U
+     *  \param theParameterV - value of parameter Vthe
+     *  \param theTrimSize - defines sizes of created face
+     *  \return New GEOM_Object, containing the face built on tangent plane.
+     */
+    GEOM_Object MakeTangentPlaneOnFace(in GEOM_Object theFace,
+                                      in double theParameterU,
+                                      in double theParameterV,
+                                      in double theTrimSize);
   };
 
   interface GEOM_ITransformOperations : GEOM_IOperations
index 40faded970c682363c058d9f5cc5066665c749ca..3d5d15a179fc39914d877abb03e837da3a80264d 100644 (file)
@@ -96,6 +96,20 @@ module GEOM
                            in double theXDX, in double theXDY, in double theXDZ,
                            in double theYDX, in double theYDY, in double theYDZ) ;
 
+    /*!
+     *  Create a tangent plane to specified face in the point with specified parameters.
+     *  Values of parameters should be between 0. and 1.0
+     *  \param theFace - face for which tangent plane shuold be built. 
+     *  \param theParameterU - value of parameter by U
+     *  \param theParameterV - value of parameter Vthe
+     *  \param theTrimSize - defines sizes of created face
+     *  \return New GEOM_Object, containing the face built on tangent plane.
+     */
+    GEOM_Object MakeTangentPlaneOnFace(in GEOM_Object theFace,
+                                      in double theParameterU,
+                                      in double theParameterV,
+                                      in double theTrimSize);
+
     //-----------------------------------------------------------//
     // Primitives Construction : 3DPrimOperations                //
     //-----------------------------------------------------------//
index a29b7f90c3aeaaa714fa4693eb3f1f79a97682a7..b23389335e38ae9065f02af68fcaa6c3e3bd0eb0 100644 (file)
@@ -690,3 +690,60 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
   SetErrorCode(OK);
   return aMarker;
 }
+
+//=============================================================================
+/*!
+ *  MakeTangentPlaneOnFace
+ */
+//=============================================================================
+
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
+                                                                     double theParamU,
+                                                                     double theParamV,
+                                                                     double theSize)
+{
+   SetErrorCode(KO);
+
+  if (theFace.IsNull()) return NULL;
+
+  //Add a new Plane object
+  Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+  //Add a new Plane function
+  Handle(GEOM_Function) aFunction =
+    aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_TANGENT_FACE);
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+  GEOMImpl_IPlane aPI (aFunction);
+
+  Handle(GEOM_Function) aRef = theFace->GetLastFunction();
+  if (aRef.IsNull()) return NULL;
+
+  aPI.SetFace(aRef);
+  aPI.SetSize(theSize);
+  aPI.SetParameterU(theParamU);
+  aPI.SetParameterV(theParamV);
+
+  //Compute the Plane value
+  try {
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Plane driver failed");
+      return NULL;
+    }
+  }
+  catch (Standard_Failure) {
+    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+    SetErrorCode(aFail->GetMessageString());
+    return NULL;
+  }
+
+  //Make a Python command
+  GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakeTangentPlaneOnFace("
+                               << theFace << ", " <<theParamU <<", "<<theParamV <<", "<< theSize << ")";
+
+  SetErrorCode(OK);
+  return aPlane;
+}
+
index 36aa0afcbfa1668efc81b67b470c07c881ba8666..2ce9377ad6067ec08b59c5c8fa61b10d38ba5951 100644 (file)
@@ -73,6 +73,12 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeMarker (double theOX,  double theOY,  double theOZ,
                                   double theXDX, double theXDY, double theXDZ,
                                   double theYDX, double theYDY, double theYDZ);
+
+  Standard_EXPORT Handle(GEOM_Object) MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
+                                                            double theParamU,
+                                                            double theParamV,
+                                                            double theSize);
+
 };
 
 #endif
index 5129d6a9da8d0d79f5181c7b5ff6ec7e0b7296dc..d7c75d2f9d6ec0e6400e5b828af1f2165e54e2e7 100644 (file)
 
 #define PLN_ARG_REF 6
 
+#define PLN_ARG_PARAM_U 7
+
+#define PLN_ARG_PARAM_V 8
+
 class GEOMImpl_IPlane
 {
  public:
@@ -59,6 +63,12 @@ class GEOMImpl_IPlane
   Handle(GEOM_Function) GetPoint1() { return _func->GetReference(PLN_ARG_PNT1); }
   Handle(GEOM_Function) GetPoint2() { return _func->GetReference(PLN_ARG_PNT2); }
   Handle(GEOM_Function) GetPoint3() { return _func->GetReference(PLN_ARG_PNT3); }
+  
+  void SetParameterU(double theParamU) { _func->SetReal(PLN_ARG_PARAM_U, theParamU); }
+  double GetParameterU() { return _func->GetReal(PLN_ARG_PARAM_U); }
+
+  void SetParameterV(double theParamV) { _func->SetReal(PLN_ARG_PARAM_V, theParamV); }
+  double GetParameterV() { return _func->GetReal(PLN_ARG_PARAM_V); }
 
  private:
 
index b67314b0b7776c0e8e96733d1f2b0a3874101613..cc5fa043ab7494dc09802b1f005ffbce0c5398ba 100644 (file)
@@ -419,3 +419,39 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
 
   return GetObject(anObject);
 }
+
+//=============================================================================
+/*!
+ *  MakeTangentPlaneOnFace
+ */
+//=============================================================================
+
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace
+                     (GEOM::GEOM_Object_ptr theFace, 
+                     CORBA::Double theParameterU,
+                     CORBA::Double theParameterV,
+                     CORBA::Double theTrimSize)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  if (theFace == NULL) return aGEOMObject._retn();
+
+  //Get the reference face
+
+  Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject
+    (theFace->GetStudyID(), theFace->GetEntry());
+  if (aRef.IsNull()) return aGEOMObject._retn();
+
+  //Create the plane
+
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeTangentPlaneOnFace(aRef, theParameterU,theParameterV,theTrimSize);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
index 8cee133b5381753efb399f132fb19e04105cf545..b4d3db0cfbc2ddb9dded88ed8b8266c6662f74fa 100644 (file)
@@ -84,6 +84,11 @@ class GEOM_IBasicOperations_i :
                                     CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
                                     CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ);
 
+   GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, 
+                                                CORBA::Double theParameterU,
+                                                CORBA::Double theParameterV,
+                                                CORBA::Double theTrimSize);
+
    ::GEOMImpl_IBasicOperations* GetOperations() { return (::GEOMImpl_IBasicOperations*)GetImpl(); }
 };
 
index 0150c5e9dab5cd80811bedd363c81eec80b52214..d53601a3e86086ca00607fad2c0695ef428a0a91 100644 (file)
@@ -630,6 +630,19 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeMarker
   return myBasicOp->MakeMarker(theOX, theOY, theOZ, theXDX, theXDY, theXDZ, theYDX, theYDY, theYDZ);
 }
 
+//=============================================================================
+//  MakeTangentPlaneOnFace:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, 
+                                                CORBA::Double theParameterU,
+                                                CORBA::Double theParameterV,
+                                                CORBA::Double theTrimSize)
+{
+  MESSAGE("GEOM_Superv_i::MakeTangentPlaneOnFace");
+  getBasicOp();
+  return myBasicOp->MakeTangentPlaneOnFace(theFace, theParameterU,theParameterV,theTrimSize);
+}
+
 //================= Primitives Construction : 3DPrimOperations ================
 //=============================================================================
 //  MakeBox:
index 6b143ff665523e17fc2da2f4ccf843a65b155bc6..733d7d9554a0f85fba9e679a307748a8b5482397 100644 (file)
@@ -164,6 +164,11 @@ public:
                                    CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
                                    CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ);
 
+  GEOM::GEOM_Object_ptr MakeTangentPlaneOnFace (GEOM::GEOM_Object_ptr theFace, 
+                                                CORBA::Double theParameterU,
+                                                CORBA::Double theParameterV,
+                                                CORBA::Double theTrimSize);
+
   //-----------------------------------------------------------//
   // Primitives Construction : 3DPrimOperations                //
   //-----------------------------------------------------------//