Dump Python extension

This commit is contained in:
ouv 2008-12-03 10:59:05 +00:00
parent 4e59c10eaf
commit a320c15fce
44 changed files with 337 additions and 170 deletions

View File

@ -289,17 +289,6 @@ module GEOM
* Aborts the previously opened transaction
*/
void AbortOperation();
/*!
* Set list of parameters
* \param theParameters is a string containing the list of parameters separated by ":" symbol
*/
void SetParameters (in string theParameters);
/*!
* Get list of parameters
*/
string GetParameters();
};
/*!

View File

@ -647,7 +647,7 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects )
QStringList aParameters;
aParameters << GroupPntVecR->SpinBox_DX->text();
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() );
if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() && !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;
break;

View File

@ -429,9 +429,9 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
aParameters<<GroupPoints->SpinBox_DY->text();
GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR );
for(int i = 0;i< aParameters.size();i++)
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !anObj->_is_nil() ) {
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
return true;

View File

@ -736,7 +736,8 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
aParameters<<myData[ DZ2 ]->text();
if ( !anObj->_is_nil() ) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}

View File

@ -652,7 +652,8 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
}
if ( !anObj->_is_nil() ) {
anObj->SetParameters(getSizeAsString().toLatin1().constData());
if ( !IsPreview() )
anObj->SetParameters(getSizeAsString().toLatin1().constData());
objects.push_back( anObj._retn() );
}
return res;

View File

@ -781,10 +781,10 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
break;
}
if(!anObj->_is_nil() && (getConstructorId()==0 ||
getConstructorId() == 1 ||
getConstructorId() == 2 ||
getConstructorId() == 4) ) {
if(!anObj->_is_nil() && !IsPreview() && (getConstructorId()==0 ||
getConstructorId() == 1 ||
getConstructorId() == 2 ||
getConstructorId() == 4) ) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}

View File

@ -494,7 +494,7 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
aParameters << GroupDimensions->SpinBox_DZ->text();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz );
if ( !anObj->_is_nil() )
if ( !anObj->_is_nil() && !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
res = true;

View File

@ -450,7 +450,8 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects )
CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter );
if ( selected.contains( QString( objStr.in() ) ) )
{
(*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
(*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( *anIter );
}
else
@ -469,7 +470,8 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects )
for ( int i = 0, n = aList->length(); i < n; i++ )
{
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aList[i] );
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back( anObj._retn() );
}
}

View File

@ -581,7 +581,7 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
MakeMultiTransformation1D(myShape,
myFaces[Face1], myFaces[Face2],
mySpinBox[SpinBox1]->value());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << "" << "";
@ -597,7 +597,7 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects)
mySpinBox[SpinBox2U]->value(),
myFaces[Face1V], myFaces[Face2V],
mySpinBox[SpinBox2V]->value());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << "" << "";

View File

@ -804,7 +804,14 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
Standard_Integer aEndCommandPos = aStartCommandPos + aCommand.Length();
//Get Entry of the result object
TCollection_AsciiString anEntry = aCommand.Token("=",1);
TCollection_AsciiString anEntry;
if( aCommand.Search("=") != -1 ) // command returns an object
anEntry = aCommand.Token("=",1);
else { // command modifies the object
int aStartEntryPos = aCommand.Location(1,'(',1,aCommand.Length());
int aEndEntryPos = aCommand.Location(1,',',aStartEntryPos,aCommand.Length());
anEntry = aCommand.SubString(aStartEntryPos+1, aEndEntryPos-1);
}
//Remove white spaces
anEntry.RightAdjust();
@ -827,18 +834,20 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
}
//Find variables used for object construction
vector<TVariable> aVariables;
ObjectStates* aStates = 0;
TVariablesList::const_iterator it = theVariables.find(anEntry);
if( it != theVariables.end() )
aVariables = (*it).second;
if( it != theVariables.end() )
aStates = (*it).second;
if(aVariables.empty()) {
if(!aStates) {
if(MYDEBUG)
cout<<"Valiables list empty!!!"<<endl;
aCommandIndex++;
continue;
}
TState aVariables = aStates->GetCurrectState();
if(MYDEBUG) {
cout<<"Variables from SObject:"<<endl;
for (int i = 0; i < aVariables.size();i++)
@ -977,7 +986,7 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
} // end of specific case for sketcher
//If parameter is entry or 'None', skip it
if(theVariables.find(aVar) != theVariables.end() || aVar == PY_NULL)
if(theVariables.find(aVar) != theVariables.end() || aVar.Search(":") != -1 || aVar == PY_NULL)
continue;
if(iVar >= aVariables.size())
@ -1003,8 +1012,63 @@ void ReplaceVariables(TCollection_AsciiString& theCommand,
theCommand.Insert(aStartCommandPos, aCommand);
aCommandIndex++;
aStates->IncrementState();
}
if (MYDEBUG)
cout<<"Command : "<<theCommand<<endl;
}
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
ObjectStates::ObjectStates()
{
_dumpstate = 0;
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
ObjectStates::~ObjectStates()
{
}
//================================================================================
/*!
* \brief Return current object state
* \retval state - Object state (vector of notebook variable)
*/
//================================================================================
TState ObjectStates::GetCurrectState() const
{
if(_states.size() > _dumpstate)
return _states[_dumpstate];
return TState();
}
//================================================================================
/*!
* \brief Add new object state
* \param theState - Object state (vector of notebook variable)
*/
//================================================================================
void ObjectStates::AddState(const TState &theState)
{
_states.push_back(theState);
}
//================================================================================
/*!
* \brief Increment object state
*/
//================================================================================
void ObjectStates::IncrementState()
{
_dumpstate++;
}

