Merge from BR_DumpPython_Extension branch (from tag mergeto_BR_V5_Dev_28Jan09)

This commit is contained in:
ouv 2009-01-28 16:31:12 +00:00
parent abd1304ef1
commit 0d6107569c
94 changed files with 2209 additions and 503 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -30,6 +30,10 @@ accessible only via \b TUI commands.
this way you don't need to create them in advance).
\n <b>TUI Command:</b> <em>geompy.MakeBox(x1,y1,z1,x2,y2,z2)</em>
\n <b>Arguments:</b> Name + X, Y and Z coordinates of both points.
\note You can also use variables defined in the SALOME \b NoteBook
to specify any numerical parameters of the box.
\image html box3.png
<b>Example:</b>

View File

@ -14,6 +14,7 @@ using a wide range of functions;</li>
various algorithms;</li>
<li>\subpage repairing_operations_page "optimization of geometrical objects";</li>
<li>\subpage using_measurement_tools_page "provision of information about geometrical objects".</li>
<li>\subpage using_notebook_geom_page.</li>
</ul>
Almost all geometry module functionalities are accessible via

View File

@ -0,0 +1,18 @@
/*!
\page using_notebook_geom_page Using SALOME NoteBook
It is possible to use variables defined through <b>SALOME NoteBook</b> for
creation and modification of objects in the Geometry module with the following
limitations:
<ul>
<li> \ref create_lcs_page "Local Coordinate System" dialog box.\n
The notebook parameters are correctly applied, but the study
update is problematic in case if the LCS is defined using an
object whose dimensions are given by parameters.
<li> \ref color_page "Select color" dialog box.
<li> \ref isolines_page "Select Number of Isos" dialog box.
</ul>
*/

View File

@ -233,6 +233,18 @@ module GEOM
* For example, method return false for GEOM_MARKER
*/
boolean IsShape();
/*!
* Set list of parameters
* \param theParameters is a string containing the notebook variables separated by ":" symbol,
* used for object creation
*/
void SetParameters (in string theParameters);
/*!
* Return list of notebook variables used for object creation separated by ":" symbol
*/
string GetParameters();
};

View File

@ -617,11 +617,13 @@ static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje
bool BasicGUI_CircleDlg::isValid( QString& msg )
{
const int id = getConstructorId();
if ( id == 0 )
if ( id == 0 ) {
//return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
//nil point means origin of global CS
//nil vector means Z axis
return getRadius() > 0;
bool ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview());
return getRadius() > 0 && ok;
}
else if ( id == 1 )
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
@ -643,9 +645,15 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects )
switch ( getConstructorId() ) {
case 0 :
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
res = true;
break;
{
QStringList aParameters;
aParameters << GroupPntVecR->SpinBox_DX->text();
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
if ( !anObj->_is_nil() && !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;
break;
}
case 1 :
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 );
res = true;

View File

@ -410,7 +410,10 @@ bool BasicGUI_EllipseDlg::isValid( QString& msg )
//return !myPoint->_is_nil() && !myDir->_is_nil();
//nil point means origin of global CS
//nil vector means Z axis
return true;
bool ok = true;
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
return ok;
}
//=================================================================================
@ -421,11 +424,17 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
{
double aMajorR = GroupPoints->SpinBox_DX->value();
double aMinorR = GroupPoints->SpinBox_DY->value();
QStringList aParameters;
aParameters<<GroupPoints->SpinBox_DX->text();
aParameters<<GroupPoints->SpinBox_DY->text();
GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR );
if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() ) {
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -99,13 +99,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* anOriGrpLayout = new QVBoxLayout( anOriGrp );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), anOriGrp ) );
myData[ X ] = new QtxDoubleSpinBox( anOriGrp );
myData[ X ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ X ] );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), anOriGrp ) );
myData[ Y ] = new QtxDoubleSpinBox( anOriGrp );
myData[ Y ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ Y ] );
anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), anOriGrp ) );
myData[ Z ] = new QtxDoubleSpinBox( anOriGrp );
myData[ Z ] = new SalomeApp_DoubleSpinBox( anOriGrp );
anOriGrpLayout->addWidget( myData[ Z ] );
aMainGrpLayout->addWidget( anOriGrp );
@ -114,13 +114,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* aXAxisGrpLayout = new QVBoxLayout( aXAxisGrp );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), aXAxisGrp ) );
myData[ DX1 ] = new QtxDoubleSpinBox( aXAxisGrp );
myData[ DX1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DX1 ] );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), aXAxisGrp ) );
myData[ DY1 ] = new QtxDoubleSpinBox( aXAxisGrp );
myData[ DY1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DY1 ] );
aXAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), aXAxisGrp ) );
myData[ DZ1 ] = new QtxDoubleSpinBox( aXAxisGrp );
myData[ DZ1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp );
aXAxisGrpLayout->addWidget( myData[ DZ1 ] );
aMainGrpLayout->addWidget( aXAxisGrp );
@ -129,13 +129,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
QVBoxLayout* anYAxisGrpLayout = new QVBoxLayout( anYAxisGrp );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), anYAxisGrp ) );
myData[ DX2 ] = new QtxDoubleSpinBox( anYAxisGrp );
myData[ DX2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DX2 ] );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), anYAxisGrp ) );
myData[ DY2 ] = new QtxDoubleSpinBox( anYAxisGrp );
myData[ DY2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DY2 ] );
anYAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), anYAxisGrp ) );
myData[ DZ2 ] = new QtxDoubleSpinBox( anYAxisGrp );
myData[ DZ2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp );
anYAxisGrpLayout->addWidget( myData[ DZ2 ] );
aMainGrpLayout->addWidget( anYAxisGrp );
@ -698,8 +698,12 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg )
}
switch ( id ) {
case 0:
return isOk;
case 0: {
bool ok = true;
for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
ok = anIter.value()->isValid( msg, !IsPreview()) && ok;
return isOk && ok;
}
case 1:
return !Group1->LineEdit1->text().isEmpty() && isOk;
case 2:
@ -720,9 +724,22 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
getOperation() )->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), myData[ Z ]->value(),
myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value(),
myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() );
if ( !anObj->_is_nil() )
QStringList aParameters;
aParameters<<myData[X]->text();
aParameters<<myData[Y]->text();
aParameters<<myData[Z]->text();
aParameters<<myData[ DX1 ]->text();
aParameters<<myData[ DY1 ]->text();
aParameters<<myData[ DZ1 ]->text();
aParameters<<myData[ DX2 ]->text();
aParameters<<myData[ DY2 ]->text();
aParameters<<myData[ DZ2 ]->text();
if ( !anObj->_is_nil() ) {
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -32,7 +32,7 @@
class DlgRef_1Sel;
class DlgRef_3Sel;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QFrame;
class BasicGUI_MarkerDlg : public GEOMBase_Skeleton
@ -41,7 +41,7 @@ class BasicGUI_MarkerDlg : public GEOMBase_Skeleton
private:
enum { X, Y, Z, DX1, DY1, DZ1, DX2, DY2, DZ2 };
typedef QMap< int, QtxDoubleSpinBox* > DataMap;
typedef QMap< int, SalomeApp_DoubleSpinBox* > DataMap;
public:
BasicGUI_MarkerDlg( GeometryGUI*, QWidget* );

View File

@ -600,6 +600,20 @@ double BasicGUI_PlaneDlg::getSize() const
return 0.;
}
//=================================================================================
// function : getSize()
// purpose :
//=================================================================================
QString BasicGUI_PlaneDlg::getSizeAsString() const
{
switch ( getConstructorId() ) {
case 0 : return GroupPntDir->SpinBox_DX->text();
case 1 : return Group3Pnts->SpinBox_DX->text();
case 2 : return GroupFace->SpinBox_DX->text();
}
return QString();
}
//=================================================================================
// function : createOperation
// purpose :
@ -629,13 +643,20 @@ bool BasicGUI_PlaneDlg::isValid( QString& msg )
msg = QString( "Please, enter size greater than 0." );
return false;
}
if ( id == 0 )
return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir );
else if ( id == 1 )
if ( id == 0 ) {
bool ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() );
return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) && ok;
}
else if ( id == 1 ) {
bool ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() );
return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
else if ( id == 2 )
return !CORBA::is_nil( myFace );
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) && ok;
}
else if ( id == 2 ) {
bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() );
return !CORBA::is_nil( myFace ) && ok;
}
return false;
}
@ -663,10 +684,12 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
res = true;
break;
}
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
if ( !anObj->_is_nil() ) {
if ( !IsPreview() )
anObj->SetParameters(getSizeAsString().toLatin1().constData());
objects.push_back( anObj._retn() );
}
return res;
}
//=================================================================================

View File

@ -56,6 +56,7 @@ private:
void Init();
void enterEvent( QEvent* );
double getSize() const;
QString getSizeAsString() const;
private:
GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace;

View File

@ -689,19 +689,37 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool BasicGUI_PointDlg::isValid( QString& /*msg*/ )
bool BasicGUI_PointDlg::isValid( QString& msg )
{
const int id = getConstructorId();
if ( id == 0 )
return true;
else if ( id == 1 )
return !myRefPoint->_is_nil();
else if ( id == 2 )
return !myEdge->_is_nil();
if ( id == 0 ) {
bool ok = true;
ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
return ok;
}
else if ( id == 1 ) {
bool ok = true;
ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
return !myRefPoint->_is_nil() && ok;
}
else if ( id == 2 ) {
bool ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
return !myEdge->_is_nil() && ok;
}
else if ( id == 3 )
return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
else if ( id == 4 )
return !myFace->_is_nil();
else if ( id == 4 ) {
bool ok = true;
ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
return !myFace->_is_nil() && ok;
}
return false;
}
@ -714,6 +732,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
bool res = false;
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
switch ( getConstructorId() ) {
case 0 :
@ -721,6 +740,10 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double x = GroupXYZ->SpinBox_DX->value();
double y = GroupXYZ->SpinBox_DY->value();
double z = GroupXYZ->SpinBox_DZ->value();
aParameters << GroupXYZ->SpinBox_DX->text();
aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x, y, z );
res = true;
@ -731,6 +754,10 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double dx = GroupRefPoint->SpinBox_DX->value();
double dy = GroupRefPoint->SpinBox_DY->value();
double dz = GroupRefPoint->SpinBox_DZ->value();
aParameters << GroupRefPoint->SpinBox_DX->text();
aParameters << GroupRefPoint->SpinBox_DY->text();
aParameters << GroupRefPoint->SpinBox_DZ->text();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointWithReference( myRefPoint, dx, dy, dz );
@ -740,6 +767,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
case 2 :
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointOnCurve( myEdge, getParameter() );
aParameters<<GroupOnCurve->SpinBox_DX->text();
res = true;
break;
case 3 :
@ -750,10 +778,20 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
case 4 :
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointOnSurface( myFace, getUParameter(), getVParameter() );
aParameters<<GroupOnSurface->SpinBox_DX->text();
aParameters<<GroupOnSurface->SpinBox_DY->text();
res = true;
break;
}
if(!anObj->_is_nil() && !IsPreview() && (getConstructorId()==0 ||
getConstructorId() == 1 ||
getConstructorId() == 2 ||
getConstructorId() == 4) ) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
if ( getConstructorId() == 1 || getConstructorId() == 2 ||
getConstructorId() == 4 ) {
TopoDS_Shape aShape;

View File

@ -453,7 +453,17 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation()
//=================================================================================
bool BasicGUI_VectorDlg::isValid( QString& msg )
{
return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil() : true;
if(getConstructorId() == 0)
return !myPoint1->_is_nil() && !myPoint2->_is_nil();
else if(getConstructorId() == 1)
{
bool ok = true;
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
return ok;
}
return false;
}
//=================================================================================
@ -478,7 +488,16 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
double dx = GroupDimensions->SpinBox_DX->value();
double dy = GroupDimensions->SpinBox_DY->value();
double dz = GroupDimensions->SpinBox_DZ->value();
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
aParameters << GroupDimensions->SpinBox_DZ->text();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz );
if ( !anObj->_is_nil() && !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;
break;
}

View File

@ -366,8 +366,12 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation()
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
bool BlocksGUI_ExplodeDlg::isValid (QString&)
bool BlocksGUI_ExplodeDlg::isValid (QString& msg)
{
bool okSP = true;
okSP = myGrp1->SpinBox1->isValid( msg, !IsPreview() ) && okSP;
okSP = myGrp1->SpinBox2->isValid( msg, !IsPreview() ) && okSP;
bool ok = false;
switch ( getConstructorId() ) {
case 0:
@ -386,7 +390,7 @@ bool BlocksGUI_ExplodeDlg::isValid (QString&)
break;
}
return ok;
return ok && okSP;
}
//=================================================================================
@ -421,6 +425,10 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects )
return objects.size() > 0;
}
QStringList aParameters;
aParameters << myGrp1->SpinBox1->text();
aParameters << myGrp1->SpinBox2->text();
// Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active
if ( !isAllSubShapes() ) {
@ -442,7 +450,11 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects )
for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter );
if ( selected.contains( QString( objStr.in() ) ) )
{
if ( !IsPreview() )
(*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( *anIter );
}
else
toRemoveFromEngine.push_back( *anIter );
}
@ -457,7 +469,12 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects )
}
else {
for ( int i = 0, n = aList->length(); i < n; i++ )
objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aList[i] );
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
}
return objects.size();

View File

