Added tangent plane for face

This commit is contained in:
gka 2006-05-15 13:56:15 +00:00
parent 46a4fc674e
commit d14cfb5308
9 changed files with 160 additions and 0 deletions

View 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

View 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 //
//-----------------------------------------------------------//

View 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;
}

View 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

View File

@ -32,6 +32,10 @@
#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:

View 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);
}

View 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(); }
};

View 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:

View 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 //
//-----------------------------------------------------------//