From 53daed0dad3c355da2b2ac65dfcb97a58ded9ccc Mon Sep 17 00:00:00 2001 From: akl Date: Mon, 29 Sep 2008 06:37:21 +0000 Subject: [PATCH] To implement issue 0019962: MakePipeBiNormalAlongAxis implementation. --- doc/salome/gui/GEOM/images/pipe2.png | Bin 0 -> 9375 bytes idl/GEOM_Gen.idl | 15 +++ idl/GEOM_Superv.idl | 4 + resources/Makefile.am | 1 + resources/pipebinormal.png | Bin 0 -> 1728 bytes src/GEOMGUI/GEOM_images.po | 3 + src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx | 62 +++++++++++ src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx | 4 + src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx | 47 ++++++++ src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 71 ++++++++++++ src/GEOMImpl/GEOMImpl_Types.hxx | 1 + src/GEOM_I/GEOM_I3DPrimOperations_i.cc | 38 +++++++ src/GEOM_I/GEOM_I3DPrimOperations_i.hh | 4 + src/GEOM_I_Superv/GEOM_Superv_i.cc | 17 +++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 4 + src/GEOM_SWIG/geompyDC.py | 17 +++ src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 115 ++++++++++++++++---- src/GenerationGUI/GenerationGUI_PipeDlg.h | 9 +- 18 files changed, 390 insertions(+), 22 deletions(-) create mode 100755 doc/salome/gui/GEOM/images/pipe2.png create mode 100644 resources/pipebinormal.png create mode 100644 src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx diff --git a/doc/salome/gui/GEOM/images/pipe2.png b/doc/salome/gui/GEOM/images/pipe2.png new file mode 100755 index 0000000000000000000000000000000000000000..0a69cd834cd4cbb5da06a7d7d3f767d942a4e08f GIT binary patch literal 9375 zcmcI~c{r5s-}WtAktl`iMcJ2R-z&)$B?e;`vP-t?(_*PCH5wwjgkkJU)*(uaZS2!n zk{Apl%-Dzb_I-}${k`k+{{DIYnCqD1UOxAAU!U_l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,9 @@ msgstr "remove_extra_edges.png" msgid "ICON_DLG_PIPE" msgstr "pipe.png" +msgid "ICON_DLG_PIPE_BINORMAL" +msgstr "pipebinormal.png" + #PrismDlg msgid "ICON_DLG_PRISM" msgstr "prism.png" diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index a1c554544..6d84b9940 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -60,6 +60,7 @@ #include #include #include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -1728,3 +1729,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; +} + diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index 5f1f52f36..c09edc45c 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -109,6 +109,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 diff --git a/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx b/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx new file mode 100644 index 000000000..38d62fa2e --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx @@ -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 diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 41aec4758..036abfdb7 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1851,6 +1852,69 @@ 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_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 +1934,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 +2359,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; diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 54b156448..cb7987537 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -179,6 +179,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 diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 55160f0fb..743cffdf1 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -819,3 +819,41 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath return GetObject(anObject); } + + +//============================================================================= +/*! + * MakePipeBiNormalAlongVector + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject + (theBase->GetStudyID(), theBase->GetEntry()); + Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject + (thePath->GetStudyID(), thePath->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + + if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); + + //Create the Pipe + Handle(GEOM_Object) anObject = + GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index 330f4974b..d2bd5b321 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -128,6 +128,10 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases, const GEOM::ListOfGO& theLocations); + GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec); + ::GEOMImpl_I3DPrimOperations* GetOperations() { return (::GEOMImpl_I3DPrimOperations*)GetImpl(); } }; diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 461ef2d96..0f89227f1 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1120,6 +1120,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath } +//============================================================================= +// MakePipe: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector + (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec) +{ + beginService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); + MESSAGE("GEOM_Superv_i::MakePipeBiNormalAlongVector"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec); + endService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); + return anObj; +} + + //============================================================================= // MakeFuse: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index bdeadb12d..58a0ba0a6 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -260,6 +260,10 @@ public: GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases, const GEOM::ListOfGO& theLocations); + GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase, + GEOM::GEOM_Object_ptr thePath, + GEOM::GEOM_Object_ptr theVec); + //-----------------------------------------------------------// // BooleanOperations // //-----------------------------------------------------------// diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 65fde5c8a..f0afc1d9c 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -1027,6 +1027,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp) return anObj + ## 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. + # + # @ref tui_creation_pipe "Example" + def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec): + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec) + RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp) + return anObj + # end of l3_complex ## @} diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 2d124940d..e660e6819 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -67,23 +67,24 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidge { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE_BINORMAL"))); setCaption(tr("GEOM_PIPE_TITLE")); /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_PIPE")); RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); + RadioButton2->setPixmap(image2); RadioButton3->close(TRUE); - GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints = new DlgRef_3Sel_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT")); + GroupPoints->TextLabel3->setText(tr("GEOM_VECTOR")); GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton2->setPixmap(image1); - GroupPoints->LineEdit1->setReadOnly( true ); - GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->PushButton3->setPixmap(image1); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -116,17 +117,20 @@ void GenerationGUI_PipeDlg::Init() GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); - myOkBase = myOkPath = false; + myOkBase = myOkPath = myOkVec = false; /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -134,6 +138,41 @@ void GenerationGUI_PipeDlg::Init() initName(tr("GEOM_PIPE")); // globalSelection( GEOM_ALLSHAPES ); + + GroupPoints->TextLabel3->hide(); + GroupPoints->PushButton3->hide(); + GroupPoints->LineEdit3->hide(); + ConstructorsClicked( 0 ); +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) +{ + erasePreview(); + + switch (constructorId) + { + case 0: + { + GroupPoints->TextLabel3->hide(); + GroupPoints->PushButton3->hide(); + GroupPoints->LineEdit3->hide(); + break; + } + case 1: + { + GroupPoints->TextLabel3->show(); + GroupPoints->PushButton3->show(); + GroupPoints->LineEdit3->show(); + break; + } + } + + displayPreview(); } @@ -158,6 +197,8 @@ bool GenerationGUI_PipeDlg::ClickOnApply() return false; initName(); + if ( getConstructorId() != 1 ) + ConstructorsClicked( getConstructorId() ); return true; } @@ -176,6 +217,8 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() myOkBase = false; else if(myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + myOkVec = false; return; } @@ -197,14 +240,20 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHAPE) return; - + if ( getConstructorId() == 1 && + (S.ShapeType() == TopAbs_SHELL || + S.ShapeType() == TopAbs_VERTEX)) + return; + myBase = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myOkBase = true; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - myOkPath = false; - + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupPoints->LineEdit3) { + myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false; + bool myOk = false; + if( !GEOMBase::GetShape(aSelectedObject, S) ) return; @@ -227,22 +276,29 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex); - myOkPath = true; + aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); + myOk = true; } else { // get Object from study - myPath = aFindedObject; - myOkPath = true; + aSelectedObject = aFindedObject; + myOk = true; } } else { - myOkPath = true; + myOk = true; if (S.ShapeType() != TopAbs_EDGE) { aSelectedObject = GEOM::GEOM_Object::_nil(); aName = ""; - myOkPath = false; + myOk = false; } + } + if (myEditCurrentArgument == GroupPoints->LineEdit2) { myPath = aSelectedObject; + myOkPath = myOk; + } + else if (myEditCurrentArgument == GroupPoints->LineEdit3) { + myVec = aSelectedObject; + myOkVec = myOk; } } myEditCurrentArgument->setText( aName ); @@ -272,6 +328,12 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() globalSelection(); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } + else if(send == GroupPoints->PushButton3) { + GroupPoints->LineEdit3->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit3; + globalSelection(); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + } SelectionIntoArgument(); } @@ -284,7 +346,8 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if(send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2) + send == GroupPoints->LineEdit2 || + send == GroupPoints->LineEdit3) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -313,7 +376,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() globalSelection( GEOM_ALLSHAPES ); connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - displayPreview(); + ConstructorsClicked(getConstructorId()); } @@ -332,7 +395,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation() //================================================================================= bool GenerationGUI_PipeDlg::isValid( QString& ) { - return myOkBase && myOkPath; + switch ( getConstructorId() ) { + case 0 : + return myOkBase && myOkPath; + case 1 : + return myOkBase && myOkPath && myOkVec; + } } //================================================================================= @@ -343,8 +411,17 @@ bool GenerationGUI_PipeDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj; - anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + switch ( getConstructorId() ) { + case 0 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakePipe( myBase, myPath ); + break; + + case 1 : + anObj = GEOM::GEOM_I3DPrimOperations::_narrow( + getOperation() )->MakePipeBiNormalAlongVector( myBase, myPath, myVec ); + break; + } if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index b926d6de7..ab623ff55 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -31,7 +31,7 @@ #include "GenerationGUI.h" #include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel_QTD.h" +#include "DlgRef_3Sel_QTD.h" //================================================================================= // class : GenerationGUI_PipeDlg @@ -59,10 +59,12 @@ private: GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::GEOM_Object_var myPath; /* Shape, defining the path */ + GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */ bool myOkBase; - bool myOkPath; /* to check when arguments are defined */ + bool myOkPath; + bool myOkVec; /* to check when arguments are defined */ - DlgRef_2Sel_QTD* GroupPoints; + DlgRef_3Sel_QTD* GroupPoints; private slots: void ClickOnOk(); @@ -71,6 +73,7 @@ private slots: void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); }; #endif // DIALOGBOX_PIPE_H -- 2.39.2