_type = PARAM_ALGO;
_shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter
+ _parameters = string();
}
//=============================================================================
{
_libName = string(theLibName);
}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void SMESH_Hypothesis::SetParameters(const char *theParameters)
+{
+ _parameters = string(theParameters);
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+char* SMESH_Hypothesis::GetParameters() const
+{
+ return (char*)_parameters.c_str();
+}
virtual const char* GetLibName() const;
void SetLibName(const char* theLibName);
+ void SetParameters(const char *theParameters);
+ char* GetParameters() const;
+
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
private:
std::string _libName;
+ std::string _parameters;
};
#endif
{
theGen = new _pyGen( theEntry2AccessorMethod );
- SMESH_NoteBook * aNoteBook = new SMESH_NoteBook( theGen );
+ SMESH_NoteBook * aNoteBook = new SMESH_NoteBook();
- // split theScript into separate commands
int from = 1, end = theScript.Length(), to;
while ( from < end && ( to = theScript.Location( "\n", from, end )))
+ {
+ if ( to != from )
+ // cut out and store a command
+ aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
+ from = to + 1;
+ }
+
+ aNoteBook->ReplaceVariables();
+
+ TCollection_AsciiString aNoteScript = aNoteBook->GetResultScript();
+ delete aNoteBook;
+ aNoteBook = 0;
+
+ // split theScript into separate commands
+ from = 1, end = aNoteScript.Length();
+ while ( from < end && ( to = aNoteScript.Location( "\n", from, end )))
{
if ( to != from )
// cut out and store a command
- theGen->AddCommand( aNoteBook->ReplaceVariables(theScript.SubString( from, to - 1 )));
+ theGen->AddCommand( aNoteScript.SubString( from, to - 1 ));
from = to + 1;
}
// finish conversion
bool AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const;
bool AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const;
const char* AccessorMethod() const;
- const std::map< _pyID, Handle(_pyMeshEditor) >& getMeshEditors() const { return myMeshEditors; }
private:
std::map< _pyID, Handle(_pyMesh) > myMeshes;
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
char* GetParameters(CORBA::Object_ptr theObject);
+ char* ParseParameters(const char* theParameters);
private:
SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
if(aSObj->_is_nil())
return;
-
+
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
- TCollection_AsciiString aNewParams;
- TCollection_AsciiString anInputParams;
- SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(theParameters);
-
SALOMEDS::GenericAttribute_var anAttr;
anAttr = aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString");
SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
+
+ TCollection_AsciiString aNewParams;
TCollection_AsciiString aOldParameters(aStringAttr->Value());
- SALOMEDS::ListOfStrings aVars= aSections[0];
- for(int i=0;i<aVars.length();i++ ) {
- anInputParams += aStudy->IsVariable(aVars[i].in()) ?
- TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
- if(i != aVars.length()-1)
- anInputParams+=":";
- }
+ TCollection_AsciiString anInputParams(ParseParameters(theParameters));
+
if(!aOldParameters.Length())
aNewParams = anInputParams;
else
aNewParams = aOldParameters+"|"+anInputParams;
-
+
aStringAttr->SetValue( aNewParams.ToCString() );
}
+//=======================================================================
+//function : GetParameters
+//purpose :
+//=======================================================================
+char* SMESH_Gen_i::ParseParameters(const char* theParameters)
+{
+ const char* aParameters = CORBA::string_dup(theParameters);
+ TCollection_AsciiString anInputParams;
+ SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
+ if( !aStudy->_is_nil() ) {
+ SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
+ if(aSections->length() > 0) {
+ SALOMEDS::ListOfStrings aVars= aSections[0];
+ for(int i=0;i<aVars.length();i++ ) {
+ anInputParams += aStudy->IsVariable(aVars[i].in()) ?
+ TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
+ if(i != aVars.length()-1)
+ anInputParams+=":";
+ }
+ }
+ }
+ return CORBA::string_dup(anInputParams.ToCString());
+}
//=======================================================================
//function : GetParameters
return myBaseImpl->GetID();
}
+//=============================================================================
+/*!
+ * SMESH_Hypothesis_i::IsPublished()
+ *
+ */
+//=============================================================================
+bool SMESH_Hypothesis_i::IsPublished(){
+ bool res = false;
+ SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
+ if(gen){
+ SALOMEDS::SObject_var SO =
+ SMESH_Gen_i::ObjectToSObject(gen->GetCurrentStudy() , SMESH::SMESH_Hypothesis::_narrow(_this()));
+ res = !SO->_is_nil();
+ }
+ return res;
+}
+
//=============================================================================
/*!
* SMESH_Hypothesis_i::SetParameters()
//=============================================================================
void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
{
- SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Hypothesis::_narrow(_this()),
- CORBA::string_dup(theParameters));
+ SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
+ char * aParameters = CORBA::string_dup(theParameters);
+ if(gen){
+ if(IsPublished()) {
+ SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Hypothesis::_narrow(_this()),aParameters);
+ }
+ else {
+ myBaseImpl->SetParameters(gen->ParseParameters(aParameters));
+ }
+ }
}
//=============================================================================
char* SMESH_Hypothesis_i::GetParameters()
{
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
- return CORBA::string_dup(gen->GetParameters(SMESH::SMESH_Hypothesis::_narrow(_this())));
+ char* aResult;
+ if(IsPublished()) {
+ MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get Parameters from SObject");
+ aResult = gen->GetParameters(SMESH::SMESH_Hypothesis::_narrow(_this()));
+ }
+ else {
+ MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get local parameters");
+ aResult = myBaseImpl->GetParameters();
+ }
+ return CORBA::string_dup(aResult);
}
//=============================================================================
// Get unique id of hypothesis
CORBA::Long GetId();
-
+
// Set list of parameters separated by ":" symbol, used for Hypothesis creation
void SetParameters (const char* theParameters);
//Return list of last notebook variables used for Hypothesis creation.
SMESH::ListOfParameters* GetLastParameters();
-
+
+ //Return true if hypothesis was published in study
+ bool IsPublished();
+
// Get implementation
::SMESH_Hypothesis* GetImpl();
#include <string>
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#else
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
#endif
using namespace std;
return _type;
}
+
+//================================================================================
+/*!
+ * \brief Constructor
+ */
+//================================================================================
+LayerDistributionStates::LayerDistributionStates():
+ ObjectStates("LayerDistribution")
+{
+}
+//================================================================================
+/*!
+ * \brief Destructor
+ */
+//================================================================================
+LayerDistributionStates::~LayerDistributionStates()
+{
+}
+
+
+//================================================================================
+/*!
+ * \brief AddDistribution
+ */
+//================================================================================
+void LayerDistributionStates::AddDistribution(const TCollection_AsciiString& theDistribution)
+{
+ _distributions.insert(pair<TCollection_AsciiString,TCollection_AsciiString>(theDistribution,""));
+}
+
+//================================================================================
+/*!
+ * \brief HasDistribution
+ */
+//================================================================================
+bool LayerDistributionStates::HasDistribution(const TCollection_AsciiString& theDistribution) const
+{
+ return _distributions.find(theDistribution) != _distributions.end();
+}
+
+//================================================================================
+/*!
+ * \brief SetDistributionType
+ */
+//================================================================================
+bool LayerDistributionStates::SetDistributionType(const TCollection_AsciiString& theDistribution,
+ const TCollection_AsciiString& theType)
+{
+ TDistributionMap::iterator it = _distributions.find(theDistribution);
+ if(it == _distributions.end())
+ return false;
+ (*it).second = theType;
+ return true;
+}
+
+//================================================================================
+/*!
+ * \brief GetDistributionType
+ */
+//================================================================================
+TCollection_AsciiString LayerDistributionStates::
+GetDistributionType(const TCollection_AsciiString& theDistribution) const
+{
+ TDistributionMap::const_iterator it = _distributions.find(theDistribution);
+ return (it == _distributions.end()) ? TCollection_AsciiString() : (*it).second;
+}
+
//================================================================================
/*!
* \brief Constructor
*/
//================================================================================
-SMESH_NoteBook::SMESH_NoteBook(Handle(_pyGen) theGen):
- myGen( theGen )
+SMESH_NoteBook::SMESH_NoteBook()
{
InitObjectMap();
}
* \retval TCollection_AsciiString - Convertion result
*/
//================================================================================
-TCollection_AsciiString SMESH_NoteBook::ReplaceVariables(const TCollection_AsciiString& theString) const
+void SMESH_NoteBook::ReplaceVariables()
{
- _pyCommand aCmd( theString, -1);
- TCollection_AsciiString aMethod = aCmd.GetMethod();
- TCollection_AsciiString aObject = aCmd.GetObject();
- TCollection_AsciiString aResultValue = aCmd.GetResultValue();
- if(aMethod.IsEmpty())
- return theString;
-
- // check if method modifies the object itself
- TVariablesMap::const_iterator it = _objectMap.find(aObject);
- if(it == _objectMap.end()) // check if method returns a new object
- it = _objectMap.find(aResultValue);
-
- if(it == _objectMap.end()) { // check if method modifies a mesh using mesh editor
- const std::map< _pyID, Handle(_pyMeshEditor) >& aMeshEditors = myGen->getMeshEditors();
- std::map< _pyID, Handle(_pyMeshEditor) >::const_iterator meIt = aMeshEditors.find(aObject);
- if(meIt != aMeshEditors.end()) {
- Handle(_pyMeshEditor) aMeshEditor = (*meIt).second;
- if(!aMeshEditor.IsNull()) {
- Handle(_pyCommand) aCreationCommand = aMeshEditor->GetCreationCmd();
- if(!aCreationCommand.IsNull()) {
- TCollection_AsciiString aMesh = aCreationCommand->GetObject();
- it = _objectMap.find(aMesh);
- }
+
+ for(int i=0;i<_commands.size();i++) {
+ Handle(_pyCommand) aCmd = _commands[i];
+ TCollection_AsciiString aMethod = aCmd->GetMethod();
+ TCollection_AsciiString aObject = aCmd->GetObject();
+ TCollection_AsciiString aResultValue = aCmd->GetResultValue();
+ if(MYDEBUG) {
+ cout<<"Command before : "<< aCmd->GetString()<<endl;
+ cout<<"Method : "<< aMethod<<endl;
+ cout<<"Object : "<< aObject<<endl;
+ cout<<"Result : "<< aResultValue<<endl;
+ }
+
+ // check if method modifies the object itself
+ TVariablesMap::const_iterator it = _objectMap.find(aObject);
+ if(it == _objectMap.end()) // check if method returns a new object
+ it = _objectMap.find(aResultValue);
+
+ if(it == _objectMap.end()) { // check if method modifies a mesh using mesh editor
+ TMeshEditorMap::const_iterator meIt = myMeshEditors.find(aObject);
+ if(meIt != myMeshEditors.end()) {
+ TCollection_AsciiString aMesh = (*meIt).second;
+ it = _objectMap.find(aMesh);
}
}
- }
-
- if(it != _objectMap.end()) {
- ObjectStates *aStates = (*it).second;
- if(MYDEBUG)
- cout<<"SMESH_NoteBook::ReplaceVariables :Object Type : "<<aStates->GetObjectType()<<endl;
- if(aStates->GetObjectType().IsEqual("LocalLength")) {
- if(aMethod.IsEqual("SetLength")) {
- if(!aStates->GetCurrectState().at(0).IsEmpty() )
- aCmd.SetArg(1,aStates->GetCurrectState().at(0));
- aStates->IncrementState();
+
+ if(it != _objectMap.end() && !aMethod.IsEmpty()) {
+ ObjectStates *aStates = (*it).second;
+ // Case for LocalLength hypothesis
+ if(aStates->GetObjectType().IsEqual("LocalLength")) {
+ if(aMethod.IsEqual("SetLength")) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("SetPrecision")) {
+ if(!aStates->GetCurrectState().at(1).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(1));
+ aStates->IncrementState();
+ }
}
- else if(aMethod.IsEqual("SetPrecision")) {
- if(!aStates->GetCurrectState().at(1).IsEmpty() )
- aCmd.SetArg(1,aStates->GetCurrectState().at(1));
- aStates->IncrementState();
+
+ // Case for SegmentLengthAroundVertex hypothesis
+ else if(aStates->GetObjectType().IsEqual("SegmentLengthAroundVertex")) {
+ if(aMethod == "SetLength") {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
}
- }
- else if(aStates->GetObjectType().IsEqual("Mesh")) {
- if(aMethod.IsEqual("Translate") ||
- aMethod.IsEqual("TranslateMakeGroups") ||
- aMethod.IsEqual("TranslateMakeMesh")) {
- bool isVariableFound = false;
- int anArgIndex = 0;
- for(int i = 1, n = aCmd.GetNbArgs(); i <= n; i++) {
- if(aCmd.GetArg(i).IsEqual("SMESH.PointStruct")) {
- anArgIndex = i+1;
- break;
- }
- }
- if(anArgIndex > 0) {
- for(int j = 0; j <= 2; j++) {
- if(!aStates->GetCurrectState().at(j).IsEmpty()) {
- isVariableFound = true;
- aCmd.SetArg(anArgIndex+j, aStates->GetCurrectState().at(j));
- }
- }
- }
- if(isVariableFound) {
- aCmd.SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
- aCmd.SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
- }
- aStates->IncrementState();
+ // Case for LayerDistribution hypothesis (not finished yet)
+ else if(aStates->GetObjectType() == "LayerDistribution") {
+ if(aMethod == "SetLayerDistribution"){
+ LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
+ aLDStates->AddDistribution(aCmd->GetArg(1));
+ }
}
+
+ else if(aStates->GetObjectType().IsEqual("Mesh")) {
+ if(aMethod.IsEqual("Translate") ||
+ aMethod.IsEqual("TranslateMakeGroups") ||
+ aMethod.IsEqual("TranslateMakeMesh")) {
+ bool isVariableFound = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
+ anArgIndex = i+1;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ for(int j = 0; j <= 2; j++) {
+ if(!aStates->GetCurrectState().at(j).IsEmpty()) {
+ isVariableFound = true;
+ aCmd->SetArg(anArgIndex+j, aStates->GetCurrectState().at(j));
+ }
+ }
+ }
+ if(isVariableFound) {
+ aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
+ aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
+ }
+ aStates->IncrementState();
+ }
+ }
+ }
+ if(MYDEBUG) {
+ cout<<"Command after: "<< aCmd->GetString()<<endl;
}
- return aCmd.GetString();
}
-
- return theString;
+ // ProcessLayerDistribution();
}
//================================================================================
/*!
}
if(MYDEBUG)
cout<<"The object Type : "<<anObjType<<endl;
+ ObjectStates *aState = NULL;
+ if(anObjType == "LayerDistribution")
+ aState = new LayerDistributionStates();
+ else
+ aState = new ObjectStates(anObjType);
- ObjectStates *aState = new ObjectStates(anObjType);
for(int i = 0; i < aSections->length(); i++) {
TState aVars;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
}
}
}
+
+//================================================================================
+/*!
+ *
+ */
+//================================================================================
+void SMESH_NoteBook::AddCommand(const TCollection_AsciiString& theString)
+{
+ Handle(_pyCommand) aCommand = new _pyCommand( theString, -1);
+ _commands.push_back(aCommand);
+
+ if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
+ myMeshEditors.insert( make_pair( aCommand->GetResultValue(),
+ aCommand->GetObject() ) );
+ }
+}
+
+//================================================================================
+/*!
+ *
+ */
+//================================================================================
+void SMESH_NoteBook::ProcessLayerDistribution()
+{
+ // 1) Find all LayerDistribution states
+ vector<LayerDistributionStates*> aLDS;
+ TVariablesMap::const_iterator it = _objectMap.begin();
+ for(;it != _objectMap.end();it++)
+ if(LayerDistributionStates* aLDStates = (LayerDistributionStates*)((*it).second)) {
+ aLDS.push_back(aLDStates);
+ }
+
+ // 2) Initialize all type of 1D Distribution hypothesis
+ for(int i=0;i<_commands.size();i++){
+ for(int j =0;j < aLDS.size();j++){
+ TCollection_AsciiString aResultValue = _commands[i]->GetResultValue();
+ if(_commands[i]->GetMethod() == "CreateHypothesis" &&
+ aLDS[j]->HasDistribution(aResultValue)){
+ TCollection_AsciiString aType = _commands[i]->GetArg(1);
+ aType.RemoveAll('\'');
+ aLDS[j]->SetDistributionType(aResultValue,aType);
+ }
+ }
+ }
+ // 3) ... and replase variables ...
+
+ for(int i=0;i<_commands.size();i++){
+ for(int j =0;j < aLDS.size();j++){
+ TCollection_AsciiString anObject = _commands[i]->GetObject();
+
+ if(aLDS[j]->HasDistribution(anObject)) {
+ TCollection_AsciiString aType = aLDS[j]->GetDistributionType(anObject);
+ TCollection_AsciiString aMethod = _commands[i]->GetMethod();
+ if(aType == "LocalLength") {
+ if(aMethod == "SetLength") {
+ if(!aLDS[j]->GetCurrectState().at(0).IsEmpty() )
+ _commands[i]->SetArg(1,aLDS[j]->GetCurrectState().at(0));
+ aLDS[j]->IncrementState();
+ }
+ else if(aMethod == "SetPrecision") {
+ if(!aLDS[j]->GetCurrectState().at(1).IsEmpty() )
+ _commands[i]->SetArg(1,aLDS[j]->GetCurrectState().at(1));
+ aLDS[j]->IncrementState();
+ }
+ }
+ }
+ }
+ }
+}
+//================================================================================
+/*!
+ * \brief Return result script
+ */
+//================================================================================
+TCollection_AsciiString SMESH_NoteBook::GetResultScript() const
+{
+ TCollection_AsciiString aResult;
+ for(int i=0;i<_commands.size();i++)
+ aResult+=_commands[i]->GetString()+"\n";
+ return aResult;
+}
#include <TCollection_AsciiString.hxx>
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
+
+class _pyCommand;
#include <vector>
#include <string>
typedef std::vector<TCollection_AsciiString> TState;
typedef std::vector<TState> TAllStates;
+typedef TCollection_AsciiString _pyID;
class ObjectStates{
int _dumpstate;
};
-class SMESH_NoteBook
+class LayerDistributionStates : public ObjectStates
{
public:
- SMESH_NoteBook(Handle(_pyGen) theGen);
- ~SMESH_NoteBook();
- TCollection_AsciiString ReplaceVariables(const TCollection_AsciiString& theString) const;
+ typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
+ LayerDistributionStates();
+ ~LayerDistributionStates();
+
+ void AddDistribution(const TCollection_AsciiString& theDistribution);
+ bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
+
+ bool SetDistributionType(const TCollection_AsciiString& theDistribution,
+ const TCollection_AsciiString& theType);
+ TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
+
+private:
+
+ TDistributionMap _distributions;
+};
+
+class SMESH_NoteBook
+{
+public:
typedef std::map<TCollection_AsciiString,ObjectStates*> TVariablesMap;
+ typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
+ SMESH_NoteBook();
+ ~SMESH_NoteBook();
+ void ReplaceVariables();
+
+ void AddCommand(const TCollection_AsciiString& theString);
+ TCollection_AsciiString GetResultScript() const;
private:
void InitObjectMap();
+ void ProcessLayerDistribution();
private:
+
TVariablesMap _objectMap;
- Handle(_pyGen) myGen;
+ std::vector<Handle(_pyCommand)> _commands;
+ TMeshEditorMap myMeshEditors;
};
#endif //SMESH_NoteBook_HeaderFile
counter = counter+1
return result, strResult
+#Wrapper class for StdMeshers_LocalLength hypothesis
class LocalLength(StdMeshers._objref_StdMeshers_LocalLength):
-
+
+ ## Set length parameter value
+ # @param length numerical value or name of variable from notebook
def SetLength(self, length):
length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetLastParameters(self),2,1,length)
StdMeshers._objref_StdMeshers_LocalLength.SetParameters(self,parameters)
StdMeshers._objref_StdMeshers_LocalLength.SetLength(self,length)
+ ## Set precision parameter value
+ # @param precision numerical value or name of variable from notebook
def SetPrecision(self, precision):
precision,parameters = ParseParameters(StdMeshers._objref_StdMeshers_LocalLength.GetLastParameters(self),2,2,precision)
StdMeshers._objref_StdMeshers_LocalLength.SetParameters(self,parameters)
#Registering the new proxy for LocalLength
omniORB.registerObjref(StdMeshers._objref_StdMeshers_LocalLength._NP_RepositoryId, LocalLength)
+
+
+#Wrapper class for StdMeshers_SegmentLengthAroundVertex hypothesis
+class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex):
+ parent = StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex
+
+ ## Set length parameter value
+ # @param length numerical value or name of variable from notebook
+ def SetLength(self, length):
+ length,parameters = ParseParameters(parent.GetLastParameters(self),1,1,length)
+ parent.SetParameters(self,parameters)
+ parent.SetLength(self,length)
+
+#Registering the new proxy for LocalLength
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex._NP_RepositoryId, LocalLength)
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
+ h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
StdMeshersGUI_LayerDistributionParamWdg* w =
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
-
+
h->SetLayerDistribution( w->GetHypothesis() );
+ /* h->SetParameters(w->GetHypothesis()->GetParameters());
+ if(QString(w->GetHypothesis()->GetName()) == "LocalLength")
+ h->SetParameters(w->GetHypothesis()->GetParameters());
+ */
}
else if( hypType()=="ProjectionSource1D" )
{
}
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
+ SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
+ QString aVaribaleName;
if( hypType()=="LocalLength" )
{
StdMeshers::StdMeshers_LocalLength_var h =
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
- SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
- QString aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+ aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
item.isVariable = !aVaribaleName.isEmpty();
if(item.isVariable)
item.myValue = aVaribaleName;
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
-
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
- item.myValue = h->GetLength();
+
+ aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+ item.isVariable = !aVaribaleName.isEmpty();
+
+ if(item.isVariable)
+ item.myValue = aVaribaleName;
+ else
+ item.myValue = h->GetLength();
p.append( item );
}
else if( hypType()=="Arithmetic1D" )
p.append( item );
}
else if( hypType()=="LayerDistribution" )
- {
- StdMeshers::StdMeshers_LayerDistribution_var h =
+ {
+ StdMeshers::StdMeshers_LayerDistribution_var h =
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
+
+ //Set into not published hypo last variables
+ /* QStringList aLastVarsList;
+ for(int i = 0;i<aParameters->length();i++)
+ aLastVarsList.append(QString(aParameters[i].in()));
+
+ if(!aLastVarsList.isEmpty())
+ h->GetLayerDistribution()->SetParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
+ */
customWidgets()->append
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
}