return aDocID.IntegerValue();
}
-void ProcessFunction(Handle(GEOM_Function)& theFunction,
- TCollection_AsciiString& theScript,
- TColStd_MapOfTransient& theProcessed);
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
+ TCollection_AsciiString& theScript,
+ TColStd_MapOfTransient& theProcessed);
Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
//=============================================================================
GEOM_Engine* GEOM_Engine::GetEngine() { return TheEngine; }
-
//=============================================================================
/*!
* SetEngine
* Destructor
*/
GEOM_Engine::~GEOM_Engine()
-{
+{
GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient It(_objects);
- for(; It.More(); It.Next())
+ for(; It.More(); It.Next())
{
RemoveObject(Handle(GEOM_Object)::DownCast(It.Value()));
}
* AddSubShape
*/
//=============================================================================
-Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
- Handle(TColStd_HArray1OfInteger) theIndices,
- bool isStandaloneOperation)
+Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
+ Handle(TColStd_HArray1OfInteger) theIndices,
+ bool isStandaloneOperation)
{
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
_objects.Bind(anID, anObject);
GEOM::TPythonDump pd (aFunction);
-
+
if (isStandaloneOperation) {
pd << anObject << " = geompy.GetSubShape(" << theMainShape << ", [";
Standard_Integer i = theIndices->Lower(), up = theIndices->Upper();
Handle(TDataStd_TreeNode) aNode;
for (int i = 1; i<=nb; i++) {
Handle(GEOM_Function) aFunction = theObject->GetFunction(i);
- if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
+ if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
aNode->Remove();
}
*/
//=============================================================================
TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
- Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
- bool isPublished,
- bool& aValidScript)
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+ bool isPublished,
+ bool& aValidScript)
{
TCollection_AsciiString aScript;
Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
if (aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
- aScript = "import geompy\n";
+ aScript = "import geompy\n";
aScript += "import math\n";
aScript += "import SALOMEDS\n\n";
aScript += "def RebuildData(theStudy):";
aScript += "\n\tgeompy.init_geom(theStudy)";
- Standard_Integer posToInertGlobalVars = aScript.Length() + 1;
+ Standard_Integer posToInsertGlobalVars = aScript.Length() + 1;
Handle(TDataStd_TreeNode) aNode, aRoot;
Handle(GEOM_Function) aFunction;
aNode = Itr.Value();
aFunction = GEOM_Function::GetFunction(aNode->Label());
if (aFunction.IsNull()) {
- MESSAGE ( "Null function !!!!" );
- continue;
+ MESSAGE ( "Null function !!!!" );
+ continue;
}
ProcessFunction(aFunction, aScript, aMap);
}
aCommand += "addToStudy( ";
if ( anEntryToBadName.IsBound( aEntry ))
aCommand += aName + ", \"" + anEntryToBadName( aEntry ) + "\" )";
- else
+ else
aCommand += aName + ", \"" + aName + "\" )";
// bind a command to the last digit of the entry
}
if ( !globalVars.IsEmpty() ) {
globalVars.Insert( 1, "\n\tglobal " );
- anUpdatedScript.Insert( posToInertGlobalVars, globalVars );
+ anUpdatedScript.Insert( posToInsertGlobalVars, globalVars );
}
return anUpdatedScript;
//=======================================================================
//function : GetDumpName
-//purpose :
+//purpose :
//=======================================================================
const char* GEOM_Engine::GetDumpName (const char* theStudyEntry) const
//=======================================================================
//function : GetAllDumpNames
-//purpose :
+//purpose :
//=======================================================================
Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const
//===========================================================================
// Internal functions
//===========================================================================
-void ProcessFunction(Handle(GEOM_Function)& theFunction,
- TCollection_AsciiString& theScript,
- TColStd_MapOfTransient& theProcessed)
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
+ TCollection_AsciiString& theScript,
+ TColStd_MapOfTransient& theProcessed)
{
if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
TDF_LabelSequence aSeq;
theFunction->GetDependency(aSeq);
Standard_Integer aLen = aSeq.Length();
- for(Standard_Integer i = 1; i<= aLen; i++) {
+ for(Standard_Integer i = 1; i <= aLen; i++) {
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
if(aFunction.IsNull()) continue;
ProcessFunction(aFunction, theScript, theProcessed);
}
*/
+ // pass functions, that depends on nonexisting ones
+ //jfa:test//bool doComment = false;
+ TDF_LabelSequence aSeq;
+ theFunction->GetDependency(aSeq);
+ Standard_Integer aLen = aSeq.Length();
+ //jfa:test//for (Standard_Integer i = 1; i <= aLen && !doComment; i++) {
+ for (Standard_Integer i = 1; i <= aLen; i++) {
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
+ //jfa:test//if (aFunction.IsNull()) doComment = true;
+ //jfa:test//else if (!theProcessed.Contains(aFunction)) doComment = true;
+ if (aFunction.IsNull()) return;
+ if (!theProcessed.Contains(aFunction)) return;
+ }
+
TCollection_AsciiString aDescr = theFunction->GetDescription();
if(aDescr.Length() == 0) {
//cout << "Warning: the function has no description" << endl;
return;
}
+
//Check if its internal function which doesn't requires dumping
if(aDescr == "None") return;
theScript += "\n\t";
+ //jfa:test//if (doComment) theScript += "#";
theScript += aDescr;
-
+
theProcessed.Add(theFunction);
- return;
}
//=============================================================================
int c = (int)arr[i];
j = i+1;
if(c >= 48 && c <= 57) { //Is digit?
-
+
isFound = Standard_False;
while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
- c = (int)arr[j++];
- if(c == 58) isFound = Standard_True;
+ c = (int)arr[j++];
+ if(c == 58) isFound = Standard_True;
}
-
+
if(isFound && arr[j-2] != 58) { // last char should be a diggit
- aSeq->Append(i+1); // +1 because AsciiString starts from 1
- aSeq->Append(j-1);
+ aSeq->Append(i+1); // +1 because AsciiString starts from 1
+ aSeq->Append(j-1);
}
}
-
+
i = j;
}