@ -112,7 +112,7 @@ void BlocksGUI_TrsfDlg::Init()
{
// Set range of spinboxes
double SpecificStep = 1.0;
QMap<int, QtxDoubleSpinBox*>::iterator anIter;
QMap<int, SalomeApp_DoubleSpinBox*>::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
//anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
initSpinBox(anIter.value(), 1.0, 999, SpecificStep, 3);
@ -128,9 +128,9 @@ void BlocksGUI_TrsfDlg::Init()
for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn)
connect(anIterBtn.value(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
QMap<int, QtxDoubleSpinBox*>::iterator anIterSpin;
QMap<int, SalomeApp_DoubleSpinBox*>::iterator anIterSpin;
for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin)
connect(anIterSpin.value(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(anIterSpin.value(), SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
// init controls and fields
initName(tr("GEOM_BLOCK_MULTITRSF"));
@ -410,7 +410,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent*)
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void BlocksGUI_TrsfDlg::ValueChangedInSpinBox(double)
void BlocksGUI_TrsfDlg::ValueChangedInSpinBox(int)
{
displayPreview();
}
@ -453,7 +453,7 @@ void BlocksGUI_TrsfDlg::createSpinWg (const QString& theLbl,
const int theId)
{
QLabel* lab = new QLabel(theLbl, theParent);
mySpinBox[theId] = new QtxDoubleSpinBox(theParent);
mySpinBox[theId] = new SalomeApp_DoubleSpinBox(theParent);
QGridLayout* l = 0;
if (!theParent->layout()) {
l = new QGridLayout(theParent);
@ -550,20 +550,23 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation()
// function : isValid
// purpose : Verify validity of input data
//=================================================================================
bool BlocksGUI_TrsfDlg::isValid (QString&)
bool BlocksGUI_TrsfDlg::isValid (QString& msg)
{
bool ok = false;
bool ok = false, okSP = true;
switch (getConstructorId()) {
case 0:
ok = !myShape->_is_nil() && myFaces[Face1] > 0;
okSP = mySpinBox[SpinBox1]->isValid( msg, !IsPreview() );
break;
case 1:
ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0;
okSP = mySpinBox[SpinBox2U]->isValid( msg, !IsPreview() ) && okSP;
okSP = mySpinBox[SpinBox2V]->isValid( msg, !IsPreview() ) && okSP;
break;
default:
break;
}
return ok;
return ok && okSP;
}
//=================================================================================
@ -581,16 +584,32 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->
MakeMultiTransformation1D(myShape,
myFaces[Face1], myFaces[Face2],
(int)mySpinBox[SpinBox1]->value());
mySpinBox[SpinBox1]->value());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << "" << "";
aParameters << mySpinBox[SpinBox1]->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
case 1:
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->
MakeMultiTransformation2D (myShape,
myFaces[Face1U], myFaces[Face2U],
(int)mySpinBox[SpinBox2U]->value(),
mySpinBox[SpinBox2U]->value(),
myFaces[Face1V], myFaces[Face2V],
(int)mySpinBox[SpinBox2V]->value());
mySpinBox[SpinBox2V]->value());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << "" << "";
aParameters << mySpinBox[SpinBox2U]->text();
aParameters << "" << "";
aParameters << mySpinBox[SpinBox2V]->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
default:

View File

@ -30,7 +30,7 @@
#include <QMap>
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
@ -79,7 +79,7 @@ private:
QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName;
QMap<int, QtxDoubleSpinBox*> mySpinBox;
QMap<int, SalomeApp_DoubleSpinBox*> mySpinBox;
private slots:
void ClickOnOk();
@ -90,7 +90,7 @@ private slots:
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox (double);
void ValueChangedInSpinBox (int);
};
#endif // BLOCKSGUI_TRSFDLG_H

View File

@ -79,7 +79,7 @@
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel1" >
@ -122,9 +122,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -104,7 +104,7 @@
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
</layout>
</widget>
@ -115,9 +115,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -35,10 +35,10 @@
<widget class="QTextBrowser" name="TextBrowser1" />
</item>
<item row="2" column="2" >
<widget class="QSpinBox" name="SpinBox2" />
<widget class="SalomeApp_IntSpinBox" name="SpinBox2" />
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="SpinBox1" />
<widget class="SalomeApp_IntSpinBox" name="SpinBox1" />
</item>
<item row="4" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckBox1" >
@ -126,6 +126,13 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SalomeApp_IntSpinBox</class>
<extends>QSpinBox</extends>
<header location="global" >SalomeApp_IntSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>

View File

@ -56,10 +56,10 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
@ -134,9 +134,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,13 +56,13 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="4" column="0" colspan="2" >
<widget class="QCheckBox" name="CheckButton1" >
@ -160,9 +160,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,13 +56,13 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
@ -153,9 +153,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -82,7 +82,7 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox1" />
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel3" >
@ -101,7 +101,7 @@
</widget>
</item>
<item row="0" column="3" >
<widget class="QtxDoubleSpinBox" name="SpinBox2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox2" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel5" >
@ -120,7 +120,7 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox4" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox4" />
</item>
<item row="1" column="2" >
<widget class="QLabel" name="TextLabel6" >
@ -139,7 +139,7 @@
</widget>
</item>
<item row="1" column="3" >
<widget class="QtxDoubleSpinBox" name="SpinBox5" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox5" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel4" >
@ -158,7 +158,7 @@
</widget>
</item>
<item row="2" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox3" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox3" />
</item>
<item row="2" column="2" colspan="2" >
<widget class="QCheckBox" name="CheckBox1" >
@ -176,9 +176,9 @@
</widget>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -72,7 +72,7 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
</layout>
</widget>
@ -83,9 +83,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@ -56,7 +56,7 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
@ -174,9 +174,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,7 +56,7 @@
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel3" >
@ -153,9 +153,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -63,10 +63,10 @@
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="TextLabel4" >
@ -173,9 +173,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,10 +56,10 @@
<number>6</number>
</property>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="0" >
<widget class="QLabel" name="TextLabel4" >
@ -166,9 +166,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -128,7 +128,7 @@
</widget>
</item>
<item row="2" column="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="0" >
<widget class="QRadioButton" name="RadioButton2" >
@ -154,7 +154,7 @@
</widget>
</item>
<item row="3" column="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" >
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" >
<property name="enabled" >
<bool>false</bool>
</property>
@ -177,7 +177,7 @@
</widget>
</item>
<item row="3" column="4" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" >
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" >
<property name="enabled" >
<bool>false</bool>
</property>
@ -190,9 +190,9 @@
</widget>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -168,13 +168,13 @@
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
</layout>
</widget>
@ -185,9 +185,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -63,16 +63,16 @@
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY2" />
</item>
<item row="5" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX2" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY1" />
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX1" />
</item>
<item row="6" column="0" >
<widget class="QLabel" name="TextLabel6" >
@ -211,9 +211,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -72,7 +72,7 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
@ -91,7 +91,7 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
</layout>
</widget>
@ -102,9 +102,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>

View File

@ -111,7 +111,7 @@
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="2" >
<spacer name="verticalSpacer" >
@ -135,9 +135,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -180,7 +180,7 @@
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
</layout>
</widget>
@ -191,10 +191,10 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
</customwidget>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>

View File

@ -144,7 +144,7 @@
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox1" />
</item>
<item row="4" column="0" >
<widget class="QLabel" name="TextLabel5" >
@ -163,7 +163,7 @@
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox2" />
</item>
<item row="5" column="0" >
<widget class="QLabel" name="TextLabel6" >
@ -182,7 +182,7 @@
</widget>
</item>
<item row="5" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox3" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox3" />
</item>
<item row="6" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckBox1" >
@ -207,9 +207,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,16 +56,16 @@
<number>6</number>
</property>
<item row="7" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY2" />
</item>
<item row="6" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX2" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX2" />
</item>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY1" />
</item>
<item row="3" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX1" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX1" />
</item>
<item row="5" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckButton1" >
@ -250,9 +250,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -111,13 +111,13 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="2" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
</layout>
</widget>
@ -128,9 +128,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -56,13 +56,13 @@
<number>6</number>
</property>
<item row="2" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="0" column="1" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
@ -121,9 +121,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -32,7 +32,7 @@
<number>6</number>
</property>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
@ -230,9 +230,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -32,7 +32,7 @@
<number>6</number>
</property>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
@ -243,9 +243,9 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>

View File

@ -32,7 +32,7 @@
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="2" >
<layout class="QGridLayout" >
@ -90,6 +90,13 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>SpinBox_DX</tabstop>
<tabstop>buttonApply</tabstop>

View File

@ -32,10 +32,10 @@
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
@ -111,6 +111,13 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>SpinBox_DX</tabstop>
<tabstop>SpinBox_DY</tabstop>

View File

@ -32,7 +32,7 @@
<number>6</number>
</property>
<item row="2" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="2" >
<layout class="QGridLayout" >
@ -66,10 +66,10 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel1" >
@ -132,6 +132,13 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>SpinBox_DX</tabstop>
<tabstop>SpinBox_DY</tabstop>

View File

@ -32,16 +32,16 @@
<number>6</number>
</property>
<item row="2" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DZ" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="3" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DS" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DS" />
</item>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="1" column="2" >
<layout class="QGridLayout" >
@ -153,6 +153,13 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>SalomeApp_DoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>SpinBox_DX</tabstop>
<tabstop>SpinBox_DY</tabstop>

View File

@ -62,6 +62,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
const double lineWidth )
: QDialog( parent, fl ),
myIsAllAdded( false ),
myIsApply( false ),
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
myGeometryGUI( GUI ),
myLineWidth( lineWidth )
@ -275,14 +276,8 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
}
}
if (event->type() == QEvent::KeyRelease) {
// NPAL16010 (Sketcher Apply non available if only one line is modified)
// To have Apply active as soon as value text changed
QtxDoubleSpinBox* aDoubleSpinBox = (QtxDoubleSpinBox*)object;
if (aDoubleSpinBox)
ValueChangedInSpinBox( aDoubleSpinBox->value() );
}
// Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
return QDialog::eventFilter(object, event);
}
@ -679,7 +674,8 @@ void EntityGUI_SketcherDlg::ClickOnEnd()
return;
}
QString Command = myCommand.join( "" ) + GetNewCommand();
QString Parameters;
QString Command = myCommand.join( "" ) + GetNewCommand( Parameters );
Sketcher_Profile aProfile( Command.toAscii() );
Command = myCommand.join( "" );
@ -719,18 +715,24 @@ bool EntityGUI_SketcherDlg::ClickOnApply()
if ( sender() && sender()->inherits( "QPushButton" ) )
( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
myCommand.append( GetNewCommand() );
QString aParameters;
myCommand.append( GetNewCommand( aParameters ) );
mySketchState = NEXT_POINT;
myUndoCommand.clear();
myUndoCommand.append( "Sketcher" );
myParameters.append( aParameters );
myUndoParameters.clear();
MainWidget->GroupConstructors->setEnabled( true );
MainWidget->GroupDest1->setEnabled( true );
setEnabledUndo( true );
setEnabledRedo( false );
myIsApply = true;
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
myIsApply = false;
// Set focus to SpinBox_DX
if ( sender() == Group1Spin->buttonApply ) {
@ -786,6 +788,9 @@ void EntityGUI_SketcherDlg::ClickOnUndo()
myUndoCommand.append( myCommand.last() );
myCommand.pop_back();
myUndoParameters.append( myParameters.last() );
myParameters.pop_back();
if ( myCommand.count() == 1 ) {
mySketchState = FIRST_POINT;
@ -811,6 +816,9 @@ void EntityGUI_SketcherDlg::ClickOnRedo()
myCommand.append( myUndoCommand.last() );
myUndoCommand.pop_back();
myParameters.append( myUndoParameters.last() );
myUndoParameters.pop_back();
mySketchState = NEXT_POINT;
MainWidget->GroupConstructors->setEnabled( true );
@ -1002,162 +1010,142 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
Standard_Real vx, vy, vz, vs;
vx = vy = vz = vs = 0.0;
QString vxStr, vyStr, vzStr, vsStr;
QString newValueStr;
if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = (SalomeApp_DoubleSpinBox*)send )
newValueStr = aDoubleSpinBox->text();
if ( send == Group1Spin->SpinBox_DX ) {
vx = newValue;
vx = newValue; vxStr = newValueStr;
}
else if ( send == Group2Spin->SpinBox_DX ) {
vx = newValue;
vy = Group2Spin->SpinBox_DY->value();
vx = newValue; vxStr = newValueStr;
vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text();
}
else if ( send == Group2Spin->SpinBox_DY ) {
vx = Group2Spin->SpinBox_DX->value();
vy = newValue;
vx = Group2Spin->SpinBox_DX->value(); vxStr = Group2Spin->SpinBox_DX->text();
vy = newValue; vyStr = newValueStr;
}
else if ( send == Group3Spin->SpinBox_DX ) {
vx = newValue;
vy = Group3Spin->SpinBox_DY->value();
vz = Group3Spin->SpinBox_DZ->value();
vx = newValue; vxStr = newValueStr;
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
}
else if ( send == Group3Spin->SpinBox_DY ) {
vx = Group3Spin->SpinBox_DX->value();
vy = newValue;
vz = Group3Spin->SpinBox_DZ->value();
vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
vy = newValue; vyStr = newValueStr;
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
}
else if ( send == Group3Spin->SpinBox_DZ ) {
vx = Group3Spin->SpinBox_DX->value();
vy = Group3Spin->SpinBox_DY->value();
vz = newValue;
vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
vz = newValue; vzStr = newValueStr;
}
else if ( send == Group4Spin->SpinBox_DX ) {
vx = newValue;
vy = Group4Spin->SpinBox_DY->value();
vz = Group4Spin->SpinBox_DZ->value();
vs = Group4Spin->SpinBox_DS->value();
vx = newValue; vxStr = newValueStr;
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
}
else if ( send == Group4Spin->SpinBox_DY ) {
vx = Group4Spin->SpinBox_DX->value();
vy = newValue;
vz = Group4Spin->SpinBox_DZ->value();
vs = Group4Spin->SpinBox_DS->value();
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
vy = newValue; vyStr = newValueStr;
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
}
else if ( send == Group4Spin->SpinBox_DZ ) {
vx = Group4Spin->SpinBox_DX->value();
vy = Group4Spin->SpinBox_DY->value();
vz = newValue;
vs = Group4Spin->SpinBox_DS->value();
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
vz = newValue; vzStr = newValueStr;
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
}
else if ( send == Group4Spin->SpinBox_DS ) {
vx = Group4Spin->SpinBox_DX->value();
vy = Group4Spin->SpinBox_DY->value();
vz = Group4Spin->SpinBox_DZ->value();
vs = newValue;
}
// NPAL16010 (Sketcher Apply non available if only one line is modified)
// if ValueChangedInSpinBox() called from eventFilter()
else if ( Group1Spin->SpinBox_DX->hasFocus() ) {
vx = newValue;
}
else if ( Group2Spin->SpinBox_DX ->hasFocus() ) {
vx = newValue;
vy = Group2Spin->SpinBox_DY->value();
}
else if ( Group2Spin->SpinBox_DY->hasFocus() ) {
vx = Group2Spin->SpinBox_DX->value();
vy = newValue;
}
else if ( Group3Spin->SpinBox_DX->hasFocus() ) {
vx = newValue;
vy = Group3Spin->SpinBox_DY->value();
vz = Group3Spin->SpinBox_DZ->value();
}
else if ( Group3Spin->SpinBox_DY->hasFocus() ) {
vx = Group3Spin->SpinBox_DX->value();
vy = newValue;
vz = Group3Spin->SpinBox_DZ->value();
}
else if ( Group3Spin->SpinBox_DZ->hasFocus() ) {
vx = Group3Spin->SpinBox_DX->value();
vy = Group3Spin->SpinBox_DY->value();
vz = newValue;
}
else if ( Group4Spin->SpinBox_DX->hasFocus() ) {
vx = newValue;
vy = Group4Spin->SpinBox_DY->value();
vz = Group4Spin->SpinBox_DZ->value();
vs = Group4Spin->SpinBox_DS->value();
}
else if ( Group4Spin->SpinBox_DY->hasFocus() ) {
vx = Group4Spin->SpinBox_DX->value();
vy = newValue;
vz = Group4Spin->SpinBox_DZ->value();
vs = Group4Spin->SpinBox_DS->value();
}
else if ( Group4Spin->SpinBox_DZ->hasFocus() ) {
vx = Group4Spin->SpinBox_DX->value();
vy = Group4Spin->SpinBox_DY->value();
vz = newValue;
vs = Group4Spin->SpinBox_DS->value();
}
else if ( Group4Spin->SpinBox_DS->hasFocus() ) {
vx = Group4Spin->SpinBox_DX->value();
vy = Group4Spin->SpinBox_DY->value();
vz = Group4Spin->SpinBox_DZ->value();
vs = newValue;
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
vs = newValue; vsStr = newValueStr;
}
// Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
if ( myConstructorId == 0 ) { // SEGMENT
if ( mySketchType == PT_ABS ) {
myX = vx;
myY = vy;
myXStr = vxStr;
myYStr = vyStr;
}
else if ( mySketchType == PT_RELATIVE ) {
myDX = vx;
myDY = vy;
myDXStr = vxStr;
myDYStr = vyStr;
}
else if ( mySketchType == DIR_ANGLE_LENGTH ) {
myAngle = vx;
myLength = vy;
myAngleStr = vxStr;
myLengthStr = vyStr;
}
else if ( mySketchType == DIR_ANGLE_X ) {
myAngle = vx;
myX = vy;
myAngleStr = vxStr;
myXStr = vyStr;
}
else if ( mySketchType == DIR_ANGLE_Y ) {
myAngle = vx;
myY = vy;
myAngleStr = vxStr;
myYStr = vyStr;
}
else if ( mySketchType == DIR_PER_LENGTH ) {
myLength = vx;
myLengthStr = vxStr;
}
else if ( mySketchType == DIR_PER_X ) {
myX = vx;
myXStr = vxStr;
}
else if ( mySketchType == DIR_PER_Y ) {
myY = vx;
myYStr = vxStr;
}
else if ( mySketchType == DIR_TAN_LENGTH ) {
myLength = vx;
myLengthStr = vxStr;
}
else if ( mySketchType == DIR_TAN_X ) {
myX = vx;
myXStr = vxStr;
}
else if ( mySketchType == DIR_TAN_Y ) {
myY = vx;
myYStr = vxStr;
}
else if ( mySketchType == DIR_DXDY_LENGTH ) {
myDX = vx;
myDY = vy;
myLength = vz;
myDXStr = vxStr;
myDYStr = vyStr;
myLengthStr = vzStr;
}
else if ( mySketchType == DIR_DXDY_X ) {
myDX = vx;
myDY = vy;
myX = vz;
myDXStr = vxStr;
myDYStr = vyStr;
myXStr = vzStr;
}
else if ( mySketchType == DIR_DXDY_Y ) {
myDX = vx;
myDY = vy;
myY = vz;
myDXStr = vxStr;
myDYStr = vyStr;
myYStr = vzStr;
}
}
else if ( myConstructorId == 1 ) { // ARC
@ -1165,20 +1153,31 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
myAngle = vx;
myRadius = vy;
myLength = vz;
myAngleStr = vxStr;
myRadiusStr = vyStr;
myLengthStr = vzStr;
}
else if ( mySketchType == DIR_PER_LENGTH ) {
myRadius = vx;
myLength = vy;
myRadiusStr = vxStr;
myLengthStr = vyStr;
}
else if ( mySketchType == DIR_TAN_LENGTH ) {
myRadius = vx;
myLength = vy;
myRadiusStr = vxStr;
myLengthStr = vyStr;
}
else if ( mySketchType == DIR_DXDY_LENGTH ) {
myDX = vx;
myDY = vy;
myRadius = vz;
myLength = vs;
myDXStr = vxStr;
myDYStr = vyStr;
myRadiusStr = vzStr;
myLengthStr = vsStr;
}
}
@ -1190,80 +1189,108 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
// function : GetNewCommand()
// purpose : Build the new command with context
//=================================================================================
QString EntityGUI_SketcherDlg::GetNewCommand()
QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
{
theParameters.clear();
QString myNewCommand = ":";
if ( mySketchState == FIRST_POINT ) {
if ( mySketchType == PT_ABS || mySketchType == PT_SEL )
if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
myNewCommand = myNewCommand + "F " + QString::number( myX ) + " " + QString::number( myY );
if ( mySketchType == PT_RELATIVE)
theParameters = myXStr + ":" + myYStr;
}
if ( mySketchType == PT_RELATIVE) {
myNewCommand = myNewCommand + "F " + QString::number( myDX ) + " " + QString::number( myDY );
theParameters = myDXStr + ":" + myDYStr;
}
return myNewCommand;
}
if ( myConstructorId == 0 ) { // SEGMENT
if ( mySketchType == PT_ABS || mySketchType == PT_SEL )
if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
myNewCommand = myNewCommand + "TT " + QString::number( myX ) + " " + QString::number( myY );
if ( mySketchType == PT_RELATIVE)
theParameters = myXStr + ":" + myYStr;
}
if ( mySketchType == PT_RELATIVE) {
myNewCommand = myNewCommand + "T " + QString::number( myDX ) + " " + QString::number( myDY );
theParameters = myDXStr + ":" + myDYStr;
}
if ( mySketchType == DIR_ANGLE_LENGTH ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
theParameters = myAngleStr + ":" + myLengthStr;
}
if ( mySketchType == DIR_ANGLE_X ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
theParameters = myAngleStr + ":" + myXStr;
}
if ( mySketchType == DIR_ANGLE_Y ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
theParameters = myAngleStr + ":" + myYStr;
}
if ( mySketchType == DIR_PER_LENGTH ) {
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
theParameters = QString::number( 90.0 ) + ":" + myLengthStr;
}
if ( mySketchType == DIR_PER_X ) {
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
theParameters = QString::number( 90.0 ) + ":" + myXStr;
}
if ( mySketchType == DIR_PER_Y ) {
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
theParameters = QString::number( 90.0 ) + ":" + myYStr;
}
if ( mySketchType == DIR_TAN_LENGTH )
if ( mySketchType == DIR_TAN_LENGTH ) {
myNewCommand = myNewCommand + "L " + QString::number( myLength );
if ( mySketchType == DIR_TAN_X )
theParameters = myLengthStr;
}
if ( mySketchType == DIR_TAN_X ) {
myNewCommand = myNewCommand + "IX " + QString::number( myX );
if ( mySketchType == DIR_TAN_Y)
theParameters = myXStr;
}
if ( mySketchType == DIR_TAN_Y) {
myNewCommand = myNewCommand + "IY " + QString::number(myY);
theParameters = myYStr;
}
if ( mySketchType == DIR_DXDY_LENGTH ) {
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr;
}
if ( mySketchType == DIR_DXDY_X ) {
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
theParameters = myDXStr + ":" + myDYStr + ":" + myXStr;
}
if ( mySketchType == DIR_DXDY_Y ) {
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
theParameters = myDXStr + ":" + myDYStr + ":" + myYStr;
}
}
else if ( myConstructorId == 1 ) { // ARC
if ( mySketchType == DIR_ANGLE_LENGTH ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr;
}
if ( mySketchType == DIR_PER_LENGTH ) {
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr;
}
if ( mySketchType == DIR_TAN_LENGTH ) {
myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
theParameters = myRadiusStr + ":" + myLengthStr;
}
if ( mySketchType == DIR_DXDY_LENGTH ) {
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr;
}
}
return myNewCommand;
@ -1284,7 +1311,32 @@ GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation()
//=================================================================================
bool EntityGUI_SketcherDlg::isValid( QString& msg )
{
return true;
bool ok = true;
bool toCorrect = !IsPreview() || myIsApply;
if( Group1Spin->isVisible() ) {
ok = Group1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
}
else if( Group2Spin->isVisible() ) {
ok = Group2Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
ok = Group2Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
}
else if( Group3Spin->isVisible() ) {
ok = Group3Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
ok = Group3Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
ok = Group3Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
}
else if( Group4Spin->isVisible() ) {
ok = Group4Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
ok = Group4Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
ok = Group4Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
ok = Group4Spin->SpinBox_DS->isValid( msg, toCorrect ) && ok;
}
if( myIsApply && !ok )
showError( msg );
return ok;
}
//=================================================================================
@ -1293,6 +1345,8 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg )
//=================================================================================
bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
{
QString aParameters;
if ( mySketchState == FIRST_POINT ) {
myLastX2 = myX;
myLastY2 = myY;
@ -1308,7 +1362,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
myShape1 = aProfile1.GetShape();
//Current Shape
QString Command2 = Command1 + GetNewCommand();
QString Command2 = Command1 + GetNewCommand( aParameters );
Sketcher_Profile aProfile2( Command2.toAscii() );
if ( aProfile2.IsDone() )
myShape2 = aProfile2.GetShape();
@ -1367,7 +1421,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
}
}
else {
cmd = myCommand.join( "" ) + GetNewCommand();
cmd = myCommand.join( "" ) + GetNewCommand( aParameters );
if ( Group1Sel->isVisible() ) {
Group1Sel->buttonApply->setEnabled( true );
@ -1410,7 +1464,15 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane );
if ( !anObj->_is_nil() )
{
if( !IsPreview() ) {
QStringList aCurrentParameters = myParameters;
aCurrentParameters << aParameters;
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters));
}
objects.push_back( anObj._retn() );
}
return true;
}
@ -1519,7 +1581,7 @@ void EntityGUI_SketcherDlg::keyPressEvent( QKeyEvent* e )
}
}
void EntityGUI_SketcherDlg::initSpinBox( QDoubleSpinBox* spinBox,
void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
double min, double max,
double step, int decimals )
{

View File

@ -31,7 +31,7 @@
#include <QDialog>
class QLineEdit;
class QDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class EntityGUI_1Sel;
class EntityGUI_1Spin;
class EntityGUI_2Spin;
@ -66,7 +66,7 @@ public:
bool eventFilter (QObject* object, QEvent* event);
protected:
void initSpinBox( QDoubleSpinBox*,
void initSpinBox( SalomeApp_DoubleSpinBox*,
double, double, double = 0.1,
int = 3 );
@ -85,7 +85,7 @@ private:
void setEnabledUndo( bool );
void setEnabledRedo( bool );
QString GetNewCommand();
QString GetNewCommand( QString& );
virtual void displayPreview( GEOM::GEOM_Object_ptr,
const bool = false,
@ -106,17 +106,26 @@ private:
int mySketchState;
bool myIsAllAdded;
bool myIsApply;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QStringList myCommand;
QStringList myUndoCommand;
QStringList myParameters;
QStringList myUndoParameters;
Standard_Real myX, myY, myDX, myDY;
Standard_Real myLength, myAngle, myRadius;
Standard_Real myLastX1, myLastY1;
Standard_Real myLastX2, myLastY2;
QString myXStr, myYStr, myDXStr, myDYStr;
QString myLengthStr, myAngleStr, myRadiusStr;
QString myLastX1Str, myLastY1Str;
QString myLastX2Str, myLastY2Str;
EntityGUI_Skeleton* MainWidget;
EntityGUI_Point* GroupPt;

View File

@ -58,12 +58,28 @@
#include <set>
#include <map>
#include <string>
#include <vector>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
#define COMMA ','
#define O_BRACKET '('
#define C_BRACKET ')'
#define O_SQR_BRACKET '['
#define C_SQR_BRACKET ']'
#define PY_NULL "None"
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
static GEOM_Engine* TheEngine = NULL;
using namespace std;
static TCollection_AsciiString BuildIDFromObject(Handle(GEOM_Object)& theObject)
{
TCollection_AsciiString anID(theObject->GetDocID()), anEntry;
@ -88,11 +104,18 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID)
void ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript,
TVariablesList theVariables,
TDF_LabelMap& theProcessed,
std::set<std::string>& theDumpedObjs);
void ReplaceVariables(TCollection_AsciiString& theCommand,
TVariablesList theVariables);
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
//=============================================================================
/*!
* GetEngine
@ -425,6 +448,7 @@ void GEOM_Engine::Close(int theDocID)
//=============================================================================
TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
TVariablesList theVariables,
bool isPublished,
bool& aValidScript)
{
@ -455,7 +479,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
MESSAGE ( "Null function !!!!" );
continue;
}
ProcessFunction(aFunction, aScript, aFuncMap, anObjMap);
ProcessFunction(aFunction, aScript, theVariables, aFuncMap, anObjMap);
}
}
@ -682,6 +706,7 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
//===========================================================================
void ProcessFunction(Handle(GEOM_Function)& theFunction,
TCollection_AsciiString& theScript,
TVariablesList theVariables,
TDF_LabelMap& theProcessed,
std::set<std::string>& theDumpedObjs)
{
@ -741,6 +766,8 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction,
//Check if its internal function which doesn't requires dumping
if(aDescr == "None") return;
//Replace parameter by notebook variables
ReplaceVariables(aDescr,theVariables);
theScript += "\n\t";
theScript += aDescr;
@ -787,3 +814,305 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin
return aSeq;
}
//=============================================================================
/*!
* ReplaceVariables: Replace parameters of the function by variales from
* Notebook if need
*/
//=============================================================================
void ReplaceVariables(TCollection_AsciiString& theCommand,
TVariablesList theVariables)
{
if (MYDEBUG)
cout<<"Command : "<<theCommand<<endl;
if (MYDEBUG) {
cout<<"All Entries:"<<endl;
TVariablesList::const_iterator it = theVariables.begin();
for(;it != theVariables.end();it++)
cout<<"\t'"<<(*it).first<<"'"<<endl;
}
//Additional case - multi-row commands
int aCommandIndex = 1;
while( aCommandIndex < 10 ) { // tmp check
TCollection_AsciiString aCommand = theCommand.Token("\n",aCommandIndex);
if( aCommand.Length() == 0 )
break;
if (MYDEBUG)
cout<<"Sub-command : "<<aCommand<<endl;
Standard_Integer aStartCommandPos = theCommand.Location(aCommand,1,theCommand.Length());
Standard_Integer aEndCommandPos = aStartCommandPos + aCommand.Length();
//Get Entry of the result object
TCollection_AsciiString anEntry;
if( aCommand.Search("=") != -1 ) // command returns an object
anEntry = aCommand.Token("=",1);
else { // command modifies the object
int aStartEntryPos = aCommand.Location(1,'(',1,aCommand.Length());
int aEndEntryPos = aCommand.Location(1,',',aStartEntryPos,aCommand.Length());
anEntry = aCommand.SubString(aStartEntryPos+1, aEndEntryPos-1);
}
//Remove white spaces
anEntry.RightAdjust();
anEntry.LeftAdjust();
if(MYDEBUG)
cout<<"Result entry : '" <<anEntry<<"'"<<endl;
//Check if result is list of entries - enough to get the first entry in this case
int aNbEntries = 1;
if( anEntry.Value( 1 ) == O_SQR_BRACKET && anEntry.Value( anEntry.Length() ) == C_SQR_BRACKET ) {
while(anEntry.Location(aNbEntries,COMMA,1,anEntry.Length()))
aNbEntries++;
TCollection_AsciiString aSeparator(COMMA);
anEntry = anEntry.Token(aSeparator.ToCString(),1);
anEntry.Remove( 1, 1 );
anEntry.RightAdjust();
anEntry.LeftAdjust();
if(MYDEBUG)
cout<<"Sub-entry : '" <<anEntry<<"'"<<endl;
}
//Find variables used for object construction
ObjectStates* aStates = 0;
TVariablesList::const_iterator it = theVariables.find(anEntry);
if( it != theVariables.end() )
aStates = (*it).second;
if(!aStates) {
if(MYDEBUG)
cout<<"Valiables list empty!!!"<<endl;
aCommandIndex++;
continue;
}
TState aVariables = aStates->GetCurrectState();
if(MYDEBUG) {
cout<<"Variables from SObject:"<<endl;
for (int i = 0; i < aVariables.size();i++)
cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
}
//Calculate total number of parameters
Standard_Integer aTotalNbParams = 1;
while(aCommand.Location(aTotalNbParams,COMMA,1,aCommand.Length()))
aTotalNbParams++;
if(MYDEBUG)
cout<<"aTotalNbParams = "<<aTotalNbParams<<endl;
Standard_Integer aFirstParam = aNbEntries;
//Replace parameters by variables
Standard_Integer aStartPos = 0;
Standard_Integer aEndPos = 0;
int iVar = 0;
TCollection_AsciiString aVar, aReplacedVar;
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
//Replace first parameter (bettwen '(' character and first ',' character)
if(i == aFirstParam)
{
aStartPos = aCommand.Location(O_BRACKET, 1, aCommand.Length()) + 1;
if(aTotalNbParams - aNbEntries > 0 )
aEndPos = aCommand.Location(aFirstParam, COMMA, 1, aCommand.Length());
else
aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
}
//Replace last parameter (bettwen ',' character and ')' character)
else if(i == aTotalNbParams)
{
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
}
//Replace other parameters (bettwen two ',' characters)
else if(i != aFirstParam && i != aTotalNbParams )
{
aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length());
}
if( aCommand.Value( aStartPos ) == O_SQR_BRACKET )
aStartPos++;
if( aCommand.Value( aEndPos-1 ) == C_SQR_BRACKET )
aEndPos--;
if(MYDEBUG)
cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<endl;
aVar = aCommand.SubString(aStartPos, aEndPos-1);
aVar.RightAdjust();
aVar.LeftAdjust();
if(MYDEBUG)
cout<<"Variable: '"<< aVar <<"'"<<endl;
// specific case for sketcher
if(aVar.Location( TCollection_AsciiString("Sketcher:"), 1, aVar.Length() ) != 0) {
Standard_Integer aNbSections = 1;
while( aVar.Location( aNbSections, ':', 1, aVar.Length() ) )
aNbSections++;
aNbSections--;
int aStartSectionPos = 0, aEndSectionPos = 0;
TCollection_AsciiString aSection, aReplacedSection;
for(Standard_Integer aSectionIndex = 1; aSectionIndex <= aNbSections; aSectionIndex++) {
aStartSectionPos = aVar.Location( aSectionIndex, ':', 1, aVar.Length() ) + 1;
if( aSectionIndex != aNbSections )
aEndSectionPos = aVar.Location( aSectionIndex + 1, ':', 1, aVar.Length() );
else
aEndSectionPos = aVar.Length();
aSection = aVar.SubString(aStartSectionPos, aEndSectionPos-1);
if(MYDEBUG)
cout<<"aSection: "<<aSection<<endl;
Standard_Integer aNbParams = 1;
while( aSection.Location( aNbParams, ' ', 1, aSection.Length() ) )
aNbParams++;
aNbParams--;
int aStartParamPos = 0, aEndParamPos = 0;
TCollection_AsciiString aParameter, aReplacedParameter;
for(Standard_Integer aParamIndex = 1; aParamIndex <= aNbParams; aParamIndex++) {
aStartParamPos = aSection.Location( aParamIndex, ' ', 1, aSection.Length() ) + 1;
if( aParamIndex != aNbParams )
aEndParamPos = aSection.Location( aParamIndex + 1, ' ', 1, aSection.Length() );
else
aEndParamPos = aSection.Length() + 1;
aParameter = aSection.SubString(aStartParamPos, aEndParamPos-1);
if(MYDEBUG)
cout<<"aParameter: "<<aParameter<<endl;
if(iVar >= aVariables.size())
continue;
aReplacedParameter = aVariables[iVar].myVariable;
if(aReplacedParameter.IsEmpty()) {
iVar++;
continue;
}
if(aVariables[iVar].isVariable) {
aReplacedParameter.InsertBefore(1,"'");
aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'");
}
if(MYDEBUG)
cout<<"aSection before : "<<aSection<<endl;
aSection.Remove(aStartParamPos, aEndParamPos - aStartParamPos);
aSection.Insert(aStartParamPos, aReplacedParameter);
if(MYDEBUG)
cout<<"aSection after : "<<aSection<<endl<<endl;
iVar++;
}
if(MYDEBUG)
cout<<"aVar before : "<<aVar<<endl;
aVar.Remove(aStartSectionPos, aEndSectionPos - aStartSectionPos);
aVar.Insert(aStartSectionPos, aSection);
if(MYDEBUG)
cout<<"aVar after : "<<aVar<<endl<<endl;
}
if(MYDEBUG)
cout<<"aCommand before : "<<aCommand<<endl;
aCommand.Remove(aStartPos, aEndPos - aStartPos);
aCommand.Insert(aStartPos, aVar);
if(MYDEBUG)
cout<<"aCommand after : "<<aCommand<<endl;
break;
} // end of specific case for sketcher
//If parameter is entry or 'None', skip it
if(theVariables.find(aVar) != theVariables.end() || aVar.Search(":") != -1 || aVar == PY_NULL)
continue;
if(iVar >= aVariables.size())
continue;
aReplacedVar = aVariables[iVar].myVariable;
if(aReplacedVar.IsEmpty()) {
iVar++;
continue;
}
if(aVariables[iVar].isVariable) {
aReplacedVar.InsertBefore(1,"\"");
aReplacedVar.InsertAfter(aReplacedVar.Length(),"\"");
}
aCommand.Remove(aStartPos, aEndPos - aStartPos);
aCommand.Insert(aStartPos, aReplacedVar);
iVar++;
}
theCommand.Remove(aStartCommandPos, aEndCommandPos - aStartCommandPos);
theCommand.Insert(aStartCommandPos, aCommand);
aCommandIndex++;
aStates->IncrementState();
}
if (MYDEBUG)
cout<<"Command : "<<theCommand<<endl;
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
ObjectStates::ObjectStates()
{
_dumpstate = 0;
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
ObjectStates::~ObjectStates()
{
}
//================================================================================
/*!
* \brief Return current object state
* \retval state - Object state (vector of notebook variable)
*/
//================================================================================
TState ObjectStates::GetCurrectState() const
{
if(_states.size() > _dumpstate)
return _states[_dumpstate];
return TState();
}
//================================================================================
/*!
* \brief Add new object state
* \param theState - Object state (vector of notebook variable)
*/
//================================================================================
void ObjectStates::AddState(const TState &theState)
{
_states.push_back(theState);
}
//================================================================================
/*!
* \brief Increment object state
*/
//================================================================================
void ObjectStates::IncrementState()
{
_dumpstate++;
}

View File

@ -33,6 +33,40 @@
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TDF_Label.hxx>
#include <map>
#include <vector>
struct TVariable{
TCollection_AsciiString myVariable;
bool isVariable;
TVariable(const TCollection_AsciiString& theVariable, bool theFlag = true):
myVariable(theVariable),
isVariable(theFlag){}
};
typedef std::vector<TVariable> TState;
typedef std::vector<TState> TAllStates;
class ObjectStates
{
public:
ObjectStates();
~ObjectStates();
TAllStates GetAllStates() const { return _states; }
TState GetCurrectState() const;
void AddState(const TState &theState);
void IncrementState();
private:
TAllStates _states;
int _dumpstate;
};
typedef std::map<TCollection_AsciiString, ObjectStates* > TVariablesList;
class GEOM_Engine
{
public:
@ -85,6 +119,7 @@ class GEOM_Engine
Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
TVariablesList theVariables,
bool isPublished,
bool& aValidScript);
@ -94,7 +129,7 @@ class GEOM_Engine
protected:
Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine);
private:
Handle(GEOM_Application) _OCAFApp;

View File

@ -382,6 +382,31 @@ TCollection_AsciiString GEOM_Object::GetAuxData()
return aData;
}
//=============================================================================
/*!
* SetParameters
*/
//=============================================================================
void GEOM_Object::SetParameters(const TCollection_AsciiString& theParameters)
{
if( _parameters.IsEmpty() )
_parameters = theParameters;
else {
_parameters += "|";
_parameters += theParameters;
}
}
//=============================================================================
/*!
* GetParameters
*/
//=============================================================================
TCollection_AsciiString GEOM_Object::GetParameters() const
{
return _parameters;
}
//=============================================================================
/*!

View File

@ -221,6 +221,12 @@ class GEOM_Object : public MMgt_TShared
//Returns an auxiliary data
Standard_EXPORT TCollection_AsciiString GetAuxData();
//Set a notebook variables used for object creation
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
//Get a notebook variables used for object creation
Standard_EXPORT TCollection_AsciiString GetParameters() const;
//###########################################################
// Sub shape methods
//###########################################################
@ -272,6 +278,7 @@ class GEOM_Object : public MMgt_TShared
Handle(TDataStd_TreeNode) _root;
TDF_Label _label;
TCollection_AsciiString _ior;
TCollection_AsciiString _parameters;
};
#endif

View File

@ -30,6 +30,8 @@
#include <GeometryGUI.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Study.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Desktop.h>
@ -130,6 +132,10 @@ void GEOMBase_Skeleton::Init()
myMainFrame->GroupBoxPublish->hide();
}
//=================================================================================
// function : initSpinBox()
// purpose :
//=================================================================================
void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
int min, int max, int step )
{
@ -137,16 +143,48 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
spinBox->setSingleStep( step );
}
void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox,
//=================================================================================
// function : initSpinBox()
// purpose :
//=================================================================================
void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
double min, double max,
double step, int decimals )
{
spinBox->setPrecision( decimals );
spinBox->setDecimals( decimals ); // it's necessary to set decimals before the range setting,
// by default Qt rounds boundaries to 2 decimals at setRange
spinBox->setRange( min, max );
spinBox->setSingleStep( step );
}
//=================================================================================
// function : updateAttributes()
// purpose : Workaround for Translation and Rotation operations with unchecked option "Create a copy".
// In this case PublishInStudy isn't called, so we need to update object's attributes manually
//=================================================================================
void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj,
const QStringList& theParameters)
{
SALOMEDS::Study_var aStudy = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS());
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry());
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
std::string aValue = aStringAttrib->Value();
if( aValue != "" )
aValue += "|";
for( int i = 0, n = theParameters.count(); i < n; i++ ) {
std::string aParameter = theParameters[i].toStdString();
if(aStudy->IsVariable(aParameter.c_str()))
aValue += aParameter;
if(i != n-1)
aValue += ":";
}
aStringAttrib->SetValue(aValue.c_str());
}
//=================================================================================
// function : ClickOnCancel()
// purpose :

View File

@ -31,6 +31,7 @@
#include <QDialog>
class SalomeApp_DoubleSpinBox;
class GeometryGUI;
class DlgRef_Skeleton;
class QSpinBox;
@ -59,8 +60,10 @@ private:
protected:
void initSpinBox( QSpinBox*, int, int, int = 1 );
void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 );
void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 );
void updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );

View File

@ -149,6 +149,14 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
return aDSStudy._retn();
}
//=======================================================================
// function : JoinObjectParameters
// purpose :
//=======================================================================
char* GeometryGUI::JoinObjectParameters(const QStringList& theParametersList)
{
return theParametersList.join(":").toLatin1().data();
}
//=======================================================================
// function : GeometryGUI::GeometryGUI()
// purpose : Constructor

View File

@ -81,6 +81,8 @@ public:
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
static char* JoinObjectParameters(const QStringList& theParametersList);
GEOM_Client& GetShapeReader() { return myShapeReader; }
Standard_CString& GetFatherior() { return myFatherior; }
//void SetState( const int state ) { myState = state; }

View File

@ -180,7 +180,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
}
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ("
GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
<< theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
SetErrorCode(OK);
@ -467,7 +467,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
return aCopy;
}
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVectorDistance("
GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
<< theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
SetErrorCode(OK);
return theObject;
@ -1208,7 +1208,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(G
//Make a Python command
if (doCopy) {
GEOM::TPythonDump(aFunction) << "geompy.MakeScaleAlongAxes("
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes("
<< theObject << ", " << thePoint << ", "
<< theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
return aCopy;
@ -1454,7 +1454,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t
}
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject
GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
<< ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
SetErrorCode(OK);

View File

@ -26,11 +26,15 @@
#include <Standard_Stream.hxx>
#include "GEOM_Gen_i.hh"
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
#include <vector>
#include <string>
//=======================================================================
//function : DumpPython
//purpose :
@ -50,6 +54,8 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
Resource_DataMapOfAsciiStringAsciiString aMap;
TVariablesList aVariableMap;
SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
SALOMEDS::SObject_var aValue = Itr->Value();
@ -61,14 +67,34 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
CORBA::String_var aName = aValue->GetName();
CORBA::String_var anEntry = GO->GetEntry();
aMap.Bind( (char*)anEntry.in(), (char*)aName.in() );
//Find attribute with list of used notebook variables
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeString_var anAttrStr;
if(aValue->FindAttribute(anAttr,"AttributeString")){
anAttrStr = SALOMEDS::AttributeString::_narrow(anAttr);
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(anAttrStr->Value());
ObjectStates* aStates = new ObjectStates();
for(int i = 0; i < aSections->length(); i++) {
TState aState;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
for(int j = 0; j < aListOfVars.length(); j++) {
bool isVar = aStudy->IsVariable(aListOfVars[j].in());
TVariable aVar = TVariable( (char*)aListOfVars[j].in(), isVar );
aState.push_back(aVar);
}
aStates->AddState(aState);
}
aVariableMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(anEntry),aStates));
}
}
}
}
TCollection_AsciiString aScript =
"### This file is generated by SALOME automatically by dump python functionality\n"
"### of GEOM component\n\n";
aScript += _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, isValidScript);
aScript += _impl->DumpPython(aStudy->StudyId(), aMap, aVariableMap, isPublished, isValidScript);
if (isPublished)
{

View File

@ -273,7 +273,25 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName");
SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr);
aNameAttrib->SetValue(aShapeName.ToCString());
//Set NoteBook variables used in the object creation
TCollection_AsciiString aVars;
SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aShape->GetParameters());
for(int i = 0, n = aSections->length(); i < n; i++) {
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
for(int j = 0, m = aListOfVars.length(); j < m; j++) {
if(theStudy->IsVariable(aListOfVars[j].in()))
aVars += TCollection_AsciiString(aListOfVars[j].in());
if(j != m-1)
aVars += ":";
}
if(i != n-1)
aVars += "|";
}
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
aStringAttrib->SetValue(aVars.ToCString());
//Set a name of the GEOM object
aShape->SetName(theName);

View File

@ -362,3 +362,14 @@ bool GEOM_Object_i::IsShape()
{
return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER;
}
void GEOM_Object_i::SetParameters(const char* theParameters)
{
_impl->SetParameters((char*)theParameters);
}
char* GEOM_Object_i::GetParameters()
{
return CORBA::string_dup(_impl->GetParameters().ToCString());
}

View File

@ -82,6 +82,10 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public
virtual bool IsShape();
virtual void SetParameters(const char* theParameters);
virtual char* GetParameters();
Handle(GEOM_Object) GetImpl() { return _impl; }
private:

View File

@ -78,6 +78,8 @@ import salome
salome.salome_init()
from salome import *
from salome_notebook import *
import GEOM
import math
@ -90,6 +92,80 @@ ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE"
def RaiseIfFailed (Method_name, Operation):
if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
## Return list of variables value from salome notebook
## @ingroup l1_geompy_auxiliary
def ParseParameters(*parameters):
Result = []
StringResult = ""
for parameter in parameters:
if isinstance(parameter,str):
if notebook.isVariable(parameter):
Result.append(notebook.get(parameter))
else:
raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
else:
Result.append(parameter)
pass
StringResult = StringResult + str(parameter)
StringResult = StringResult + ":"
pass
StringResult = StringResult[:len(StringResult)-1]
Result.append(StringResult)
return Result
## Return list of variables value from salome notebook
## @ingroup l1_geompy_auxiliary
def ParseList(list):
Result = []
StringResult = ""
for parameter in list:
if isinstance(parameter,str) and notebook.isVariable(parameter):
Result.append(str(notebook.get(parameter)))
pass
else:
Result.append(str(parameter))
pass
StringResult = StringResult + str(parameter)
StringResult = StringResult + ":"
pass
StringResult = StringResult[:len(StringResult)-1]
return Result, StringResult
## Return list of variables value from salome notebook
## @ingroup l1_geompy_auxiliary
def ParseSketcherCommand(command):
Result = ""
StringResult = ""
sections = command.split(":")
for section in sections:
parameters = section.split(" ")
paramIndex = 1
for parameter in parameters:
if paramIndex > 1 and parameter.find("'") != -1:
parameter = parameter.replace("'","")
if notebook.isVariable(parameter):
Result = Result + str(notebook.get(parameter)) + " "
pass
else:
raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
pass
pass
else:
Result = Result + str(parameter) + " "
pass
if paramIndex > 1:
StringResult = StringResult + parameter
StringResult = StringResult + ":"
pass
paramIndex = paramIndex + 1
pass
Result = Result[:len(Result)-1] + ":"
pass
Result = Result[:len(Result)-1]
return Result, StringResult
## Kinds of shape enumeration
# @ingroup l1_geompy_auxiliary
@ -253,8 +329,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_point "Example"
def MakeVertex(self,theX, theY, theZ):
# Example: see GEOM_TestAll.py
theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
RaiseIfFailed("MakePointXYZ", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a point, distant from the referenced point
@ -268,8 +346,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_point "Example"
def MakeVertexWithRef(self,theReference, theX, theY, theZ):
# Example: see GEOM_TestAll.py
theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
RaiseIfFailed("MakePointWithReference", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a point, corresponding to the given parameter on the given curve.
@ -280,8 +360,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_point "Example"
def MakeVertexOnCurve(self,theRefCurve, theParameter):
# Example: see GEOM_TestAll.py
theParameter, Parameters = ParseParameters(theParameter)
anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
RaiseIfFailed("MakePointOnCurve", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a point, corresponding to the given parameters on the
@ -293,9 +375,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
#
# @ref swig_MakeVertexOnSurface "Example"
def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter)
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
RaiseIfFailed("MakePointOnSurface", self.BasicOp)
anObj.SetParameters(Parameters);
return anObj
## Create a point on intersection of two lines.
@ -329,8 +413,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_vector "Example"
def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a vector between two points.
@ -392,8 +478,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlane(self,thePnt, theVec, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
RaiseIfFailed("MakePlanePntVec", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a plane, passing through the three given points
@ -406,8 +494,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a plane, similar to the existing one, but with another size of representing face.
@ -418,8 +508,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_plane "Example"
def MakePlaneFace(self,theFace, theTrimSize):
# Example: see GEOM_TestAll.py
theTrimSize, Parameters = ParseParameters(theTrimSize);
anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
RaiseIfFailed("MakePlaneFace", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a local coordinate system.
@ -431,8 +523,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_MakeMarker "Example"
def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
# Example: see GEOM_TestAll.py
OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ);
anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
RaiseIfFailed("MakeMarker", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
## Create a local coordinate system.
@ -513,8 +607,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_circle "Example"
def MakeCircle(self, thePnt, theVec, theR):
# Example: see GEOM_TestAll.py
theR, Parameters = ParseParameters(theR)
anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
## Create a circle with given radius.
@ -561,8 +657,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_ellipse "Example"
def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor)
anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
RaiseIfFailed("MakeEllipse", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
## Create an ellipse with given radiuses.
@ -651,8 +749,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_sketcher_page "Example"
def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
# Example: see GEOM_TestAll.py
theCommand,Parameters = ParseSketcherCommand(theCommand)
anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
RaiseIfFailed("MakeSketcher", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
## Create a sketcher (wire or face), following the textual description,
@ -707,8 +807,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_box "Example"
def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a box with two specified opposite vertices,
@ -734,8 +836,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_face "Example"
def MakeFaceHW(self,theH, theW, theOrientation):
# Example: see GEOM_TestAll.py
theH,theW,Parameters = ParseParameters(theH, theW)
anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
RaiseIfFailed("MakeFaceHW", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a face from another plane and two sizes,
@ -749,8 +853,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_face "Example"
def MakeFaceObjHW(self, theObj, theH, theW):
# Example: see GEOM_TestAll.py
theH,theW,Parameters = ParseParameters(theH, theW)
anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a disk with given center, normal vector and radius.
@ -762,8 +868,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_disk "Example"
def MakeDiskPntVecR(self,thePnt, theVec, theR):
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a disk, passing through three given points
@ -785,8 +893,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_face "Example"
def MakeDiskR(self,theR, theOrientation):
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
RaiseIfFailed("MakeDiskR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a cylinder with given base point, axis, radius and height.
@ -799,8 +909,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_cylinder "Example"
def MakeCylinder(self,thePnt, theAxis, theR, theH):
# Example: see GEOM_TestAll.py
theR,theH,Parameters = ParseParameters(theR, theH)
anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a cylinder with given radius and height at
@ -813,8 +925,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_cylinder "Example"
def MakeCylinderRH(self,theR, theH):
# Example: see GEOM_TestAll.py
theR,theH,Parameters = ParseParameters(theR, theH)
anObj = self.PrimOp.MakeCylinderRH(theR, theH)
RaiseIfFailed("MakeCylinderRH", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a sphere with given center and radius.
@ -825,8 +939,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_sphere "Example"
def MakeSpherePntR(self, thePnt, theR):
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
RaiseIfFailed("MakeSpherePntR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a sphere with given center and radius.
@ -848,8 +964,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_sphere "Example"
def MakeSphereR(self, theR):
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
anObj = self.PrimOp.MakeSphereR(theR)
RaiseIfFailed("MakeSphereR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a cone with given base point, axis, height and radiuses.
@ -865,8 +983,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_cone "Example"
def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
# Example: see GEOM_TestAll.py
theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a cone with given height and radiuses at
@ -882,8 +1002,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_cone "Example"
def MakeConeR1R2H(self,theR1, theR2, theH):
# Example: see GEOM_TestAll.py
theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a torus with given center, normal vector and radiuses.
@ -896,8 +1018,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_torus "Example"
def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a torus with given radiuses at the origin of coordinate system.
@ -908,8 +1032,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_torus "Example"
def MakeTorusRR(self, theRMajor, theRMinor):
# Example: see GEOM_TestAll.py
theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
RaiseIfFailed("MakeTorusRR", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
# end of l3_3d_primitives
@ -942,8 +1068,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_prism "Example"
def MakePrismVecH(self, theBase, theVec, theH):
# Example: see GEOM_TestAll.py
theH,Parameters = ParseParameters(theH)
anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the vector,
@ -957,8 +1085,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_prism "Example"
def MakePrismVecH2Ways(self, theBase, theVec, theH):
# Example: see GEOM_TestAll.py
theH,Parameters = ParseParameters(theH)
anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
@ -969,8 +1099,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
@ -983,8 +1115,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shape by revolution of the base shape around the axis
@ -998,14 +1132,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_revolution "Example"
def MakeRevolution(self, theBase, theAxis, theAngle):
# Example: see GEOM_TestAll.py
theAngle,Parameters = ParseParameters(theAngle)
anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## The Same Revolution but in both ways forward&backward.
def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
theAngle,Parameters = ParseParameters(theAngle)
anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a filling from the given compound of contours.
@ -1025,9 +1163,12 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_creation_filling "Example"
def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
# Example: see GEOM_TestAll.py
theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
theTol2D, theTol3D, theNbIter)
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
theTol2D, theTol3D, theNbIter, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
@ -1739,8 +1880,13 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_shape_processing "Example"
def ProcessShape(self,theShape, theOperators, theParameters, theValues):
# Example: see GEOM_TestHealing.py
theValues,Parameters = ParseList(theValues)
anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
RaiseIfFailed("ProcessShape", self.HealOp)
for string in (theOperators + theParameters):
Parameters = ":" + Parameters
pass
anObj.SetParameters(Parameters)
return anObj
## Remove faces from the given object (shape).
@ -1771,8 +1917,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @return New GEOM_Object, containing processed shape.
def Sew(self, theObject, theTolerance):
# Example: see MakeSewing() above
theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.HealOp.Sew(theObject, theTolerance)
RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters)
return anObj
## Remove internal wires and edges from the given object (face).
@ -1829,8 +1977,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_add_point_on_edge "Example"
def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
# Example: see GEOM_TestHealing.py
theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
RaiseIfFailed("DivideEdge", self.HealOp)
anObj.SetParameters(Parameters)
return anObj
## Change orientation of the given object. Updates given shape.
@ -1877,9 +2027,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_glue_faces "Example"
def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
# Example: see GEOM_Spanner.py
theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
if anObj is None:
raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
return anObj
## Find coincident faces in theShape for possible gluing.
@ -2085,6 +2237,20 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
return anObj
## Translate the given object along the vector, specified by its components.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
# @return Translated GEOM_Object.
#
# @ref tui_translation "Example"
def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
anObj.SetParameters(Parameters)
RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
return anObj
## Translate the given object along the vector, specified
# by its components, creating its copy before the translation.
# @param theObject The object to be translated.
@ -2094,7 +2260,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_translation "Example"
def MakeTranslation(self,theObject, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
anObj.SetParameters(Parameters)
RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
return anObj
@ -2111,6 +2279,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
return anObj
## Translate the given object along the given vector on given distance.
# @param theObject The object to be translated.
# @param theVector The translation vector.
# @param theDistance The translation distance.
# @param theCopy Flag used to translate object itself or create a copy.
# @return Translated GEOM_Object.
#
# @ref tui_translation "Example"
def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
# Example: see GEOM_TestAll.py
theDistance,Parameters = ParseParameters(theDistance)
anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Translate the given object along the given vector on given distance,
# creating its copy before the translation.
# @param theObject The object to be translated.
@ -2121,8 +2305,30 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_translation "Example"
def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
# Example: see GEOM_TestAll.py
theDistance,Parameters = ParseParameters(theDistance)
anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the given axis on the given angle.
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
# @return Rotated GEOM_Object.
#
# @ref tui_rotation "Example"
def Rotate(self,theObject, theAxis, theAngle):
# Example: see GEOM_TestAll.py
flag = False
if isinstance(theAngle,str):
flag = True
theAngle, Parameters = ParseParameters(theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
RaiseIfFailed("RotateCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the given axis
@ -2135,8 +2341,15 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_rotation "Example"
def MakeRotation(self,theObject, theAxis, theAngle):
# Example: see GEOM_TestAll.py
flag = False
if isinstance(theAngle,str):
flag = True
theAngle, Parameters = ParseParameters(theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
RaiseIfFailed("RotateCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate given object around vector perpendicular to plane
@ -2164,8 +2377,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_scale "Example"
def MakeScaleTransform(self, theObject, thePoint, theFactor):
# Example: see GEOM_TestAll.py
theFactor, Parameters = ParseParameters(theFactor)
anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Scale the given object by different factors along coordinate axes,
@ -2179,9 +2394,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref swig_scale "Example"
def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
# Example: see GEOM_TestAll.py
theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
theFactorX, theFactorY, theFactorZ)
RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Create an object, symmetrical
@ -2264,8 +2481,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_offset "Example"
def MakeOffset(self,theObject, theOffset):
# Example: see GEOM_TestAll.py
theOffset, Parameters = ParseParameters(theOffset)
anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
# -----------------------------------------------------------------------------
@ -2283,8 +2502,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_multi_translation "Example"
def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
# Example: see GEOM_TestAll.py
theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes)
anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Conseqently apply two specified translations to theObject specified number of times.
@ -2302,9 +2523,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
theVector2, theStep2, theNbTimes2):
# Example: see GEOM_TestAll.py
theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2)
anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
theVector2, theStep2, theNbTimes2)
RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the given axis a given number times.
@ -2318,8 +2541,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_multi_rotation "Example"
def MultiRotate1D(self,theObject, theAxis, theNbTimes):
# Example: see GEOM_TestAll.py
theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
RaiseIfFailed("MultiRotate1D", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the
@ -2339,8 +2564,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_multi_rotation "Example"
def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
# Example: see GEOM_TestAll.py
theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
RaiseIfFailed("MultiRotate2D", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## The same, as MultiRotate1D(), but axis is given by direction and point
@ -2374,8 +2601,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# \n @ref swig_MakeFilletAll "Example 2"
def MakeFilletAll(self,theShape, theR):
# Example: see GEOM_TestOthers.py
theR,Parameters = ParseParameters(theR)
anObj = self.LocalOp.MakeFilletAll(theShape, theR)
RaiseIfFailed("MakeFilletAll", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Perform a fillet on the specified edges/faces of the given shape
@ -2389,6 +2618,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_fillet "Example"
def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
anObj = None
if theShapeType == ShapeType["EDGE"]:
anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
@ -2396,10 +2626,12 @@ class geompyDC(GEOM._objref_GEOM_Gen):
else:
anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
RaiseIfFailed("MakeFilletFaces", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## The same that MakeFillet but with two Fillet Radius R1 and R2
def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
theR1,theR2,Parameters = ParseParameters(theR1,theR2)
anObj = None
if theShapeType == ShapeType["EDGE"]:
anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
@ -2407,6 +2639,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
else:
anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Perform a fillet on the specified edges/faces of the given shape
@ -2432,8 +2665,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# \n @ref swig_MakeChamferAll "Example 2"
def MakeChamferAll(self,theShape, theD):
# Example: see GEOM_TestOthers.py
theD,Parameters = ParseParameters(theD)
anObj = self.LocalOp.MakeChamferAll(theShape, theD)
RaiseIfFailed("MakeChamferAll", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on edges, common to the specified faces,
@ -2448,15 +2683,24 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_chamfer "Example"
def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
# Example: see GEOM_TestAll.py
theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdge", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferEdge but with params theD is chamfer length and
# theAngle is Angle of chamfer (angle in radians)
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
flag = False
if isinstance(theAngle,str):
flag = True
theD,theAngle,Parameters = ParseParameters(theD,theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on all edges of the specified faces,
@ -2473,17 +2717,26 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_chamfer "Example"
def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
# Example: see GEOM_TestAll.py
theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
RaiseIfFailed("MakeChamferFaces", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferFaces but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians)
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
#
# @ref swig_FilletChamfer "Example"
def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
flag = False
if isinstance(theAngle,str):
flag = True
theD,theAngle,Parameters = ParseParameters(theD,theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on edges,
@ -2495,15 +2748,24 @@ class geompyDC(GEOM._objref_GEOM_Gen):
#
# @ref swig_FilletChamfer "Example"
def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
RaiseIfFailed("MakeChamferEdges", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferEdges but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians)
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
flag = False
if isinstance(theAngle,str):
flag = True
theD,theAngle,Parameters = ParseParameters(theD,theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
## Shortcut to MakeChamferEdge() and MakeChamferFaces()
@ -2536,8 +2798,11 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_archimede "Example"
def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
# Example: see GEOM_TestAll.py
theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
theWeight,theWaterDensity,theMeshDeflection)
anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
RaiseIfFailed("MakeArchimede", self.LocalOp)
anObj.SetParameters(Parameters)
return anObj
# end of l3_basic_op
@ -3176,8 +3441,12 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# \n @ref swig_MakeBlockExplode "Example 2"
def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
# Example: see GEOM_TestOthers.py
theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
for anObj in aList:
anObj.SetParameters(Parameters)
pass
return aList
## Find block, containing the given point inside its volume or on boundary.
@ -3229,8 +3498,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @ref tui_multi_transformation "Example"
def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
# Example: see GEOM_Spanner.py
DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
anObj.SetParameters(Parameters)
return anObj
## Multi-transformate block and glue the result.
@ -3244,9 +3515,12 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
DirFace1V, DirFace2V, NbTimesV):
# Example: see GEOM_Spanner.py
DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
DirFace1V, DirFace2V, NbTimesV)
RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
anObj.SetParameters(Parameters)
return anObj
## Build all possible propagation groups.

View File

@ -336,9 +336,16 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool GenerationGUI_FillingDlg::isValid( QString& )
bool GenerationGUI_FillingDlg::isValid( QString& msg )
{
return myOkCompound > 0;
bool ok = true;
ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) && ok;
return myOkCompound > 0 && ok;
}
//=================================================================================
@ -351,9 +358,20 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling(
myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox );
if ( !anObj->_is_nil() )
{
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox1->text();
aParameters << GroupPoints->SpinBox2->text();
aParameters << GroupPoints->SpinBox3->text();
aParameters << GroupPoints->SpinBox4->text();
aParameters << GroupPoints->SpinBox5->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -622,14 +622,24 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool GenerationGUI_PrismDlg::isValid (QString&)
bool GenerationGUI_PrismDlg::isValid (QString& msg)
{
bool ok = true;
if( getConstructorId() == 0 )
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
else if( getConstructorId() == 2 )
{
ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
if (getConstructorId() == 0)
return (myOkBase && myOkVec); // by vector and height
return (myOkBase && myOkVec) && ok; // by vector and height
else if (getConstructorId() == 1)
return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
else if (getConstructorId() == 2)
return myOkBase;
return myOkBase && ok;
return false;
}
@ -640,6 +650,7 @@ bool GenerationGUI_PrismDlg::isValid (QString&)
//=================================================================================
bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
{
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
switch (getConstructorId()) {
@ -652,6 +663,13 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismVecH2Ways(myBase, myVec, getHeight());
}
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
break;
case 1:
if (!myBothway2) {
@ -676,6 +694,15 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPoints3->SpinBox_DX->text();
aParameters << GroupPoints3->SpinBox_DY->text();
aParameters << GroupPoints3->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
break;
}

View File

@ -390,9 +390,10 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool GenerationGUI_RevolDlg::isValid (QString&)
bool GenerationGUI_RevolDlg::isValid (QString& msg)
{
return myOkBase && myOkAxis;
bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
return myOkBase && myOkAxis && ok;
}
//=================================================================================
@ -413,7 +414,15 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
}
if (!anObj->_is_nil())
{
if (!IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back(anObj._retn());
}
return true;
}

View File

@ -248,9 +248,13 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ArchimedeDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool OperationGUI_ArchimedeDlg::isValid( QString& )
bool OperationGUI_ArchimedeDlg::isValid( QString& msg )
{
return !myShape->_is_nil();
bool ok = true;
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
return !myShape->_is_nil() && ok;
}
//=================================================================================
@ -269,7 +273,17 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );
if ( !anObj->_is_nil() )
{
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
aParameters << GroupPoints->SpinBox_DY->text();
aParameters << GroupPoints->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
return true;
}

View File

@ -85,7 +85,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q
int row = aLayout->rowCount();
aLayout->addWidget(new QLabel(tr("D"), myGrp1), row, 0);
aLayout->addWidget((mySpinBox[ SpinBox1 ] = new QtxDoubleSpinBox(myGrp1)), row++, 2);
aLayout->addWidget((mySpinBox[ SpinBox1 ] = new SalomeApp_DoubleSpinBox(myGrp1)), row++, 2);
aLayout->setRowStretch(row, 10);
// Create second group
@ -146,7 +146,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q
// Set range of spinboxes
double SpecificStep = 10.0;
QMap< int, QtxDoubleSpinBox* >::iterator anIter;
QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
if (anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24)
initSpinBox(anIter.value(), 0.001, 89.999, 5, 0);
@ -176,7 +176,7 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
void OperationGUI_ChamferDlg::Init()
{
// Set Initial values of spinboxes
QMap< int, QtxDoubleSpinBox* >::iterator anIter;
QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter)
anIter.value()->setValue(5);
@ -214,7 +214,7 @@ void OperationGUI_ChamferDlg::Init()
this, SLOT(LineEditReturnPressed()));
// spin boxes
QMap< int, QtxDoubleSpinBox* >::iterator anIterSpin;
QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIterSpin;
for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin)
connect(anIterSpin.value(), SIGNAL(valueChanged(double)),
this, SLOT(ValueChangedInSpinBox(double)));
@ -250,26 +250,26 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId)
//disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
// Get values from previous widget
double D1 = 5, D2 = 5, D = 5, Angle = 5;
QString D1 = "5", D2 = "5", D = "5", Angle = "5";
if (myConstructorId == 0)
D1 = D2 = mySpinBox[ SpinBox1 ]->value();
D1 = D2 = mySpinBox[ SpinBox1 ]->text();
else if (myConstructorId == 1) {
D1 = mySpinBox[ SpinBox21 ]->value();
D2 = mySpinBox[ SpinBox22 ]->value();
D = mySpinBox[ SpinBox23 ]->value();
Angle = mySpinBox[ SpinBox24 ]->value();
D1 = mySpinBox[ SpinBox21 ]->text();
D2 = mySpinBox[ SpinBox22 ]->text();
D = mySpinBox[ SpinBox23 ]->text();
Angle = mySpinBox[ SpinBox24 ]->text();
}
else if (myConstructorId == 2) {
D1 = mySpinBox[ SpinBox31 ]->value();
D2 = mySpinBox[ SpinBox32 ]->value();
D = mySpinBox[ SpinBox33 ]->value();
Angle = mySpinBox[ SpinBox34 ]->value();
D1 = mySpinBox[ SpinBox31 ]->text();
D2 = mySpinBox[ SpinBox32 ]->text();
D = mySpinBox[ SpinBox33 ]->text();
Angle = mySpinBox[ SpinBox34 ]->text();
}
else if (myConstructorId == 3) {
D1 = mySpinBox[ SpinBox41 ]->value();
D2 = mySpinBox[ SpinBox42 ]->value();
D = mySpinBox[ SpinBox43 ]->value();
Angle = mySpinBox[ SpinBox44 ]->value();
D1 = mySpinBox[ SpinBox41 ]->text();
D2 = mySpinBox[ SpinBox42 ]->text();
D = mySpinBox[ SpinBox43 ]->text();
Angle = mySpinBox[ SpinBox44 ]->text();
}
myConstructorId = constructorId;
@ -280,38 +280,38 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId)
myGrp3->hide();
myGrp4->hide();
myGrp1->show();
mySpinBox[ SpinBox1 ]->setValue(D1);
mySpinBox[ SpinBox1 ]->setText(D1);
break;
case 1:
myGrp1->hide();
myGrp3->hide();
myGrp4->hide();
myGrp2->show();
mySpinBox[ SpinBox21 ]->setValue(D1);
mySpinBox[ SpinBox22 ]->setValue(D2);
mySpinBox[ SpinBox23 ]->setValue(D);
mySpinBox[ SpinBox24 ]->setValue(Angle);
mySpinBox[ SpinBox21 ]->setText(D1);
mySpinBox[ SpinBox22 ]->setText(D2);
mySpinBox[ SpinBox23 ]->setText(D);
mySpinBox[ SpinBox24 ]->setText(Angle);
break;
case 2:
myGrp1->hide();
myGrp2->hide();
myGrp4->hide();
myGrp3->show();
mySpinBox[ SpinBox31 ]->setValue(D1);
mySpinBox[ SpinBox32 ]->setValue(D2);
mySpinBox[ SpinBox32 ]->setValue(D2);
mySpinBox[ SpinBox33 ]->setValue(D);
mySpinBox[ SpinBox34 ]->setValue(Angle);
mySpinBox[ SpinBox31 ]->setText(D1);
mySpinBox[ SpinBox32 ]->setText(D2);
mySpinBox[ SpinBox32 ]->setText(D2);
mySpinBox[ SpinBox33 ]->setText(D);
mySpinBox[ SpinBox34 ]->setText(Angle);
break;
case 3:
myGrp1->hide();
myGrp2->hide();
myGrp3->hide();
myGrp4->show();
mySpinBox[ SpinBox41 ]->setValue(D1);
mySpinBox[ SpinBox42 ]->setValue(D2);
mySpinBox[ SpinBox43 ]->setValue(D);
mySpinBox[ SpinBox44 ]->setValue(Angle);
mySpinBox[ SpinBox41 ]->setText(D1);
mySpinBox[ SpinBox42 ]->setText(D2);
mySpinBox[ SpinBox43 ]->setText(D);
mySpinBox[ SpinBox44 ]->setText(Angle);
break;
default:
break;
@ -643,8 +643,8 @@ void OperationGUI_ChamferDlg::createRadioWg(const QString& theLbl1,
myRadioButton[ theRbId ] = new QRadioButton(theParent);
QLabel* lab1 = new QLabel(theLbl1, theParent);
QLabel* lab2 = new QLabel(theLbl2, theParent);
mySpinBox[ theSpin1Id ] = new QtxDoubleSpinBox(theParent);
mySpinBox[ theSpin2Id ] = new QtxDoubleSpinBox(theParent);
mySpinBox[ theSpin1Id ] = new SalomeApp_DoubleSpinBox(theParent);
mySpinBox[ theSpin2Id ] = new SalomeApp_DoubleSpinBox(theParent);
int row = theLayout->rowCount();
theLayout->addWidget(myRadioButton[ theRbId ], row, 0);
theLayout->addWidget(lab1, row, 2);
@ -740,14 +740,50 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
bool OperationGUI_ChamferDlg::isValid (QString&)
bool OperationGUI_ChamferDlg::isValid (QString& msg)
{
bool ok = true;
switch (getConstructorId())
{
case 0: return !myShape->_is_nil();
case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;
case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
case 3: return !myShape->_is_nil() && myEdges.Extent() > 0;
case 0:
ok = mySpinBox[ SpinBox1 ]->isValid( msg, !IsPreview() );
return !myShape->_is_nil() && ok;
case 1:
if (myRadioButton[ RadioButton21 ]->isChecked())
{
ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok;
}
else
{
ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok;
}
return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0 && ok;
case 2:
if (myRadioButton[ RadioButton31 ]->isChecked())
{
ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok;
}
else
{
ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok;
}
return !myShape->_is_nil() && myFaces.Extent() > 0 && ok;
case 3:
if (myRadioButton[ RadioButton41 ]->isChecked())
{
ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok;
}
else
{
ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok;
ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok;
}
return !myShape->_is_nil() && myEdges.Extent() > 0 && ok;
default: return false;
}
}
@ -758,6 +794,7 @@ bool OperationGUI_ChamferDlg::isValid (QString&)
//=================================================================================
bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
{
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
bool flag = (myRadioButton[ RadioButton21 ]->isChecked() &&
myRadioButton[ RadioButton31 ]->isChecked() &&
@ -767,6 +804,8 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
if (!anObj->_is_nil())
aParameters << mySpinBox[ SpinBox1 ]->text();
}
else if (anId == 1) {
if (flag) {
@ -776,6 +815,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
mySpinBox[ SpinBox22 ]->value(),
myFace[ Face1 ],
myFace[ Face2 ]);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox21 ]->text();
aParameters << mySpinBox[ SpinBox22 ]->text();
}
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
@ -784,6 +828,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
mySpinBox[ SpinBox24 ]->value() * PI180,
myFace[ Face1 ],
myFace[ Face2 ]);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox23 ]->text();
aParameters << mySpinBox[ SpinBox24 ]->text();
}
}
}
else if (anId == 2)
@ -794,18 +843,30 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
for (int i = 1, n = myFaces.Extent(); i <= n; i++)
anArray[ i - 1 ] = myFaces(i);
if (flag)
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferFaces(myShape,
mySpinBox[ SpinBox31 ]->value(),
mySpinBox[ SpinBox32 ]->value(),
anArray);
else
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferFacesAD(myShape,
mySpinBox[ SpinBox33 ]->value(),
mySpinBox[ SpinBox34 ]->value() * PI180,
anArray);
if (flag) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferFaces(myShape,
mySpinBox[ SpinBox31 ]->value(),
mySpinBox[ SpinBox32 ]->value(),
anArray);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox31 ]->text();
aParameters << mySpinBox[ SpinBox32 ]->text();
}
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferFacesAD(myShape,
mySpinBox[ SpinBox33 ]->value(),
mySpinBox[ SpinBox34 ]->value() * PI180,
anArray);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox33 ]->text();
aParameters << mySpinBox[ SpinBox34 ]->text();
}
}
}
else if (anId == 3) {
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
@ -818,6 +879,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
mySpinBox[ SpinBox41 ]->value(),
mySpinBox[ SpinBox42 ]->value(),
anArray);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox41 ]->text();
aParameters << mySpinBox[ SpinBox42 ]->text();
}
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
@ -825,11 +891,20 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
mySpinBox[ SpinBox43 ]->value(),
mySpinBox[ SpinBox44 ]->value() * PI180,
anArray);
if (!anObj->_is_nil())
{
aParameters << mySpinBox[ SpinBox43 ]->text();
aParameters << mySpinBox[ SpinBox44 ]->text();
}
}
}
if (!anObj->_is_nil())
{
if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}
return true;
}

View File

@ -32,10 +32,10 @@
#include <QMap>
class SalomeApp_DoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
class QtxDoubleSpinBox;
class QGridLayout;
class QRadioButton;
@ -105,7 +105,7 @@ private:
QMap< int, QPushButton* > mySelBtn;
QMap< int, QLineEdit* > mySelName;
QMap< int, QtxDoubleSpinBox* > mySpinBox;
QMap< int, SalomeApp_DoubleSpinBox* > mySpinBox;
QMap< int, QRadioButton* > myRadioButton;
};

View File

@ -74,13 +74,13 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI,
TextLabelNear = new QLabel( tr( "Near" ), GroupArguments );
GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 );
SpinBox_Near = new QtxDoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments );
SpinBox_Near = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 );
TextLabelFar = new QLabel( tr( "Far" ), GroupArguments );
GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 );
SpinBox_Far = new QtxDoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments );
SpinBox_Far = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 );
resetButton = new QPushButton( tr( "Reset" ), GroupArguments );

View File

@ -32,7 +32,7 @@ class QGroupBox;
class QLabel;
class QPushButton;
class QComboBox;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
enum ViewerTypes { VTK, OCC, OTHER };
@ -58,9 +58,9 @@ private:
QGroupBox* GroupArguments;
QLabel* TextLabelNear;
QtxDoubleSpinBox* SpinBox_Near;
SalomeApp_DoubleSpinBox* SpinBox_Near;
QLabel* TextLabelFar;
QtxDoubleSpinBox* SpinBox_Far;
SalomeApp_DoubleSpinBox* SpinBox_Far;
QPushButton* resetButton;
QComboBox* TypeCB;

View File

@ -217,19 +217,19 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId)
return;
// Get radius from previous widget
double R = 5, R1 = 5, R2 = 5;
QString R = "5", R1 = "5", R2 = "5";
if (myConstructorId == 0) {
R = Group1->SpinBox_DX->value();
R = Group1->SpinBox_DX->text();
}
else if (myConstructorId == 1) {
R = Group2->SpinBox_DX->value();
R1 = Group2->SpinBox_DY->value();
R2 = Group2->SpinBox_DZ->value();
R = Group2->SpinBox_DX->text();
R1 = Group2->SpinBox_DY->text();
R2 = Group2->SpinBox_DZ->text();
}
else {
R = Group3->SpinBox_DX->value();
R1 = Group3->SpinBox_DY->value();
R2 = Group3->SpinBox_DZ->value();
R = Group3->SpinBox_DX->text();
R1 = Group3->SpinBox_DY->text();
R2 = Group3->SpinBox_DZ->text();
}
myConstructorId = constructorId;
@ -239,23 +239,23 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId)
Group2->hide();
Group3->hide();
Group1->show();
Group1->SpinBox_DX->setValue(R);
Group1->SpinBox_DX->setText(R);
break;
case 1:
Group1->hide();
Group3->hide();
Group2->show();
Group2->SpinBox_DX->setValue(R);
Group2->SpinBox_DY->setValue(R1);
Group2->SpinBox_DZ->setValue(R2);
Group2->SpinBox_DX->setText(R);
Group2->SpinBox_DY->setText(R1);
Group2->SpinBox_DZ->setText(R2);
break;
case 2:
Group1->hide();
Group2->hide();
Group3->show();
Group3->SpinBox_DX->setValue(R);
Group3->SpinBox_DY->setValue(R1);
Group3->SpinBox_DZ->setValue(R2);
Group3->SpinBox_DX->setText(R);
Group3->SpinBox_DY->setText(R1);
Group3->SpinBox_DZ->setText(R2);
break;
default:
break;
@ -586,13 +586,32 @@ GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation()
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
bool OperationGUI_FilletDlg::isValid (QString&)
bool OperationGUI_FilletDlg::isValid (QString& msg)
{
bool ok = true;
switch (getConstructorId())
{
case 0: return !myShape->_is_nil();
case 1: return !myShape->_is_nil() && myEdges.Extent() > 0;
case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
case 0:
ok = Group1->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
return !myShape->_is_nil() && ok;
case 1:
if (Group2->RadioButton1->isChecked())
ok = Group2->SpinBox_DX->isValid( msg, !IsPreview() );
else
{
ok = Group2->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = Group2->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
return !myShape->_is_nil() && myEdges.Extent() > 0 && ok;
case 2:
if (Group3->RadioButton1->isChecked())
ok = Group3->SpinBox_DX->isValid( msg, !IsPreview() );
else
{
ok = Group3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = Group3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
return !myShape->_is_nil() && myFaces.Extent() > 0 && ok;
default: return false;
}
}
@ -603,12 +622,16 @@ bool OperationGUI_FilletDlg::isValid (QString&)
//=================================================================================
bool OperationGUI_FilletDlg::execute (ObjectList& objects)
{
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
int anId = getConstructorId();
if (anId == 0)
if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletAll(myShape, getRadius());
if (!anObj->_is_nil())
aParameters << Group1->SpinBox_DX->text();
}
else if (anId == 1) {
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
aList->length(myEdges.Extent());
@ -617,14 +640,25 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
aList[ i - 1 ] = myEdges(i);
if (Group2->RadioButton1->isChecked())
{
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletEdges(myShape, getRadius(), aList);
if (!anObj->_is_nil())
aParameters << Group2->SpinBox_DX->text();
}
else
{
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletEdgesR1R2(myShape,
Group2->SpinBox_DY->value(),
Group2->SpinBox_DZ->value(),
aList);
if (!anObj->_is_nil())
{
aParameters << Group2->SpinBox_DY->text();
aParameters << Group2->SpinBox_DZ->text();
}
}
}
else if (anId == 2) {
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
@ -636,17 +670,28 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
if (Group3->RadioButton1->isChecked()) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletFaces(myShape, getRadius(), aList);
if (!anObj->_is_nil())
aParameters << Group3->SpinBox_DX->text();
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletFacesR1R2(myShape,
Group3->SpinBox_DY->value(),
Group3->SpinBox_DZ->value(), aList);
if (!anObj->_is_nil())
{
aParameters << Group3->SpinBox_DY->text();
aParameters << Group3->SpinBox_DZ->text();
}
}
}
if (!anObj->_is_nil())
{
if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}
return true;
}

View File

@ -422,9 +422,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool PrimitiveGUI_BoxDlg::isValid (QString&)
bool PrimitiveGUI_BoxDlg::isValid (QString& msg)
{
return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : true;
bool ok = true;
if( getConstructorId() == 1 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
ok = fabs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && ok;
ok = fabs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && ok;
ok = fabs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion() && ok;
}
return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : ok;
}
//=================================================================================
@ -453,6 +464,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
double z = GroupDimensions->SpinBox_DZ->value();
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
aParameters << GroupDimensions->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
}
break;

View File

@ -438,11 +438,26 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_ConeDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool PrimitiveGUI_ConeDlg::isValid (QString&)
bool PrimitiveGUI_ConeDlg::isValid (QString& msg)
{
if (!getRadius1() && !getRadius2())
return false;
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
bool ok = true;
if( getConstructorId() == 0 )
{
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
else if( getConstructorId() == 1 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
ok = fabs( getHeight() ) > Precision::Confusion() && ok;
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
@ -460,12 +475,28 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
aParameters << GroupPoints->SpinBox_DY->text();
aParameters << GroupPoints->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
aParameters << GroupDimensions->SpinBox_DZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
}

View File

@ -434,9 +434,21 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool PrimitiveGUI_CylinderDlg::isValid (QString&)
bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
{
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
bool ok = true;
if( getConstructorId() == 0 )
{
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
else if( getConstructorId() == 1 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
ok = fabs( getHeight() ) > Precision::Confusion() && ok;
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
@ -454,12 +466,26 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
aParameters << GroupPoints->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderRH(getRadius(), getHeight());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
}

View File

@ -542,13 +542,19 @@ static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje
// function : isValid
// purpose :
//=================================================================================
bool PrimitiveGUI_DiskDlg::isValid (QString&)
bool PrimitiveGUI_DiskDlg::isValid (QString& msg)
{
bool ok = true;
if( getConstructorId() == 0 )
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
else if( getConstructorId() == 1 )
ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
const int id = getConstructorId();
if (id == 0)
return true;
return ok;
else if (id == 1)
return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0 && ok;
else if (id == 2)
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual(myPoint1, myPoint2) && !isEqual(myPoint1, myPoint3) && !isEqual(myPoint2, myPoint3);
@ -562,6 +568,7 @@ bool PrimitiveGUI_DiskDlg::isValid (QString&)
bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
{
bool res = false;
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
@ -569,11 +576,21 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskR(getRadius(), myOrientationType);
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupDimensions->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskPntVecR(myPoint, myDir, getRadius());
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPntVecR->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
case 2:

View File

@ -459,14 +459,26 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_FaceDlg::createOperation()
//=================================================================================
bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
{
bool ok = true;
if( getConstructorId() == 0 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
else if( getConstructorId() == 1 )
{
ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
const int id = getConstructorId();
if ( id == 0 )
return true;
return ok;
else if ( id == 1 ) {
if (GroupType->RadioButton1->isChecked())
return !myEdge->_is_nil();
return !myEdge->_is_nil() && ok;
else if (GroupType->RadioButton2->isChecked())
return !myFace->_is_nil();
return !myFace->_is_nil() && ok;
}
return false;
}
@ -478,12 +490,19 @@ bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
{
bool res = false;
QStringList aParameters;
GEOM::GEOM_Object_var anObj;
switch (getConstructorId()) {
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
GroupDimensions->SpinBox_DY->value(), myOrientationType);
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
case 1:
@ -493,6 +512,12 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
else if (GroupType->RadioButton2->isChecked())
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPlane->SpinBox_DX->text();
aParameters << GroupPlane->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
}

View File

@ -378,7 +378,12 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation()
//=================================================================================
bool PrimitiveGUI_SphereDlg::isValid( QString& msg )
{
return getConstructorId() == 0 ? !myPoint->_is_nil() : true;
bool ok = true;
if( getConstructorId() == 0 )
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
else if( getConstructorId() == 1 )
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
return getConstructorId() == 0 ? !myPoint->_is_nil() && ok : ok;
}
//=================================================================================
@ -396,6 +401,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
{
if ( !CORBA::is_nil( myPoint ) ) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
}
break;
@ -403,6 +414,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
case 1 :
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
}

View File

@ -431,9 +431,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool PrimitiveGUI_TorusDlg::isValid (QString&)
bool PrimitiveGUI_TorusDlg::isValid (QString& msg)
{
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
bool ok = true;
if( getConstructorId() == 0 )
{
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
else if( getConstructorId() == 1 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
//=================================================================================
@ -451,12 +462,26 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
aParameters << GroupPoints->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusRR(getRadius1(), getRadius2());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
res = true;
break;
}

View File

@ -84,7 +84,7 @@ RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, Q
myIsParameterGr->addButton( rb2, 1 );
rb1->setChecked( true );
myValEdt = new QtxDoubleSpinBox( 0., 1., 0.1, 3, 32, GroupPoints->Box );
myValEdt = new SalomeApp_DoubleSpinBox( 0., 1., 0.1, 3, 32, GroupPoints->Box );
myValEdt->setValue( 0.5 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
@ -338,9 +338,10 @@ GEOM::GEOM_IOperations_ptr RepairGUI_DivideEdgeDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_DivideEdgeDlg::isValid( QString& )
bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
{
return !myObject->_is_nil();
bool ok = myValEdt->isValid( msg, !IsPreview() );
return !myObject->_is_nil() && ok;
}
//=================================================================================
@ -353,7 +354,17 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
( myObject, -1, myValEdt->value(), getIsByParameter() );
bool aResult = !anObj->_is_nil();
if ( aResult )
{
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << "";
aParameters << myValEdt->text();
aParameters << "";
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
return aResult;
}

View File

@ -29,7 +29,7 @@
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QButtonGroup;
//=================================================================================
@ -63,7 +63,7 @@ private:
DlgRef_1SelExt* GroupPoints;
QButtonGroup* myIsParameterGr;
QtxDoubleSpinBox* myValEdt;
SalomeApp_DoubleSpinBox* myValEdt;
protected slots:
void ClickOnOk();

View File

@ -82,7 +82,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare
GroupPoints->LineEdit1->setReadOnly( true );
QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myTolEdt = new QtxDoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 7, GroupPoints->Box );
myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 7, GroupPoints->Box );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box );
@ -98,7 +98,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare
GroupPoints2->LineEdit1->setReadOnly( true );
QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
myTolEdt2 = new QtxDoubleSpinBox( GroupPoints2->Box );
myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box );
initSpinBox( myTolEdt2, 0, 100, 1e-7, 7 );
myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
@ -380,17 +380,22 @@ GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_GlueDlg::isValid( QString& )
bool RepairGUI_GlueDlg::isValid( QString& msg )
{
bool ok = true;
double v = 0;
switch ( getConstructorId() )
{
case 0:
v = myTolEdt->value(); break;
v = myTolEdt->value();
ok = myTolEdt->isValid( msg, !IsPreview() );
break;
case 1:
v = myTolEdt2->value(); break;
v = myTolEdt2->value();
ok = myTolEdt2->isValid( msg, !IsPreview() );
break;
}
return !myObject->_is_nil() && ( IsPreview() || v > 0. );
return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
}
//=================================================================================
@ -408,8 +413,14 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true );
aResult = !anObj->_is_nil();
if ( aResult )
if ( aResult && !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
break;
}
case 1:
@ -456,7 +467,15 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
aResult = !anObj->_is_nil();
if ( aResult )
{
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt2->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
// Remove from engine useless objects
clearTemporary();

View File

@ -29,7 +29,7 @@
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QPushButton;
class QCheckBox;
@ -73,8 +73,8 @@ private:
DlgRef_1SelExt* GroupPoints;
DlgRef_1SelExt* GroupPoints2;
QtxDoubleSpinBox* myTolEdt;
QtxDoubleSpinBox* myTolEdt2;
SalomeApp_DoubleSpinBox* myTolEdt;
SalomeApp_DoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;

View File

@ -75,7 +75,7 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget*
QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
myTolEdt = new QtxDoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 10, GroupPoints->Box );
myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 10, GroupPoints->Box );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ),
@ -263,10 +263,11 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SewingDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool RepairGUI_SewingDlg::isValid( QString& )
bool RepairGUI_SewingDlg::isValid( QString& msg )
{
myClosed = -1;
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. );
bool ok = myTolEdt->isValid( msg, !IsPreview() );
return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
}
//=================================================================================
@ -297,7 +298,15 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() );
aResult = !anObj->_is_nil();
if ( aResult )
{
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
}
return aResult;

View File

@ -29,7 +29,7 @@
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
class QPushButton;
//=================================================================================
@ -59,7 +59,7 @@ private:
GEOM::GEOM_Object_var myObject;
DlgRef_1SelExt* GroupPoints;
QtxDoubleSpinBox* myTolEdt;
SalomeApp_DoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;
int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect().

View File

@ -32,6 +32,8 @@
#include <QtxDoubleSpinBox.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_IntSpinBox.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
@ -124,8 +126,8 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myFixShapeTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myFixShapeMaxTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myFixShapeTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myFixShapeTol3D, 0, 1 );
@ -139,7 +141,7 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myFixFaceSizeTol = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myFixFaceSizeTol, 0, 1 );
@ -151,7 +153,7 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
myDropSmallEdgesTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 );
@ -163,8 +165,8 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitAngleAngle = new QtxDoubleSpinBox( 0, 360, 1, 10, 10, w );
mySplitAngleMaxTol = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
mySplitAngleAngle = new SalomeApp_DoubleSpinBox( 0, 360, 1, 10, 10, w );
mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 );
aLay->addWidget( mySplitAngleAngle, 0, 1 );
@ -178,7 +180,7 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitClosedFacesNum = new QSpinBox( w );
mySplitClosedFacesNum = new SalomeApp_IntSpinBox( w );
aLay->addWidget( new QLabel( tr( "GEOM_NUM_SPLIT_POINTS" ), w ), 0, 0 );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 );
@ -190,7 +192,7 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySplitContTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
mySplitContTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
mySplitContSurfCont = new QComboBox( w );
mySplitContSurfCont->addItems( aContinueties );
mySplitContCurvCont = new QComboBox( w );
@ -214,12 +216,12 @@ void RepairGUI_ShapeProcessDlg::init()
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
myBSplineTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myBSplineTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myBSplineTol2D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myBSplineTol2D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myBSplineDegree = new QSpinBox( w );
myBSplineSegments = new QSpinBox( w );
myBSplineDegree = new SalomeApp_IntSpinBox( w );
myBSplineSegments = new SalomeApp_IntSpinBox( w );
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
@ -256,7 +258,7 @@ void RepairGUI_ShapeProcessDlg::init()
myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
myToBezierMaxTol = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
myToBezierMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
aLay->addWidget( myToBezier3DCurveChk, 1, 0 );
@ -271,7 +273,7 @@ void RepairGUI_ShapeProcessDlg::init()
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
mySameParameterTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
mySameParameterTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
aLay->addWidget( mySameParameterTol3D, 0, 1 );
@ -498,10 +500,10 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& theValue )
{
if ( theControl && !theValue.isNull() ) {
if ( qobject_cast<QtxDoubleSpinBox*>( theControl ) )
qobject_cast<QtxDoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
else if ( qobject_cast<QSpinBox*>( theControl ) )
qobject_cast<QSpinBox*>( theControl )->setValue( theValue.toInt() );
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
qobject_cast<SalomeApp_IntSpinBox*>( theControl )->setValue( theValue.toInt() );
else if ( qobject_cast<QComboBox*>( theControl ) )
qobject_cast<QComboBox*>( theControl )->setEditText( theValue );
else if ( qobject_cast<QCheckBox*>( theControl ) )
@ -516,10 +518,10 @@ void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& th
QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
{
if ( theControl ) {
if ( qobject_cast<QtxDoubleSpinBox*>( theControl ) )
return QString::number( qobject_cast<QtxDoubleSpinBox*>( theControl )->value() );
else if ( qobject_cast<QSpinBox*>( theControl ) )
return QString::number( qobject_cast<QSpinBox*>( theControl )->value() );
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
return QString::number( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->value() );
else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
return QString::number( qobject_cast<SalomeApp_IntSpinBox*>( theControl )->value() );
else if ( qobject_cast<QComboBox*>( theControl ) )
return qobject_cast<QComboBox*>( theControl )->currentText();
else if ( qobject_cast<QCheckBox*>( theControl ) )
@ -528,6 +530,21 @@ QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
return 0;
}
//=================================================================================
// function : getText()
// purpose : get text in the proper way
//=================================================================================
QString RepairGUI_ShapeProcessDlg::getText( QWidget* theControl ) const
{
if ( theControl ) {
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
return qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->text();
else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
return qobject_cast<SalomeApp_IntSpinBox*>( theControl )->text();
}
return QString::null;
}
//=================================================================================
// function : createOperation
// purpose :
@ -543,6 +560,22 @@ GEOM::GEOM_IOperations_ptr RepairGUI_ShapeProcessDlg::createOperation()
//=================================================================================
bool RepairGUI_ShapeProcessDlg::isValid( QString& msg )
{
bool ok = true;
QMapIterator<QString,QStringList> aMapIter( myValMap );
while( aMapIter.hasNext() ) {
aMapIter.next();
const QStringList& aList = aMapIter.value();
QListIterator<QString> aListIter( aList );
while( aListIter.hasNext() ) {
const QString& aParam = aListIter.next();
QWidget* aControl = getControl( aParam );
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( aControl ) )
ok = qobject_cast<SalomeApp_DoubleSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
else if ( qobject_cast<SalomeApp_IntSpinBox*>( aControl ) )
ok = qobject_cast<SalomeApp_IntSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
}
}
bool error = false;
GEOM::string_array_var anOperators = getActiveOperators();
if ( !myObjects->length() ) {
@ -555,7 +588,7 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg )
msg += tr( "ERROR_NO_OPERATORS" );
error = true;
}
return !error;
return !error && ok;
}
//=================================================================================
@ -593,7 +626,22 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj );
else
{
if ( !IsPreview() )
{
QStringList aParameters;
for ( int i = 0; i < anOperators->length(); i++ )
aParameters << QString( anOperators[i] );
for ( int i = 0; i < aParams->length(); i++ )
aParameters << QString( aParams[i] );
aParameters << getTexts( aParams );
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
}
if ( !anErrorObjNames.empty() )
@ -754,6 +802,27 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_arr
return aValues._retn();
}
//=================================================================================
// function : getTexts
// purpose :
//=================================================================================
QStringList RepairGUI_ShapeProcessDlg::getTexts( const GEOM::string_array& theParams )
{
QStringList aTexts;
for ( int i = 0; i < theParams.length(); i++ ) {
QWidget* aCtrl = getControl( (const char*)theParams[i] );
if ( aCtrl )
{
QString aText = getText( aCtrl );
if( !aText.isNull() )
aTexts.append( aText );
}
}
return aTexts;
}
//=================================================================================
// function : initSelection
// purpose : set selection of ALL shape types except vertexes

View File

@ -31,8 +31,8 @@
#include <QMap>
class DlgRef_1Sel;
class QSpinBox;
class QtxDoubleSpinBox;
class SalomeApp_IntSpinBox;
class SalomeApp_DoubleSpinBox;
class QComboBox;
class QCheckBox;
class QListWidget;
@ -64,12 +64,15 @@ private:
GEOM::string_array* getParameters( const GEOM::string_array& );
GEOM::string_array* getValues( const GEOM::string_array& );
QStringList getTexts( const GEOM::string_array& );
void enterEvent( QEvent* );
QWidget* getControl( const QString& );
void setValue( QWidget*, const QString& ); // initialize the given control in the proper way
// (analize its class and convert the value string)
QString getValue( QWidget* ) const; // retrieve value of the control in the proper way
QString getText( QWidget* ) const; // retrieve text of the control (for spin-boxes only)
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures
@ -84,38 +87,38 @@ private:
DlgRef_1Sel* mySelectWdgt;
QListWidget* myOpList;
QtxDoubleSpinBox* myFixShapeTol3D;
QtxDoubleSpinBox* myFixShapeMaxTol3D;
SalomeApp_DoubleSpinBox* myFixShapeTol3D;
SalomeApp_DoubleSpinBox* myFixShapeMaxTol3D;
QtxDoubleSpinBox* myFixFaceSizeTol;
SalomeApp_DoubleSpinBox* myFixFaceSizeTol;
QtxDoubleSpinBox* myDropSmallEdgesTol3D;
SalomeApp_DoubleSpinBox* myDropSmallEdgesTol3D;
QtxDoubleSpinBox* mySplitAngleAngle;
QtxDoubleSpinBox* mySplitAngleMaxTol;
SalomeApp_DoubleSpinBox* mySplitAngleAngle;
SalomeApp_DoubleSpinBox* mySplitAngleMaxTol;
QSpinBox* mySplitClosedFacesNum;
SalomeApp_IntSpinBox* mySplitClosedFacesNum;
QtxDoubleSpinBox* mySplitContTol3D;
SalomeApp_DoubleSpinBox* mySplitContTol3D;
QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk;
QCheckBox* myBSpline3DCurveChk;
QCheckBox* myBSpline2DCurveChk;
QtxDoubleSpinBox* myBSplineTol3D;
QtxDoubleSpinBox* myBSplineTol2D;
QSpinBox* myBSplineDegree;
QSpinBox* myBSplineSegments;
SalomeApp_DoubleSpinBox* myBSplineTol3D;
SalomeApp_DoubleSpinBox* myBSplineTol2D;
SalomeApp_IntSpinBox* myBSplineDegree;
SalomeApp_IntSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk;
QtxDoubleSpinBox* myToBezierMaxTol;
SalomeApp_DoubleSpinBox* myToBezierMaxTol;
QtxDoubleSpinBox* mySameParameterTol3D;
SalomeApp_DoubleSpinBox* mySameParameterTol3D;
private slots:
void onOk();

View File

@ -177,6 +177,9 @@ void TransformationGUI_MultiRotationDlg::Init()
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
this, SLOT(TextValueChangedInSpinBox( const QString& )));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
@ -464,6 +467,17 @@ void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*)
ActivateThisDialog();
}
//=================================================================================
// function : TextValueChangedInSpinBox()
// purpose :
//=================================================================================
void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){
bool isDigit;
s.toDouble(&isDigit);
if(!isDigit)
GroupDimensions->CheckButton1->setChecked(false);
GroupDimensions->CheckButton1->setEnabled(isDigit);
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
@ -515,9 +529,21 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_MultiRotationDlg::isValid (QString& /*msg*/)
bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
{
return !(myBase->_is_nil() || myVector->_is_nil());
bool ok = true;
switch(getConstructorId()){
case 0:
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
break;
case 1:
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
break;
}
return !(myBase->_is_nil() || myVector->_is_nil()) && ok;
}
//=================================================================================
@ -529,12 +555,15 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
bool res = false;
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiRotate1D(myBase, myVector, myNbTimes1);
if(!IsPreview())
aParameters<<GroupPoints->SpinBox_DX->text();
res = true;
}
break;
@ -542,13 +571,22 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
if(!IsPreview()) {
aParameters<<GroupDimensions->SpinBox_DX1->text();
aParameters<<GroupDimensions->SpinBox_DY1->text();
aParameters<<GroupDimensions->SpinBox_DX2->text();
aParameters<<GroupDimensions->SpinBox_DY2->text();
}
res = true;
}
break;
}
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}
return res;
}

