mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-30 04:10:34 +05:00
Implementation Notebook in the GEOM.
This commit is contained in:
parent
7cfb5a7c3b
commit
38e241bb31
@ -79,7 +79,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="TextLabel1" >
|
||||
@ -122,9 +122,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -63,10 +63,10 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="TextLabel4" >
|
||||
@ -173,9 +173,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -63,16 +63,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DY2" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY2" />
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX2" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX2" />
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DY1" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY1" />
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX1" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX1" />
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="TextLabel6" >
|
||||
@ -211,9 +211,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -144,7 +144,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox1" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox1" />
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="TextLabel5" >
|
||||
@ -163,7 +163,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox2" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox2" />
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="TextLabel6" >
|
||||
@ -182,7 +182,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox3" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox3" />
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="CheckBox1" >
|
||||
@ -207,9 +207,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -56,16 +56,16 @@
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="7" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DY2" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY2" />
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX2" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX2" />
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DY1" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY1" />
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX1" />
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX1" />
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3" >
|
||||
<widget class="QCheckBox" name="CheckButton1" >
|
||||
@ -250,9 +250,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -76,7 +76,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2" >
|
||||
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
@ -238,9 +238,9 @@
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QtxDoubleSpinBox</class>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global" >QtxDoubleSpinBox.h</header>
|
||||
<header location="global" >SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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<<GroupPoints->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<<GroupDimensions->SpinBox_DX1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY1->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DX2->text();
|
||||
aParameters<<GroupDimensions->SpinBox_DY2->text();
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
if (!anObj->_is_nil()) {
|
||||
if(!IsPreview())
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user