mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-08 03:47:27 +05:00
Dump Python extension
This commit is contained in:
parent
f86d14b0c0
commit
4e59c10eaf
@ -32,7 +32,7 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
@ -90,6 +90,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SalomeApp_DoubleSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
<tabstop>buttonApply</tabstop>
|
<tabstop>buttonApply</tabstop>
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="TextLabel2" >
|
<widget class="QLabel" name="TextLabel2" >
|
||||||
@ -111,6 +111,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SalomeApp_DoubleSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
<tabstop>SpinBox_DY</tabstop>
|
<tabstop>SpinBox_DY</tabstop>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DZ" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
@ -66,10 +66,10 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="TextLabel1" >
|
<widget class="QLabel" name="TextLabel1" >
|
||||||
@ -132,6 +132,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SalomeApp_DoubleSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
<tabstop>SpinBox_DY</tabstop>
|
<tabstop>SpinBox_DY</tabstop>
|
||||||
|
@ -32,16 +32,16 @@
|
|||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DZ" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" >
|
<item row="3" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DS" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DS" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DY" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QDoubleSpinBox" name="SpinBox_DX" />
|
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2" >
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
@ -153,6 +153,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SalomeApp_DoubleSpinBox</class>
|
||||||
|
<extends>QDoubleSpinBox</extends>
|
||||||
|
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
<tabstop>SpinBox_DY</tabstop>
|
<tabstop>SpinBox_DY</tabstop>
|
||||||
|
@ -61,6 +61,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
|
|||||||
const double lineWidth )
|
const double lineWidth )
|
||||||
: QDialog( parent, fl ),
|
: QDialog( parent, fl ),
|
||||||
myIsAllAdded( false ),
|
myIsAllAdded( false ),
|
||||||
|
myIsApply( false ),
|
||||||
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
|
GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
|
||||||
myGeometryGUI( GUI ),
|
myGeometryGUI( GUI ),
|
||||||
myLineWidth( lineWidth )
|
myLineWidth( lineWidth )
|
||||||
@ -274,13 +275,7 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type() == QEvent::KeyRelease) {
|
// Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
|
||||||
// NPAL16010 (Sketcher Apply non available if only one line is modified)
|
|
||||||
// To have Apply active as soon as value text changed
|
|
||||||
QDoubleSpinBox* aDoubleSpinBox = (QDoubleSpinBox*)object;
|
|
||||||
if (aDoubleSpinBox)
|
|
||||||
ValueChangedInSpinBox( aDoubleSpinBox->value() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return QDialog::eventFilter(object, event);
|
return QDialog::eventFilter(object, event);
|
||||||
}
|
}
|
||||||
@ -678,7 +673,8 @@ void EntityGUI_SketcherDlg::ClickOnEnd()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Command = myCommand.join( "" ) + GetNewCommand();
|
QString Parameters;
|
||||||
|
QString Command = myCommand.join( "" ) + GetNewCommand( Parameters );
|
||||||
Sketcher_Profile aProfile( Command.toAscii() );
|
Sketcher_Profile aProfile( Command.toAscii() );
|
||||||
|
|
||||||
Command = myCommand.join( "" );
|
Command = myCommand.join( "" );
|
||||||
@ -718,18 +714,24 @@ bool EntityGUI_SketcherDlg::ClickOnApply()
|
|||||||
if ( sender() && sender()->inherits( "QPushButton" ) )
|
if ( sender() && sender()->inherits( "QPushButton" ) )
|
||||||
( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
|
( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
|
||||||
|
|
||||||
myCommand.append( GetNewCommand() );
|
QString aParameters;
|
||||||
|
myCommand.append( GetNewCommand( aParameters ) );
|
||||||
mySketchState = NEXT_POINT;
|
mySketchState = NEXT_POINT;
|
||||||
|
|
||||||
myUndoCommand.clear();
|
myUndoCommand.clear();
|
||||||
myUndoCommand.append( "Sketcher" );
|
myUndoCommand.append( "Sketcher" );
|
||||||
|
|
||||||
|
myParameters.append( aParameters );
|
||||||
|
myUndoParameters.clear();
|
||||||
|
|
||||||
MainWidget->GroupConstructors->setEnabled( true );
|
MainWidget->GroupConstructors->setEnabled( true );
|
||||||
MainWidget->GroupDest1->setEnabled( true );
|
MainWidget->GroupDest1->setEnabled( true );
|
||||||
setEnabledUndo( true );
|
setEnabledUndo( true );
|
||||||
setEnabledRedo( false );
|
setEnabledRedo( false );
|
||||||
|
|
||||||
|
myIsApply = true;
|
||||||
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
|
||||||
|
myIsApply = false;
|
||||||
|
|
||||||
// Set focus to SpinBox_DX
|
// Set focus to SpinBox_DX
|
||||||
if ( sender() == Group1Spin->buttonApply ) {
|
if ( sender() == Group1Spin->buttonApply ) {
|
||||||
@ -785,6 +787,9 @@ void EntityGUI_SketcherDlg::ClickOnUndo()
|
|||||||
myUndoCommand.append( myCommand.last() );
|
myUndoCommand.append( myCommand.last() );
|
||||||
myCommand.pop_back();
|
myCommand.pop_back();
|
||||||
|
|
||||||
|
myUndoParameters.append( myParameters.last() );
|
||||||
|
myParameters.pop_back();
|
||||||
|
|
||||||
if ( myCommand.count() == 1 ) {
|
if ( myCommand.count() == 1 ) {
|
||||||
mySketchState = FIRST_POINT;
|
mySketchState = FIRST_POINT;
|
||||||
|
|
||||||
@ -810,6 +815,9 @@ void EntityGUI_SketcherDlg::ClickOnRedo()
|
|||||||
myCommand.append( myUndoCommand.last() );
|
myCommand.append( myUndoCommand.last() );
|
||||||
myUndoCommand.pop_back();
|
myUndoCommand.pop_back();
|
||||||
|
|
||||||
|
myParameters.append( myUndoParameters.last() );
|
||||||
|
myUndoParameters.pop_back();
|
||||||
|
|
||||||
mySketchState = NEXT_POINT;
|
mySketchState = NEXT_POINT;
|
||||||
|
|
||||||
MainWidget->GroupConstructors->setEnabled( true );
|
MainWidget->GroupConstructors->setEnabled( true );
|
||||||
@ -1000,162 +1008,142 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
|||||||
Standard_Real vx, vy, vz, vs;
|
Standard_Real vx, vy, vz, vs;
|
||||||
vx = vy = vz = vs = 0.0;
|
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 ) {
|
if ( send == Group1Spin->SpinBox_DX ) {
|
||||||
vx = newValue;
|
vx = newValue; vxStr = newValueStr;
|
||||||
}
|
}
|
||||||
else if ( send == Group2Spin->SpinBox_DX ) {
|
else if ( send == Group2Spin->SpinBox_DX ) {
|
||||||
vx = newValue;
|
vx = newValue; vxStr = newValueStr;
|
||||||
vy = Group2Spin->SpinBox_DY->value();
|
vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group2Spin->SpinBox_DY ) {
|
else if ( send == Group2Spin->SpinBox_DY ) {
|
||||||
vx = Group2Spin->SpinBox_DX->value();
|
vx = Group2Spin->SpinBox_DX->value(); vxStr = Group2Spin->SpinBox_DX->text();
|
||||||
vy = newValue;
|
vy = newValue; vyStr = newValueStr;
|
||||||
}
|
}
|
||||||
else if ( send == Group3Spin->SpinBox_DX ) {
|
else if ( send == Group3Spin->SpinBox_DX ) {
|
||||||
vx = newValue;
|
vx = newValue; vxStr = newValueStr;
|
||||||
vy = Group3Spin->SpinBox_DY->value();
|
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
|
||||||
vz = Group3Spin->SpinBox_DZ->value();
|
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group3Spin->SpinBox_DY ) {
|
else if ( send == Group3Spin->SpinBox_DY ) {
|
||||||
vx = Group3Spin->SpinBox_DX->value();
|
vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
|
||||||
vy = newValue;
|
vy = newValue; vyStr = newValueStr;
|
||||||
vz = Group3Spin->SpinBox_DZ->value();
|
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group3Spin->SpinBox_DZ ) {
|
else if ( send == Group3Spin->SpinBox_DZ ) {
|
||||||
vx = Group3Spin->SpinBox_DX->value();
|
vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
|
||||||
vy = Group3Spin->SpinBox_DY->value();
|
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
|
||||||
vz = newValue;
|
vz = newValue; vzStr = newValueStr;
|
||||||
}
|
}
|
||||||
else if ( send == Group4Spin->SpinBox_DX ) {
|
else if ( send == Group4Spin->SpinBox_DX ) {
|
||||||
vx = newValue;
|
vx = newValue; vxStr = newValueStr;
|
||||||
vy = Group4Spin->SpinBox_DY->value();
|
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
|
||||||
vz = Group4Spin->SpinBox_DZ->value();
|
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
|
||||||
vs = Group4Spin->SpinBox_DS->value();
|
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group4Spin->SpinBox_DY ) {
|
else if ( send == Group4Spin->SpinBox_DY ) {
|
||||||
vx = Group4Spin->SpinBox_DX->value();
|
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
|
||||||
vy = newValue;
|
vy = newValue; vyStr = newValueStr;
|
||||||
vz = Group4Spin->SpinBox_DZ->value();
|
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
|
||||||
vs = Group4Spin->SpinBox_DS->value();
|
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group4Spin->SpinBox_DZ ) {
|
else if ( send == Group4Spin->SpinBox_DZ ) {
|
||||||
vx = Group4Spin->SpinBox_DX->value();
|
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
|
||||||
vy = Group4Spin->SpinBox_DY->value();
|
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
|
||||||
vz = newValue;
|
vz = newValue; vzStr = newValueStr;
|
||||||
vs = Group4Spin->SpinBox_DS->value();
|
vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
|
||||||
}
|
}
|
||||||
else if ( send == Group4Spin->SpinBox_DS ) {
|
else if ( send == Group4Spin->SpinBox_DS ) {
|
||||||
vx = Group4Spin->SpinBox_DX->value();
|
vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
|
||||||
vy = Group4Spin->SpinBox_DY->value();
|
vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
|
||||||
vz = Group4Spin->SpinBox_DZ->value();
|
vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
|
||||||
vs = newValue;
|
vs = newValue; vsStr = newValueStr;
|
||||||
}
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
// Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
|
||||||
|
|
||||||
if ( myConstructorId == 0 ) { // SEGMENT
|
if ( myConstructorId == 0 ) { // SEGMENT
|
||||||
if ( mySketchType == PT_ABS ) {
|
if ( mySketchType == PT_ABS ) {
|
||||||
myX = vx;
|
myX = vx;
|
||||||
myY = vy;
|
myY = vy;
|
||||||
|
myXStr = vxStr;
|
||||||
|
myYStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == PT_RELATIVE ) {
|
else if ( mySketchType == PT_RELATIVE ) {
|
||||||
myDX = vx;
|
myDX = vx;
|
||||||
myDY = vy;
|
myDY = vy;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
else if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
||||||
myAngle = vx;
|
myAngle = vx;
|
||||||
myLength = vy;
|
myLength = vy;
|
||||||
|
myAngleStr = vxStr;
|
||||||
|
myLengthStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_ANGLE_X ) {
|
else if ( mySketchType == DIR_ANGLE_X ) {
|
||||||
myAngle = vx;
|
myAngle = vx;
|
||||||
myX = vy;
|
myX = vy;
|
||||||
|
myAngleStr = vxStr;
|
||||||
|
myXStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_ANGLE_Y ) {
|
else if ( mySketchType == DIR_ANGLE_Y ) {
|
||||||
myAngle = vx;
|
myAngle = vx;
|
||||||
myY = vy;
|
myY = vy;
|
||||||
|
myAngleStr = vxStr;
|
||||||
|
myYStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_PER_LENGTH ) {
|
else if ( mySketchType == DIR_PER_LENGTH ) {
|
||||||
myLength = vx;
|
myLength = vx;
|
||||||
|
myLengthStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_PER_X ) {
|
else if ( mySketchType == DIR_PER_X ) {
|
||||||
myX = vx;
|
myX = vx;
|
||||||
|
myXStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_PER_Y ) {
|
else if ( mySketchType == DIR_PER_Y ) {
|
||||||
myY = vx;
|
myY = vx;
|
||||||
|
myYStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_TAN_LENGTH ) {
|
else if ( mySketchType == DIR_TAN_LENGTH ) {
|
||||||
myLength = vx;
|
myLength = vx;
|
||||||
|
myLengthStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_TAN_X ) {
|
else if ( mySketchType == DIR_TAN_X ) {
|
||||||
myX = vx;
|
myX = vx;
|
||||||
|
myXStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_TAN_Y ) {
|
else if ( mySketchType == DIR_TAN_Y ) {
|
||||||
myY = vx;
|
myY = vx;
|
||||||
|
myYStr = vxStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_DXDY_LENGTH ) {
|
else if ( mySketchType == DIR_DXDY_LENGTH ) {
|
||||||
myDX = vx;
|
myDX = vx;
|
||||||
myDY = vy;
|
myDY = vy;
|
||||||
myLength = vz;
|
myLength = vz;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
|
myLengthStr = vzStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_DXDY_X ) {
|
else if ( mySketchType == DIR_DXDY_X ) {
|
||||||
myDX = vx;
|
myDX = vx;
|
||||||
myDY = vy;
|
myDY = vy;
|
||||||
myX = vz;
|
myX = vz;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
|
myXStr = vzStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_DXDY_Y ) {
|
else if ( mySketchType == DIR_DXDY_Y ) {
|
||||||
myDX = vx;
|
myDX = vx;
|
||||||
myDY = vy;
|
myDY = vy;
|
||||||
myY = vz;
|
myY = vz;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
|
myYStr = vzStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( myConstructorId == 1 ) { // ARC
|
else if ( myConstructorId == 1 ) { // ARC
|
||||||
@ -1163,20 +1151,31 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
|||||||
myAngle = vx;
|
myAngle = vx;
|
||||||
myRadius = vy;
|
myRadius = vy;
|
||||||
myLength = vz;
|
myLength = vz;
|
||||||
|
myAngleStr = vxStr;
|
||||||
|
myRadiusStr = vyStr;
|
||||||
|
myLengthStr = vzStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_PER_LENGTH ) {
|
else if ( mySketchType == DIR_PER_LENGTH ) {
|
||||||
myRadius = vx;
|
myRadius = vx;
|
||||||
myLength = vy;
|
myLength = vy;
|
||||||
|
myRadiusStr = vxStr;
|
||||||
|
myLengthStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_TAN_LENGTH ) {
|
else if ( mySketchType == DIR_TAN_LENGTH ) {
|
||||||
myRadius = vx;
|
myRadius = vx;
|
||||||
myLength = vy;
|
myLength = vy;
|
||||||
|
myRadiusStr = vxStr;
|
||||||
|
myLengthStr = vyStr;
|
||||||
}
|
}
|
||||||
else if ( mySketchType == DIR_DXDY_LENGTH ) {
|
else if ( mySketchType == DIR_DXDY_LENGTH ) {
|
||||||
myDX = vx;
|
myDX = vx;
|
||||||
myDY = vy;
|
myDY = vy;
|
||||||
myRadius = vz;
|
myRadius = vz;
|
||||||
myLength = vs;
|
myLength = vs;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
|
myRadiusStr = vzStr;
|
||||||
|
myLengthStr = vsStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1188,80 +1187,108 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
|||||||
// function : GetNewCommand()
|
// function : GetNewCommand()
|
||||||
// purpose : Build the new command with context
|
// purpose : Build the new command with context
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
QString EntityGUI_SketcherDlg::GetNewCommand()
|
QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
|
||||||
{
|
{
|
||||||
|
theParameters.clear();
|
||||||
QString myNewCommand = ":";
|
QString myNewCommand = ":";
|
||||||
if ( mySketchState == FIRST_POINT ) {
|
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 );
|
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 );
|
myNewCommand = myNewCommand + "F " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr;
|
||||||
|
}
|
||||||
return myNewCommand;
|
return myNewCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( myConstructorId == 0 ) { // SEGMENT
|
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 );
|
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 );
|
myNewCommand = myNewCommand + "T " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr;
|
||||||
|
}
|
||||||
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
||||||
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
||||||
|
theParameters = myAngleStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_ANGLE_X ) {
|
if ( mySketchType == DIR_ANGLE_X ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
||||||
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
||||||
|
theParameters = myAngleStr + ":" + myXStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_ANGLE_Y ) {
|
if ( mySketchType == DIR_ANGLE_Y ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
||||||
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
|
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
|
||||||
|
theParameters = myAngleStr + ":" + myYStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_PER_LENGTH ) {
|
if ( mySketchType == DIR_PER_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
||||||
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
||||||
|
theParameters = QString::number( 90.0 ) + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_PER_X ) {
|
if ( mySketchType == DIR_PER_X ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
||||||
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
||||||
|
theParameters = QString::number( 90.0 ) + ":" + myXStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_PER_Y ) {
|
if ( mySketchType == DIR_PER_Y ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
||||||
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
|
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 );
|
myNewCommand = myNewCommand + "L " + QString::number( myLength );
|
||||||
if ( mySketchType == DIR_TAN_X )
|
theParameters = myLengthStr;
|
||||||
|
}
|
||||||
|
if ( mySketchType == DIR_TAN_X ) {
|
||||||
myNewCommand = myNewCommand + "IX " + QString::number( myX );
|
myNewCommand = myNewCommand + "IX " + QString::number( myX );
|
||||||
if ( mySketchType == DIR_TAN_Y)
|
theParameters = myXStr;
|
||||||
|
}
|
||||||
|
if ( mySketchType == DIR_TAN_Y) {
|
||||||
myNewCommand = myNewCommand + "IY " + QString::number(myY);
|
myNewCommand = myNewCommand + "IY " + QString::number(myY);
|
||||||
|
theParameters = myYStr;
|
||||||
|
}
|
||||||
if ( mySketchType == DIR_DXDY_LENGTH ) {
|
if ( mySketchType == DIR_DXDY_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_DXDY_X ) {
|
if ( mySketchType == DIR_DXDY_X ) {
|
||||||
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr + ":" + myXStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_DXDY_Y ) {
|
if ( mySketchType == DIR_DXDY_Y ) {
|
||||||
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
|
myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr + ":" + myYStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( myConstructorId == 1 ) { // ARC
|
else if ( myConstructorId == 1 ) { // ARC
|
||||||
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
||||||
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
||||||
|
theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_PER_LENGTH ) {
|
if ( mySketchType == DIR_PER_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
|
||||||
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
||||||
|
theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_TAN_LENGTH ) {
|
if ( mySketchType == DIR_TAN_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
||||||
|
theParameters = myRadiusStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
if ( mySketchType == DIR_DXDY_LENGTH ) {
|
if ( mySketchType == DIR_DXDY_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return myNewCommand;
|
return myNewCommand;
|
||||||
@ -1282,7 +1309,32 @@ GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool EntityGUI_SketcherDlg::isValid( QString& msg )
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -1291,6 +1343,8 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
|
QString aParameters;
|
||||||
|
|
||||||
if ( mySketchState == FIRST_POINT ) {
|
if ( mySketchState == FIRST_POINT ) {
|
||||||
myLastX2 = myX;
|
myLastX2 = myX;
|
||||||
myLastY2 = myY;
|
myLastY2 = myY;
|
||||||
@ -1306,7 +1360,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
|||||||
myShape1 = aProfile1.GetShape();
|
myShape1 = aProfile1.GetShape();
|
||||||
|
|
||||||
//Current Shape
|
//Current Shape
|
||||||
QString Command2 = Command1 + GetNewCommand();
|
QString Command2 = Command1 + GetNewCommand( aParameters );
|
||||||
Sketcher_Profile aProfile2( Command2.toAscii() );
|
Sketcher_Profile aProfile2( Command2.toAscii() );
|
||||||
if ( aProfile2.IsDone() )
|
if ( aProfile2.IsDone() )
|
||||||
myShape2 = aProfile2.GetShape();
|
myShape2 = aProfile2.GetShape();
|
||||||
@ -1365,7 +1419,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cmd = myCommand.join( "" ) + GetNewCommand();
|
cmd = myCommand.join( "" ) + GetNewCommand( aParameters );
|
||||||
|
|
||||||
if ( Group1Sel->isVisible() ) {
|
if ( Group1Sel->isVisible() ) {
|
||||||
Group1Sel->buttonApply->setEnabled( true );
|
Group1Sel->buttonApply->setEnabled( true );
|
||||||
@ -1408,7 +1462,15 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
|||||||
GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane );
|
GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane );
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if ( !anObj->_is_nil() )
|
||||||
|
{
|
||||||
|
if( !IsPreview() ) {
|
||||||
|
QStringList aCurrentParameters = myParameters;
|
||||||
|
aCurrentParameters << aParameters;
|
||||||
|
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters));
|
||||||
|
}
|
||||||
|
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1517,7 +1579,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 min, double max,
|
||||||
double step, int decimals )
|
double step, int decimals )
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QDoubleSpinBox;
|
class SalomeApp_DoubleSpinBox;
|
||||||
class EntityGUI_1Sel;
|
class EntityGUI_1Sel;
|
||||||
class EntityGUI_1Spin;
|
class EntityGUI_1Spin;
|
||||||
class EntityGUI_2Spin;
|
class EntityGUI_2Spin;
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
bool eventFilter (QObject* object, QEvent* event);
|
bool eventFilter (QObject* object, QEvent* event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initSpinBox( QDoubleSpinBox*,
|
void initSpinBox( SalomeApp_DoubleSpinBox*,
|
||||||
double, double, double = 0.1,
|
double, double, double = 0.1,
|
||||||
int = 3 );
|
int = 3 );
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ private:
|
|||||||
void setEnabledUndo( bool );
|
void setEnabledUndo( bool );
|
||||||
void setEnabledRedo( bool );
|
void setEnabledRedo( bool );
|
||||||
|
|
||||||
QString GetNewCommand();
|
QString GetNewCommand( QString& );
|
||||||
|
|
||||||
virtual void displayPreview( GEOM::GEOM_Object_ptr,
|
virtual void displayPreview( GEOM::GEOM_Object_ptr,
|
||||||
const bool = false,
|
const bool = false,
|
||||||
@ -106,17 +106,26 @@ private:
|
|||||||
int mySketchState;
|
int mySketchState;
|
||||||
|
|
||||||
bool myIsAllAdded;
|
bool myIsAllAdded;
|
||||||
|
bool myIsApply;
|
||||||
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||||
|
|
||||||
QStringList myCommand;
|
QStringList myCommand;
|
||||||
QStringList myUndoCommand;
|
QStringList myUndoCommand;
|
||||||
|
|
||||||
|
QStringList myParameters;
|
||||||
|
QStringList myUndoParameters;
|
||||||
|
|
||||||
Standard_Real myX, myY, myDX, myDY;
|
Standard_Real myX, myY, myDX, myDY;
|
||||||
Standard_Real myLength, myAngle, myRadius;
|
Standard_Real myLength, myAngle, myRadius;
|
||||||
Standard_Real myLastX1, myLastY1;
|
Standard_Real myLastX1, myLastY1;
|
||||||
Standard_Real myLastX2, myLastY2;
|
Standard_Real myLastX2, myLastY2;
|
||||||
|
|
||||||
|
QString myXStr, myYStr, myDXStr, myDYStr;
|
||||||
|
QString myLengthStr, myAngleStr, myRadiusStr;
|
||||||
|
QString myLastX1Str, myLastY1Str;
|
||||||
|
QString myLastX2Str, myLastY2Str;
|
||||||
|
|
||||||
EntityGUI_Skeleton* MainWidget;
|
EntityGUI_Skeleton* MainWidget;
|
||||||
|
|
||||||
EntityGUI_Point* GroupPt;
|
EntityGUI_Point* GroupPt;
|
||||||
|
@ -859,7 +859,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
|||||||
Standard_Integer aStartPos = 0;
|
Standard_Integer aStartPos = 0;
|
||||||
Standard_Integer aEndPos = 0;
|
Standard_Integer aEndPos = 0;
|
||||||
int iVar = 0;
|
int iVar = 0;
|
||||||
TCollection_AsciiString aReplasedVar, aVar;
|
TCollection_AsciiString aVar, aReplacedVar;
|
||||||
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
|
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
|
||||||
//Replace first parameter (bettwen '(' character and first ',' character)
|
//Replace first parameter (bettwen '(' character and first ',' character)
|
||||||
if(i == aFirstParam)
|
if(i == aFirstParam)
|
||||||
@ -898,6 +898,84 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
|||||||
if(MYDEBUG)
|
if(MYDEBUG)
|
||||||
cout<<"Variable: '"<< aVar <<"'"<<endl;
|
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 parameter is entry or 'None', skip it
|
||||||
if(theVariables.find(aVar) != theVariables.end() || aVar == PY_NULL)
|
if(theVariables.find(aVar) != theVariables.end() || aVar == PY_NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -905,20 +983,19 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
|||||||
if(iVar >= aVariables.size())
|
if(iVar >= aVariables.size())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
aReplasedVar = aVariables[iVar].myVariable;
|
aReplacedVar = aVariables[iVar].myVariable;
|
||||||
|
if(aReplacedVar.IsEmpty()) {
|
||||||
if(aReplasedVar.IsEmpty()) {
|
|
||||||
iVar++;
|
iVar++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aVariables[iVar].isVariable) {
|
if(aVariables[iVar].isVariable) {
|
||||||
aReplasedVar.InsertBefore(1,"\"");
|
aReplacedVar.InsertBefore(1,"\"");
|
||||||
aReplasedVar.InsertAfter(aReplasedVar.Length(),"\"");
|
aReplacedVar.InsertAfter(aReplacedVar.Length(),"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
aCommand.Remove(aStartPos, aEndPos - aStartPos);
|
aCommand.Remove(aStartPos, aEndPos - aStartPos);
|
||||||
aCommand.Insert(aStartPos, aReplasedVar);
|
aCommand.Insert(aStartPos, aReplacedVar);
|
||||||
iVar++;
|
iVar++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +134,40 @@ def ParseList(list):
|
|||||||
StringResult = StringResult + ":"
|
StringResult = StringResult + ":"
|
||||||
pass
|
pass
|
||||||
StringResult = StringResult[:len(StringResult)-1]
|
StringResult = StringResult[:len(StringResult)-1]
|
||||||
return Result,StringResult
|
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
|
## Kinds of shape enumeration
|
||||||
# @ingroup l1_geompy_auxiliary
|
# @ingroup l1_geompy_auxiliary
|
||||||
@ -706,8 +738,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# @ref tui_sketcher_page "Example"
|
# @ref tui_sketcher_page "Example"
|
||||||
def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
|
def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
|
||||||
# Example: see GEOM_TestAll.py
|
# Example: see GEOM_TestAll.py
|
||||||
|
theCommand,Parameters = ParseSketcherCommand(theCommand)
|
||||||
anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
|
anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
|
||||||
RaiseIfFailed("MakeSketcher", self.CurvesOp)
|
RaiseIfFailed("MakeSketcher", self.CurvesOp)
|
||||||
|
anObj.SetParameters(Parameters)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
## Create a sketcher (wire or face), following the textual description,
|
## Create a sketcher (wire or face), following the textual description,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user