mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-01 04:10:34 +05:00
To implement issue 0019962: MakePipeBiNormalAlongAxis implementation.
This commit is contained in:
parent
dc0102b3ab
commit
0c6f0114a9
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 |
BIN
doc/salome/gui/GEOM/images/pipebinormalsn.png
Normal file
BIN
doc/salome/gui/GEOM/images/pipebinormalsn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 200 KiB |
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
To generate a \b Pipe in the <b>Main Menu</b> select <b>New Entity - > Generation - > Extrusion along a path</b>
|
To generate a \b Pipe in the <b>Main Menu</b> select <b>New Entity - > Generation - > Extrusion along a path</b>
|
||||||
|
|
||||||
\n To create an extruded \b Pipe shape, you need to define the <b>Base
|
\n Firstly, to create an extruded \b Pipe shape, you can define the <b>Base
|
||||||
Object</b> (vertex, edge, planar wire, face or shell), which will be extruded
|
Object</b> (vertex, edge, planar wire, face or shell), which will be extruded
|
||||||
and the <b>Path Object</b> (edge or wire) along which the <b>Base
|
and the <b>Path Object</b> (edge or wire) along which the <b>Base
|
||||||
Object</b> will be extruded.
|
Object</b> will be extruded.
|
||||||
@ -18,12 +18,30 @@ definition of the path.
|
|||||||
|
|
||||||
\image html pipe.png
|
\image html pipe.png
|
||||||
|
|
||||||
|
\n Secondly, you can define the <b>Base
|
||||||
|
Object</b> (edge, planar wire or face), which will be extruded,
|
||||||
|
the <b>Path Object</b> (edge or wire) along which the <b>Base
|
||||||
|
Object</b> will be extruded and the <b>Vector</b> (edge or wire)
|
||||||
|
to keep constant angular relations between the sections and this one.
|
||||||
|
\n The \b Result of the operation will be a GEOM_Object (edge, face, shell,
|
||||||
|
solid or compsolid).
|
||||||
|
|
||||||
|
\n <b>TUI Command:</b> <em>geompy.MakePipeBiNormalAlongVector(baseShape, pathShape, binormalShape)</em>
|
||||||
|
\n <b>Arguments:</b> Name + 1 shape (edge, planar wire or face)
|
||||||
|
serving as base object + 1 shape (edge or wire) for
|
||||||
|
definition of the path + 1 shape (edge or wire) to set a fixed
|
||||||
|
BiNormal direction to perform the extrusion.
|
||||||
|
|
||||||
|
\image html pipe2.png
|
||||||
|
|
||||||
<b>Example:</b>
|
<b>Example:</b>
|
||||||
|
|
||||||
\image html pipe_wire_edgesn.png
|
\image html pipe_wire_edgesn.png
|
||||||
|
|
||||||
\image html pipesn.png
|
\image html pipesn.png
|
||||||
|
|
||||||
|
\image html pipebinormalsn.png
|
||||||
|
|
||||||
Our <b>TUI Scripts</b> provide you with useful examples of creation of
|
Our <b>TUI Scripts</b> provide you with useful examples of creation of
|
||||||
\ref tui_creation_pipe "Complex Geometric Objects".
|
\ref tui_creation_pipe "Complex Geometric Objects".
|
||||||
|
|
||||||
|
@ -543,4 +543,84 @@ gg.createAndDisplayGO(id_pipe)
|
|||||||
gg.setDisplayMode(id_pipe,1)
|
gg.setDisplayMode(id_pipe,1)
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
\anchor tui_creation_pipe_binormal_along_vector
|
||||||
|
<br><h2>Creation of a PipeBiNormalAlongVector</h2>
|
||||||
|
|
||||||
|
\code
|
||||||
|
def MakeHelix(radius, height, rotation, direction):
|
||||||
|
# - create a helix -
|
||||||
|
radius = 1.0 * radius
|
||||||
|
height = 1.0 * height
|
||||||
|
rotation = 1.0 * rotation
|
||||||
|
if direction > 0:
|
||||||
|
direction = +1
|
||||||
|
else:
|
||||||
|
direction = -1
|
||||||
|
pass
|
||||||
|
from math import sqrt
|
||||||
|
length_z = height
|
||||||
|
length_xy = radius*rotation
|
||||||
|
length = sqrt(length_z*length_z + length_xy*length_xy)
|
||||||
|
import geompy
|
||||||
|
nb_steps = 1
|
||||||
|
epsilon = 1.0e-6
|
||||||
|
while 1:
|
||||||
|
z_step = height / nb_steps
|
||||||
|
angle_step = rotation / nb_steps
|
||||||
|
z = 0.0
|
||||||
|
angle = 0.0
|
||||||
|
helix_points = []
|
||||||
|
for n in range(nb_steps+1):
|
||||||
|
from math import cos, sin
|
||||||
|
x = radius * cos(angle)
|
||||||
|
y = radius * sin(angle)
|
||||||
|
p = geompy.MakeVertex(x, y, z)
|
||||||
|
helix_points.append( p )
|
||||||
|
z += z_step
|
||||||
|
angle += direction * angle_step
|
||||||
|
pass
|
||||||
|
helix = geompy.MakeInterpol(helix_points)
|
||||||
|
length_test = geompy.BasicProperties(helix)[0]
|
||||||
|
prec = abs(length-length_test)/length
|
||||||
|
# print nb_steps, length_test, prec
|
||||||
|
if prec < epsilon:
|
||||||
|
break
|
||||||
|
nb_steps *= 2
|
||||||
|
pass
|
||||||
|
return helix
|
||||||
|
|
||||||
|
def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0):
|
||||||
|
# - create a pipe -
|
||||||
|
thread_radius = 1.0 * thread_radius
|
||||||
|
# create a helix
|
||||||
|
helix = MakeHelix(radius, height, rotation, direction)
|
||||||
|
# base in the (Ox, Oz) plane
|
||||||
|
import geompy
|
||||||
|
p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius)
|
||||||
|
p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius)
|
||||||
|
p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius)
|
||||||
|
p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius)
|
||||||
|
e0 = geompy.MakeEdge(p0, p1)
|
||||||
|
e1 = geompy.MakeEdge(p1, p2)
|
||||||
|
e2 = geompy.MakeEdge(p2, p3)
|
||||||
|
e3 = geompy.MakeEdge(p3, p0)
|
||||||
|
w = geompy.MakeWire([e0, e1, e2, e3])
|
||||||
|
# create a base face
|
||||||
|
base = geompy.MakeFace(w, True)
|
||||||
|
# create a binormal vector
|
||||||
|
binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0)
|
||||||
|
# create a pipe
|
||||||
|
spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal)
|
||||||
|
# Publish in the study
|
||||||
|
geompy.addToStudy(base, "base")
|
||||||
|
geompy.addToStudy(helix, "helix")
|
||||||
|
geompy.addToStudy(binormal, "binormal")
|
||||||
|
geompy.addToStudy(spring, "spring")
|
||||||
|
return spring
|
||||||
|
|
||||||
|
from math import pi
|
||||||
|
|
||||||
|
spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2)
|
||||||
|
\endcode
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -1031,3 +1031,40 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
|
|||||||
|
|
||||||
return GetObject(anObject);
|
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);
|
||||||
|
}
|
||||||
|
@ -156,6 +156,10 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
|
|||||||
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
||||||
const GEOM::ListOfGO& theLocations);
|
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()
|
::GEOMImpl_I3DPrimOperations* GetOperations()
|
||||||
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
|
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
|
||||||
};
|
};
|
||||||
|
@ -1222,6 +1222,24 @@ 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:
|
// MakeFuse:
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -282,6 +282,10 @@ public:
|
|||||||
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
||||||
const GEOM::ListOfGO& theLocations);
|
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 //
|
// BooleanOperations //
|
||||||
//-----------------------------------------------------------//
|
//-----------------------------------------------------------//
|
||||||
|
@ -1139,6 +1139,23 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
|
RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
|
||||||
return anObj
|
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
|
# end of l3_complex
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
|
@ -55,26 +55,26 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
|
|||||||
{
|
{
|
||||||
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
|
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
|
||||||
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_BINORMAL")));
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_PIPE_TITLE"));
|
setWindowTitle(tr("GEOM_PIPE_TITLE"));
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE"));
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE"));
|
||||||
mainFrame()->RadioButton1->setIcon(image0);
|
mainFrame()->RadioButton1->setIcon(image0);
|
||||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
mainFrame()->RadioButton2->setIcon(image2);
|
||||||
mainFrame()->RadioButton2->close();
|
|
||||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
mainFrame()->RadioButton3->close();
|
mainFrame()->RadioButton3->close();
|
||||||
|
|
||||||
GroupPoints = new DlgRef_2Sel(centralWidget());
|
GroupPoints = new DlgRef_3Sel(centralWidget());
|
||||||
|
|
||||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
|
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
|
||||||
GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT"));
|
GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT"));
|
||||||
|
GroupPoints->TextLabel3->setText(tr("GEOM_VECTOR"));
|
||||||
GroupPoints->PushButton1->setIcon(image1);
|
GroupPoints->PushButton1->setIcon(image1);
|
||||||
GroupPoints->PushButton2->setIcon(image1);
|
GroupPoints->PushButton2->setIcon(image1);
|
||||||
GroupPoints->LineEdit1->setReadOnly(true);
|
GroupPoints->PushButton3->setIcon(image1);
|
||||||
GroupPoints->LineEdit2->setReadOnly(true);
|
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
@ -105,28 +105,68 @@ void GenerationGUI_PipeDlg::Init()
|
|||||||
// init variables
|
// init variables
|
||||||
GroupPoints->LineEdit1->setReadOnly(true);
|
GroupPoints->LineEdit1->setReadOnly(true);
|
||||||
GroupPoints->LineEdit2->setReadOnly(true);
|
GroupPoints->LineEdit2->setReadOnly(true);
|
||||||
|
GroupPoints->LineEdit3->setReadOnly(true);
|
||||||
|
|
||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
GroupPoints->LineEdit2->setText("");
|
GroupPoints->LineEdit2->setText("");
|
||||||
myBase = myPath = GEOM::GEOM_Object::_nil();
|
GroupPoints->LineEdit3->setText("");
|
||||||
myOkBase = myOkPath = false;
|
myBase = myPath = myVec = GEOM::GEOM_Object::_nil();
|
||||||
|
myOkBase = myOkPath = myOkVec = false;
|
||||||
|
|
||||||
// signals and slots connections
|
// signals and slots connections
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
|
||||||
|
|
||||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect(GroupPoints->PushButton2, 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
initName(tr("GEOM_PIPE"));
|
initName(tr("GEOM_PIPE"));
|
||||||
|
|
||||||
|
GroupPoints->TextLabel3->hide();
|
||||||
|
GroupPoints->PushButton3->hide();
|
||||||
|
GroupPoints->LineEdit3->hide();
|
||||||
|
ConstructorsClicked(0);
|
||||||
|
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -147,6 +187,8 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
if ( getConstructorId() != 1 )
|
||||||
|
ConstructorsClicked( getConstructorId() );
|
||||||
// activate selection and connect selection manager
|
// activate selection and connect selection manager
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
return true;
|
return true;
|
||||||
@ -162,6 +204,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit3) myOkVec = false;
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
@ -187,14 +230,23 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
S.ShapeType() == TopAbs_SOLID ||
|
S.ShapeType() == TopAbs_SOLID ||
|
||||||
S.ShapeType() == TopAbs_SHAPE)
|
S.ShapeType() == TopAbs_SHAPE)
|
||||||
return;
|
return;
|
||||||
|
if ( getConstructorId() == 1 &&
|
||||||
|
(S.ShapeType() == TopAbs_SHELL ||
|
||||||
|
S.ShapeType() == TopAbs_VERTEX))
|
||||||
|
return;
|
||||||
|
|
||||||
myBase = aSelectedObject;
|
myBase = aSelectedObject;
|
||||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||||
myOkBase = true;
|
myOkBase = true;
|
||||||
if (!myOkPath)
|
if (!myOkPath)
|
||||||
GroupPoints->PushButton2->click();
|
GroupPoints->PushButton2->click();
|
||||||
|
else if (!myOkVec)
|
||||||
|
GroupPoints->PushButton3->click();
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
|
||||||
|
myEditCurrentArgument == GroupPoints->LineEdit3) {
|
||||||
|
myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false;
|
||||||
|
bool myOk = false;
|
||||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
|
|
||||||
if (aSelectedObject != myBase) {
|
if (aSelectedObject != myBase) {
|
||||||
@ -210,27 +262,44 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
|
||||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||||
getGeomEngine()->GetIShapesOperations(getStudyId());
|
getGeomEngine()->GetIShapesOperations(getStudyId());
|
||||||
myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
|
||||||
myOkPath = true;
|
myOk = true;
|
||||||
}
|
}
|
||||||
else { // get Object from study
|
else { // get Object from study
|
||||||
myPath = aFindedObject;
|
aSelectedObject = aFindedObject;
|
||||||
myOkPath = true;
|
myOk = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myOkPath = true;
|
myOk = true;
|
||||||
if (S.ShapeType() != TopAbs_EDGE) {
|
if (S.ShapeType() != TopAbs_EDGE) {
|
||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
aName = "";
|
aName = "";
|
||||||
myOkPath = false;
|
myOk = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
myPath = aSelectedObject;
|
myPath = aSelectedObject;
|
||||||
|
myOkPath = myOk;
|
||||||
|
}
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
|
||||||
|
myVec = aSelectedObject;
|
||||||
|
myOkVec = myOk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
if (myOkPath && !myOkBase)
|
if (myOkPath) {
|
||||||
|
if (!myOkBase)
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
|
else if (!myOkVec)
|
||||||
|
GroupPoints->PushButton3->click();
|
||||||
|
}
|
||||||
|
else if (myOkVec) {
|
||||||
|
if (!myOkBase)
|
||||||
|
GroupPoints->PushButton1->click();
|
||||||
|
else if (!myOkPath)
|
||||||
|
GroupPoints->PushButton2->click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear selection
|
// clear selection
|
||||||
@ -252,15 +321,22 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
|
|||||||
|
|
||||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
globalSelection(GEOM_ALLSHAPES);
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
|
GroupPoints->PushButton1->setDown(false);
|
||||||
|
GroupPoints->PushButton2->setDown(false);
|
||||||
|
GroupPoints->PushButton3->setDown(false);
|
||||||
|
GroupPoints->LineEdit1->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit2->setEnabled(false);
|
||||||
|
GroupPoints->LineEdit3->setEnabled(false);
|
||||||
if (send == GroupPoints->PushButton1) {
|
if (send == GroupPoints->PushButton1) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
GroupPoints->PushButton2->setDown(false);
|
|
||||||
GroupPoints->LineEdit2->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
else if (send == GroupPoints->PushButton2) {
|
else if (send == GroupPoints->PushButton2) {
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
GroupPoints->PushButton1->setDown(false);
|
|
||||||
GroupPoints->LineEdit1->setEnabled(false);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
|
}
|
||||||
|
else if(send == GroupPoints->PushButton3) {
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit3;
|
||||||
|
|
||||||
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
|
||||||
}
|
}
|
||||||
@ -285,7 +361,8 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed()
|
|||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if (send == GroupPoints->LineEdit1 ||
|
if (send == GroupPoints->LineEdit1 ||
|
||||||
send == GroupPoints->LineEdit2) {
|
send == GroupPoints->LineEdit2 ||
|
||||||
|
send == GroupPoints->LineEdit3) {
|
||||||
myEditCurrentArgument = send;
|
myEditCurrentArgument = send;
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
}
|
}
|
||||||
@ -328,7 +405,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool GenerationGUI_PipeDlg::isValid (QString&)
|
bool GenerationGUI_PipeDlg::isValid (QString&)
|
||||||
{
|
{
|
||||||
|
switch ( getConstructorId() ) {
|
||||||
|
case 0 :
|
||||||
return myOkBase && myOkPath;
|
return myOkBase && myOkPath;
|
||||||
|
case 1 :
|
||||||
|
return myOkBase && myOkPath && myOkVec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -339,7 +421,15 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
|
|||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
|
||||||
|
switch ( getConstructorId() ) {
|
||||||
|
case 0 :
|
||||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakePipe(myBase, myPath);
|
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())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <GEOMBase_Skeleton.h>
|
#include <GEOMBase_Skeleton.h>
|
||||||
|
|
||||||
class DlgRef_2Sel;
|
class DlgRef_3Sel;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GenerationGUI_PipeDlg
|
// class : GenerationGUI_PipeDlg
|
||||||
@ -56,10 +56,12 @@ private:
|
|||||||
private:
|
private:
|
||||||
GEOM::GEOM_Object_var myBase; /* Base shape */
|
GEOM::GEOM_Object_var myBase; /* Base shape */
|
||||||
GEOM::GEOM_Object_var myPath; /* Shape, defining the path */
|
GEOM::GEOM_Object_var myPath; /* Shape, defining the path */
|
||||||
|
GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */
|
||||||
bool myOkBase;
|
bool myOkBase;
|
||||||
bool myOkPath; /* to check when arguments are defined */
|
bool myOkPath;
|
||||||
|
bool myOkVec; /* to check when arguments are defined */
|
||||||
|
|
||||||
DlgRef_2Sel* GroupPoints;
|
DlgRef_3Sel* GroupPoints;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
@ -68,6 +70,7 @@ private slots:
|
|||||||
void LineEditReturnPressed();
|
void LineEditReturnPressed();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
|
void ConstructorsClicked( int );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERATIONGUI_PIPEDLG_H
|
#endif // GENERATIONGUI_PIPEDLG_H
|
||||||
|
Loading…
Reference in New Issue
Block a user