mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 16:10:33 +05:00
Dump Python extension
This commit is contained in:
parent
f86d14b0c0
commit
4e59c10eaf
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -61,6 +61,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 )
|
||||
@ -274,14 +275,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
|
||||
QDoubleSpinBox* aDoubleSpinBox = (QDoubleSpinBox*)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);
|
||||
}
|
||||
|
||||
@ -678,7 +673,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( "" );
|
||||
@ -718,18 +714,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 ) {
|
||||
@ -785,6 +787,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;
|
||||
|
||||
@ -810,6 +815,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 );
|
||||
@ -1000,162 +1008,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
|
||||
@ -1163,20 +1151,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1188,80 +1187,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;
|
||||
@ -1282,7 +1309,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;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -1291,6 +1343,8 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg )
|
||||
//=================================================================================
|
||||
bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
||||
{
|
||||
QString aParameters;
|
||||
|
||||
if ( mySketchState == FIRST_POINT ) {
|
||||
myLastX2 = myX;
|
||||
myLastY2 = myY;
|
||||
@ -1306,7 +1360,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();
|
||||
@ -1365,7 +1419,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
|
||||
}
|
||||
}
|
||||
else {
|
||||
cmd = myCommand.join( "" ) + GetNewCommand();
|
||||
cmd = myCommand.join( "" ) + GetNewCommand( aParameters );
|
||||
|
||||
if ( Group1Sel->isVisible() ) {
|
||||
Group1Sel->buttonApply->setEnabled( true );
|
||||
@ -1408,7 +1462,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;
|
||||
}
|
||||
@ -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 step, int decimals )
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -859,7 +859,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
||||
Standard_Integer aStartPos = 0;
|
||||
Standard_Integer aEndPos = 0;
|
||||
int iVar = 0;
|
||||
TCollection_AsciiString aReplasedVar, aVar;
|
||||
TCollection_AsciiString aVar, aReplacedVar;
|
||||
for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
|
||||
//Replace first parameter (bettwen '(' character and first ',' character)
|
||||
if(i == aFirstParam)
|
||||
@ -897,7 +897,85 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
||||
|
||||
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 == PY_NULL)
|
||||
continue;
|
||||
@ -905,20 +983,19 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
|
||||
if(iVar >= aVariables.size())
|
||||
continue;
|
||||
|
||||
aReplasedVar = aVariables[iVar].myVariable;
|
||||
|
||||
if(aReplasedVar.IsEmpty()) {
|
||||
aReplacedVar = aVariables[iVar].myVariable;
|
||||
if(aReplacedVar.IsEmpty()) {
|
||||
iVar++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(aVariables[iVar].isVariable) {
|
||||
aReplasedVar.InsertBefore(1,"\"");
|
||||
aReplasedVar.InsertAfter(aReplasedVar.Length(),"\"");
|
||||
aReplacedVar.InsertBefore(1,"\"");
|
||||
aReplacedVar.InsertAfter(aReplacedVar.Length(),"\"");
|
||||
}
|
||||
|
||||
aCommand.Remove(aStartPos, aEndPos - aStartPos);
|
||||
aCommand.Insert(aStartPos, aReplasedVar);
|
||||
aCommand.Insert(aStartPos, aReplacedVar);
|
||||
iVar++;
|
||||
}
|
||||
|
||||
|
@ -134,8 +134,40 @@ def ParseList(list):
|
||||
StringResult = StringResult + ":"
|
||||
pass
|
||||
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
|
||||
# @ingroup l1_geompy_auxiliary
|
||||
@ -706,8 +738,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,
|
||||
|
Loading…
Reference in New Issue
Block a user