0016756: EDF 545 GEOM : Extrusion, give the coordinates of the vector as input

This commit is contained in:
dmv 2008-07-22 07:20:59 +00:00
parent 2bd6b8908e
commit 2dbe613765
27 changed files with 634 additions and 23 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -34,6 +34,16 @@ shell) serving as base object + 2 vertices.
\image html extrusion2.png
\n Finally, you can define the \b Extrusion by the <b>Base Shape</b>
and the <b>DX, DY, DZ</b> Vector\n
<b>Both Directions</b> checkbox allows extruding the
source objects forward and backward also.
\n <b>TUI Command:</b> <em>geompy.MakePrismDXDYDZ(Base, dx, dy, dz)</em>
\n <b>Arguments:</b> Name + 1 shape (vertex, edge, planar wire, face or
shell) serving as base object + 3 axis directions.
\image html extrusion3.png
<b>Examples:</b>
\image html prisms_basessn.png

View File

@ -942,6 +942,18 @@ module GEOM
GEOM_Object MakePrismTwoPnt2Ways (in GEOM_Object theBase,
in GEOM_Object thePoint1,
in GEOM_Object thePoint2);
/*!
* Create a shape by extrusion of the base shape along a vector, defined by DX DY DZ.
* \param theBase Base shape to be extruded.
* \param DX, DY, DZ end of extrusion vector.
* \return New GEOM_Object, containing the created prism.
*/
GEOM_Object MakePrismDXDYDZ (in GEOM_Object theBase,
in double theDX, in double theDY, in double theDZ);
/* The same prism but in two directions forward&backward */
GEOM_Object MakePrismDXDYDZ2Ways (in GEOM_Object theBase,
in double theDX, in double theDY, in double theDZ);
/*!
* Create a shape by extrusion of the base shape along

View File

@ -119,6 +119,7 @@ point_line_intersection.png \
polyline.png \
prism.png \
prism2.png \
prism3.png \
revol.png \
rotate.png \
rotatepnt.png \

View File

@ -177,6 +177,20 @@ DlgRef_1Sel3Spin::~DlgRef_1Sel3Spin()
{
}
//////////////////////////////////////////
// DlgRef_1Sel3Spin1Check
//////////////////////////////////////////
DlgRef_1Sel3Spin1Check::DlgRef_1Sel3Spin1Check( QWidget* parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setupUi( this );
}
DlgRef_1Sel3Spin1Check::~DlgRef_1Sel3Spin1Check()
{
}
//////////////////////////////////////////
// DlgRef_1Sel4Spin
//////////////////////////////////////////

View File

@ -210,6 +210,22 @@ public:
~DlgRef_1Sel3Spin();
};
//////////////////////////////////////////
// DlgRef_1Sel3Spin1Check
//////////////////////////////////////////
#include "ui_DlgRef_1Sel3Spin1Check_QTD.h"
class DLGREF_EXPORT DlgRef_1Sel3Spin1Check : public QWidget,
public Ui::DlgRef_1Sel3Spin1Check_QTD
{
Q_OBJECT
public:
DlgRef_1Sel3Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
~DlgRef_1Sel3Spin1Check();
};
//////////////////////////////////////////
// DlgRef_1Sel4Spin
//////////////////////////////////////////

View File

@ -42,6 +42,7 @@ HEADERS += DlgRef_2Sel1Spin_QTD.h
HEADERS += DlgRef_2Sel2Spin_QTD.h
HEADERS += DlgRef_2Sel3Spin_QTD.h
HEADERS += DlgRef_1Sel1Spin1Check_QTD.h
HEADERS += DlgRef_1Sel3Spin1Check_QTD.h
HEADERS += DlgRef_2Sel1Spin2Check_QTD.h
HEADERS += DlgRef_2Sel2Spin1Check_QTD.h
HEADERS += DlgRef_2Sel4Spin1Check_QTD.h
@ -66,6 +67,7 @@ HEADERS += DlgRef_2Sel1Spin.h
HEADERS += DlgRef_2Sel2Spin.h
HEADERS += DlgRef_2Sel3Spin.h
HEADERS += DlgRef_1Sel1Spin1Check.h
HEADERS += DlgRef_1Sel3Spin1Check.h
HEADERS += DlgRef_2Sel1Spin2Check.h
HEADERS += DlgRef_2Sel2Spin1Check.h
HEADERS += DlgRef_2Sel4Spin1Check.h
@ -93,6 +95,7 @@ SOURCES += DlgRef_2Sel1Spin.cxx
SOURCES += DlgRef_2Sel2Spin.cxx
SOURCES += DlgRef_2Sel3Spin.cxx
SOURCES += DlgRef_1Sel1Spin1Check.cxx
SOURCES += DlgRef_1Sel3Spin1Check.cxx
SOURCES += DlgRef_2Sel1Spin2Check.cxx
SOURCES += DlgRef_2Sel2Spin1Check.cxx
SOURCES += DlgRef_2Sel4Spin1Check.cxx

View File

@ -0,0 +1,177 @@
<ui version="4.0" >
<class>DlgRef_1Sel3Spin1Check_QTD</class>
<widget class="QWidget" name="DlgRef_1Sel3Spin1Check_QTD" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>156</width>
<height>120</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QGroupBox" name="GroupBox1" >
<property name="title" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="4" column="0" colspan="2" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL2</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="TextLabel4" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL4</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL3</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLineEdit" name="LineEdit1" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL1</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="PushButton1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>
<tabstop>SpinBox_DX</tabstop>
<tabstop>SpinBox_DY</tabstop>
<tabstop>SpinBox_DZ</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -49,6 +49,7 @@ UIC_FILES = \
ui_DlgRef_1Sel2Spin_QTD.h \
ui_DlgRef_1Sel3Check_QTD.h \
ui_DlgRef_1Sel3Spin_QTD.h \
ui_DlgRef_1Sel3Spin1Check_QTD.h \
ui_DlgRef_1Sel4Spin_QTD.h \
ui_DlgRef_1Sel5Spin1Check_QTD.h \
ui_DlgRef_1Sel5Spin_QTD.h \

View File

@ -338,6 +338,10 @@
<source>ICON_DLG_PRISM_2P</source>
<translation>prism2.png</translation>
</message>
<message>
<source>ICON_DLG_PRISM_DXDYDZ</source>
<translation>prism3.png</translation>
</message>
<message>
<source>ICON_DLG_PROPAGATE</source>
<translation>propagate.png</translation>

View File

@ -496,6 +496,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_EXTRUSION_BSV_2P</source>
<translation>Base Shape + 2 Points</translation>
</message>
<message>
<source>GEOM_EXTRUSION_DXDYDZ</source>
<translation>Base Shape + DX DY DZ Vector</translation>
</message>
<message>
<source>GEOM_EXTRUSION_TITLE</source>
<translation>Construction by Extrusion</translation>

View File

@ -874,6 +874,121 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways
return aPrism;
}
//=============================================================================
/*!
* MakePrismDXDYDZ
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ
(Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ)
{
SetErrorCode(KO);
if (theBase.IsNull()) return NULL;
//Add a new Prism object
Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
//Add a new Prism function for creation a Prism by DXDYDZ
Handle(GEOM_Function) aFunction =
aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_DXDYDZ);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
GEOMImpl_IPrism aCI (aFunction);
Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
if (aRefBase.IsNull()) return NULL;
aCI.SetBase(aRefBase);
aCI.SetDX(theDX);
aCI.SetDY(theDY);
aCI.SetDZ(theDZ);
//Compute the Prism value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Extrusion can not be created, check input data");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismDXDYDZ("
<< theBase << ", " << theDX << ", " << theDY << ", " << theDZ << ")";
SetErrorCode(OK);
return aPrism;
}
//=============================================================================
/*!
* MakePrismDXDYDZ_2WAYS
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways
(Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ)
{
SetErrorCode(KO);
if (theBase.IsNull()) return NULL;
//Add a new Prism object
Handle(GEOM_Object) aPrism = GetEngine()->AddObject(GetDocID(), GEOM_PRISM);
//Add a new Prism function for creation a Prism by DXDYDZ
Handle(GEOM_Function) aFunction =
aPrism->AddFunction(GEOMImpl_PrismDriver::GetID(), PRISM_BASE_DXDYDZ_2WAYS);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_PrismDriver::GetID()) return NULL;
GEOMImpl_IPrism aCI (aFunction);
Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
if (aRefBase.IsNull()) return NULL;
aCI.SetBase(aRefBase);
aCI.SetDX(theDX);
aCI.SetDY(theDY);
aCI.SetDZ(theDZ);
//Compute the Prism value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Extrusion can not be created, check input data");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismDXDYDZ2Ways("
<< theBase << ", " << theDX << ", " << theDY << ", " << theDZ << ")";
SetErrorCode(OK);
return aPrism;
}
//=============================================================================
/*!

View File

@ -70,6 +70,12 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
Handle(GEOM_Object) thePoint1,
Handle(GEOM_Object) thePoint2);
Standard_EXPORT Handle(GEOM_Object) MakePrismDXDYDZ (Handle(GEOM_Object) theBase,
double theDX, double theDY, double theDZ);
Standard_EXPORT Handle(GEOM_Object) MakePrismDXDYDZ2Ways (Handle(GEOM_Object) theBase,
double theDX, double theDY, double theDZ);
Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePath);

View File

@ -27,6 +27,9 @@
#define PRISM_ARG_BASE 3
#define PRISM_ARG_PNT_F 4
#define PRISM_ARG_PNT_L 5
#define PRISM_ARG_DX 6
#define PRISM_ARG_DY 7
#define PRISM_ARG_DZ 8
class GEOMImpl_IPrism
{
@ -39,6 +42,14 @@ class GEOMImpl_IPrism
void SetFirstPoint(Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_F, thePoint); }
void SetLastPoint (Handle(GEOM_Function) thePoint) { _func->SetReference(PRISM_ARG_PNT_L, thePoint); }
void SetDX(double theDX) { _func->SetReal(PRISM_ARG_DX, theDX); }
void SetDY(double theDY) { _func->SetReal(PRISM_ARG_DY, theDY); }
void SetDZ(double theDZ) { _func->SetReal(PRISM_ARG_DZ, theDZ); }
double GetDX() { return _func->GetReal(PRISM_ARG_DX); }
double GetDY() { return _func->GetReal(PRISM_ARG_DY); }
double GetDZ() { return _func->GetReal(PRISM_ARG_DZ); }
Handle(GEOM_Function) GetBase () { return _func->GetReference(PRISM_ARG_BASE); }
Handle(GEOM_Function) GetVector() { return _func->GetReference(PRISM_ARG_VEC ); }
Handle(GEOM_Function) GetFirstPoint() { return _func->GetReference(PRISM_ARG_PNT_F ); }

View File

@ -129,7 +129,21 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
}
}
}
} else {
} else if (aType == PRISM_BASE_DXDYDZ || aType == PRISM_BASE_DXDYDZ_2WAYS) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
gp_Vec aV (aCI.GetDX(), aCI.GetDY(), aCI.GetDZ());
if (aV.Magnitude() > gp::Resolution()) {
if (aType == PRISM_BASE_DXDYDZ_2WAYS)
{
gp_Trsf aTrsf;
aTrsf.SetTranslation(-aV);
BRepBuilderAPI_Transform aTransformation(aShapeBase, aTrsf, Standard_False);
aShapeBase = aTransformation.Shape();
aV = aV * 2;
}
aShape = BRepPrimAPI_MakePrism(aShapeBase, aV, Standard_False).Shape();
}
}
if (aShape.IsNull()) return 0;

View File

@ -171,6 +171,8 @@
#define PRISM_BASE_TWO_PNT 2
#define PRISM_BASE_VEC_H_2WAYS 3
#define PRISM_BASE_TWO_PNT_2WAYS 4
#define PRISM_BASE_DXDYDZ 5
#define PRISM_BASE_DXDYDZ_2WAYS 6
#define REVOLUTION_BASE_AXIS_ANGLE 1
#define REVOLUTION_BASE_AXIS_ANGLE_2WAYS 2

View File

@ -239,8 +239,8 @@ static bool inUse( _PTR(Study) study, const QString& component, const QMap<QStri
continue;
GEOM::ListOfGO_var list = geomObj->GetDependency();
if( list->length() <= 1 )
continue; // ??? why 1?
if( list->length() == 0 )
continue;
for( int i = 0; i < list->length(); i++ ) {
bool depends = false;

View File

@ -459,6 +459,68 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePrismDXDYDZ
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
(GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
CORBA::Double theDY, CORBA::Double theDZ)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if (theBase == NULL) return aGEOMObject._retn();
//Get the reference objects
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
(theBase->GetStudyID(), theBase->GetEntry());
if (aBase.IsNull()) return aGEOMObject._retn();
//Create the Prism
Handle(GEOM_Object) anObject =
GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePrismDXDYDZ2Ways
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
(GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
CORBA::Double theDY, CORBA::Double theDZ)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if (theBase == NULL) return aGEOMObject._retn();
//Get the reference objects
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
(theBase->GetStudyID(), theBase->GetEntry());
if (aBase.IsNull()) return aGEOMObject._retn();
//Create the Prism
Handle(GEOM_Object) anObject =
GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePipe

View File

@ -94,6 +94,15 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX,
CORBA::Double theDY,
CORBA::Double theDZ);
GEOM::GEOM_Object_ptr MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX,
CORBA::Double theDY,
CORBA::Double theDZ);
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath);

View File

@ -967,6 +967,34 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr
return anObj;
}
//=============================================================================
// MakePrismDXDYDZ:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
{
beginService( " GEOM_Superv_i::MakePrismDXDYDZ" );
MESSAGE("GEOM_Superv_i::MakePrismDXDYDZ");
get3DPrimOp();
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismDXDYDZ(theBase, theDX, theDY, theDZ);
endService( " GEOM_Superv_i::MakePrismDXDYDZ" );
return anObj;
}
//=============================================================================
// MakePrismDXDYDZ:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
{
beginService( " GEOM_Superv_i::MakePrismDXDYDZ2Ways" );
MESSAGE("GEOM_Superv_i::MakePrismDXDYDZ2Ways");
get3DPrimOp();
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ);
endService( " GEOM_Superv_i::MakePrismDXDYDZ2Ways" );
return anObj;
}
//=============================================================================
// MakePipe:
//=============================================================================

View File

@ -226,6 +226,14 @@ public:
GEOM::GEOM_Object_ptr MakePrismTwoPnt2Ways (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr MakePrismDXDYDZ (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX,
CORBA::Double theDY,
CORBA::Double theDZ);
GEOM::GEOM_Object_ptr MakePrismDXDYDZ2Ways (GEOM::GEOM_Object_ptr theBase,
CORBA::Double theDX,
CORBA::Double theDY,
CORBA::Double theDZ);
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath);
GEOM::GEOM_Object_ptr MakeRevolutionAxisAngle (GEOM::GEOM_Object_ptr theBase,

View File

@ -171,6 +171,8 @@ def TestAll (geompy, math):
Copy = geompy.MakeCopy(Box) #(GEOM_Object_ptr)->GEOM_Object_ptr
Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
PrismDXDYDZ= geompy.MakePrismDXDYDZ(Face2, 10, 20, 100)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
PrismDXDYDZ2Ways= geompy.MakePrismDXDYDZ2Ways(Face, 30, -20, 200)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Revolution = geompy.MakeRevolution(Face, vz, angle2) #
Revolution2Ways = geompy.MakeRevolution(Face, vz, angle1) #
Filling = geompy.MakeFilling(Compound, mindeg, maxdeg,
@ -336,6 +338,8 @@ def TestAll (geompy, math):
id_Copy = geompy.addToStudy(Copy, "Copy")
id_Prism = geompy.addToStudy(Prism, "Prism")
id_Prism2Ways = geompy.addToStudy(Prism2Ways, "Prism2Ways")
id_PrismDXDYDZ= geompy.addToStudy(PrismDXDYDZ,"PrismDXDYDZ")
id_PrismDXDYDZ2Ways= geompy.addToStudy(PrismDXDYDZ2Ways,"PrismDXDYDZ2Ways")
id_Revolution = geompy.addToStudy(Revolution, "Revolution")
id_Revolution2Ways = geompy.addToStudy(Revolution2Ways, "Revolution2Ways")
id_Filling = geompy.addToStudy(Filling, "Filling")

View File

@ -851,6 +851,32 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
# @return New GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# i.e. all the space, transfixed by the base shape during its translation
# along the vector on the given distance in 2 Ways (forward/backward) .
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
# @return New GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
return anObj
## Create a shape by revolution of the base shape around the axis
# on the given angle, i.e. all the space, transfixed by the base

View File

@ -58,6 +58,7 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWi
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_2P" ) ) );
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PRISM_DXDYDZ" ) ) );
setWindowTitle( tr( "GEOM_EXTRUSION_TITLE" ) );
@ -65,11 +66,10 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWi
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_EXTRUSION" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
mainFrame()->RadioButton3->setIcon( image3 );
mainFrame()->RadioButton1->setChecked( true );
myBothway = myBothway2 = false;
myBothway = myBothway2 = myBothway3 = false;
GroupPoints = new DlgRef_2Sel1Spin2Check( centralWidget() );
GroupPoints->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV" ) );
@ -85,7 +85,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWi
GroupPoints->CheckButton2->setText( tr( "GEOM_REVERSE" ) );
GroupPoints2 = new DlgRef_3Sel1Check( centralWidget() );
GroupPoints2->GroupBox1->setTitle( tr( "GEOM_EXTRUSION_BSV_2P" ) );
GroupPoints2->TextLabel1->setText( tr( "GEOM_BASE" ) );
GroupPoints2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
@ -96,10 +95,21 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg( GeometryGUI* theGeometryGUI, QWi
GroupPoints2->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
GroupPoints2->CheckButton1->setChecked( myBothway2 );
GroupPoints3 = new DlgRef_1Sel3Spin1Check( centralWidget() );
GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
GroupPoints3->TextLabel1->setText(tr("GEOM_BASE"));
GroupPoints3->PushButton1->setIcon(image1);
GroupPoints3->TextLabel2->setText(tr("GEOM_DX"));
GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
GroupPoints3->CheckButton1->setText( tr( "GEOM_BOTHWAY" ) );
GroupPoints3->CheckButton1->setChecked( myBothway3 );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
layout->addWidget( GroupPoints2 );
layout->addWidget( GroupPoints3);
/***************************************************************/
setHelpFileName( "create_extrusion_page.html" );
@ -133,6 +143,8 @@ void GenerationGUI_PrismDlg::Init()
GroupPoints2->LineEdit2->setReadOnly( true );
GroupPoints2->LineEdit3->setReadOnly( true );
GroupPoints3->LineEdit1->setReadOnly( true );
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
@ -141,6 +153,13 @@ void GenerationGUI_PrismDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
/* min, max, step and decimals for spin boxes & initial values */
initSpinBox( GroupPoints3->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
initSpinBox( GroupPoints3->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
initSpinBox( GroupPoints3->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
GroupPoints3->SpinBox_DX->setValue( 0.0 );
GroupPoints3->SpinBox_DY->setValue( 0.0 );
GroupPoints3->SpinBox_DZ->setValue( 0.0 );
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
GroupPoints->SpinBox_DX->setValue( 100.0 );
@ -165,12 +184,18 @@ void GenerationGUI_PrismDlg::Init()
connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway2() ) );
connect( GroupPoints2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints3->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints3->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints3->SpinBox_DZ, SIGNAL( valueChanged ( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
connect( GroupPoints3->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( onBothway() ) );
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@ -187,6 +212,9 @@ void GenerationGUI_PrismDlg::Init()
void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep( double step )
{
GroupPoints->SpinBox_DX->setSingleStep(step);
GroupPoints3->SpinBox_DX->setSingleStep(step);
GroupPoints3->SpinBox_DY->setSingleStep(step);
GroupPoints3->SpinBox_DZ->setSingleStep(step);
}
@ -205,6 +233,7 @@ void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
globalSelection( GEOM_ALLSHAPES );
GroupPoints2->hide();
GroupPoints3->hide();
GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1;
@ -221,6 +250,7 @@ void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
GroupPoints->hide();
GroupPoints2->show();
GroupPoints3->hide();
myEditCurrentArgument = GroupPoints2->LineEdit1;
GroupPoints2->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
@ -231,6 +261,17 @@ void GenerationGUI_PrismDlg::ConstructorsClicked( int constructorId )
break;
}
case 2:
{
globalSelection( GEOM_ALLSHAPES );
GroupPoints->hide();
GroupPoints2->hide();
GroupPoints3->show();
myEditCurrentArgument = GroupPoints3->LineEdit1;
GroupPoints3->LineEdit1->setText( GroupPoints->LineEdit1->text() ); // keep base
}
}
qApp->processEvents();
@ -340,7 +381,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
}
myEditCurrentArgument->setText( aName );
}
else { // getConstructorId()==1 - extrusion using 2 points
else if ( getConstructorId() == 1 ) { // getConstructorId()==1 - extrusion using 2 points
if ( IObjectCount() != 1 ) {
if ( myEditCurrentArgument == GroupPoints2->LineEdit1 )
myOkBase = false;
@ -410,6 +451,18 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
myPoint2 = aSelectedObject;
}
}
else if ( getConstructorId() == 2 ) { // extrusion using dx dy dz
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if ( !testResult || CORBA::is_nil( aSelectedObject ) )
return;
QString aName = GEOMBase::GetName( aSelectedObject );
myBase = aSelectedObject;
myEditCurrentArgument->setText( aName );
}
displayPreview();
}
@ -447,6 +500,10 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
myEditCurrentArgument = GroupPoints2->LineEdit3;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
}
else if ( send == GroupPoints3->PushButton1 ) {
GroupPoints3->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints3->LineEdit1;
}
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
@ -464,7 +521,8 @@ void GenerationGUI_PrismDlg::LineEditReturnPressed()
send == GroupPoints->LineEdit2 ||
send == GroupPoints2->LineEdit1 ||
send == GroupPoints2->LineEdit2 ||
send == GroupPoints2->LineEdit3 ) {
send == GroupPoints2->LineEdit3 ||
send == GroupPoints3->LineEdit1) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -532,8 +590,10 @@ bool GenerationGUI_PrismDlg::isValid( QString& )
{
if ( getConstructorId() == 0 )
return ( myOkBase && myOkVec ); // by vector and height
else
else if ( getConstructorId() == 1 )
return ( myOkBase && myOkPnt1 && myOkPnt2 ); // by two points
else if ( getConstructorId() == 2 )
return true;
}
//=================================================================================
@ -565,6 +625,20 @@ bool GenerationGUI_PrismDlg::execute( ObjectList& objects )
MakePrismTwoPnt2Ways( myBase, myPoint1, myPoint2 );
}
break;
case 2 :
double dx = GroupPoints3->SpinBox_DX->value();
double dy = GroupPoints3->SpinBox_DY->value();
double dz = GroupPoints3->SpinBox_DZ->value();
if ( !myBothway3 ) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
MakePrismDXDYDZ( myBase, dx, dy, dz );
}
else {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->
MakePrismDXDYDZ2Ways( myBase, dx, dy, dz );
}
break;
}
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
@ -589,17 +663,25 @@ void GenerationGUI_PrismDlg::onReverse()
//=================================================================================
void GenerationGUI_PrismDlg::onBothway()
{
bool anOldValue = myBothway;
myBothway = !anOldValue;
GroupPoints->CheckButton2->setEnabled( !myBothway );
displayPreview();
}
void GenerationGUI_PrismDlg::onBothway2()
{
bool anOldValue = myBothway2;
myBothway2 = !anOldValue;
displayPreview();
bool anOldValue;
switch ( getConstructorId() ) {
case 0:
anOldValue = myBothway;
myBothway = !anOldValue;
GroupPoints->CheckButton2->setEnabled( !myBothway );
displayPreview();
break;
case 1:
anOldValue = myBothway2;
myBothway2 = !anOldValue;
displayPreview();
break;
case 2:
anOldValue = myBothway3;
myBothway3 = !anOldValue;
displayPreview();
break;
}
}
//=================================================================================

View File

@ -30,6 +30,7 @@
class DlgRef_2Sel1Spin2Check;
class DlgRef_3Sel1Check;
class DlgRef_1Sel3Spin1Check;
//=================================================================================
// class : GenerationGUI_PrismDlg
@ -66,9 +67,11 @@ private:
bool myOkPnt2;
bool myBothway;
bool myBothway2;
bool myBothway3;
DlgRef_2Sel1Spin2Check* GroupPoints;
DlgRef_3Sel1Check* GroupPoints2; // for second layout for extrusion using 2 points
DlgRef_1Sel3Spin1Check* GroupPoints3;
private slots:
void ClickOnOk();
@ -82,7 +85,6 @@ private slots:
void SetDoubleSpinBoxStep( double );
void onReverse();
void onBothway();
void onBothway2();
};
#endif // GENERATIONGUI_PRISMDLG_H