From 6801e0b5256813cbe057b9e1244357512dcb61f3 Mon Sep 17 00:00:00 2001 From: gka Date: Mon, 24 Apr 2006 07:59:25 +0000 Subject: [PATCH] Add methods for creatin thrusections and pipe with different sections and getting tangent on curve by parameter --- idl/GEOM_Gen.idl | 50 +++++++++++++++++++++++++++- idl/GEOM_Superv.idl | 14 ++++++++ src/GEOM_I_Superv/GEOM_Superv_i.cc | 37 +++++++++++++++++++++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 13 ++++++++ src/GEOM_SWIG/geompy.py | 53 ++++++++++++++++++++++++++++++ 5 files changed, 166 insertions(+), 1 deletion(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 24023fa50..cd043a608 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -254,7 +254,7 @@ module GEOM */ GEOM_Object MakePointWithReference (in GEOM_Object theReference, in double theX, in double theY, in double theZ); - + /*! * Create a point, corresponding to the given parameter on the given curve. * \param theRefCurve The referenced curve. @@ -264,6 +264,18 @@ module GEOM GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, in double theParameter); + + /*! + * Create a vector, corresponding to tangent to the given parameter on the given curve. + * \param theRefCurve The referenced curve. + * \param theParameter Value of parameter on the referenced curve.This value should be have value + * \between 0. and 1.. Value of 0. corresponds first parameter of curve value 1. corresponds + * \last parameter of curve. + * \return New GEOM_Object, containing the created point. + */ + GEOM_Object MakeTangentOnCurve (in GEOM_Object theRefCurve, + in double theParameter); + /*! * Create a vector with the given components. * \param theDX X component of the vector. @@ -271,6 +283,7 @@ module GEOM * \param theDZ Z component of the vector. * \return New GEOM_Object, containing the created vector. */ + GEOM_Object MakeVectorDXDYDZ (in double theDX, in double theDY, in double theDZ); @@ -781,6 +794,41 @@ module GEOM in long theMinDeg, in long theMaxDeg, in double theTol2D, in double theTol3D, in long theNbIter); + + /*! + * Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. + * \param theSeqSections - set of specified sections. + * \param theModeSolid - mode defining building solid or shell + * \param thePreci - precision 3D used for smoothing by default 1.e-6 + * \param theRuled - mode defining type of the result surfaces (ruled or smoothed). + * \return New GEOM_Object, containing the created shell or solid. + */ + GEOM_Object MakeThruSections(in ListOfGO theSeqSections, + in boolean theModeSolid, + in double thePreci, + in boolean theRuled); + + /*! + * Create a shape by extrusion of the profile shape along + * the path shape. The path shape can be a wire or an edge. + * the several profiles can be specified in the several locations of path. + * \param theSeqBases - list of Bases shape to be extruded. + * \param theLocations - list of locations on the path corresponding + * specified list of the Bases shapes. Number of locations + * should be equal to number of bases or list of locations can be empty. + * \param thePath - Path shape to extrude the base shape along it. + * \param theWithContact - the mode defining that the section is translated to be in + * contact with the spine. + * \param - WithCorrection - defining that the section is rotated to be + * orthogonal to the spine tangent in the correspondent point + * \return New GEOM_Object, containing the created pipe. + */ + GEOM_Object MakePipeWithDifferentSections (in ListOfGO theSeqBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + }; /*! diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 4f2c94f36..40faded97 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -72,6 +72,10 @@ module GEOM in double theZ) ; GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, in double theParameter) ; + + GEOM_Object MakeTangentOnCurve (in GEOM_Object theRefCurve, + in double theParameter); + GEOM_Object MakeVectorDXDYDZ (in double theDX, in double theDY, in double theDZ) ; @@ -148,7 +152,17 @@ module GEOM in long theMinDeg, in long theMaxDeg, in double theTol2D, in double theTol3D, in long theNbIter) ; + GEOM_Object MakeThruSections(in ListOfGO theSeqSections, + in boolean theModeSolid, + in double thePreci, + in boolean theRuled); + GEOM_Object MakePipeWithDifferentSections (in ListOfGO theSeqBases, + in ListOfGO theLocations, + in GEOM_Object thePath, + in boolean theWithContact , + in boolean theWithCorrection ); + //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 38455e4ce..0150c5e9d 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -536,6 +536,17 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the return myBasicOp->MakePointOnCurve(theRefCurve, theParameter); } +//============================================================================= +// MakeTangentOnCurve: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theParameter) +{ + MESSAGE("GEOM_Superv_i::MakeTangentOnCurve"); + getBasicOp(); + return myBasicOp->MakeTangentOnCurve(theRefCurve, theParameter); +} + //============================================================================= // MakeVectorDXDYDZ: //============================================================================= @@ -845,6 +856,32 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape return myBoolOp->MakeBoolean(theShape1, theShape2, theOperation); } +//============================================================================= +// MakeThruSections: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections, + CORBA::Boolean theModeSolid, + CORBA::Double thePreci, + CORBA::Boolean theRuled) +{ + MESSAGE("GEOM_Superv_i::MakeThruSections"); + get3DPrimOp(); + return my3DPrimOp->MakeThruSections(theSeqSections, theModeSolid,thePreci,theRuled); +} + +//============================================================================= +// MakePipe: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections) +{ + MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); + get3DPrimOp(); + return my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections); +} //============================================================================= // MakeFuse: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index d64bfb912..6b143ff66 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -142,6 +142,8 @@ public: CORBA::Double theZ); GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve, CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakeTangentOnCurve (GEOM::GEOM_Object_ptr theRefCurve, + CORBA::Double theParameter); GEOM::GEOM_Object_ptr MakeVectorDXDYDZ (CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ); @@ -218,6 +220,17 @@ public: CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter); + + GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections, + CORBA::Boolean theModeSolid, + CORBA::Double thePreci, + CORBA::Boolean theRuled); + + GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases, + const GEOM::ListOfGO& theLocations, + GEOM::GEOM_Object_ptr thePath, + CORBA::Boolean theWithContact, + CORBA::Boolean theWithCorrections); //-----------------------------------------------------------// // BooleanOperations // diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index e34d3163e..cef51da44 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -196,6 +196,20 @@ def MakeVertexOnCurve(theRefCurve, theParameter): print "MakePointOnCurve : ", BasicOp.GetErrorCode() return anObj +def MakeTangentOnCurve(theRefCurve, theParameter): + """ + * Create a tangent, corresponding to the given parameter on the given curve. + * \param theRefCurve The referenced curve. + * \param theParameter Value of parameter on the referenced curve. + * \return New GEOM_Object, containing the created tangent. + + * + """ + anObj = BasicOp.MakeTangentOnCurve(theRefCurve, theParameter) + if BasicOp.IsDone() == 0: + print "MakeTangentOnCurve : ", BasicOp.GetErrorCode() + return anObj + def MakeVectorDXDYDZ(theDX, theDY, theDZ): """ * Create a vector with the given components. @@ -748,6 +762,45 @@ def MakeRevolution(theBase, theAxis, theAngle): print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode() return anObj +def MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled): + """ + * Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. + * \param theSeqSections - set of specified sections. + * \param theModeSolid - mode defining building solid or shell + * \param thePreci - precision 3D used for smoothing by default 1.e-6 + * \param theRuled - mode defining type of the result surfaces (ruled or smoothed). + * \return New GEOM_Object, containing the created shell or solid. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled) + if PrimOp.IsDone() == 0: + print "MakeThruSections : ", PrimOp.GetErrorCode() + return anObj + +def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection): + """ + * Create a shape by extrusion of the profile shape along + * the path shape. The path shape can be a wire or an edge. + * the several profiles can be specified in the several locations of path. + * \param theSeqBases - list of Bases shape to be extruded. + * \param theLocations - list of locations on the path corresponding + * specified list of the Bases shapes. Number of locations + * should be equal to number of bases or list of locations can be empty. + * \param thePath - Path shape to extrude the base shape along it. + * \param theWithContact - the mode defining that the section is translated to be in + * contact with the spine. + * \param - WithCorrection - defining that the section is rotated to be + * orthogonal to the spine tangent in the correspondent point + * \return New GEOM_Object, containing the created pipe. + + * Example: see GEOM_TestAll.py + """ + anObj = PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithContact,theWithCorrection) + if PrimOp.IsDone() == 0: + print "MakePipeWithDifferentSections : ", PrimOp.GetErrorCode() + return anObj + # ----------------------------------------------------------------------------- # Create base shapes # ----------------------------------------------------------------------------- -- 2.39.2