View File

@ -77,6 +77,7 @@ private slots:
void SetEditCurrentArgument();
void ReverseAngle();
void ValueChangedInSpinBox( double );
void TextValueChangedInSpinBox( const QString& );
void ConstructorsClicked( int );
void SetDoubleSpinBoxStep( double );
};

View File

@ -187,6 +187,13 @@ void TransformationGUI_MultiTranslationDlg::Init()
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )),
this, SLOT(TextValueChangedInSpinBox(const QString& )));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
@ -509,6 +516,40 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
ActivateThisDialog();
}
//=================================================================================
// function : TextValueChangedInSpinBox
// purpose :
//=================================================================================
void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s)
{
QObject* send = (QObject*)sender();
bool isDigit = true;
switch (getConstructorId()) {
case 0:
GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
if(!isDigit){
GroupPoints->CheckButton1->setChecked(false);
}
GroupPoints->CheckButton1->setEnabled(isDigit);
break;
case 1:
if (send == GroupDimensions->SpinBox_DX1) {
GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
if(!isDigit)
GroupDimensions->CheckButton1->setChecked(false);
GroupDimensions->CheckButton1->setEnabled(isDigit);
}
else if(send == GroupDimensions->SpinBox_DX2){
GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
if(!isDigit)
GroupDimensions->CheckButton2->setChecked(false);
GroupDimensions->CheckButton2->setEnabled(isDigit);
}
break;
}
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
@ -516,7 +557,6 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*)
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
{
QObject* send = (QObject*)sender();
switch (getConstructorId()) {
case 0:
if (send == GroupPoints->SpinBox_DX)
@ -583,14 +623,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/)
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
{
int aConstructorId = getConstructorId();
if (aConstructorId == 0)
return !(myBase->_is_nil() || myVectorU->_is_nil());
else if (aConstructorId == 1)
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
if (aConstructorId == 0) {
bool ok = true;
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok;
}
else if (aConstructorId == 1) {
bool ok = true;
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok;
}
return 0;
}
@ -604,11 +654,17 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
if(!IsPreview()) {
aParameters<<GroupPoints->SpinBox_DX->text();
aParameters<<GroupPoints->SpinBox_DY->text();
}
res = true;
}
break;
@ -618,13 +674,22 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV);
if(!IsPreview()) {
aParameters<<GroupDimensions->SpinBox_DX1->text();
aParameters<<GroupDimensions->SpinBox_DY1->text();
aParameters<<GroupDimensions->SpinBox_DX2->text();
aParameters<<GroupDimensions->SpinBox_DY2->text();
}
res = true;
}
break;
}
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}
return res;
}

