#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeStringArray.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Entity.h>
if (!myModules.empty())
aFile << std::endl;
- aFile << "import model" << std::endl << std::endl;
+ aFile << "from salome.shaper import model" << std::endl << std::endl;
aFile << "model.begin()" << std::endl;
// dump collected data
ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const FeaturePtr& theEntity)
{
+ bool isFound = myNames.find(theEntity) != myNames.end();
myDumpBuffer << name(theEntity);
- bool isUserDefinedName = !myNames[theEntity].myIsDefault;
- // store results if they have user-defined names or colors
- std::list<ResultPtr> aResultsWithNameOrColor;
- const std::list<ResultPtr>& aResults = theEntity->results();
- std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
- for (; aResIt != aResults.end(); ++aResIt)
- if (!myNames[*aResIt].myIsDefault || !isDefaultColor(*aResIt) || !isDefaultDeflection(*aResIt))
- aResultsWithNameOrColor.push_back(*aResIt);
- // store just dumped entity to stack
- myEntitiesStack.push(LastDumpedEntity(theEntity, isUserDefinedName, aResultsWithNameOrColor));
+ if (!isFound) {
+ bool isUserDefinedName = !myNames[theEntity].myIsDefault;
+ // store results if they have user-defined names or colors
+ std::list<ResultPtr> aResultsWithNameOrColor;
+ const std::list<ResultPtr>& aResults = theEntity->results();
+ std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+ for (; aResIt != aResults.end(); ++aResIt)
+ if (!myNames[*aResIt].myIsDefault || !isDefaultColor(*aResIt) ||
+ !isDefaultDeflection(*aResIt))
+ aResultsWithNameOrColor.push_back(*aResIt);
+ // store just dumped entity to stack
+ myEntitiesStack.push(
+ LastDumpedEntity(theEntity, isUserDefinedName, aResultsWithNameOrColor));
+ }
// remove entity from the list of not dumped items
myNotDumpedEntities.erase(theEntity);
break;
}
}
- myDumpBuffer << name(aFeature) << ".result()[" << anIndex << "]";
+
+ myDumpBuffer << name(aFeature);
+ if(anIndex == 0) {
+ myDumpBuffer << ".result()";
+ } else {
+ myDumpBuffer << ".results()[" << anIndex << "]";
+ }
return *this;
}
return *this;
}
+ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
+ const std::shared_ptr<ModelAPI_AttributeStringArray>& theArray)
+{
+ myDumpBuffer<<"[";
+ for(int anIndex = 0; anIndex < theArray->size(); ++anIndex) {
+ if (anIndex != 0)
+ myDumpBuffer<<", ";
+
+ myDumpBuffer<<"\""<<theArray->value(anIndex)<<"\"";
+ }
+
+ myDumpBuffer<<"]";
+ return *this;
+}
+
/// Dump std::endl
-MODELHIGHAPI_EXPORT
ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper,
std::basic_ostream<char>& (*theEndl)(std::basic_ostream<char>&))
{