mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-28 18:30:36 +05:00
To implement issue 0019962: MakePipeBiNormalAlongAxis implementation.
This commit is contained in:
parent
6aed1127dd
commit
dc0102b3ab
@ -1107,6 +1107,22 @@ module GEOM
|
||||
*/
|
||||
GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
|
||||
in ListOfGO theLocations);
|
||||
|
||||
/*!
|
||||
* Create a shape by extrusion of the base shape along
|
||||
* the path shape with constant bi-normal direction along the given vector.
|
||||
* The path shape can be a wire or an edge.
|
||||
* \param theBase Base shape to be extruded.
|
||||
* \param thePath Path shape to extrude the base shape along it.
|
||||
* \param theVec Vector defines a constant binormal direction to keep the
|
||||
* same angle beetween the Direction and the sections
|
||||
* along the sweep surface.
|
||||
* \return New GEOM_Object, containing the created pipe.
|
||||
*/
|
||||
GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase,
|
||||
in GEOM_Object thePath,
|
||||
in GEOM_Object theVec);
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -212,6 +212,10 @@ module GEOM
|
||||
GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
|
||||
in ListOfGO theLocations );
|
||||
|
||||
GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase,
|
||||
in GEOM_Object thePath,
|
||||
in GEOM_Object theVec);
|
||||
|
||||
//-----------------------------------------------------------//
|
||||
// BooleanOperations //
|
||||
//-----------------------------------------------------------//
|
||||
|
@ -110,6 +110,7 @@ partition.png \
|
||||
partitionkeep.png \
|
||||
partitionplane.png \
|
||||
pipe.png \
|
||||
pipebinormal.png \
|
||||
plane.png \
|
||||
planeWorking.png \
|
||||
plane3points.png \
|
||||
|
BIN
resources/pipebinormal.png
Normal file
BIN
resources/pipebinormal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -306,6 +306,10 @@
|
||||
<source>ICON_DLG_PIPE</source>
|
||||
<translation>pipe.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PIPE_BINORMAL</source>
|
||||
<translation>pipebinormal.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_PLANE_3PNTS</source>
|
||||
<translation>plane3points.png</translation>
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include <GEOMImpl_IThruSections.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
#include <GEOMImpl_IPipeShellSect.hxx>
|
||||
#include <GEOMImpl_IPipeBiNormal.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
@ -2122,3 +2123,64 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakePipeBiNormalAlongVector
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
|
||||
Handle(GEOM_Object) thePath,
|
||||
Handle(GEOM_Object) theVec)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theBase.IsNull() || thePath.IsNull() || theVec.IsNull()) return NULL;
|
||||
|
||||
//Add a new Pipe object
|
||||
Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
|
||||
|
||||
//Add a new Pipe function
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BI_NORMAL_ALONG_VECTOR);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IPipeBiNormal aCI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
|
||||
Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
|
||||
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
||||
|
||||
if (aRefBase.IsNull() || aRefPath.IsNull() || aRefVec.IsNull()) return NULL;
|
||||
|
||||
aCI.SetBase(aRefBase);
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetVector(aRefVec);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Pipe 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) << aPipe << " = geompy.MakePipeBiNormalAlongVector("
|
||||
<< theBase << ", " << thePath << ", " << theVec << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aPipe;
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theLocations);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
|
||||
Handle(GEOM_Object) thePath,
|
||||
Handle(GEOM_Object) theVec);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
47
src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx
Normal file
47
src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2005 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//NOTE: This is an interface to a function for the Pipe creation.
|
||||
|
||||
#ifndef _GEOMImpl_IPIPEBINORMAL_HXX_
|
||||
#define _GEOMImpl_IPIPEBINORMAL_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#ifndef _GEOMImpl_IPIPE_HXX_
|
||||
#include "GEOMImpl_IPipe.hxx"
|
||||
#endif
|
||||
|
||||
#define PIPE_ARG_BASE 1
|
||||
#define PIPE_ARG_PATH 2
|
||||
#define PIPE_ARG_VEC 3
|
||||
|
||||
class GEOMImpl_IPipeBiNormal : public GEOMImpl_IPipe
|
||||
{
|
||||
public:
|
||||
|
||||
GEOMImpl_IPipeBiNormal(Handle(GEOM_Function)& theFunction):GEOMImpl_IPipe(theFunction) {}
|
||||
|
||||
void SetVector(Handle(GEOM_Function) theVec) { _func->SetReference(PIPE_ARG_VEC, theVec); }
|
||||
|
||||
Handle(GEOM_Function) GetVector() { return _func->GetReference(PIPE_ARG_VEC); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -25,6 +25,7 @@
|
||||
#include <GEOMImpl_IShapesOperations.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
#include <GEOMImpl_IPipeShellSect.hxx>
|
||||
#include <GEOMImpl_IPipeBiNormal.hxx>
|
||||
#include <GEOMImpl_IPipe.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
@ -1851,6 +1852,72 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : CreatePipeBiNormalAlongVector
|
||||
//purpose : auxilary for Execute()
|
||||
//=======================================================================
|
||||
static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath,
|
||||
GEOMImpl_IPipe* aCI)
|
||||
{
|
||||
GEOMImpl_IPipeBiNormal* aCIBN = (GEOMImpl_IPipeBiNormal*)aCI;
|
||||
|
||||
Handle(GEOM_Function) aRefBase = aCIBN->GetBase();
|
||||
Handle(GEOM_Function) aRefVec = aCIBN->GetVector();
|
||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||
TopoDS_Shape aShapeVec = aRefVec->GetValue();
|
||||
|
||||
if (aShapeBase.IsNull()) {
|
||||
if(aCIBN) delete aCIBN;
|
||||
Standard_NullObject::Raise("MakePipe aborted : null base argument");
|
||||
}
|
||||
|
||||
TopoDS_Shape aProf;
|
||||
if( aShapeBase.ShapeType() == TopAbs_VERTEX ) {
|
||||
aProf = aShapeBase;
|
||||
}
|
||||
else if( aShapeBase.ShapeType() == TopAbs_EDGE) {
|
||||
aProf = BRepBuilderAPI_MakeWire(TopoDS::Edge(aShapeBase)).Shape();
|
||||
}
|
||||
else if( aShapeBase.ShapeType() == TopAbs_WIRE) {
|
||||
aProf = aShapeBase;
|
||||
}
|
||||
else if( aShapeBase.ShapeType() == TopAbs_FACE) {
|
||||
TopExp_Explorer wexp(aShapeBase,TopAbs_WIRE);
|
||||
aProf = wexp.Current();
|
||||
}
|
||||
else {
|
||||
Standard_TypeMismatch::Raise
|
||||
("MakePipe aborted : invalid type of base");
|
||||
}
|
||||
BRepOffsetAPI_MakePipeShell PipeBuilder(aWirePath);
|
||||
PipeBuilder.Add(aProf);
|
||||
|
||||
if (aShapeVec.IsNull()) {
|
||||
if(aCIBN) delete aCIBN;
|
||||
Standard_NullObject::Raise
|
||||
("MakePipe aborted : null vector argument");
|
||||
}
|
||||
if (aShapeVec.ShapeType() != TopAbs_EDGE)
|
||||
Standard_TypeMismatch::Raise
|
||||
("MakePipe aborted: invalid type of vector");
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec);
|
||||
TopoDS_Vertex V1, V2;
|
||||
TopExp::Vertices(anEdge, V1, V2, Standard_True);
|
||||
if (V1.IsNull() || V2.IsNull())
|
||||
Standard_NullObject::Raise
|
||||
("MakePipe aborted: vector is not defined");
|
||||
gp_Vec aVec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
|
||||
gp_Dir BiNormal(aVec);
|
||||
PipeBuilder.SetMode(BiNormal);
|
||||
PipeBuilder.Build();
|
||||
if( aShapeBase.ShapeType() == TopAbs_FACE) {
|
||||
PipeBuilder.MakeSolid();
|
||||
}
|
||||
|
||||
return PipeBuilder.Shape();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Execute
|
||||
//purpose :
|
||||
@ -1870,6 +1937,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
||||
aCI = new GEOMImpl_IPipeShellSect(aFunction);
|
||||
else if(aType == PIPE_SHELLS_WITHOUT_PATH)
|
||||
aCI = new GEOMImpl_IPipeShellSect(aFunction);
|
||||
else if(aType == PIPE_BI_NORMAL_ALONG_VECTOR)
|
||||
aCI = new GEOMImpl_IPipeBiNormal(aFunction);
|
||||
else
|
||||
return 0;
|
||||
|
||||
@ -2293,6 +2362,11 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
||||
aShape = CreatePipeShellsWithoutPath(aCI);
|
||||
}
|
||||
|
||||
//building a pipe with constant bi-normal along given vector
|
||||
else if (aType == PIPE_BI_NORMAL_ALONG_VECTOR) {
|
||||
aShape = CreatePipeBiNormalAlongVector(aWirePath, aCI);
|
||||
}
|
||||
|
||||
if (aCI) {
|
||||
delete aCI;
|
||||
aCI = 0;
|
||||
|
@ -188,6 +188,7 @@
|
||||
#define PIPE_DIFFERENT_SECTIONS 2
|
||||
#define PIPE_SHELL_SECTIONS 3
|
||||
#define PIPE_SHELLS_WITHOUT_PATH 4
|
||||
#define PIPE_BI_NORMAL_ALONG_VECTOR 5
|
||||
|
||||
#define THRUSECTIONS_RULED 1
|
||||
#define THRUSECTIONS_SMOOTHED 2
|
||||
|
@ -92,6 +92,7 @@ salomeinclude_HEADERS = \
|
||||
GEOMImpl_IPartition.hxx \
|
||||
GEOMImpl_IPipeDiffSect.hxx \
|
||||
GEOMImpl_IPipeShellSect.hxx \
|
||||
GEOMImpl_IPipeBiNormal.hxx \
|
||||
GEOMImpl_VectorDriver.hxx \
|
||||
GEOMImpl_LineDriver.hxx \
|
||||
GEOMImpl_DiskDriver.hxx \
|
||||
|
Loading…
Reference in New Issue
Block a user