View File

@ -78,6 +78,7 @@ private slots:
void ReverseStepU();
void ReverseStepV();
void ValueChangedInSpinBox( double );
void TextValueChangedInSpinBox( const QString& );
void ConstructorsClicked( int );
void SetDoubleSpinBoxStep( double );
};

View File

@ -278,7 +278,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
return false;
}
}
return true;
return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
}
//=================================================================================
@ -295,8 +295,12 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() ) {
if(!IsPreview()) {
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
}
objects.push_back( anObj._retn() );
}
}
}
else {

View File

@ -151,6 +151,9 @@ void TransformationGUI_RotationDlg::Init()
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )),
this, SLOT(TextValueChangedInSpinBox( const QString&)));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
@ -465,6 +468,16 @@ void TransformationGUI_RotationDlg::enterEvent (QEvent*)
ActivateThisDialog();
}
void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
{
bool isDigit = true;
s.toDouble(&isDigit);
if(!isDigit) {
GroupPoints->CheckButton2->setChecked(false);
}
GroupPoints->CheckButton2->setEnabled(isDigit);
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
@ -487,16 +500,16 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
bool TransformationGUI_RotationDlg::isValid (QString& msg)
{
if (myObjects.length() < 1) return false;
switch (getConstructorId()) {
case 0:
return !(myAxis->_is_nil());
case 0: {
bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
return myObjects.length() > 0 && !(myAxis->_is_nil()) && ok;
break;
}
case 1:
return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
return myObjects.length() > 0 && !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
break;
default:
break;
@ -518,13 +531,19 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
switch (getConstructorId()) {
case 0:
{
QStringList aParameters;
aParameters<<GroupPoints->SpinBox_DX->text();
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back(anObj._retn());
}
}
}
else {
@ -532,8 +551,13 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
Rotate(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}
}
res = true;

View File

@ -74,6 +74,7 @@ private slots:
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox();
void TextValueChangedInSpinBox( const QString& );
void CreateCopyModeChanged( bool );
void ConstructorsClicked( int );
void onReverse();

View File

@ -29,7 +29,7 @@
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <QtxDoubleSpinBox.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
@ -93,13 +93,13 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry
LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1);
SpinBox_FX = new QtxDoubleSpinBox(GroupBox1);
SpinBox_FX = new SalomeApp_DoubleSpinBox(GroupBox1);
TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1);
SpinBox_FY = new QtxDoubleSpinBox(GroupBox1);
SpinBox_FY = new SalomeApp_DoubleSpinBox(GroupBox1);
TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1);
SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1);
SpinBox_FZ = new SalomeApp_DoubleSpinBox(GroupBox1);
CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1);
CheckBoxCopy->setChecked(true);
@ -460,18 +460,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/)
bool TransformationGUI_ScaleDlg::isValid (QString& msg)
{
if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001)
{
// && !myPoint->_is_nil()
if (getConstructorId() == 0)
return true;
if (fabs(SpinBox_FY->value()) > 0.00001 &&
fabs(SpinBox_FZ->value()) > 0.00001)
return true;
// && !myPoint->_is_nil()
if (getConstructorId() == 0) {
bool ok = SpinBox_FX->isValid( msg, !IsPreview() );
return myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001 && ok;
}
return false;
bool ok = true;
ok = SpinBox_FX->isValid( msg, !IsPreview() ) && ok;
ok = SpinBox_FY->isValid( msg, !IsPreview() ) && ok;
ok = SpinBox_FZ->isValid( msg, !IsPreview() ) && ok;
return myObjects.length() > 0 &&
fabs(SpinBox_FX->value()) > 0.00001 &&
fabs(SpinBox_FY->value()) > 0.00001 &&
fabs(SpinBox_FZ->value()) > 0.00001 && ok;
}
//=================================================================================
@ -494,8 +498,11 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
objects.push_back(anObj._retn());
}
}
}
else
@ -520,6 +527,13 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
if (!anObj->_is_nil())
if(!IsPreview()) {
QStringList aParameters;
aParameters<<SpinBox_FX->text();
aParameters<<SpinBox_FY->text();
aParameters<<SpinBox_FZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back(anObj._retn());
}
}

