mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-28 11:50:32 +05:00
Issue 0020790: EDF 1340 GEOM : Dump Study & Notebook for the 3D Sketcher
This commit is contained in:
parent
04da005e39
commit
fa1c854edc
@ -70,8 +70,10 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
|
|||||||
bool modal, Qt::WindowFlags fl,
|
bool modal, Qt::WindowFlags fl,
|
||||||
const double lineWidth )
|
const double lineWidth )
|
||||||
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
|
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
|
||||||
myGeometryGUI( theGeometryGUI ),
|
myMode( -1 ),
|
||||||
myLineWidth( lineWidth )
|
myOK( false ),
|
||||||
|
myLineWidth( lineWidth ),
|
||||||
|
myGeometryGUI( theGeometryGUI )
|
||||||
{
|
{
|
||||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
|
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
|
||||||
@ -92,6 +94,9 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
|
|||||||
GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS"));
|
GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS"));
|
||||||
GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
|
GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
|
||||||
GroupType->RadioButton3->close();
|
GroupType->RadioButton3->close();
|
||||||
|
myTypeGroup = new QButtonGroup( this );
|
||||||
|
myTypeGroup->addButton( GroupType->RadioButton1, 0 );
|
||||||
|
myTypeGroup->addButton( GroupType->RadioButton2, 1 );
|
||||||
|
|
||||||
Group3Spin = new EntityGUI_3Spin( centralWidget() );
|
Group3Spin = new EntityGUI_3Spin( centralWidget() );
|
||||||
Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
|
Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
|
||||||
@ -145,9 +150,11 @@ void EntityGUI_3DSketcherDlg::Init()
|
|||||||
initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||||
initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
|
||||||
|
|
||||||
/* signals and slots connections */
|
Group3Spin->SpinBox_DX->setValue(0.0);
|
||||||
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( PointClicked( int ) ) );
|
Group3Spin->SpinBox_DY->setValue(0.0);
|
||||||
|
Group3Spin->SpinBox_DZ->setValue(0.0);
|
||||||
|
|
||||||
|
/* signals and slots connections */
|
||||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||||
|
|
||||||
@ -157,8 +164,7 @@ void EntityGUI_3DSketcherDlg::Init()
|
|||||||
connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
|
connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
|
||||||
connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
|
connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
|
||||||
|
|
||||||
connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) );
|
connect( myTypeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) );
|
||||||
connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) );
|
|
||||||
|
|
||||||
connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||||
connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
|
||||||
@ -179,35 +185,43 @@ void EntityGUI_3DSketcherDlg::Init()
|
|||||||
// function : TypeClicked()
|
// function : TypeClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::TypeClicked()
|
void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
|
||||||
{
|
{
|
||||||
|
if ( mode == myMode ) return;
|
||||||
|
|
||||||
bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
|
bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
|
||||||
Group3Spin->SpinBox_DX->blockSignals(true);
|
Group3Spin->SpinBox_DX->blockSignals(true);
|
||||||
Group3Spin->SpinBox_DY->blockSignals(true);
|
Group3Spin->SpinBox_DY->blockSignals(true);
|
||||||
Group3Spin->SpinBox_DZ->blockSignals(true);
|
Group3Spin->SpinBox_DZ->blockSignals(true);
|
||||||
// Get setting of step value from file configuration
|
// Get setting of step value from file configuration
|
||||||
double x, y, z;
|
XYZ xyz = getLastPoint();
|
||||||
GetLastPoints(x, y, z);
|
bool okx, oky, okz;
|
||||||
if ( GroupType->RadioButton1->isChecked() ) { // XY
|
Group3Spin->SpinBox_DX->text().toDouble( &okx );
|
||||||
|
Group3Spin->SpinBox_DY->text().toDouble( &oky );
|
||||||
|
Group3Spin->SpinBox_DZ->text().toDouble( &okz );
|
||||||
|
if ( mode == 0 ) { // XY
|
||||||
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
|
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
|
||||||
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
|
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
|
||||||
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
|
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
|
||||||
Group3Spin->SpinBox_DX->setValue( x + Group3Spin->SpinBox_DX->value() );
|
if ( okx ) Group3Spin->SpinBox_DX->setValue( xyz.x + Group3Spin->SpinBox_DX->value() );
|
||||||
Group3Spin->SpinBox_DY->setValue( y + Group3Spin->SpinBox_DY->value() );
|
if ( oky ) Group3Spin->SpinBox_DY->setValue( xyz.y + Group3Spin->SpinBox_DY->value() );
|
||||||
Group3Spin->SpinBox_DZ->setValue( z + Group3Spin->SpinBox_DZ->value() );
|
if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
|
||||||
Group3Spin->buttonApply->setFocus();
|
Group3Spin->buttonApply->setFocus();
|
||||||
} else if ( GroupType->RadioButton2->isChecked() ) { // DXDY
|
}
|
||||||
|
else { // DXDY
|
||||||
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
|
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
|
||||||
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
|
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
|
||||||
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
|
Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
|
||||||
Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - x );
|
if ( okx ) Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - xyz.x );
|
||||||
Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - y );
|
if ( oky ) Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - xyz.y );
|
||||||
Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - z );
|
if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
|
||||||
Group3Spin->buttonApply->setFocus();
|
Group3Spin->buttonApply->setFocus();
|
||||||
}
|
}
|
||||||
Group3Spin->SpinBox_DX->blockSignals(blocked);
|
Group3Spin->SpinBox_DX->blockSignals(blocked);
|
||||||
Group3Spin->SpinBox_DY->blockSignals(blocked);
|
Group3Spin->SpinBox_DY->blockSignals(blocked);
|
||||||
Group3Spin->SpinBox_DZ->blockSignals(blocked);
|
Group3Spin->SpinBox_DZ->blockSignals(blocked);
|
||||||
|
|
||||||
|
myMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -216,23 +230,22 @@ void EntityGUI_3DSketcherDlg::TypeClicked()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
|
void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
|
||||||
{
|
{
|
||||||
Locker lock( myOK );
|
QString msg;
|
||||||
|
if ( !isValid( msg ) ) {
|
||||||
double x, y, z;
|
showError( msg );
|
||||||
GetCurrentPoints(x, y, z);
|
return;
|
||||||
myPointsList.append(x);
|
}
|
||||||
myPointsList.append(y);
|
|
||||||
myPointsList.append(z);
|
|
||||||
|
|
||||||
|
myPointsList.append( getCurrentPoint() );
|
||||||
myRedoList.clear();
|
myRedoList.clear();
|
||||||
|
|
||||||
if ( GroupType->RadioButton2->isChecked() ) {
|
if ( myMode == 1 ) {
|
||||||
Group3Spin->SpinBox_DX->setValue( 0.0 );
|
Group3Spin->SpinBox_DX->setValue( 0.0 );
|
||||||
Group3Spin->SpinBox_DY->setValue( 0.0 );
|
Group3Spin->SpinBox_DY->setValue( 0.0 );
|
||||||
Group3Spin->SpinBox_DZ->setValue( 0.0 );
|
Group3Spin->SpinBox_DZ->setValue( 0.0 );
|
||||||
}
|
}
|
||||||
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
|
||||||
UpdateButtonsState();
|
UpdateButtonsState();
|
||||||
|
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -241,11 +254,10 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::UpdateButtonsState()
|
void EntityGUI_3DSketcherDlg::UpdateButtonsState()
|
||||||
{
|
{
|
||||||
if ( !myPointsList.count() )
|
if ( myPointsList.count() == 0 ) GroupType->RadioButton1->click();
|
||||||
GroupType->RadioButton1->setChecked( true );
|
GroupType->RadioButton2->setEnabled( myPointsList.count() > 0 );
|
||||||
GroupType->RadioButton2->setEnabled( myPointsList.count() > 2 );
|
Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 0 );
|
||||||
Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 2 );
|
Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 0 );
|
||||||
Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -254,16 +266,8 @@ void EntityGUI_3DSketcherDlg::UpdateButtonsState()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::ClickOnUndo()
|
void EntityGUI_3DSketcherDlg::ClickOnUndo()
|
||||||
{
|
{
|
||||||
if (myPointsList.count() > 2) {
|
if (myPointsList.count() > 0) {
|
||||||
double x, y, z;
|
myRedoList.append( myPointsList.takeLast() );
|
||||||
GetLastPoints(x, y, z);
|
|
||||||
myRedoList.append(x);
|
|
||||||
myRedoList.append(y);
|
|
||||||
myRedoList.append(z);
|
|
||||||
myPointsList.removeLast();
|
|
||||||
myPointsList.removeLast();
|
|
||||||
myPointsList.removeLast();
|
|
||||||
|
|
||||||
UpdateButtonsState();
|
UpdateButtonsState();
|
||||||
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
||||||
}
|
}
|
||||||
@ -275,15 +279,8 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::ClickOnRedo()
|
void EntityGUI_3DSketcherDlg::ClickOnRedo()
|
||||||
{
|
{
|
||||||
int count = myRedoList.count();
|
if ( myRedoList.count() > 0) {
|
||||||
if ( count > 2 ) {
|
myPointsList.append( myRedoList.takeLast() );
|
||||||
myPointsList.append( myRedoList[count-3] );
|
|
||||||
myPointsList.append( myRedoList[count-2] );
|
|
||||||
myPointsList.append( myRedoList[count-1] );
|
|
||||||
myRedoList.removeLast();
|
|
||||||
myRedoList.removeLast();
|
|
||||||
myRedoList.removeLast();
|
|
||||||
|
|
||||||
UpdateButtonsState();
|
UpdateButtonsState();
|
||||||
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
||||||
}
|
}
|
||||||
@ -335,11 +332,10 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
|
|||||||
Group3Spin->SpinBox_DY->setValue( aY );
|
Group3Spin->SpinBox_DY->setValue( aY );
|
||||||
Group3Spin->SpinBox_DZ->setValue( aZ );
|
Group3Spin->SpinBox_DZ->setValue( aZ );
|
||||||
} else if ( GroupType->RadioButton2->isChecked() ) {
|
} else if ( GroupType->RadioButton2->isChecked() ) {
|
||||||
double x, y, z;
|
XYZ xyz = getLastPoint();
|
||||||
GetLastPoints(x, y, z);
|
Group3Spin->SpinBox_DX->setValue( aX - xyz.x );
|
||||||
Group3Spin->SpinBox_DX->setValue( aX - x );
|
Group3Spin->SpinBox_DY->setValue( aY - xyz.y );
|
||||||
Group3Spin->SpinBox_DY->setValue( aY - y );
|
Group3Spin->SpinBox_DZ->setValue( aZ - xyz.z );
|
||||||
Group3Spin->SpinBox_DZ->setValue( aZ - z );
|
|
||||||
}
|
}
|
||||||
Group3Spin->SpinBox_DX->blockSignals(blocked);
|
Group3Spin->SpinBox_DX->blockSignals(blocked);
|
||||||
Group3Spin->SpinBox_DY->blockSignals(blocked);
|
Group3Spin->SpinBox_DY->blockSignals(blocked);
|
||||||
@ -416,7 +412,11 @@ GEOM::GEOM_IOperations_ptr EntityGUI_3DSketcherDlg::createOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
|
bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
|
||||||
{
|
{
|
||||||
return true;
|
bool ok = true;
|
||||||
|
ok = Group3Spin->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
|
||||||
|
ok = Group3Spin->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
|
||||||
|
ok = Group3Spin->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -427,30 +427,40 @@ bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
|
|||||||
{
|
{
|
||||||
GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
|
GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
|
||||||
if (!myOK || myPointsList.size() == 0)
|
if (!myOK || myPointsList.size() == 0)
|
||||||
aCoordsArray->length(myPointsList.size()+3);
|
aCoordsArray->length((myPointsList.size()+1)*3);
|
||||||
else
|
else
|
||||||
aCoordsArray->length(myPointsList.size());
|
aCoordsArray->length(myPointsList.size()*3);
|
||||||
|
|
||||||
|
QStringList aParameters;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
QList<double>::const_iterator it;
|
QList<XYZ>::const_iterator it;
|
||||||
for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
|
for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
|
||||||
aCoordsArray[i] = *it;
|
aCoordsArray[i++] = (*it).x;
|
||||||
i++;
|
aCoordsArray[i++] = (*it).y;
|
||||||
|
aCoordsArray[i++] = (*it).z;
|
||||||
|
aParameters << (*it).xt;
|
||||||
|
aParameters << (*it).yt;
|
||||||
|
aParameters << (*it).zt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myOK || myPointsList.size() == 0) {
|
if (!myOK || myPointsList.size() == 0) {
|
||||||
double x, y, z;
|
XYZ xyz = getCurrentPoint();
|
||||||
GetCurrentPoints(x, y, z);
|
aCoordsArray[i++] = xyz.x;
|
||||||
aCoordsArray[i] = x;
|
aCoordsArray[i++] = xyz.y;
|
||||||
aCoordsArray[i+1] = y;
|
aCoordsArray[i++] = xyz.z;
|
||||||
aCoordsArray[i+2] = z;
|
aParameters << xyz.xt;
|
||||||
|
aParameters << xyz.yt;
|
||||||
|
aParameters << xyz.zt;
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
|
GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
|
||||||
GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray );
|
GEOM::GEOM_Object_var anObj = anOper->Make3DSketcher( aCoordsArray );
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if ( !anObj->_is_nil() ) {
|
||||||
|
if ( !IsPreview() ) anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -461,8 +471,8 @@ bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
|
||||||
void EntityGUI_3DSketcherDlg::initSpinBox( QDoubleSpinBox* spinBox,
|
void EntityGUI_3DSketcherDlg::initSpinBox( QDoubleSpinBox* spinBox,
|
||||||
double min, double max,
|
double min, double max,
|
||||||
double step, int decimals )
|
double step, int decimals )
|
||||||
{
|
{
|
||||||
spinBox->setDecimals( decimals );
|
spinBox->setDecimals( decimals );
|
||||||
spinBox->setRange( min, max );
|
spinBox->setRange( min, max );
|
||||||
@ -500,12 +510,15 @@ void EntityGUI_3DSketcherDlg::ClickOnOk()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool EntityGUI_3DSketcherDlg::ClickOnApply()
|
bool EntityGUI_3DSketcherDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (myPointsList.count() > 3) {
|
QString msg;
|
||||||
myPointsList.append(myPointsList[0]);
|
if ( !isValid( msg ) ) {
|
||||||
myPointsList.append(myPointsList[1]);
|
showError( msg );
|
||||||
myPointsList.append(myPointsList[2]);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (myPointsList.count() > 0)
|
||||||
|
myPointsList.append(myPointsList[0]);
|
||||||
|
|
||||||
Locker lock( myOK );
|
Locker lock( myOK );
|
||||||
|
|
||||||
if ( !onAccept() )
|
if ( !onAccept() )
|
||||||
@ -516,33 +529,36 @@ bool EntityGUI_3DSketcherDlg::ClickOnApply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : GetLastPoints()
|
// function : getLastPoint()
|
||||||
// purpose : return last points from list
|
// purpose : return last points from list
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::GetLastPoints(double& x, double& y, double& z)
|
EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getLastPoint() const
|
||||||
{
|
{
|
||||||
int count = myPointsList.count();
|
return myPointsList.count() > 0 ? myPointsList.last() : XYZ();
|
||||||
x = count > 2 ? myPointsList[count-3] : 0.0;
|
|
||||||
y = count > 2 ? myPointsList[count-2] : 0.0;
|
|
||||||
z = count > 2 ? myPointsList[count-1] : 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : GetCurrentPoints()
|
// function : getCurrentPoint()
|
||||||
// purpose : returns current points
|
// purpose : returns current points
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void EntityGUI_3DSketcherDlg::GetCurrentPoints(double& x, double& y, double& z)
|
EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const
|
||||||
{
|
{
|
||||||
if ( GroupType->RadioButton1->isChecked() ) {
|
XYZ xyz;
|
||||||
x = Group3Spin->SpinBox_DX->value();
|
if ( myMode == 0 ) {
|
||||||
y = Group3Spin->SpinBox_DY->value();
|
xyz.x = Group3Spin->SpinBox_DX->value();
|
||||||
z = Group3Spin->SpinBox_DZ->value();
|
xyz.y = Group3Spin->SpinBox_DY->value();
|
||||||
} else { // if (GroupType->RadioButton2->isChecked())
|
xyz.z = Group3Spin->SpinBox_DZ->value();
|
||||||
GetLastPoints(x, y, z);
|
}
|
||||||
x += Group3Spin->SpinBox_DX->value();
|
else {
|
||||||
y += Group3Spin->SpinBox_DY->value();
|
xyz = getLastPoint();
|
||||||
z += Group3Spin->SpinBox_DZ->value();
|
xyz.x += Group3Spin->SpinBox_DX->value();
|
||||||
|
xyz.y += Group3Spin->SpinBox_DY->value();
|
||||||
|
xyz.z += Group3Spin->SpinBox_DZ->value();
|
||||||
}
|
}
|
||||||
|
xyz.xt = Group3Spin->SpinBox_DX->text();
|
||||||
|
xyz.yt = Group3Spin->SpinBox_DY->text();
|
||||||
|
xyz.zt = Group3Spin->SpinBox_DZ->text();
|
||||||
|
return xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
@ -571,7 +587,7 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
|
|||||||
CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
|
CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
|
||||||
getDisplayer()->SetName( objStr.in() );
|
getDisplayer()->SetName( objStr.in() );
|
||||||
|
|
||||||
// Create wire from applayed object
|
// Create wire from applied object
|
||||||
TopoDS_Shape anApplyedWire, aLastSegment;
|
TopoDS_Shape anApplyedWire, aLastSegment;
|
||||||
if ( !createShapes( object, anApplyedWire, aLastSegment ) )
|
if ( !createShapes( object, anApplyedWire, aLastSegment ) )
|
||||||
return;
|
return;
|
||||||
@ -605,17 +621,16 @@ bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
|
|||||||
aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
|
aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( myOK ) {
|
theApplyedWire = aShape;
|
||||||
theApplyedWire = aShape;
|
if ( myOK )
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
BRepBuilderAPI_MakeWire aBuilder;
|
BRepBuilderAPI_MakeWire aBuilder;
|
||||||
TopExp_Explorer anExp( aShape, TopAbs_EDGE );
|
TopExp_Explorer edgeExp( aShape, TopAbs_EDGE );
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
TopoDS_Shape anEdge = anExp.Current();
|
TopoDS_Shape anEdge = edgeExp.Current();
|
||||||
anExp.Next();
|
edgeExp.Next();
|
||||||
if ( anExp.More() ) // i.e. non-last edge
|
if ( edgeExp.More() ) // i.e. non-last edge
|
||||||
aBuilder.Add( TopoDS::Edge( anEdge ) );
|
aBuilder.Add( TopoDS::Edge( anEdge ) );
|
||||||
else {
|
else {
|
||||||
theLastSegment = anEdge;
|
theLastSegment = anEdge;
|
||||||
@ -623,8 +638,13 @@ bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aBuilder.IsDone() )
|
if ( aBuilder.IsDone() ) {
|
||||||
theApplyedWire = aBuilder.Shape();
|
theApplyedWire = aBuilder.Shape();
|
||||||
|
}
|
||||||
|
else if ( !theLastSegment.IsNull() ) {
|
||||||
|
TopExp_Explorer vertexExp( theLastSegment, TopAbs_VERTEX );
|
||||||
|
theApplyedWire = vertexExp.Current();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <GEOMBase_Skeleton.h>
|
#include <GEOMBase_Skeleton.h>
|
||||||
|
|
||||||
|
class QButtonGroup;
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
class EntityGUI_3Spin;
|
class EntityGUI_3Spin;
|
||||||
class DlgRef_3Radio;
|
class DlgRef_3Radio;
|
||||||
@ -47,6 +48,14 @@ class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
struct XYZ
|
||||||
|
{
|
||||||
|
XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
|
||||||
|
double x, y, z;
|
||||||
|
QString xt, yt, zt;
|
||||||
|
};
|
||||||
|
typedef QList<XYZ> XYZList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
|
EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
|
||||||
~EntityGUI_3DSketcherDlg();
|
~EntityGUI_3DSketcherDlg();
|
||||||
@ -77,13 +86,18 @@ private:
|
|||||||
TopoDS_Shape&,
|
TopoDS_Shape&,
|
||||||
TopoDS_Shape& );
|
TopoDS_Shape& );
|
||||||
|
|
||||||
|
XYZ getLastPoint() const;
|
||||||
|
XYZ getCurrentPoint() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<double> myPointsList;
|
XYZList myPointsList;
|
||||||
QList<double> myRedoList;
|
XYZList myRedoList;
|
||||||
|
|
||||||
EntityGUI_3Spin* Group3Spin;
|
EntityGUI_3Spin* Group3Spin;
|
||||||
DlgRef_3Radio* GroupType;
|
DlgRef_3Radio* GroupType;
|
||||||
|
QButtonGroup* myTypeGroup;
|
||||||
|
|
||||||
|
int myMode;
|
||||||
bool myOK;
|
bool myOK;
|
||||||
double myLineWidth;
|
double myLineWidth;
|
||||||
GeometryGUI* myGeometryGUI;
|
GeometryGUI* myGeometryGUI;
|
||||||
@ -94,8 +108,6 @@ private slots:
|
|||||||
bool ClickOnApply();
|
bool ClickOnApply();
|
||||||
// bool isSameAsPrevious();
|
// bool isSameAsPrevious();
|
||||||
void UpdateButtonsState();
|
void UpdateButtonsState();
|
||||||
void GetLastPoints(double&, double&, double&);
|
|
||||||
void GetCurrentPoints(double&, double&, double&);
|
|
||||||
|
|
||||||
void ClickOnUndo();
|
void ClickOnUndo();
|
||||||
void ClickOnRedo();
|
void ClickOnRedo();
|
||||||
@ -103,7 +115,7 @@ private slots:
|
|||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog();
|
void DeactivateActiveDialog();
|
||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
void TypeClicked();
|
void TypeClicked( int );
|
||||||
void ValueChangedInSpinBox( double );
|
void ValueChangedInSpinBox( double );
|
||||||
void SetDoubleSpinBoxStep( double );
|
void SetDoubleSpinBoxStep( double );
|
||||||
};
|
};
|
||||||
|
@ -801,6 +801,8 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
|
|||||||
|
|
||||||
erasePreview( false );
|
erasePreview( false );
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( ( !publish && !useTransaction ) || openCommand() ) {
|
if ( ( !publish && !useTransaction ) || openCommand() ) {
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
@ -857,6 +859,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
|
|||||||
commitCommand();
|
commitCommand();
|
||||||
updateObjBrowser();
|
updateObjBrowser();
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
||||||
|
result = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
abortCommand();
|
abortCommand();
|
||||||
@ -870,7 +873,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
|
|||||||
|
|
||||||
updateViewer();
|
updateViewer();
|
||||||
|
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
<TS version="1.1" >
|
<TS version="1.1" >
|
||||||
<context>
|
<context>
|
||||||
<name>@default</name>
|
<name>@default</name>
|
||||||
|
<message>
|
||||||
|
<source>BRep_API: command not done</source>
|
||||||
|
<translation>Error: can't build object</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
|
<source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
|
||||||
<translation>Invert</translation>
|
<translation>Invert</translation>
|
||||||
|
@ -101,16 +101,25 @@ def ParseParameters(*parameters):
|
|||||||
Result = []
|
Result = []
|
||||||
StringResult = []
|
StringResult = []
|
||||||
for parameter in parameters:
|
for parameter in parameters:
|
||||||
if isinstance(parameter,str):
|
if isinstance(parameter, list):
|
||||||
if notebook.isVariable(parameter):
|
lResults = ParseParameters(*parameter)
|
||||||
Result.append(notebook.get(parameter))
|
if len(lResults) > 0:
|
||||||
else:
|
Result.append(lResults[:-1])
|
||||||
raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
|
StringResult += lResults[-1].split(":")
|
||||||
else:
|
pass
|
||||||
Result.append(parameter)
|
pass
|
||||||
|
else:
|
||||||
|
if isinstance(parameter,str):
|
||||||
|
if notebook.isVariable(parameter):
|
||||||
|
Result.append(notebook.get(parameter))
|
||||||
|
else:
|
||||||
|
raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
Result.append(parameter)
|
||||||
|
pass
|
||||||
|
StringResult.append(str(parameter))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
StringResult.append(str(parameter))
|
|
||||||
pass
|
pass
|
||||||
if Result:
|
if Result:
|
||||||
Result.append(":".join(StringResult))
|
Result.append(":".join(StringResult))
|
||||||
@ -946,8 +955,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
#
|
#
|
||||||
# @ref tui_sketcher_page "Example"
|
# @ref tui_sketcher_page "Example"
|
||||||
def Make3DSketcher(self, theCoordinates):
|
def Make3DSketcher(self, theCoordinates):
|
||||||
|
theCoordinates,Parameters = ParseParameters(theCoordinates)
|
||||||
anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
|
anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
|
||||||
RaiseIfFailed("Make3DSketcher", self.CurvesOp)
|
RaiseIfFailed("Make3DSketcher", self.CurvesOp)
|
||||||
|
anObj.SetParameters(Parameters)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
# end of l3_sketcher
|
# end of l3_sketcher
|
||||||
|
Loading…
Reference in New Issue
Block a user