From: rnv Date: Fri, 21 Nov 2008 17:00:36 +0000 (+0000) Subject: Implementation Notebook in the GEOM. X-Git-Tag: TG_DumpPython_Extension_3~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=38e241bb3116e5efd8c9f1bb99099cc823b10f0b;p=modules%2Fgeom.git Implementation Notebook in the GEOM. --- diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui index 9001ffd15..ab8c89f83 100644 --- a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui @@ -79,7 +79,7 @@ - + @@ -122,9 +122,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui index 40f733590..07800a567 100644 --- a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui @@ -63,10 +63,10 @@
- + - + @@ -173,9 +173,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui index a25d1159e..27e0b7e56 100644 --- a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui @@ -63,16 +63,16 @@
- + - + - + - + @@ -211,9 +211,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui index e2c68c662..10ee30bc3 100644 --- a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui @@ -144,7 +144,7 @@
- + @@ -163,7 +163,7 @@ - + @@ -182,7 +182,7 @@ - + @@ -207,9 +207,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui index 9329141a8..41fcdd0d0 100644 --- a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui @@ -56,16 +56,16 @@ 6 - + - + - + - + @@ -250,9 +250,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui b/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui index 43217034f..fd51fd4a2 100644 --- a/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui @@ -76,7 +76,7 @@
- + 0 @@ -238,9 +238,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index 957197365..d6043d2c5 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -1206,7 +1206,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(G //Make a Python command if (doCopy) { - GEOM::TPythonDump(aFunction) << "geompy.MakeScaleAlongAxes(" + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes(" << theObject << ", " << thePoint << ", " << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")"; return aCopy; diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 7438859ff..1996716ac 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -2189,7 +2189,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_translation "Example" def MakeTranslation(self,theObject, theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ) + anObj.SetParameters(Parameters) RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp) return anObj @@ -2216,8 +2218,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_translation "Example" def MakeTranslationVectorDistance(self, theObject, theVector, theDistance): # Example: see GEOM_TestAll.py + theDistance,Parameters = ParseParameters(theDistance) anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1) RaiseIfFailed("TranslateVectorDistance", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the given axis @@ -2230,8 +2234,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_rotation "Example" def MakeRotation(self,theObject, theAxis, theAngle): # Example: see GEOM_TestAll.py + flag = False + if isinstance(theAngle,str): + flag = True + theAngle, Parameters = ParseParameters(theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle) RaiseIfFailed("RotateCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate given object around vector perpendicular to plane @@ -2259,8 +2270,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_scale "Example" def MakeScaleTransform(self, theObject, thePoint, theFactor): # Example: see GEOM_TestAll.py + theFactor, Parameters = ParseParameters(theFactor) anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor) RaiseIfFailed("ScaleShapeCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Scale the given object by different factors along coordinate axes, @@ -2274,9 +2287,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref swig_scale "Example" def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ): # Example: see GEOM_TestAll.py + theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ) anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint, theFactorX, theFactorY, theFactorZ) RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Create an object, symmetrical @@ -2344,8 +2359,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_offset "Example" def MakeOffset(self,theObject, theOffset): # Example: see GEOM_TestAll.py + theOffset, Parameters = ParseParameters(theOffset) anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset) RaiseIfFailed("OffsetShapeCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj # ----------------------------------------------------------------------------- @@ -2363,8 +2380,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_translation "Example" def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes): # Example: see GEOM_TestAll.py + theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes) anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes) RaiseIfFailed("MultiTranslate1D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Conseqently apply two specified translations to theObject specified number of times. @@ -2382,9 +2401,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2): # Example: see GEOM_TestAll.py + theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2) anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2) RaiseIfFailed("MultiTranslate2D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the given axis a given number times. @@ -2398,8 +2419,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_rotation "Example" def MultiRotate1D(self,theObject, theAxis, theNbTimes): # Example: see GEOM_TestAll.py + theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes) anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes) RaiseIfFailed("MultiRotate1D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the @@ -2419,8 +2442,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_rotation "Example" def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2): # Example: see GEOM_TestAll.py + theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2) anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2) RaiseIfFailed("MultiRotate2D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## The same, as MultiRotate1D(), but axis is given by direction and point diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 439a14753..c94a58629 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -174,6 +174,9 @@ void TransformationGUI_MultiRotationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )), + this, SLOT(TextValueChangedInSpinBox( const QString& ))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); @@ -460,6 +463,17 @@ void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*) ActivateThisDialog(); } +//================================================================================= +// function : TextValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){ + bool isDigit; + s.toDouble(&isDigit); + if(!isDigit) + GroupDimensions->CheckButton1->setChecked(false); + GroupDimensions->CheckButton1->setEnabled(isDigit); +} //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -511,9 +525,21 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MultiRotationDlg::isValid (QString& /*msg*/) +bool TransformationGUI_MultiRotationDlg::isValid (QString& msg) { - return !(myBase->_is_nil() || myVector->_is_nil()); + bool ok = true; + switch(getConstructorId()){ + case 0: + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + break; + case 1: + ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; + break; + } + return !(myBase->_is_nil() || myVector->_is_nil()) && ok; } //================================================================================= @@ -525,12 +551,15 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) bool res = false; GEOM::GEOM_Object_var anObj; + QStringList aParameters; switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiRotate1D(myBase, myVector, myNbTimes1); + if(!IsPreview()) + aParameters<SpinBox_DX->text(); res = true; } break; @@ -538,13 +567,22 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2); + if(!IsPreview()) { + aParameters<SpinBox_DX1->text(); + aParameters<SpinBox_DY1->text(); + aParameters<SpinBox_DX2->text(); + aParameters<SpinBox_DY2->text(); + } res = true; } break; } - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } return res; }