View File

@ -33,7 +33,7 @@ class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QtxDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : TransformationGUI_ScaleDlg
@ -77,9 +77,9 @@ private:
QLabel* TextLabel3;
QLabel* TextLabel4;
QLabel* TextLabel5;
QtxDoubleSpinBox* SpinBox_FX;
QtxDoubleSpinBox* SpinBox_FY;
QtxDoubleSpinBox* SpinBox_FZ;
SalomeApp_DoubleSpinBox* SpinBox_FX;
SalomeApp_DoubleSpinBox* SpinBox_FY;
SalomeApp_DoubleSpinBox* SpinBox_FZ;
QCheckBox* CheckBoxCopy;
private slots:

View File

@ -517,19 +517,26 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation()
// function : isValid
// purpose :
//=================================================================================
bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/)
bool TransformationGUI_TranslationDlg::isValid (QString& msg)
{
int aConstructorId = getConstructorId();
if (myObjects.length() < 1) return false;
switch (aConstructorId) {
case 0:
return true;
case 0:
{
bool ok = true;
ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
return myObjects.length() > 0 && ok;
}
case 1:
return !(myPoint1->_is_nil() || myPoint2->_is_nil());
return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil());
case 2:
return !(myVector->_is_nil());
{
bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
return myObjects.length() > 0 && !(myVector->_is_nil()) && ok;
}
default:
break;
}
@ -554,13 +561,21 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
double dy = GroupPoints->SpinBox2->value();
double dz = GroupPoints->SpinBox3->value();
QStringList aParameters;
aParameters<<GroupPoints->SpinBox1->text();
aParameters<<GroupPoints->SpinBox2->text();
aParameters<<GroupPoints->SpinBox3->text();
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}
}
}
else {
@ -568,8 +583,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZ(myObjects[i], dx, dy, dz);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}
}
res = true;
@ -600,6 +620,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
}
case 2:
{
QStringList aParameters;
aParameters<<GroupPoints->SpinBox3->text();
bool byDistance = GroupPoints->CheckBox1->isChecked();
if (byDistance) {
double aDistance = GroupPoints->SpinBox3->value();
@ -607,8 +629,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}
}
else {