def writeXMLObject(absoluteFolderDirectory, derivation, fileNames, target, xmlObject):
 extension = evaluate.getEvaluatedString(xmlObject.getFabricationExtension(), derivation.elementNode, 'extension')
 fileNameRoot = derivation.fileName
 if (fileNameRoot == ''):
  fileNameRoot = evaluate.getEvaluatedString('', target, 'name')
  fileNameRoot = evaluate.getEvaluatedString(fileNameRoot, target, 'id')
  fileNameRoot += derivation.suffix
 fileName = ('%s.%s' % (fileNameRoot, extension))
 suffixIndex = 2
 while (fileName in fileNames):
  fileName = ('%s_%s.%s' % (fileNameRoot, suffixIndex, extension))
  suffixIndex += 1
 absoluteFileName = os.path.join(absoluteFolderDirectory, fileName)
 fileNames.append(fileName)
 archive.makeDirectory(absoluteFolderDirectory)
 if (not derivation.writeMatrix):
  xmlObject.matrix4X4 = matrix.Matrix()
 print 'The write tool generated the file:'
 print absoluteFileName
 archive.writeFileText(absoluteFileName, xmlObject.getFabricationText(derivation.addLayerTemplate))

def writeXMLObject ( absoluteFolderDirectory , derivation , fileNames , target , xmlObject ) : extension = evaluate . getEvaluatedString ( xmlObject . getFabricationExtension ( ) , derivation . elementNode , 'extension' ) fileNameRoot = derivation . fileName if ( fileNameRoot == '' ) : fileNameRoot = evaluate . getEvaluatedString ( '' , target , 'name' ) fileNameRoot = evaluate . getEvaluatedString ( fileNameRoot , target , 'id' ) fileNameRoot += derivation . suffix fileName = ( '%s.%s' % ( fileNameRoot , extension ) ) suffixIndex = 2 while ( fileName in fileNames ) : fileName = ( '%s_%s.%s' % ( fileNameRoot , suffixIndex , extension ) ) suffixIndex += 1 absoluteFileName = os . path . join ( absoluteFolderDirectory , fileName ) fileNames . append ( fileName ) archive . makeDirectory ( absoluteFolderDirectory ) if ( not derivation . writeMatrix ) : xmlObject . matrix4X4 = matrix . Matrix ( ) print 'The write tool generated the file:' print absoluteFileName archive . writeFileText ( absoluteFileName , xmlObject . getFabricationText ( derivation . addLayerTemplate ) )
write one instance of the xmlobject .