// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
-bool BlocksGUI_ExplodeDlg::isValid (QString&)
+bool BlocksGUI_ExplodeDlg::isValid (QString& msg)
{
+ bool okSP = true;
+ okSP = myGrp1->SpinBox1->isValid( msg, !IsPreview() ) && okSP;
+ okSP = myGrp1->SpinBox2->isValid( msg, !IsPreview() ) && okSP;
+
bool ok = false;
switch ( getConstructorId() ) {
case 0:
break;
}
- return ok;
+ return ok && okSP;
}
//=================================================================================
return objects.size() > 0;
}
+ QStringList aParameters;
+ aParameters << myGrp1->SpinBox1->text();
+ aParameters << myGrp1->SpinBox2->text();
+
// Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active
if ( !isAllSubShapes() ) {
for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter );
if ( selected.contains( QString( objStr.in() ) ) )
+ {
+ (*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( *anIter );
+ }
else
toRemoveFromEngine.push_back( *anIter );
}
}
else {
for ( int i = 0, n = aList->length(); i < n; i++ )
- objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) );
+ {
+ GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aList[i] );
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ objects.push_back( anObj._retn() );
+ }
}
return objects.size();
{
// Set range of spinboxes
double SpecificStep = 1.0;
- QMap<int, QDoubleSpinBox*>::iterator anIter;
+ QMap<int, SalomeApp_DoubleSpinBox*>::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
//anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3);
initSpinBox(anIter.value(), 1.0, MAX_NUMBER, SpecificStep, 3);
for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn)
connect(anIterBtn.value(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- QMap<int, QDoubleSpinBox*>::iterator anIterSpin;
+ QMap<int, SalomeApp_DoubleSpinBox*>::iterator anIterSpin;
for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin)
connect(anIterSpin.value(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
const int theId)
{
QLabel* lab = new QLabel(theLbl, theParent);
- mySpinBox[theId] = new QDoubleSpinBox(theParent);
+ mySpinBox[theId] = new SalomeApp_DoubleSpinBox(theParent);
QGridLayout* l = 0;
if (!theParent->layout()) {
l = new QGridLayout(theParent);
// function : isValid
// purpose : Verify validity of input data
//=================================================================================
-bool BlocksGUI_TrsfDlg::isValid (QString&)
+bool BlocksGUI_TrsfDlg::isValid (QString& msg)
{
- bool ok = false;
+ bool ok = false, okSP = true;
switch (getConstructorId()) {
case 0:
ok = !myShape->_is_nil() && myFaces[Face1] > 0;
+ okSP = mySpinBox[SpinBox1]->isValid( msg, !IsPreview() );
break;
case 1:
ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0;
+ okSP = mySpinBox[SpinBox2U]->isValid( msg, !IsPreview() ) && okSP;
+ okSP = mySpinBox[SpinBox2V]->isValid( msg, !IsPreview() ) && okSP;
break;
default:
break;
}
- return ok;
+ return ok && okSP;
}
//=================================================================================
MakeMultiTransformation1D(myShape,
myFaces[Face1], myFaces[Face2],
(int)mySpinBox[SpinBox1]->value());
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << "" << "";
+ aParameters << mySpinBox[SpinBox1]->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
case 1:
(int)mySpinBox[SpinBox2U]->value(),
myFaces[Face1V], myFaces[Face2V],
(int)mySpinBox[SpinBox2V]->value());
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << "" << "";
+ aParameters << mySpinBox[SpinBox2U]->text();
+ aParameters << "" << "";
+ aParameters << mySpinBox[SpinBox2V]->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
default:
#include <QMap>
-class QDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
QMap<int, QPushButton*> mySelBtn;
QMap<int, QLineEdit*> mySelName;
- QMap<int, QDoubleSpinBox*> mySpinBox;
+ QMap<int, SalomeApp_DoubleSpinBox*> mySpinBox;
private slots:
void ClickOnOk();
<widget class="QTextBrowser" name="TextBrowser1" />
</item>
<item row="2" column="2" >
- <widget class="QSpinBox" name="SpinBox2" />
+ <widget class="SalomeApp_IntSpinBox" name="SpinBox2" />
</item>
<item row="1" column="2" >
- <widget class="QSpinBox" name="SpinBox1" />
+ <widget class="SalomeApp_IntSpinBox" name="SpinBox1" />
</item>
<item row="4" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckBox1" >
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>SalomeApp_IntSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header location="global" >SalomeApp_IntSpinBox.h</header>
+ </customwidget>
+ </customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>
<number>6</number>
</property>
<item row="2" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
</item>
<item row="3" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
</item>
<item row="1" column="1" colspan="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="4" column="0" colspan="2" >
<widget class="QCheckBox" name="CheckButton1" >
<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>
</widget>
</item>
<item row="0" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox1" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox1" />
</item>
<item row="0" column="2" >
<widget class="QLabel" name="TextLabel3" >
</widget>
</item>
<item row="0" column="3" >
- <widget class="QtxDoubleSpinBox" name="SpinBox2" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox2" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel5" >
</widget>
</item>
<item row="1" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox4" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox4" />
</item>
<item row="1" column="2" >
<widget class="QLabel" name="TextLabel6" >
</widget>
</item>
<item row="1" column="3" >
- <widget class="QtxDoubleSpinBox" name="SpinBox5" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox5" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel4" >
</widget>
</item>
<item row="2" column="1" >
- <widget class="QtxDoubleSpinBox" name="SpinBox3" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox3" />
</item>
<item row="2" column="2" colspan="2" >
<widget class="QCheckBox" name="CheckBox1" >
</widget>
<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>
<number>6</number>
</property>
<item row="2" 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>
<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>
</widget>
</item>
<item row="2" column="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
</item>
<item row="3" column="0" >
<widget class="QRadioButton" name="RadioButton2" >
</widget>
</item>
<item row="3" column="2" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DY" >
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="4" >
- <widget class="QtxDoubleSpinBox" name="SpinBox_DZ" >
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
<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>
#define COMMA ','
#define O_BRACKET '('
#define C_BRACKET ')'
+#define O_SQR_BRACKET '['
+#define C_SQR_BRACKET ']'
#define PY_NULL "None"
#ifdef _DEBUG_
void ReplaceVariables(TCollection_AsciiString& theCommand,
TVariablesList theVariables)
{
- //Get Entry of the result object
- TCollection_AsciiString anEntry = theCommand.Token("=",1);
+ if (MYDEBUG)
+ cout<<"Command : "<<theCommand<<endl;
if (MYDEBUG) {
cout<<"All Entries:"<<endl;
for(;it != theVariables.end();it++)
cout<<"\t'"<<(*it).first<<"'"<<endl;
}
-
- //Remove white spaces
- anEntry.RightAdjust();
- anEntry.LeftAdjust();
- if(MYDEBUG)
- cout<<"Result entry : '" <<anEntry<<"'"<<endl;
-
- //Find variables used for object construction
- vector<TVariable> aVariables;
- TVariablesList::const_iterator it = theVariables.find(anEntry);
- if( it != theVariables.end() )
- aVariables = (*it).second;
- if(aVariables.empty()) {
+ //Additional case - multi-row commands
+ int aCommandIndex = 1;
+ while( aCommandIndex < 10 ) { // tmp check
+ TCollection_AsciiString aCommand = theCommand.Token("\n",aCommandIndex);
+ if( aCommand.Length() == 0 )
+ break;
+
+ if (MYDEBUG)
+ cout<<"Sub-command : "<<aCommand<<endl;
+
+ Standard_Integer aStartCommandPos = theCommand.Location(aCommand,1,theCommand.Length());
+ Standard_Integer aEndCommandPos = aStartCommandPos + aCommand.Length();
+
+ //Get Entry of the result object
+ TCollection_AsciiString anEntry = aCommand.Token("=",1);
+
+ //Remove white spaces
+ anEntry.RightAdjust();
+ anEntry.LeftAdjust();
if(MYDEBUG)
- cout<<"Valiables list empty!!!"<<endl;
- return;
- }
+ cout<<"Result entry : '" <<anEntry<<"'"<<endl;
+
+ //Check if result is list of entries - enough to get the first entry in this case
+ int aNbEntries = 1;
+ if( anEntry.Value( 1 ) == O_SQR_BRACKET && anEntry.Value( anEntry.Length() ) == C_SQR_BRACKET ) {
+ while(anEntry.Location(aNbEntries,COMMA,1,anEntry.Length()))
+ aNbEntries++;
+ TCollection_AsciiString aSeparator(COMMA);
+ anEntry = anEntry.Token(aSeparator.ToCString(),1);
+ anEntry.Remove( 1, 1 );
+ anEntry.RightAdjust();
+ anEntry.LeftAdjust();
+ if(MYDEBUG)
+ cout<<"Sub-entry : '" <<anEntry<<"'"<<endl;
+ }
+
+ //Find variables used for object construction
+ vector<TVariable> aVariables;
+ TVariablesList::const_iterator it = theVariables.find(anEntry);
+ if( it != theVariables.end() )
+ aVariables = (*it).second;
+
+ if(aVariables.empty()) {
+ if(MYDEBUG)
+ cout<<"Valiables list empty!!!"<<endl;
+ aCommandIndex++;
+ continue;
+ }
- if(MYDEBUG) {
- cout<<"Variables from SObject:"<<endl;
- for (int i = 0; i < aVariables.size();i++)
- cout<<"\t Variable["<<i<<"]"<<aVariables[i].myVariable<<endl;
- }
+ if(MYDEBUG) {
+ cout<<"Variables from SObject:"<<endl;
+ for (int i = 0; i < aVariables.size();i++)
+ cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
+ }
- //Calculate total number of parameter
- Standard_Integer aTotalNbParams = 1;
- while(theCommand.Location(aTotalNbParams,COMMA,1,theCommand.Length()))
- aTotalNbParams++;
-
- //Replace parameters by variables
- Standard_Integer aStartPos = 0;
- Standard_Integer aEndPos = 0;
- int iVar = 0;
- TCollection_AsciiString aReplasedVar, aVar;
- for(Standard_Integer i=1;i <= aTotalNbParams;i++) {
-
- //Replace first parameter (bettwen '(' character and first ',' character)
- if(i == 1)
+ //Calculate total number of parameters
+ Standard_Integer aTotalNbParams = 1;
+ while(aCommand.Location(aTotalNbParams,COMMA,1,aCommand.Length()))
+ aTotalNbParams++;
+
+ if(MYDEBUG)
+ cout<<"aTotalNbParams = "<<aTotalNbParams<<endl;
+
+ Standard_Integer aFirstParam = aNbEntries;
+
+ //Replace parameters by variables
+ Standard_Integer aStartPos = 0;
+ Standard_Integer aEndPos = 0;
+ int iVar = 0;
+ TCollection_AsciiString aReplasedVar, aVar;
+ for(Standard_Integer i=aFirstParam;i <= aTotalNbParams;i++) {
+ //Replace first parameter (bettwen '(' character and first ',' character)
+ if(i == aFirstParam)
{
- aStartPos = theCommand.Location(O_BRACKET, 1, theCommand.Length()) + 1;
- if(aTotalNbParams != 1 )
- aEndPos = theCommand.Location(COMMA, 1, theCommand.Length());
+ aStartPos = aCommand.Location(O_BRACKET, 1, aCommand.Length()) + 1;
+ if(aTotalNbParams - aNbEntries > 0 )
+ aEndPos = aCommand.Location(aFirstParam, COMMA, 1, aCommand.Length());
else
- aEndPos = theCommand.Location(C_BRACKET, 1, theCommand.Length());
+ aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
}
- //Replace last parameter (bettwen ',' character and ')' character)
- else if(i == aTotalNbParams)
+ //Replace last parameter (bettwen ',' character and ')' character)
+ else if(i == aTotalNbParams)
{
- aStartPos = theCommand.Location(i-1, COMMA, 1, theCommand.Length()) + 2;
- aEndPos = theCommand.Location(C_BRACKET, 1, theCommand.Length());
+ aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
+ aEndPos = aCommand.Location(C_BRACKET, 1, aCommand.Length());
}
- //Replace other parameters (bettwen two ',' characters)
- else if(i != 1 && i != aTotalNbParams )
+ //Replace other parameters (bettwen two ',' characters)
+ else if(i != aFirstParam && i != aTotalNbParams )
{
- aStartPos = theCommand.Location(i-1, COMMA, 1, theCommand.Length()) + 2;
- aEndPos = theCommand.Location(i, COMMA, 1, theCommand.Length());
+ aStartPos = aCommand.Location(i-1, COMMA, 1, aCommand.Length()) + 2;
+ aEndPos = aCommand.Location(i, COMMA, 1, aCommand.Length());
}
- aVar = theCommand.SubString(aStartPos, aEndPos-1);
- if(MYDEBUG)
- cout<<"Current variable 1: '"<< aVar <<"'"<<endl;
- aVar.RightAdjust();
- aVar.LeftAdjust();
-
- if(MYDEBUG)
- cout<<"Current variable 2: '"<< aVar <<"'"<<endl;
-
- //If parameter is entry or 'None', skip it
- if(theVariables.find(aVar) != theVariables.end() || aVar == PY_NULL)
- continue;
+ if( aCommand.Value( aStartPos ) == O_SQR_BRACKET )
+ aStartPos++;
+ if( aCommand.Value( aEndPos-1 ) == C_SQR_BRACKET )
+ aEndPos--;
+
+ if(MYDEBUG)
+ cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<endl;
+
+ aVar = aCommand.SubString(aStartPos, aEndPos-1);
+ aVar.RightAdjust();
+ aVar.LeftAdjust();
- aReplasedVar = aVariables[iVar].myVariable;
+ if(MYDEBUG)
+ cout<<"Variable: '"<< aVar <<"'"<<endl;
+ //If parameter is entry or 'None', skip it
+ if(theVariables.find(aVar) != theVariables.end() || aVar == PY_NULL)
+ continue;
+
+ if(iVar >= aVariables.size())
+ continue;
+
+ aReplasedVar = aVariables[iVar].myVariable;
- if(aReplasedVar.IsEmpty()) {
+ if(aReplasedVar.IsEmpty()) {
+ iVar++;
+ continue;
+ }
+
+ if(aVariables[iVar].isVariable) {
+ aReplasedVar.InsertBefore(1,"\"");
+ aReplasedVar.InsertAfter(aReplasedVar.Length(),"\"");
+ }
+
+ aCommand.Remove(aStartPos, aEndPos - aStartPos);
+ aCommand.Insert(aStartPos, aReplasedVar);
iVar++;
- continue;
}
- if(aVariables[iVar].isVariable) {
- aReplasedVar.InsertBefore(1,"\"");
- aReplasedVar.InsertAfter(aReplasedVar.Length(),"\"");
- }
+ theCommand.Remove(aStartCommandPos, aEndCommandPos - aStartCommandPos);
+ theCommand.Insert(aStartCommandPos, aCommand);
- theCommand.Remove(aStartPos, aEndPos - aStartPos);
- theCommand.Insert(aStartPos,aReplasedVar);
- iVar++;
+ aCommandIndex++;
}
+
+ if (MYDEBUG)
+ cout<<"Command : "<<theCommand<<endl;
}
double min, double max,
double step, int decimals )
{
+ spinBox->setPrecision( decimals );
spinBox->setDecimals( decimals ); // it's necessary to set decimals before the range setting,
// by default Qt rounds boundaries to 2 decimals at setRange
spinBox->setRange( min, max );
aNameAttrib->SetValue(aShapeName.ToCString());
//Set NoteBook variables used in the object creation
- TCollection_AsciiString aParams(aShape->GetParameters());
- if(!aParams.IsEmpty()) {
- TCollection_AsciiString aVars;
- int nbVars = 0;
- int n = 1;
- TCollection_AsciiString aParam = aParams.Token(":",1);
- while( aParam.Length() != 0 ) {
- aParam = aParams.Token(":",n);
- if(theStudy->IsVariable(aParam.ToCString())){
- aVars+=aParam;
- nbVars++;
- }
- if(aParam.Length() == 0)
- break;
- aVars+=":";
- n++;
- }
- aVars.Remove(aVars.Length(),1);
- if(nbVars > 0 ) {
- anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
- SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
- aStringAttrib->SetValue(aVars.ToCString());
+ bool isFound = false;
+ TCollection_AsciiString aVars;
+ SALOMEDS::ListOfStrings_var aListOfVars = theStudy->ParseVariables(aShape->GetParameters());
+ for(int i = 0, n = aListOfVars->length(); i < n; i++) {
+ if(theStudy->IsVariable(aListOfVars[i].in())) {
+ aVars += TCollection_AsciiString(aListOfVars[i].in());
+ isFound = true;
}
+ if(i != n-1)
+ aVars += ":";
}
-
+ if(isFound) {
+ anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
+ SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
+ aStringAttrib->SetValue(aVars.ToCString());
+ }
+
//Set a name of the GEOM object
aShape->SetName(theName);
Result.append(StringResult)
return Result
+## Return list of variables value from salome notebook
+## @ingroup l1_geompy_auxiliary
+def ParseList(list):
+ Result = []
+ StringResult = ""
+ for parameter in list:
+ if isinstance(parameter,str) and notebook.isVariable(parameter):
+ Result.append(str(notebook.get(parameter)))
+ pass
+ else:
+ Result.append(str(parameter))
+ pass
+
+ StringResult = StringResult + str(parameter)
+ StringResult = StringResult + ":"
+ pass
+ StringResult = StringResult[:len(StringResult)-1]
+ return Result,StringResult
+
## Kinds of shape enumeration
# @ingroup l1_geompy_auxiliary
# @ref tui_creation_prism "Example"
def MakePrismVecH(self, theBase, theVec, theH):
# Example: see GEOM_TestAll.py
+ theH,Parameters = ParseParameters(theH)
anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the vector,
# @ref tui_creation_prism "Example"
def MakePrismVecH2Ways(self, theBase, theVec, theH):
# Example: see GEOM_TestAll.py
+ theH,Parameters = ParseParameters(theH)
anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
+ theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# @ref tui_creation_prism "Example"
def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
+ theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a shape by revolution of the base shape around the axis
# @ref tui_creation_revolution "Example"
def MakeRevolution(self, theBase, theAxis, theAngle):
# Example: see GEOM_TestAll.py
+ theAngle,Parameters = ParseParameters(theAngle)
anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## The Same Revolution but in both ways forward&backward.
def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
+ theAngle,Parameters = ParseParameters(theAngle)
anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a filling from the given compound of contours.
# @ref tui_creation_filling "Example"
def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0):
# Example: see GEOM_TestAll.py
+ theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg,
+ theTol2D, theTol3D, theNbIter)
anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg,
theTol2D, theTol3D, theNbIter, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
# @ref tui_shape_processing "Example"
def ProcessShape(self,theShape, theOperators, theParameters, theValues):
# Example: see GEOM_TestHealing.py
+ theValues,Parameters = ParseList(theValues)
anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
RaiseIfFailed("ProcessShape", self.HealOp)
+ for string in (theOperators + theParameters):
+ Parameters = ":" + Parameters
+ pass
+ anObj.SetParameters(Parameters)
return anObj
## Remove faces from the given object (shape).
# @return New GEOM_Object, containing processed shape.
def Sew(self, theObject, theTolerance):
# Example: see MakeSewing() above
+ theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.HealOp.Sew(theObject, theTolerance)
RaiseIfFailed("Sew", self.HealOp)
+ anObj.SetParameters(Parameters)
return anObj
## Remove internal wires and edges from the given object (face).
# @ref tui_add_point_on_edge "Example"
def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
# Example: see GEOM_TestHealing.py
+ theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter)
anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
RaiseIfFailed("DivideEdge", self.HealOp)
+ anObj.SetParameters(Parameters)
return anObj
## Change orientation of the given object. Updates given shape.
# @ref tui_glue_faces "Example"
def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
# Example: see GEOM_Spanner.py
+ theTolerance,Parameters = ParseParameters(theTolerance)
anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids)
if anObj is None:
raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
+ anObj.SetParameters(Parameters)
return anObj
## Find coincident faces in theShape for possible gluing.
# \n @ref swig_MakeFilletAll "Example 2"
def MakeFilletAll(self,theShape, theR):
# Example: see GEOM_TestOthers.py
+ theR,Parameters = ParseParameters(theR)
anObj = self.LocalOp.MakeFilletAll(theShape, theR)
RaiseIfFailed("MakeFilletAll", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a fillet on the specified edges/faces of the given shape
# @ref tui_fillet "Example"
def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
# Example: see GEOM_TestAll.py
+ theR,Parameters = ParseParameters(theR)
anObj = None
if theShapeType == ShapeType["EDGE"]:
anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
else:
anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
RaiseIfFailed("MakeFilletFaces", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## The same that MakeFillet but with two Fillet Radius R1 and R2
def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
+ theR1,theR2,Parameters = ParseParameters(theR1,theR2)
anObj = None
if theShapeType == ShapeType["EDGE"]:
anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
else:
anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a symmetric chamfer on all edges of the given shape.
# \n @ref swig_MakeChamferAll "Example 2"
def MakeChamferAll(self,theShape, theD):
# Example: see GEOM_TestOthers.py
+ theD,Parameters = ParseParameters(theD)
anObj = self.LocalOp.MakeChamferAll(theShape, theD)
RaiseIfFailed("MakeChamferAll", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on edges, common to the specified faces,
# @ref tui_chamfer "Example"
def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
# Example: see GEOM_TestAll.py
+ theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdge", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferEdge but with params theD is chamfer length and
- # theAngle is Angle of chamfer (angle in radians)
+ # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
+ flag = False
+ if isinstance(theAngle,str):
+ flag = True
+ theD,theAngle,Parameters = ParseParameters(theD,theAngle)
+ if flag:
+ theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on all edges of the specified faces,
# @ref tui_chamfer "Example"
def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
# Example: see GEOM_TestAll.py
+ theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
RaiseIfFailed("MakeChamferFaces", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferFaces but with params theD is chamfer lenght and
- # theAngle is Angle of chamfer (angle in radians)
+ # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
#
# @ref swig_FilletChamfer "Example"
def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
+ flag = False
+ if isinstance(theAngle,str):
+ flag = True
+ theD,theAngle,Parameters = ParseParameters(theD,theAngle)
+ if flag:
+ theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Perform a chamfer on edges,
#
# @ref swig_FilletChamfer "Example"
def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
+ theD1,theD2,Parameters = ParseParameters(theD1,theD2)
anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
RaiseIfFailed("MakeChamferEdges", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## The Same that MakeChamferEdges but with params theD is chamfer lenght and
- # theAngle is Angle of chamfer (angle in radians)
+ # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
+ flag = False
+ if isinstance(theAngle,str):
+ flag = True
+ theD,theAngle,Parameters = ParseParameters(theD,theAngle)
+ if flag:
+ theAngle = theAngle*math.pi/180.0
anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
## Shortcut to MakeChamferEdge() and MakeChamferFaces()
# @ref tui_archimede "Example"
def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
# Example: see GEOM_TestAll.py
+ theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters(
+ theWeight,theWaterDensity,theMeshDeflection)
anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
RaiseIfFailed("MakeArchimede", self.LocalOp)
+ anObj.SetParameters(Parameters)
return anObj
# end of l3_basic_op
# \n @ref swig_MakeBlockExplode "Example 2"
def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
# Example: see GEOM_TestOthers.py
+ theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces)
aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
+ for anObj in aList:
+ anObj.SetParameters(Parameters)
+ pass
return aList
## Find block, containing the given point inside its volume or on boundary.
# @ref tui_multi_transformation "Example"
def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
# Example: see GEOM_Spanner.py
+ DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes)
anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
+ anObj.SetParameters(Parameters)
return anObj
## Multi-transformate block and glue the result.
def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
DirFace1V, DirFace2V, NbTimesV):
# Example: see GEOM_Spanner.py
+ DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters(
+ DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV)
anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
DirFace1V, DirFace2V, NbTimesV)
RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
+ anObj.SetParameters(Parameters)
return anObj
## Build all possible propagation groups.
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_FillingDlg::isValid( QString& )
+bool GenerationGUI_FillingDlg::isValid( QString& msg )
{
- return myOkCompound > 0;
+ bool ok = true;
+ ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) && ok;
+
+ return myOkCompound > 0 && ok;
}
//=================================================================================
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling(
myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox );
-
if ( !anObj->_is_nil() )
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox1->text();
+ aParameters << GroupPoints->SpinBox2->text();
+ aParameters << GroupPoints->SpinBox3->text();
+ aParameters << GroupPoints->SpinBox4->text();
+ aParameters << GroupPoints->SpinBox5->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
return true;
}
QString aName = GEOMBase::GetName(aSelectedObject);
myBase = aSelectedObject;
+ myOkBase = true;
myEditCurrentArgument->setText(aName);
}
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_PrismDlg::isValid (QString&)
+bool GenerationGUI_PrismDlg::isValid (QString& msg)
{
+ bool ok = true;
+ if( getConstructorId() == 0 )
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ else if( getConstructorId() == 2 )
+ {
+ ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
+
if (getConstructorId() == 0)
- return (myOkBase && myOkVec); // by vector and height
+ return (myOkBase && myOkVec) && ok; // by vector and height
else if (getConstructorId() == 1)
return (myOkBase && myOkPnt1 && myOkPnt2); // by two points
else if (getConstructorId() == 2)
- return true;
+ return myOkBase && ok;
return false;
}
//=================================================================================
bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
{
+ QStringList aParameters;
GEOM::GEOM_Object_var anObj;
switch (getConstructorId()) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismVecH2Ways(myBase, myVec, getHeight());
}
+
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupPoints->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
+
break;
case 1:
if (!myBothway2) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
+
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupPoints3->SpinBox_DX->text();
+ aParameters << GroupPoints3->SpinBox_DY->text();
+ aParameters << GroupPoints3->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
+
break;
}
// function : isValid
// purpose :
//=================================================================================
-bool GenerationGUI_RevolDlg::isValid (QString&)
+bool GenerationGUI_RevolDlg::isValid (QString& msg)
{
- return myOkBase && myOkAxis;
+ bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
+ return myOkBase && myOkAxis && ok;
}
//=================================================================================
}
if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back(anObj._retn());
+ }
return true;
}
// function : isValid
// purpose :
//=================================================================================
-bool OperationGUI_ArchimedeDlg::isValid( QString& )
+bool OperationGUI_ArchimedeDlg::isValid( QString& msg )
{
- return !myShape->_is_nil();
+ bool ok = true;
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ return !myShape->_is_nil() && ok;
}
//=================================================================================
getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection );
if ( !anObj->_is_nil() )
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ aParameters << GroupPoints->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
return true;
}
int row = aLayout->rowCount();
aLayout->addWidget(new QLabel(tr("D"), myGrp1), row, 0);
- aLayout->addWidget((mySpinBox[ SpinBox1 ] = new QDoubleSpinBox(myGrp1)), row++, 2);
+ aLayout->addWidget((mySpinBox[ SpinBox1 ] = new SalomeApp_DoubleSpinBox(myGrp1)), row++, 2);
aLayout->setRowStretch(row, 10);
// Create second group
// Set range of spinboxes
double SpecificStep = 10.0;
- QMap< int, QDoubleSpinBox* >::iterator anIter;
+ QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) {
if (anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24)
initSpinBox(anIter.value(), 0.001, 89.999, 5, 0);
void OperationGUI_ChamferDlg::Init()
{
// Set Initial values of spinboxes
- QMap< int, QDoubleSpinBox* >::iterator anIter;
+ QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter;
for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter)
anIter.value()->setValue(5);
this, SLOT(LineEditReturnPressed()));
// spin boxes
- QMap< int, QDoubleSpinBox* >::iterator anIterSpin;
+ QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIterSpin;
for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin)
connect(anIterSpin.value(), SIGNAL(valueChanged(double)),
this, SLOT(ValueChangedInSpinBox(double)));
//disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
// Get values from previous widget
- double D1 = 5, D2 = 5, D = 5, Angle = 5;
+ QString D1 = "5", D2 = "5", D = "5", Angle = "5";
if (myConstructorId == 0)
- D1 = D2 = mySpinBox[ SpinBox1 ]->value();
+ D1 = D2 = mySpinBox[ SpinBox1 ]->text();
else if (myConstructorId == 1) {
- D1 = mySpinBox[ SpinBox21 ]->value();
- D2 = mySpinBox[ SpinBox22 ]->value();
- D = mySpinBox[ SpinBox23 ]->value();
- Angle = mySpinBox[ SpinBox24 ]->value();
+ D1 = mySpinBox[ SpinBox21 ]->text();
+ D2 = mySpinBox[ SpinBox22 ]->text();
+ D = mySpinBox[ SpinBox23 ]->text();
+ Angle = mySpinBox[ SpinBox24 ]->text();
}
else if (myConstructorId == 2) {
- D1 = mySpinBox[ SpinBox31 ]->value();
- D2 = mySpinBox[ SpinBox32 ]->value();
- D = mySpinBox[ SpinBox33 ]->value();
- Angle = mySpinBox[ SpinBox34 ]->value();
+ D1 = mySpinBox[ SpinBox31 ]->text();
+ D2 = mySpinBox[ SpinBox32 ]->text();
+ D = mySpinBox[ SpinBox33 ]->text();
+ Angle = mySpinBox[ SpinBox34 ]->text();
}
else if (myConstructorId == 3) {
- D1 = mySpinBox[ SpinBox41 ]->value();
- D2 = mySpinBox[ SpinBox42 ]->value();
- D = mySpinBox[ SpinBox43 ]->value();
- Angle = mySpinBox[ SpinBox44 ]->value();
+ D1 = mySpinBox[ SpinBox41 ]->text();
+ D2 = mySpinBox[ SpinBox42 ]->text();
+ D = mySpinBox[ SpinBox43 ]->text();
+ Angle = mySpinBox[ SpinBox44 ]->text();
}
myConstructorId = constructorId;
myGrp3->hide();
myGrp4->hide();
myGrp1->show();
- mySpinBox[ SpinBox1 ]->setValue(D1);
+ mySpinBox[ SpinBox1 ]->setText(D1);
break;
case 1:
myGrp1->hide();
myGrp3->hide();
myGrp4->hide();
myGrp2->show();
- mySpinBox[ SpinBox21 ]->setValue(D1);
- mySpinBox[ SpinBox22 ]->setValue(D2);
- mySpinBox[ SpinBox23 ]->setValue(D);
- mySpinBox[ SpinBox24 ]->setValue(Angle);
+ mySpinBox[ SpinBox21 ]->setText(D1);
+ mySpinBox[ SpinBox22 ]->setText(D2);
+ mySpinBox[ SpinBox23 ]->setText(D);
+ mySpinBox[ SpinBox24 ]->setText(Angle);
break;
case 2:
myGrp1->hide();
myGrp2->hide();
myGrp4->hide();
myGrp3->show();
- mySpinBox[ SpinBox31 ]->setValue(D1);
- mySpinBox[ SpinBox32 ]->setValue(D2);
- mySpinBox[ SpinBox32 ]->setValue(D2);
- mySpinBox[ SpinBox33 ]->setValue(D);
- mySpinBox[ SpinBox34 ]->setValue(Angle);
+ mySpinBox[ SpinBox31 ]->setText(D1);
+ mySpinBox[ SpinBox32 ]->setText(D2);
+ mySpinBox[ SpinBox32 ]->setText(D2);
+ mySpinBox[ SpinBox33 ]->setText(D);
+ mySpinBox[ SpinBox34 ]->setText(Angle);
break;
case 3:
myGrp1->hide();
myGrp2->hide();
myGrp3->hide();
myGrp4->show();
- mySpinBox[ SpinBox41 ]->setValue(D1);
- mySpinBox[ SpinBox42 ]->setValue(D2);
- mySpinBox[ SpinBox43 ]->setValue(D);
- mySpinBox[ SpinBox44 ]->setValue(Angle);
+ mySpinBox[ SpinBox41 ]->setText(D1);
+ mySpinBox[ SpinBox42 ]->setText(D2);
+ mySpinBox[ SpinBox43 ]->setText(D);
+ mySpinBox[ SpinBox44 ]->setText(Angle);
break;
default:
break;
myRadioButton[ theRbId ] = new QRadioButton(theParent);
QLabel* lab1 = new QLabel(theLbl1, theParent);
QLabel* lab2 = new QLabel(theLbl2, theParent);
- mySpinBox[ theSpin1Id ] = new QDoubleSpinBox(theParent);
- mySpinBox[ theSpin2Id ] = new QDoubleSpinBox(theParent);
+ mySpinBox[ theSpin1Id ] = new SalomeApp_DoubleSpinBox(theParent);
+ mySpinBox[ theSpin2Id ] = new SalomeApp_DoubleSpinBox(theParent);
int row = theLayout->rowCount();
theLayout->addWidget(myRadioButton[ theRbId ], row, 0);
theLayout->addWidget(lab1, row, 2);
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
-bool OperationGUI_ChamferDlg::isValid (QString&)
+bool OperationGUI_ChamferDlg::isValid (QString& msg)
{
+ bool ok = true;
switch (getConstructorId())
{
- case 0: return !myShape->_is_nil();
- case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;
- case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
- case 3: return !myShape->_is_nil() && myEdges.Extent() > 0;
+ case 0:
+ ok = mySpinBox[ SpinBox1 ]->isValid( msg, !IsPreview() );
+ return !myShape->_is_nil() && ok;
+ case 1:
+ if (myRadioButton[ RadioButton21 ]->isChecked())
+ {
+ ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ else
+ {
+ ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0 && ok;
+ case 2:
+ if (myRadioButton[ RadioButton31 ]->isChecked())
+ {
+ ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ else
+ {
+ ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ return !myShape->_is_nil() && myFaces.Extent() > 0 && ok;
+ case 3:
+ if (myRadioButton[ RadioButton41 ]->isChecked())
+ {
+ ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ else
+ {
+ ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok;
+ ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok;
+ }
+ return !myShape->_is_nil() && myEdges.Extent() > 0 && ok;
default: return false;
}
}
//=================================================================================
bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
{
+ QStringList aParameters;
GEOM::GEOM_Object_var anObj;
bool flag = (myRadioButton[ RadioButton21 ]->isChecked() &&
myRadioButton[ RadioButton31 ]->isChecked() &&
if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value());
+ if (!anObj->_is_nil())
+ aParameters << mySpinBox[ SpinBox1 ]->text();
}
else if (anId == 1) {
if (flag) {
mySpinBox[ SpinBox22 ]->value(),
myFace[ Face1 ],
myFace[ Face2 ]);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox21 ]->text();
+ aParameters << mySpinBox[ SpinBox22 ]->text();
+ }
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
mySpinBox[ SpinBox24 ]->value() * PI180,
myFace[ Face1 ],
myFace[ Face2 ]);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox23 ]->text();
+ aParameters << mySpinBox[ SpinBox24 ]->text();
+ }
}
}
else if (anId == 2)
for (int i = 1, n = myFaces.Extent(); i <= n; i++)
anArray[ i - 1 ] = myFaces(i);
- if (flag)
- anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
- MakeChamferFaces(myShape,
- mySpinBox[ SpinBox31 ]->value(),
- mySpinBox[ SpinBox32 ]->value(),
- anArray);
- else
- anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
- MakeChamferFacesAD(myShape,
- mySpinBox[ SpinBox33 ]->value(),
- mySpinBox[ SpinBox34 ]->value() * PI180,
- anArray);
+ if (flag) {
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
+ MakeChamferFaces(myShape,
+ mySpinBox[ SpinBox31 ]->value(),
+ mySpinBox[ SpinBox32 ]->value(),
+ anArray);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox31 ]->text();
+ aParameters << mySpinBox[ SpinBox32 ]->text();
+ }
+ }
+ else {
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
+ MakeChamferFacesAD(myShape,
+ mySpinBox[ SpinBox33 ]->value(),
+ mySpinBox[ SpinBox34 ]->value() * PI180,
+ anArray);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox33 ]->text();
+ aParameters << mySpinBox[ SpinBox34 ]->text();
+ }
+ }
}
else if (anId == 3) {
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
mySpinBox[ SpinBox41 ]->value(),
mySpinBox[ SpinBox42 ]->value(),
anArray);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox41 ]->text();
+ aParameters << mySpinBox[ SpinBox42 ]->text();
+ }
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
mySpinBox[ SpinBox43 ]->value(),
mySpinBox[ SpinBox44 ]->value() * PI180,
anArray);
+ if (!anObj->_is_nil())
+ {
+ aParameters << mySpinBox[ SpinBox43 ]->text();
+ aParameters << mySpinBox[ SpinBox44 ]->text();
+ }
}
}
if (!anObj->_is_nil())
+ {
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
+ }
return true;
}
#include <QMap>
-class QDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
class QGroupBox;
class QPushButton;
class QLineEdit;
QMap< int, QPushButton* > mySelBtn;
QMap< int, QLineEdit* > mySelName;
- QMap< int, QDoubleSpinBox* > mySpinBox;
+ QMap< int, SalomeApp_DoubleSpinBox* > mySpinBox;
QMap< int, QRadioButton* > myRadioButton;
};
return;
// Get radius from previous widget
- double R = 5, R1 = 5, R2 = 5;
+ QString R = "5", R1 = "5", R2 = "5";
if (myConstructorId == 0) {
- R = Group1->SpinBox_DX->value();
+ R = Group1->SpinBox_DX->text();
}
else if (myConstructorId == 1) {
- R = Group2->SpinBox_DX->value();
- R1 = Group2->SpinBox_DY->value();
- R2 = Group2->SpinBox_DZ->value();
+ R = Group2->SpinBox_DX->text();
+ R1 = Group2->SpinBox_DY->text();
+ R2 = Group2->SpinBox_DZ->text();
}
else {
- R = Group3->SpinBox_DX->value();
- R1 = Group3->SpinBox_DY->value();
- R2 = Group3->SpinBox_DZ->value();
+ R = Group3->SpinBox_DX->text();
+ R1 = Group3->SpinBox_DY->text();
+ R2 = Group3->SpinBox_DZ->text();
}
myConstructorId = constructorId;
Group2->hide();
Group3->hide();
Group1->show();
- Group1->SpinBox_DX->setValue(R);
+ Group1->SpinBox_DX->setText(R);
break;
case 1:
Group1->hide();
Group3->hide();
Group2->show();
- Group2->SpinBox_DX->setValue(R);
- Group2->SpinBox_DY->setValue(R1);
- Group2->SpinBox_DZ->setValue(R2);
+ Group2->SpinBox_DX->setText(R);
+ Group2->SpinBox_DY->setText(R1);
+ Group2->SpinBox_DZ->setText(R2);
break;
case 2:
Group1->hide();
Group2->hide();
Group3->show();
- Group3->SpinBox_DX->setValue(R);
- Group3->SpinBox_DY->setValue(R1);
- Group3->SpinBox_DZ->setValue(R2);
+ Group3->SpinBox_DX->setText(R);
+ Group3->SpinBox_DY->setText(R1);
+ Group3->SpinBox_DZ->setText(R2);
break;
default:
break;
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
-bool OperationGUI_FilletDlg::isValid (QString&)
+bool OperationGUI_FilletDlg::isValid (QString& msg)
{
+ bool ok = true;
switch (getConstructorId())
{
- case 0: return !myShape->_is_nil();
- case 1: return !myShape->_is_nil() && myEdges.Extent() > 0;
- case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
+ case 0:
+ ok = Group1->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ return !myShape->_is_nil() && ok;
+ case 1:
+ if (Group2->RadioButton1->isChecked())
+ ok = Group2->SpinBox_DX->isValid( msg, !IsPreview() );
+ else
+ {
+ ok = Group2->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = Group2->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
+ return !myShape->_is_nil() && myEdges.Extent() > 0 && ok;
+ case 2:
+ if (Group3->RadioButton1->isChecked())
+ ok = Group3->SpinBox_DX->isValid( msg, !IsPreview() );
+ else
+ {
+ ok = Group3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = Group3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
+ return !myShape->_is_nil() && myFaces.Extent() > 0 && ok;
default: return false;
}
}
//=================================================================================
bool OperationGUI_FilletDlg::execute (ObjectList& objects)
{
+ QStringList aParameters;
GEOM::GEOM_Object_var anObj;
int anId = getConstructorId();
- if (anId == 0)
+ if (anId == 0) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletAll(myShape, getRadius());
+ if (!anObj->_is_nil())
+ aParameters << Group1->SpinBox_DX->text();
+ }
else if (anId == 1) {
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
aList->length(myEdges.Extent());
aList[ i - 1 ] = myEdges(i);
if (Group2->RadioButton1->isChecked())
+ {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletEdges(myShape, getRadius(), aList);
+ if (!anObj->_is_nil())
+ aParameters << Group2->SpinBox_DX->text();
+ }
else
+ {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletEdgesR1R2(myShape,
Group2->SpinBox_DY->value(),
Group2->SpinBox_DZ->value(),
aList);
+ if (!anObj->_is_nil())
+ {
+ aParameters << Group2->SpinBox_DY->text();
+ aParameters << Group2->SpinBox_DZ->text();
+ }
+ }
}
else if (anId == 2) {
GEOM::ListOfLong_var aList = new GEOM::ListOfLong;
if (Group3->RadioButton1->isChecked()) {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletFaces(myShape, getRadius(), aList);
+ if (!anObj->_is_nil())
+ aParameters << Group3->SpinBox_DX->text();
}
else {
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFilletFacesR1R2(myShape,
Group3->SpinBox_DY->value(),
Group3->SpinBox_DZ->value(), aList);
+ if (!anObj->_is_nil())
+ {
+ aParameters << Group3->SpinBox_DY->text();
+ aParameters << Group3->SpinBox_DZ->text();
+ }
}
}
if (!anObj->_is_nil())
+ {
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
+ }
return true;
}
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+
+ ok = fabs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && ok;
+ ok = fabs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && ok;
+ ok = fabs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion() && ok;
}
return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : ok;
}
double z = GroupDimensions->SpinBox_DZ->value();
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
-
- QStringList aParameters;
- aParameters << GroupDimensions->SpinBox_DX->text();
- aParameters << GroupDimensions->SpinBox_DY->text();
- aParameters << GroupDimensions->SpinBox_DZ->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ aParameters << GroupDimensions->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
}
break;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
}
+ ok = fabs( getHeight() ) > Precision::Confusion() && ok;
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
-
- QStringList aParameters;
- aParameters << GroupPoints->SpinBox_DX->text();
- aParameters << GroupPoints->SpinBox_DY->text();
- aParameters << GroupPoints->SpinBox_DZ->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ aParameters << GroupPoints->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
-
- QStringList aParameters;
- aParameters << GroupDimensions->SpinBox_DX->text();
- aParameters << GroupDimensions->SpinBox_DY->text();
- aParameters << GroupDimensions->SpinBox_DZ->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ aParameters << GroupDimensions->SpinBox_DZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
}
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
}
+ ok = fabs( getHeight() ) > Precision::Confusion() && ok;
return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
}
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
-
- QStringList aParameters;
- aParameters << GroupPoints->SpinBox_DX->text();
- aParameters << GroupPoints->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderRH(getRadius(), getHeight());
-
- QStringList aParameters;
- aParameters << GroupDimensions->SpinBox_DX->text();
- aParameters << GroupDimensions->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
}
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskR(getRadius(), myOrientationType);
-
- aParameters << GroupDimensions->SpinBox_DX->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskPntVecR(myPoint, myDir, getRadius());
-
- aParameters << GroupPntVecR->SpinBox_DX->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupPntVecR->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
case 2:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
GroupDimensions->SpinBox_DY->value(), myOrientationType);
-
- aParameters << GroupDimensions->SpinBox_DX->text();
- aParameters << GroupDimensions->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
case 1:
else if (GroupType->RadioButton2->isChecked())
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
-
- aParameters << GroupPlane->SpinBox_DX->text();
- aParameters << GroupPlane->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ aParameters << GroupPlane->SpinBox_DX->text();
+ aParameters << GroupPlane->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
}
{
if ( !CORBA::is_nil( myPoint ) ) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
-
- QStringList aParameters;
- aParameters << GroupPoints->SpinBox_DX->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
}
break;
case 1 :
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
-
- QStringList aParameters;
- aParameters << GroupDimensions->SpinBox_DX->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
}
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
-
- QStringList aParameters;
- aParameters << GroupPoints->SpinBox_DX->text();
- aParameters << GroupPoints->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
}
break;
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusRR(getRadius1(), getRadius2());
-
- QStringList aParameters;
- aParameters << GroupDimensions->SpinBox_DX->text();
- aParameters << GroupDimensions->SpinBox_DY->text();
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
-
+ if (!anObj->_is_nil())
+ {
+ QStringList aParameters;
+ aParameters << GroupDimensions->SpinBox_DX->text();
+ aParameters << GroupDimensions->SpinBox_DY->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
res = true;
break;
}
myIsParameterGr->addButton( rb2, 1 );
rb1->setChecked( true );
- myValEdt = new QDoubleSpinBox( GroupPoints->Box );
+ myValEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myValEdt, 0., 1., 0.1, 3 );
myValEdt->setValue( 0.5 );
QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );
// function : isValid
// purpose :
//=================================================================================
-bool RepairGUI_DivideEdgeDlg::isValid( QString& )
+bool RepairGUI_DivideEdgeDlg::isValid( QString& msg )
{
- return !myObject->_is_nil();
+ return !myObject->_is_nil() && myValEdt->isValid( msg, !IsPreview() );
}
//=================================================================================
( myObject, -1, myValEdt->value(), getIsByParameter() );
bool aResult = !anObj->_is_nil();
if ( aResult )
+ {
+ QStringList aParameters;
+ aParameters << "";
+ aParameters << myValEdt->text();
+ aParameters << "";
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
return aResult;
}
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
-class QDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
class QButtonGroup;
//=================================================================================
DlgRef_1SelExt* GroupPoints;
QButtonGroup* myIsParameterGr;
- QDoubleSpinBox* myValEdt;
+ SalomeApp_DoubleSpinBox* myValEdt;
protected slots:
void ClickOnOk();
GroupPoints->LineEdit1->setReadOnly( true );
QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
- myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
+ myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0, 100, 1e-7, 7 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
GroupPoints2->LineEdit1->setReadOnly( true );
QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
- myTolEdt2 = new QDoubleSpinBox( GroupPoints2->Box );
+ myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box );
initSpinBox( myTolEdt2, 0, 100, 1e-7, 7 );
myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
// function : isValid
// purpose :
//=================================================================================
-bool RepairGUI_GlueDlg::isValid( QString& )
+bool RepairGUI_GlueDlg::isValid( QString& msg )
{
+ bool ok = true;
double v = 0;
switch ( getConstructorId() )
{
case 0:
- v = myTolEdt->value(); break;
+ v = myTolEdt->value();
+ ok = myTolEdt->isValid( msg, !IsPreview() );
+ break;
case 1:
- v = myTolEdt2->value(); break;
+ v = myTolEdt2->value();
+ ok = myTolEdt2->isValid( msg, !IsPreview() );
+ break;
}
- return !myObject->_is_nil() && ( IsPreview() || v > 0. );
+ return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
}
//=================================================================================
( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true );
aResult = !anObj->_is_nil();
if ( aResult )
+ {
+ QStringList aParameters;
+ aParameters << myTolEdt->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
break;
}
case 1:
aResult = !anObj->_is_nil();
if ( aResult )
+ {
+ QStringList aParameters;
+ aParameters << myTolEdt2->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
// Remove from engine useless objects
clearTemporary();
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
-class QDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
class QPushButton;
class QCheckBox;
DlgRef_1SelExt* GroupPoints;
DlgRef_1SelExt* GroupPoints2;
- QDoubleSpinBox* myTolEdt;
- QDoubleSpinBox* myTolEdt2;
+ SalomeApp_DoubleSpinBox* myTolEdt;
+ SalomeApp_DoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
aLay->setMargin( 0 ); aLay->setSpacing( 6 );
- myTolEdt = new QDoubleSpinBox( GroupPoints->Box );
+ myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
initSpinBox( myTolEdt, 0, 100, 1e-7, 10 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
// function : isValid
// purpose :
//=================================================================================
-bool RepairGUI_SewingDlg::isValid( QString& )
+bool RepairGUI_SewingDlg::isValid( QString& msg )
{
myClosed = -1;
- return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. );
+ return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && myTolEdt->isValid( msg, !IsPreview() );
}
//=================================================================================
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() );
aResult = !anObj->_is_nil();
if ( aResult )
+ {
+ QStringList aParameters;
+ aParameters << myTolEdt->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
}
return aResult;
#include <GEOMBase_Skeleton.h>
class DlgRef_1SelExt;
-class QDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
class QPushButton;
//=================================================================================
GEOM::GEOM_Object_var myObject;
DlgRef_1SelExt* GroupPoints;
- QDoubleSpinBox* myTolEdt;
+ SalomeApp_DoubleSpinBox* myTolEdt;
QPushButton* myFreeBoundBtn;
int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect().
#include <GEOMImpl_Types.hxx>
#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
+#include <SalomeApp_IntSpinBox.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- myFixShapeTol3D = new QDoubleSpinBox( w );
+ myFixShapeTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myFixShapeTol3D, 0, 100, 1e-7, 10 );
- myFixShapeMaxTol3D = new QDoubleSpinBox( w );
+ myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myFixShapeMaxTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- myFixFaceSizeTol = new QDoubleSpinBox( w );
+ myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myFixFaceSizeTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- myDropSmallEdgesTol3D = new QDoubleSpinBox( w );
+ myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myDropSmallEdgesTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- mySplitAngleAngle = new QDoubleSpinBox( w );
+ mySplitAngleAngle = new SalomeApp_DoubleSpinBox( w );
initSpinBox( mySplitAngleAngle, 0, 360, 1 );
- mySplitAngleMaxTol = new QDoubleSpinBox( w );
+ mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( w );
initSpinBox( mySplitAngleMaxTol, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- mySplitClosedFacesNum = new QSpinBox( w );
+ mySplitClosedFacesNum = new SalomeApp_IntSpinBox( w );
aLay->addWidget( new QLabel( tr( "GEOM_NUM_SPLIT_POINTS" ), w ), 0, 0 );
aLay->addWidget( mySplitClosedFacesNum, 0, 1 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- mySplitContTol3D = new QDoubleSpinBox( w );
+ mySplitContTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( mySplitContTol3D, 0, 100, 1e-7, 10 );
mySplitContSurfCont = new QComboBox( w );
mySplitContSurfCont->addItems( aContinueties );
myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
- myBSplineTol3D = new QDoubleSpinBox( w );
+ myBSplineTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myBSplineTol3D, 0, 100, 1e-7, 10 );
- myBSplineTol2D = new QDoubleSpinBox( w );
+ myBSplineTol2D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myBSplineTol2D, 0, 100, 1e-7, 10 );
- myBSplineDegree = new QSpinBox( w );
- myBSplineSegments = new QSpinBox( w );
+ myBSplineDegree = new SalomeApp_IntSpinBox( w );
+ myBSplineSegments = new SalomeApp_IntSpinBox( w );
myBSpline2DCont = new QComboBox( w );
myBSpline2DCont->addItems( aContinueties );
myBSpline3DCont = new QComboBox( w );
myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w );
myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w );
- myToBezierMaxTol = new QDoubleSpinBox( w );
+ myToBezierMaxTol = new SalomeApp_DoubleSpinBox( w );
initSpinBox( myToBezierMaxTol, 0, 100, 1e-7, 10 );
aLay->addWidget( myToBezierSurfModeChk, 0, 0 );
QGridLayout* aLay = new QGridLayout( w );
aLay->setMargin( 9 ); aLay->setSpacing( 6 );
- mySameParameterTol3D = new QDoubleSpinBox( w );
+ mySameParameterTol3D = new SalomeApp_DoubleSpinBox( w );
initSpinBox( mySameParameterTol3D, 0, 100, 1e-7, 10 );
aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 );
void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& theValue )
{
if ( theControl && !theValue.isNull() ) {
- if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
- qobject_cast<QDoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
- else if ( qobject_cast<QSpinBox*>( theControl ) )
- qobject_cast<QSpinBox*>( theControl )->setValue( theValue.toInt() );
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->setValue( theValue.toDouble() );
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ qobject_cast<SalomeApp_IntSpinBox*>( theControl )->setValue( theValue.toInt() );
else if ( qobject_cast<QComboBox*>( theControl ) )
qobject_cast<QComboBox*>( theControl )->setEditText( theValue );
else if ( qobject_cast<QCheckBox*>( theControl ) )
QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
{
if ( theControl ) {
- if ( qobject_cast<QDoubleSpinBox*>( theControl ) )
- return QString::number( qobject_cast<QDoubleSpinBox*>( theControl )->value() );
- else if ( qobject_cast<QSpinBox*>( theControl ) )
- return QString::number( qobject_cast<QSpinBox*>( theControl )->value() );
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ return QString::number( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->value() );
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ return QString::number( qobject_cast<SalomeApp_IntSpinBox*>( theControl )->value() );
else if ( qobject_cast<QComboBox*>( theControl ) )
return qobject_cast<QComboBox*>( theControl )->currentText();
else if ( qobject_cast<QCheckBox*>( theControl ) )
return 0;
}
+//=================================================================================
+// function : getText()
+// purpose : get text in the proper way
+//=================================================================================
+QString RepairGUI_ShapeProcessDlg::getText( QWidget* theControl ) const
+{
+ if ( theControl ) {
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ) )
+ return qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->text();
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ) )
+ return qobject_cast<SalomeApp_IntSpinBox*>( theControl )->text();
+ }
+ return QString::null;
+}
+
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
bool RepairGUI_ShapeProcessDlg::isValid( QString& msg )
{
+ bool ok = true;
+ QMapIterator<QString,QStringList> aMapIter( myValMap );
+ while( aMapIter.hasNext() ) {
+ aMapIter.next();
+ const QStringList& aList = aMapIter.value();
+ QListIterator<QString> aListIter( aList );
+ while( aListIter.hasNext() ) {
+ const QString& aParam = aListIter.next();
+ QWidget* aControl = getControl( aParam );
+ if ( qobject_cast<SalomeApp_DoubleSpinBox*>( aControl ) )
+ ok = qobject_cast<SalomeApp_DoubleSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
+ else if ( qobject_cast<SalomeApp_IntSpinBox*>( aControl ) )
+ ok = qobject_cast<SalomeApp_IntSpinBox*>( aControl )->isValid( msg, !IsPreview() ) && ok;
+ }
+ }
+
bool error = false;
GEOM::string_array_var anOperators = getActiveOperators();
if ( !myObjects->length() ) {
msg += tr( "ERROR_NO_OPERATORS" );
error = true;
}
- return !error;
+ return !error && ok;
}
//=================================================================================
if ( anObj->_is_nil() )
anErrorObjNames << GEOMBase::GetName( obj );
else
+ {
+ QStringList aParameters;
+
+ for ( int i = 0; i < anOperators->length(); i++ )
+ aParameters << QString( anOperators[i] );
+
+ for ( int i = 0; i < aParams->length(); i++ )
+ aParameters << QString( aParams[i] );
+
+ aParameters << getTexts( aParams );
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
objects.push_back( anObj._retn() );
+ }
}
if ( !anErrorObjNames.empty() )
return aValues._retn();
}
+//=================================================================================
+// function : getTexts
+// purpose :
+//=================================================================================
+QStringList RepairGUI_ShapeProcessDlg::getTexts( const GEOM::string_array& theParams )
+{
+ QStringList aTexts;
+
+ for ( int i = 0; i < theParams.length(); i++ ) {
+ QWidget* aCtrl = getControl( (const char*)theParams[i] );
+ if ( aCtrl )
+ {
+ QString aText = getText( aCtrl );
+ if( !aText.isNull() )
+ aTexts.append( aText );
+ }
+ }
+
+ return aTexts;
+}
+
//=================================================================================
// function : initSelection
// purpose : set selection of ALL shape types except vertexes
#include <QMap>
class DlgRef_1Sel;
-class QSpinBox;
-class QDoubleSpinBox;
+class SalomeApp_IntSpinBox;
+class SalomeApp_DoubleSpinBox;
class QComboBox;
class QCheckBox;
class QListWidget;
GEOM::string_array* getParameters( const GEOM::string_array& );
GEOM::string_array* getValues( const GEOM::string_array& );
+ QStringList getTexts( const GEOM::string_array& );
+
void enterEvent( QEvent* );
QWidget* getControl( const QString& );
void setValue( QWidget*, const QString& ); // initialize the given control in the proper way
// (analize its class and convert the value string)
QString getValue( QWidget* ) const; // retrieve value of the control in the proper way
+ QString getText( QWidget* ) const; // retrieve text of the control (for spin-boxes only)
//QDict<QString,QWidget*> myCtrlMap; // map of controls (values) of parameters
void initParamsValues(); // initialize the data structures
DlgRef_1Sel* mySelectWdgt;
QListWidget* myOpList;
- QDoubleSpinBox* myFixShapeTol3D;
- QDoubleSpinBox* myFixShapeMaxTol3D;
+ SalomeApp_DoubleSpinBox* myFixShapeTol3D;
+ SalomeApp_DoubleSpinBox* myFixShapeMaxTol3D;
- QDoubleSpinBox* myFixFaceSizeTol;
+ SalomeApp_DoubleSpinBox* myFixFaceSizeTol;
- QDoubleSpinBox* myDropSmallEdgesTol3D;
+ SalomeApp_DoubleSpinBox* myDropSmallEdgesTol3D;
- QDoubleSpinBox* mySplitAngleAngle;
- QDoubleSpinBox* mySplitAngleMaxTol;
+ SalomeApp_DoubleSpinBox* mySplitAngleAngle;
+ SalomeApp_DoubleSpinBox* mySplitAngleMaxTol;
- QSpinBox* mySplitClosedFacesNum;
+ SalomeApp_IntSpinBox* mySplitClosedFacesNum;
- QDoubleSpinBox* mySplitContTol3D;
+ SalomeApp_DoubleSpinBox* mySplitContTol3D;
QComboBox* mySplitContSurfCont;
QComboBox* mySplitContCurvCont;
QCheckBox* myBSplineSurfModeChk;
QCheckBox* myBSpline3DCurveChk;
QCheckBox* myBSpline2DCurveChk;
- QDoubleSpinBox* myBSplineTol3D;
- QDoubleSpinBox* myBSplineTol2D;
- QSpinBox* myBSplineDegree;
- QSpinBox* myBSplineSegments;
+ SalomeApp_DoubleSpinBox* myBSplineTol3D;
+ SalomeApp_DoubleSpinBox* myBSplineTol2D;
+ SalomeApp_IntSpinBox* myBSplineDegree;
+ SalomeApp_IntSpinBox* myBSplineSegments;
QComboBox* myBSpline2DCont;
QComboBox* myBSpline3DCont;
QCheckBox* myToBezierSurfModeChk;
QCheckBox* myToBezier3DCurveChk;
QCheckBox* myToBezier2DCurveChk;
- QDoubleSpinBox* myToBezierMaxTol;
+ SalomeApp_DoubleSpinBox* myToBezierMaxTol;
- QDoubleSpinBox* mySameParameterTol3D;
+ SalomeApp_DoubleSpinBox* mySameParameterTol3D;
private slots:
void onOk();