View File

@ -44,7 +44,27 @@ struct TVariable{
isVariable(theFlag){}
};
typedef std::map<TCollection_AsciiString, std::vector<TVariable> > TVariablesList;
typedef std::vector<TVariable> TState;
typedef std::vector<TState> TAllStates;
class ObjectStates
{
public:
ObjectStates();
~ObjectStates();
TAllStates GetAllStates() const { return _states; }
TState GetCurrectState() const;
void AddState(const TState &theState);
void IncrementState();
private:
TAllStates _states;
int _dumpstate;
};
typedef std::map<TCollection_AsciiString, ObjectStates* > TVariablesList;
class GEOM_Engine
{

View File

@ -65,16 +65,6 @@ class GEOM_IOperations
return (char*) _errorCode.ToCString();
}
//Sets a parameters of the operation
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters) {
_parameters = theParameters;
}
//Returns a parameters of the operation
Standard_EXPORT char* GetParameters() {
return (char*) _parameters.ToCString();
}
//Returns a pointer to GEOM_Engine which this operation interface is associated
Standard_EXPORT GEOM_Engine* GetEngine() { return _engine; }

View File

@ -380,6 +380,31 @@ TCollection_AsciiString GEOM_Object::GetAuxData()
return aData;
}
//=============================================================================
/*!
* SetParameters
*/
//=============================================================================
void GEOM_Object::SetParameters(const TCollection_AsciiString& theParameters)
{
if( _parameters.IsEmpty() )
_parameters = theParameters;
else {
_parameters += "|";
_parameters += theParameters;
}
}
//=============================================================================
/*!
* GetParameters
*/
//=============================================================================
TCollection_AsciiString GEOM_Object::GetParameters() const
{
return _parameters;
}
//=============================================================================
/*!

View File

@ -220,12 +220,10 @@ class GEOM_Object : public MMgt_TShared
Standard_EXPORT TCollection_AsciiString GetAuxData();
//Set a notebook variables used for object creation
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters)
{_parameters = theParameters;}
Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters);
//Get a notebook variables used for object creation
Standard_EXPORT TCollection_AsciiString GetParameters() const
{return _parameters;}
Standard_EXPORT TCollection_AsciiString GetParameters() const;
//###########################################################
// Sub shape methods

View File

@ -31,6 +31,7 @@
#include <SalomeApp_Application.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Study.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_Desktop.h>
@ -131,23 +132,21 @@ void GEOMBase_Skeleton::Init()
myMainFrame->GroupBoxPublish->hide();
}
//=================================================================================
// function : initSpinBox()
// purpose :
//=================================================================================
void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
int min, int max, int step )
{
spinBox->setRange( min, max );
spinBox->setSingleStep( step );
}
// TODO: to replace these method:
void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox,
double min, double max,
double step, int 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 );
spinBox->setSingleStep( step );
}
// TODO: by the following:
//=================================================================================
// function : initSpinBox()
// purpose :
//=================================================================================
void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
double min, double max,
double step, int decimals )
@ -159,6 +158,33 @@ void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
spinBox->setSingleStep( step );
}
//=================================================================================
// function : updateAttributes()
// purpose : Workaround for Translation and Rotation operations with unchecked option "Create a copy".
// In this case PublishInStudy isn't called, so we need to update object's attributes manually
//=================================================================================
void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj,
const QStringList& theParameters)
{
SALOMEDS::Study_var aStudy = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS());
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry());
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString");
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
std::string aValue = aStringAttrib->Value();
if( aValue != "" )
aValue += "|";
for( int i = 0, n = theParameters.count(); i < n; i++ ) {
std::string aParameter = theParameters[i].toStdString();
if(aStudy->IsVariable(aParameter.c_str()))
aValue += aParameter;
if(i != n-1)
aValue += ":";
}
aStringAttrib->SetValue(aValue.c_str());
}
//=================================================================================
// function : ClickOnCancel()
// purpose :

View File

@ -60,11 +60,10 @@ private:
protected:
void initSpinBox( QSpinBox*, int, int, int = 1 );
// TODO: to replace these method:
void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 );
// TODO: by the following:
void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 );
void updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& );
void closeEvent( QCloseEvent* );
void keyPressEvent( QKeyEvent* );

View File

@ -178,7 +178,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ
}
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ("
GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ("
<< theObject << ", " << theX << ", " << theY << ", " << theZ << ")";
SetErrorCode(OK);
@ -465,7 +465,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance
return aCopy;
}
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVectorDistance("
GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance("
<< theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")";
SetErrorCode(OK);
return theObject;
@ -1383,7 +1383,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t
}
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject
GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject
<< ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
SetErrorCode(OK);

View File

@ -70,20 +70,22 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
//Find attribute with list of used notebook variables
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeString_var anAttrStr;
vector<TVariable> aVariables;
if(aValue->FindAttribute(anAttr,"AttributeString")){
anAttrStr = SALOMEDS::AttributeString::_narrow(anAttr);
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(anAttrStr->Value());
ObjectStates* aStates = new ObjectStates();
for(int i = 0; i < aSections->length(); i++) {
TState aState;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
for(int j = 0; j < aListOfVars.length(); j++) {
bool isVar = aStudy->IsVariable(aListOfVars[j].in());
TVariable aVar = TVariable( (char*)aListOfVars[j].in(), isVar );
aVariables.push_back(aVar);
aState.push_back(aVar);
}
aStates->AddState(aState);
}
aVariableMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(anEntry),aStates));
}
aVariableMap.insert(pair<TCollection_AsciiString,vector<TVariable> >((char*)anEntry,aVariables));
}
}
}

View File

@ -274,27 +274,22 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
aNameAttrib->SetValue(aShapeName.ToCString());
//Set NoteBook variables used in the object creation
bool isFound = false;
TCollection_AsciiString aVars;
SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aShape->GetParameters());
for(int i = 0, n = aSections->length(); i < n; i++) {
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
for(int j = 0, m = aListOfVars.length(); j < m; j++) {
if(theStudy->IsVariable(aListOfVars[j].in())) {
if(theStudy->IsVariable(aListOfVars[j].in()))
aVars += TCollection_AsciiString(aListOfVars[j].in());
isFound = true;
}
if(j != m-1)
aVars += ":";
}
if(i != n-1)
aVars += "|";
}
if(isFound) {
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString");
SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr);
aStringAttrib->SetValue(aVars.ToCString());
}
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);

View File

@ -68,7 +68,6 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double the
Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
GetObject(anObject)->SetParameters(GetParameters());
return GetObject(anObject);
}

View File

@ -122,26 +122,6 @@ void GEOM_IOperations_i::AbortOperation()
_impl->AbortOperation();
}
//=============================================================================
/*!
* SetParameters
*/
//=============================================================================
void GEOM_IOperations_i::SetParameters(const char* theParameters)
{
_impl->SetParameters((char*)theParameters);
}
//=============================================================================
/*!
* GetParameters
*/
//=============================================================================
char* GEOM_IOperations_i::GetParameters()
{
return CORBA::string_dup(_impl->GetParameters());
}
//=============================================================================
/*!
* GetObject

View File

@ -53,10 +53,6 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
virtual void AbortOperation();
virtual void SetParameters(const char* theParameters);
virtual char* GetParameters();
::GEOM_IOperations* GetImpl() { return _impl; }

View File

@ -2214,6 +2214,20 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
return anObj
## Translate the given object along the vector, specified by its components.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
# @return Translated GEOM_Object.
#
# @ref tui_translation "Example"
def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
# Example: see GEOM_TestAll.py
theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
anObj.SetParameters(Parameters)
RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
return anObj
## Translate the given object along the vector, specified
# by its components, creating its copy before the translation.
# @param theObject The object to be translated.
@ -2242,6 +2256,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
return anObj
## Translate the given object along the given vector on given distance.
# @param theObject The object to be translated.
# @param theVector The translation vector.
# @param theDistance The translation distance.
# @param theCopy Flag used to translate object itself or create a copy.
# @return Translated GEOM_Object.
#
# @ref tui_translation "Example"
def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
# Example: see GEOM_TestAll.py
theDistance,Parameters = ParseParameters(theDistance)
anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy)
RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Translate the given object along the given vector on given distance,
# creating its copy before the translation.
# @param theObject The object to be translated.
@ -2258,6 +2288,26 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the given axis on the given angle.
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
# @return Rotated GEOM_Object.
#
# @ref tui_rotation "Example"
def Rotate(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.Rotate(theObject, theAxis, theAngle)
RaiseIfFailed("RotateCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
## Rotate the given object around the given axis
# on the given angle, creating its copy before the rotatation.
# @param theObject The object to be rotated.

View File

@ -360,14 +360,16 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
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));
if ( !IsPreview() )
{
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() );
}

View File

@ -662,7 +662,7 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
MakePrismVecH2Ways(myBase, myVec, getHeight());
}
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
@ -693,7 +693,7 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPoints3->SpinBox_DX->text();
aParameters << GroupPoints3->SpinBox_DY->text();

View File

@ -414,10 +414,12 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
if (!anObj->_is_nil())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if (!IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back(anObj._retn());
}

View File

@ -274,12 +274,14 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects )
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));
if ( !IsPreview() )
{
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() );
}

View File

@ -899,7 +899,8 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects)
if (!anObj->_is_nil())
{
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}

View File

@ -73,13 +73,13 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI,
TextLabelNear = new QLabel( tr( "Near" ), GroupArguments );
GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 );
SpinBox_Near = new QDoubleSpinBox( GroupArguments );
SpinBox_Near = new SalomeApp_DoubleSpinBox( GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 );
TextLabelFar = new QLabel( tr( "Far" ), GroupArguments );
GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 );
SpinBox_Far = new QDoubleSpinBox( GroupArguments );
SpinBox_Far = new SalomeApp_DoubleSpinBox( GroupArguments );
GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 );
resetButton = new QPushButton( tr( "Reset" ), GroupArguments );

View File

@ -32,7 +32,7 @@ class QGroupBox;
class QLabel;
class QPushButton;
class QComboBox;
class QDoubleSpinBox;
class SalomeApp_DoubleSpinBox;
enum ViewerTypes { VTK, OCC, OTHER };
@ -58,9 +58,9 @@ private:
QGroupBox* GroupArguments;
QLabel* TextLabelNear;
QDoubleSpinBox* SpinBox_Near;
SalomeApp_DoubleSpinBox* SpinBox_Near;
QLabel* TextLabelFar;
QDoubleSpinBox* SpinBox_Far;
SalomeApp_DoubleSpinBox* SpinBox_Far;
QPushButton* resetButton;
QComboBox* TypeCB;

View File

@ -687,7 +687,8 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects)
if (!anObj->_is_nil())
{
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if (!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
}

View File

@ -467,7 +467,7 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
double z = GroupDimensions->SpinBox_DZ->value();
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();

View File

@ -470,7 +470,7 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
@ -484,7 +484,7 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();

View File

@ -464,7 +464,7 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
@ -477,7 +477,7 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeCylinderRH(getRadius(), getHeight());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();

View File

@ -575,7 +575,7 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
case 0:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskR(getRadius(), myOrientationType);
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupDimensions->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
@ -585,7 +585,7 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeDiskPntVecR(myPoint, myDir, getRadius());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPntVecR->SpinBox_DX->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));

View File

@ -497,7 +497,7 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
GroupDimensions->SpinBox_DY->value(), myOrientationType);
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupDimensions->SpinBox_DX->text();
aParameters << GroupDimensions->SpinBox_DY->text();
@ -512,7 +512,7 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
else if (GroupType->RadioButton2->isChecked())
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
aParameters << GroupPlane->SpinBox_DX->text();
aParameters << GroupPlane->SpinBox_DY->text();

View File

@ -401,7 +401,7 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
{
if ( !CORBA::is_nil( myPoint ) ) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
@ -414,7 +414,7 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
case 1 :
{
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();

View File

@ -460,7 +460,7 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text();
@ -473,7 +473,7 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
case 1:
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
MakeTorusRR(getRadius1(), getRadius2());
if (!anObj->_is_nil())
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << GroupDimensions->SpinBox_DX->text();

View File

@ -354,12 +354,14 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects )
bool aResult = !anObj->_is_nil();
if ( aResult )
{
QStringList aParameters;
aParameters << "";
aParameters << myValEdt->text();
aParameters << "";
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << "";
aParameters << myValEdt->text();
aParameters << "";
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}

View File

@ -413,7 +413,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true );
aResult = !anObj->_is_nil();
if ( aResult )
if ( aResult && !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt->text();
@ -468,10 +468,12 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
if ( aResult )
{
QStringList aParameters;
aParameters << myTolEdt2->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt2->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}

View File

@ -298,10 +298,12 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects )
aResult = !anObj->_is_nil();
if ( aResult )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
if ( !IsPreview() )
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back( anObj._retn() );
}
}

View File

@ -637,17 +637,19 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
anErrorObjNames << GEOMBase::GetName( obj );
else
{
QStringList aParameters;
if ( !IsPreview() )
{
QStringList aParameters;
for ( int i = 0; i < anOperators->length(); i++ )
aParameters << QString( anOperators[i] );
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));
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() );
}
}

View File

@ -530,6 +530,8 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
switch (getConstructorId()) {
case 0:
{
QStringList aParameters;
aParameters<<GroupPoints->SpinBox_DX->text();
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
@ -537,7 +539,7 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
objects.push_back(anObj._retn());
}
@ -548,8 +550,13 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
Rotate(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}
}
res = true;

View File

@ -581,8 +581,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZ(myObjects[i], dx, dy, dz);
if (!anObj->_is_nil())
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}
}
res = true;
@ -614,6 +619,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
case 2:
{
QStringList aParameters;
aParameters<<GroupPoints->SpinBox3->text();
bool byDistance = GroupPoints->CheckBox1->isChecked();
if (byDistance) {
double aDistance = GroupPoints->SpinBox3->value();
@ -622,9 +628,10 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
if (!anObj->_is_nil()) {
if(toCreateCopy)
if(!IsPreview())
anObj->SetParameters(GroupPoints->SpinBox3->text().toLatin1().constData());
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
}
}