mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-12 01:30:36 +05:00
To implement issue 0019962: MakePipeBiNormalAlongAxis implementation.
This commit is contained in:
parent
baf033379d
commit
53daed0dad
BIN
doc/salome/gui/GEOM/images/pipe2.png
Executable file
BIN
doc/salome/gui/GEOM/images/pipe2.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
@ -1048,6 +1048,21 @@ 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);
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -198,6 +198,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 //
|
||||
//-----------------------------------------------------------//
|
||||
|
@ -107,6 +107,7 @@ partition.png \
|
||||
partitionkeep.png \
|
||||
partitionplane.png \
|
||||
pipe.png \
|
||||
pipebinormal.png \
|
||||
plane.png \
|
||||
planeWorking.png \
|
||||
planedxyz.png \
|
||||
|
BIN
resources/pipebinormal.png
Normal file
BIN
resources/pipebinormal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -359,6 +359,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"
|
||||
|
@ -60,6 +60,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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
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,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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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(); }
|
||||
};
|
||||
|
@ -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:
|
||||
//=============================================================================
|
||||
|
@ -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 //
|
||||
//-----------------------------------------------------------//
|
||||
|
@ -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
|
||||
## @}
|
||||
|
||||
|
@ -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() );
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user