Beispiel #1
0
 def toCoviseCaseFile(self, cocaseDir):
     #cocaseDir is path to which the file will be saved
     theCase = CoviseCaseFile()
     for node in self._rootNode.children():
         part = self._idPartMap[node.key()]
         item = None
         #name of data
         itemName = part.filename.lstrip('/').split('/')
         itemName.reverse()
         itemName = itemName[0]
         relPath = self.toShortPath(cocaseDir, os.path.dirname(part.filename))
         relPath = relPath + itemName
         if '2D' == part.type:
             item = CoviseCaseFileItem(part.name, GEOMETRY_2D, relPath)
         elif '3D' == part.type:
             item = CoviseCaseFileItem(part.name, GEOMETRY_3D, relPath)
         else:
             assert False
         for cnode in node.children():
             cpart = self._idPartMap[cnode.key()]
             relPath = self.toShortPath(cocaseDir, os.path.dirname(cpart.filename))
             partName = cpart.filename.lstrip('/').split('/')
             partName.reverse()
             partName = partName[0]
             relPath = relPath+partName
             if 'S' == cpart.type:
                 item.addVariableAndFilename(
                     cpart.name, relPath, SCALARVARIABLE)
             if 'V' == cpart.type:
                 item.addVariableAndFilename(
                     cpart.name, relPath, VECTOR3DVARIABLE)
         theCase.add(item)
     return theCase
Beispiel #2
0
 def convertBegin(self):
     self.cocase = CoviseCaseFile()
     if self.coCaseFile != "None":
         inputFile = open(self.coCaseFile, 'rb')
         self.cocase = pickle.load(inputFile)
         inputFile.close()
         self.cocasename = (os.path.basename(self.coCaseFile))[0:-7]
     else:
         self.cocasename=self.fileName
     logFileName = self.outputFilePath + '/' + self.cocasename + '.log'
     self.logFile = open(logFileName, 'w')
     self.logFile.write("Options:\n")
     self.logFile.write("Covise Case Name = %s\n"%(self.cocasename,))
     self.logFile.write("Covise Data Directory = %s\n"%(self.outputFilePath,))
     self.logFile.write("scale = %s\n"%(self.scale))
     self.logFile.write("\n")
     self.logFile.flush()
Beispiel #3
0
theNet = net()
theGridRCovise = RWCovise()
theDataRCovise = RWCovise()
theGridWCovise = RWCovise()
theDataWCovise = RWCovise()
theSimplify = SimplifySurface()
theNet.add(theGridRCovise)
theNet.add(theDataRCovise)
theNet.add(theGridWCovise)
theNet.add(theDataWCovise)
theNet.add(theSimplify)
theSimplify.set_percent(thePercent)
theSimplify.set_max_normaldeviation(theMaxNormalDeviation)

cocase = CoviseCaseFile()
inputFile = open(theCoCaseFileName, 'rb')
cocase = pickle.load(inputFile)
inputFile.close()

try:
    os.mkdir(os.path.dirname(theCoCaseFileName) + '/' + theOutputSubDir)
except:
    pass
shutil.copy(theCoCaseFileName,
            os.path.dirname(theCoCaseFileName) + '/' + theOutputSubDir + '/.')

i = 1
for item in cocase.items_:
    print(i, "/", len(cocase.items_), ":", item.geometryFileName_)
    if (item.dimensionality_ == GEOMETRY_2D):
Beispiel #4
0
    def startModules(self):
        #print "Ensight2CoviseGui.startModules"
        self.aErrorLogAction = ErrorLogAction()
        CoviseMsgLoop().register(self.aErrorLogAction)

        global theNet
        theNet = net()

        self.scalarVariables3DGetterAction = ChoiceGetterAction()
        self.vectorVariables3DGetterAction = ChoiceGetterAction()
        self.scalarVariables2DGetterAction = ChoiceGetterAction()
        self.vectorVariables2DGetterAction = ChoiceGetterAction()

        # MODULE: ReadEnsight
        self.ReadEnsight_1 = ReadEnsight()
        theNet.add(self.ReadEnsight_1)

        self.aPartsCollectorAction = PartsCollectorAction()
        CoviseMsgLoop().register(self.aPartsCollectorAction)

        # hang in variable-getters
        self.ReadEnsight_1.addNotifier('data_for_sdata1_3D',
                                       self.scalarVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_3D',
                                       self.vectorVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_sdata1_2D',
                                       self.scalarVariables2DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_2D',
                                       self.vectorVariables2DGetterAction)

        # set parameter values
        if self.isByteSwapped == True:
            self.ReadEnsight_1.set_data_byte_swap("TRUE")
        else:
            self.ReadEnsight_1.set_data_byte_swap("FALSE")
        self.ReadEnsight_1.set_case_file(self.fullEnsightCaseName)
        self.ReadEnsight_1.set_include_polyhedra("TRUE")
        self.ReadEnsight_1.set_enable_autocoloring("FALSE")

        # wait for choices to be updated
        self.scalarVariables3DGetterAction.waitForChoices()
        self.vectorVariables3DGetterAction.waitForChoices()
        self.scalarVariables2DGetterAction.waitForChoices()
        self.vectorVariables2DGetterAction.waitForChoices()

        # wait for the part info message
        self.aPartsCollectorAction.waitForPartsinfoFinished()

        # get variables
        self.scalarVariables3D = self.scalarVariables3DGetterAction.getChoices(
        )
        self.vectorVariables3D = self.vectorVariables3DGetterAction.getChoices(
        )
        self.scalarVariables2D = self.scalarVariables2DGetterAction.getChoices(
        )
        self.vectorVariables2D = self.vectorVariables2DGetterAction.getChoices(
        )

        text = "Ensight Case File: %s" % (self.fullEnsightCaseName)
        self.statusText.append(text)

        self.statusText.append("\n3D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict3dParts().keys(
        ):
            partname = self.aPartsCollectorAction.getRefNameDict3dParts(
            )[partid]
            text = "\tPart %d = %s" % (partid, partname)
            self.statusText.append(text)

        self.statusText.append("3D Part Variables:")
        for svar in self.scalarVariables3D:
            text = "\t%s(scalar)" % (svar)
            self.statusText.append(text)
        for vvar in self.vectorVariables3D:
            text = "\t%s(vector)" % (vvar)
            self.statusText.append(text)

        self.statusText.append("\n2D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict2dParts().keys(
        ):
            partname = self.aPartsCollectorAction.getRefNameDict2dParts(
            )[partid]
            text = "\tPart %d = %s" % (partid, partname)
            self.statusText.append(text)

        self.statusText.append("2D Part Variables:")
        for svar in self.scalarVariables2D:
            text = "\t%s(scalar)" % (svar)
            self.statusText.append(text)
        for vvar in self.vectorVariables2D:
            text = "\t%s(vector)" % (vvar)
            self.statusText.append(text)

        QtWidgets.QApplication.processEvents()

        # MODULE: RWCovise
        self.RWCovise_1 = RWCovise()
        theNet.add(self.RWCovise_1)
        self.RWCovise_1.set_stepNo(0)
        self.RWCovise_1.set_rotate_output("FALSE")
        self.RWCovise_1.set_rotation_axis(3)
        self.RWCovise_1.set_rot_speed(2.000000)

        self.cocase = CoviseCaseFile()
        cn = os.path.basename(str(self.fullEnsightCaseName))
        self.cocasename = cn[0:cn.rfind('.')]