def getBox(self, forceExecute = False):
     """ return the bounding box """
     if self._bb==None:
         self._bb = BoundingBox()
         theNet().add( self._bb)
         connect( self.geoConnectionPoint(), ConnectionPoint( self._bb, 'GridIn0' ) )
         # Clear info queue so we dont read a previous BB output.
         # (If something goes wrong with the queue, this could be the reason.)
         coviseStartup.globalReceiverThread.infoQueue.clear()
         if not self.executeGeo():
             saveExecute(self._bb)
         boxParser = BoundingBoxParser()
         boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue)
         self._boundingBox = boxParser.getBox()
     elif forceExecute:
         # Clear info queue so we dont read a previous BB output.
         # (If something goes wrong with the queue, this could be the reason.)
         coviseStartup.globalReceiverThread.infoQueue.clear()
         if not self.executeGeo():
             saveExecute(self._bb)
         boxParser = BoundingBoxParser()
         boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue)
         try:
             oldbb = self._boundingBox
             self._boundingBox = boxParser.getBox()
         except (ValueError):
             self._boundingBox = oldbb
     return self._boundingBox
Beispiel #2
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this VisItem: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         if hasattr(self, '_module') and self._module: theNet().remove(self._module)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #3
0
    def delete(self, isInitialized, negMsgHandler=None):
        ''' delete this CoviseVis: remove the module '''
        _infoer.function = str(self.delete)
        _infoer.write(" ")

        if isInitialized:

            # Manually remove the object from any parent object it is mounted to.
            # This is not very elegant because when an object (child) is deleted, the unmounting
            # done in OpenCOVER will send a removeChildMessage to the parent. However, because
            # it's a separate process, the child will already be fully deleted in vr-prepare
            # when receiving this message and the coverKey of the child is not known anymore.
            sceneObjects = [
                obj
                for obj in globalKeyHandler().getAllElements().itervalues()
                if hasattr(obj, "typeNr") and (obj.typeNr == VIS_SCENE_OBJECT)
            ]
            for obj in sceneObjects:
                if self.key in obj.params.children:
                    params = CopyParams(obj.params)
                    params.children.remove(self.key)
                    negMsgHandler.internalRecvParams(obj.key, params)
                    negMsgHandler.sendParams(obj.key, params)

            self.sendDelete()

            theNet().remove(self.performerScene)

        VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #4
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.coverDocument)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #5
0
    def delete(self, isInitialized, negMsgHandler=None):
        ''' delete this CoviseVis: remove the module '''
        _infoer.function = str(self.delete)
        _infoer.write(" ")

        if isInitialized:

            # Manually remove the object from any parent object it is mounted to.
            # This is not very elegant because when an object (child) is deleted, the unmounting
            # done in OpenCOVER will send a removeChildMessage to the parent. However, because
            # it's a separate process, the child will already be fully deleted in vr-prepare
            # when receiving this message and the coverKey of the child is not known anymore.   
            sceneObjects = [obj for obj in globalKeyHandler().getAllElements().itervalues() if hasattr(obj,"typeNr") and (obj.typeNr == VIS_SCENE_OBJECT)]
            for obj in sceneObjects:
                if self.key in obj.params.children:
                    params = CopyParams(obj.params)
                    params.children.remove(self.key)
                    negMsgHandler.internalRecvParams( obj.key, params )
                    negMsgHandler.sendParams( obj.key, params )


            self.sendDelete()

            theNet().remove(self.performerScene)

        VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #6
0
    def __init(self, negMsgHandler):
        """ __init is called from __update
            + start _module module if it does not already exist and connect output to COVER
            + set default parameters of module
            + set default boundingBox which is also used in the GUI to set borders of the float sliders
            + set color inport and corresponding module
            + send params to the gui
        """
        if self.__firstTime == True:
            self.__firstTime = False
            PartModuleVis._init(self, negMsgHandler)
            PartColoredVis._init(self, negMsgHandler, self.__myColors,
                                 'ColormapIn0')

            # make my custom connections between further self created modules here
            theNet().connect(self._module, 'GridOut0', self.__myCollect,
                             'GridIn0')
            if not self.params.variable == 'unset':
                theNet().connect(self.__myColors, 'DataOut0', self.__myCollect,
                                 'DataIn0')
                theNet().connect(self._module, 'DataOut0', self.__myColors,
                                 'DataIn0')
            else:
                theNet().disconnect(self.__myColors, 'DataOut0',
                                    self.__myCollect, 'DataIn0')
                theNet().disconnect(self._module, 'DataOut0', self.__myColors,
                                    'DataIn0')

            # send params to gui
            self.sendParams()
Beispiel #7
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.coverDocument)
     VisItem.delete(self, isInitialized, negMsgHandler)
    def executeData(self, varName):
        self.__initData(varName)

        # reconnect data
        if varName in self.__dataInConnectionPoints.keys():
            theNet().disconnectAllFromModulePort(
                self.__dataInConnectionPoints[varName].module,
                self.__dataInConnectionPoints[varName].port)
            connect(ParentClass.dataConnectionPoint(self, varName),
                    self.__dataInConnectionPoints[varName])

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeData(self, varName) == True:
            self.__needExecuteData[varName] = False
            return True

        if not self.__needExecuteData[varName]:
            return False
        self.__needExecuteData[varName] = False

        if varName in self.__dataInConnectionPoints.keys():
            saveExecute(self.__dataInConnectionPoints[varName].module)
            return True

        return False
Beispiel #9
0
    def __update(self):
        """ do init if necessary; update module parameters """
        self.__init()

        # update input
        dataInConnect = self.importModule.dataConnectionPoint(
            self.params.variable)
        if not self.__lastDataConnection == None:
            disconnect(self.__lastDataConnection, self.__colorsIn)
        else:
            theNet().connect(self.__colors, 'TextureOut0', self.__collect,
                             'TextureIn0')

        if dataInConnect:
            connect(
                self.importModule.dataConnectionPoint(self.params.variable),
                self.__colorsIn)
        self.__lastDataConnection = self.importModule.dataConnectionPoint(
            self.params.variable)

        _infoer.function = str(self.__update)
        _infoer.write(": updating to variable " + self.params.variable)

        # update colormap settings
        self.__colors.set_numSteps(self.params.numSteps)
Beispiel #10
0
    def __init(self):
        """ start COVISE ReadCAD Module """
        if self.__readCad == None:
            self.__readCad = ReadCAD()
            theNet().add(self.__readCad)
            self.__readCadPolyOut = ConnectionPoint(self.__readCad, 'mesh')
            self.__readCadNormalsOut = ConnectionPoint(self.__readCad,
                                                       'Normals')
            self.__readCadColorsOut = ConnectionPoint(self.__readCad,
                                                      'colorOut')
            self.__readCad.set_catia_server('obie')
            self.__readCad.set_catia_server_port('7000')
            self.__readCad.set_partIndex(self.__index)
            self.__readCad.set_file_path(self.__filename)

            self.__collect = Collect()
            theNet().add(self.__collect)
            connect(self.__readCadPolyOut,
                    ConnectionPoint(self.__collect, 'GridIn0'))
            connect(self.__readCadNormalsOut,
                    ConnectionPoint(self.__collect, 'DataIn1'))
            connect(self.__readCadColorsOut,
                    ConnectionPoint(self.__collect, 'DataIn0'))
            self.__connectGeoOut = ConnectionPoint(self.__collect,
                                                   'GeometryOut0')
Beispiel #11
0
 def __update(self):
     """ __update is called from the run method to update the module parameter before execution
         + update module parameters """
     _infoer.function = str(self.__update)
     _infoer.write(" ")
     if self.performerScene == None:
         self.performerScene = PerformerScene()
         theNet().add(self.performerScene)
     # update params
     self.performerScene.set_modelPath(
         covise.getCoConfigEntry("vr-prepare.Coxml.ResourceDirectory") +
         "/coxml/" + self.params.filename)
     self.performerScene.set_scale(self.params.scale)
     if (self.params.backface == True):
         self.performerScene.set_backface('TRUE')
     else:
         self.performerScene.set_backface('FALSE')
     if (self.params.orientation_iv == True):
         self.performerScene.set_orientation_iv('TRUE')
     else:
         self.performerScene.set_orientation_iv('FALSE')
     if (self.params.convert_xforms_iv == True):
         self.performerScene.set_convert_xforms_iv('TRUE')
     else:
         self.performerScene.set_convert_xforms_iv('FALSE')
     _infoer.write(" finished")
Beispiel #12
0
    def __init(self, negMsgHandler):
        """ __init is called from __update
            + start _module module if it does not already exist and connect output to COVER
            + set default parameters of module
            + set default boundingBox which is also used in the GUI to set borders of the float sliders
            + set color inport and corresponding module
            + send params to the gui
        """
        if self.__firstTime == True:
            self.__firstTime = False
            PartModuleVis._init(self, negMsgHandler)
            PartColoredVis._init(self, negMsgHandler, self.__myColors, 'ColormapIn0')
            
            # make my custom connections between further self created modules here
            theNet().connect(self._module, 'GridOut0', self.__myCollect, 'GridIn0')
            if not self.params.variable == 'unset': 
                theNet().connect(self.__myColors, 'DataOut0', self.__myCollect, 'DataIn0')
                theNet().connect(self._module, 'DataOut0', self.__myColors, 'DataIn0')
            else: 
                theNet().disconnect(self.__myColors, 'DataOut0', self.__myCollect, 'DataIn0')
                theNet().disconnect(self._module, 'DataOut0', self.__myColors, 'DataIn0')
                    

            # send params to gui
            self.sendParams()
Beispiel #13
0
    def executeOct(self):
        self.octTreeConnectionPoint()
        one_executed = False
        #quickfix
        #save/loading of a 2d composed probing point does not work with this
        #for part in self._parts:
        #    if part.executeOct():
        #        one_executed = True
        numPorts = 0
        numModules = 0
        for part in self._parts:
            # dont reconnect BlockCollect inter-connections
            if (numPorts % 15 == 0) and (numModules != 0):
                numPorts += 1
            theNet().disconnectAllFromModulePort(self._collectOct[numModules].objInConnectionPoint(numPorts).module, self._collectOct[numModules].objInConnectionPoint(numPorts).port)
            connect(part.octTreeConnectionPoint(), self._collectOct[numModules].objInConnectionPoint(numPorts))
            numPorts = numPorts + 1
            if numPorts % 15 == 0:
                numModules = numModules +1
                numPorts = 0

            if part.executeOct():
                one_executed = True

        if not one_executed and self._firstTimeOct:
            for bc in self._collectOct:
                bc.execute()
                one_executed = True
        self._firstTimeOct = False
        return one_executed
Beispiel #14
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this CoviseVis: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.performerScene)
         theNet().remove(self.addAttribute)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #15
0
 def initPartTree(self, negMsgHandler):
     readCAD = ReadCAD()
     theNet().add(readCAD)
     negMsgHandler.registerParamsNotfier(readCAD, self.key, ['SelectPart'])
     readCAD.set_catia_server('obie')
     readCAD.set_catia_server_port('7000')
     readCAD.set_file_path(self.params.filename)
     self.neg = negMsgHandler
Beispiel #16
0
 def delete(self, isInitialized, negMsgHandler=None):
     """ delete this CoviseVis: remove the module """
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         theNet().remove(self.performerScene)
         theNet().remove(self.addAttribute)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #17
0
 def delete(self, isInitialized, negMsgHandler=None):
     ''' delete this VisItem: remove the module '''
     _infoer.function = str(self.delete)
     _infoer.write(" ")
     if isInitialized:
         if hasattr(self, '_module') and self._module:
             theNet().remove(self._module)
     VisItem.delete(self, isInitialized, negMsgHandler)
Beispiel #18
0
 def initPartTree( self, negMsgHandler ):
     readCAD = ReadCAD()
     theNet().add(readCAD)
     negMsgHandler.registerParamsNotfier( readCAD, self.key, ['SelectPart'] )
     readCAD.set_catia_server('obie')
     readCAD.set_catia_server_port('7000')
     readCAD.set_file_path( self.params.filename )
     self.neg = negMsgHandler
Beispiel #19
0
 def test_Geo(self):
     moduleCount = theNet().moduleCount()
     ip = self._ImportModule1()
     box = ip.getBox()
     (x,y,z) = box.getCenter()
     self.assertEqual((x,y,z), (-0.041321500000000011, 0.0, 0.1766115))
     # delete
     ip.delete()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #20
0
 def test_Data(self):
     moduleCount = theNet().moduleCount()
     ip = self._ImportModule1()
     value = 'Temperature'
     (a,b) = ip.getDataMinMax(value)
     self.assertEqual((a,b), (78.848465, 446.557648))
     # delete
     ip.delete()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #21
0
 def test_Data(self):
     moduleCount = theNet().moduleCount()
     ip = self._ImportModule1()
     value = 'Temperature'
     (a, b) = ip.getDataMinMax(value)
     self.assertEqual((a, b), (78.848465, 446.557648))
     # delete
     ip.delete()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #22
0
 def delete(self, isInitialized, negMsgHandler=None):
     if isInitialized:
         if hasattr(self,
                    '_PartIsoCutterVis__myCollect') and self.__myCollect:
             theNet().remove(self.__myCollect)
         if hasattr(self,
                    '_PartIsoCutterVis__myColors') and self.__myColors:
             theNet().remove(self.__myColors)
     PartModuleVis.delete(self, isInitialized, negMsgHandler)
Beispiel #23
0
 def test_Geo(self):
     moduleCount = theNet().moduleCount()
     ip = self._ImportModule1()
     box = ip.getBox()
     (x, y, z) = box.getCenter()
     self.assertEqual((x, y, z), (-0.041321500000000011, 0.0, 0.1766115))
     # delete
     ip.delete()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #24
0
 def __init(self):
     """ start COVISE Module and connect output to COVER """
     if self.__addAttribute==None :
         self.__addAttribute = AddAttribute()
         theNet().add(self.__addAttribute)
         self.__addAttribute.set_attrName( "COLOR" )
         addAttributeIn = ConnectionPoint( self.__addAttribute, 'inObject' )
         self.__addAttributeOut = ConnectionPoint( self.__addAttribute, 'outObject' )
         connect( self.importModule.geoConnectionPoint(), addAttributeIn )
         VisItem.connectToCover( self, self )
Beispiel #25
0
    def __initBase(self):
        """
            + __initBase is called from the constructor and after the class was unpickled
            + add privately created modules here
        """
        self.__firstTime = True

        # create custom modules here
        self.__myCollect = Collect()
        theNet().add(self.__myCollect)
Beispiel #26
0
 def testGroupGeo(self):
     moduleCount = theNet().moduleCount()
     gip = self._LargeGroup()
     bp = gip.getBox()
     (x,y,z) = bp.getCenter()
     self.assertEqual((x,y,z), (1.6700575000000002, 0.0, 0.40254699999999999))
     # delete
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #27
0
 def testTransientGroupGeo(self):
     moduleCount = theNet().moduleCount()
     gip = self._TransientGroup()
     bp = gip.getBox()
     (x,y,z) = bp.getCenter()
     self.assertEqual((x,y,z), (0.099999999999999978, 0.012500000000000011, 0.050000000000000003))
     # delete
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #28
0
def testGroupGeo():

    gip = testLargeGroup()
    bp = gip.getBox()
    (x,y,z) = bp.getCenter()
    theNet().save("/work/sk_te/testgui.net")
    if not (x,y,z)==(1.6700575000000002, 0.0, 0.40254699999999999):
        print("test failed", (x,y,z))
    else:
        print("OK")
Beispiel #29
0
    def __initBase(self):
        """
            + __initBase is called from the constructor and after the class was unpickled
            + add privately created modules here
        """
        self.__firstTime = True

        # create custom modules here
        self.__myCollect = Collect()
        theNet().add(self.__myCollect)
Beispiel #30
0
def testSample():
    #ip = testSampleImportModule1()
    ip = testSampleGroup()
    ip.executeGeo()
    #ip.executeOct()
    ip.executeSampleData(COMPOSED_VELOCITY)
    #(a,b) = ip.getDataMinMax('rotvel')#COMPOSED_VELOCITY)
    #print("min, max " , a, b)
    #ip.executeSampleData('Temperature')
    theNet().save("/work/sk_te/testgui.net")
Beispiel #31
0
 def __init(self):
     """ start COVISE Module and connect output to COVER """
     if self.__addAttribute == None:
         self.__addAttribute = AddAttribute()
         theNet().add(self.__addAttribute)
         self.__addAttribute.set_attrName("COLOR")
         addAttributeIn = ConnectionPoint(self.__addAttribute, 'inObject')
         self.__addAttributeOut = ConnectionPoint(self.__addAttribute,
                                                  'outObject')
         connect(self.importModule.geoConnectionPoint(), addAttributeIn)
         VisItem.connectToCover(self, self)
Beispiel #32
0
 def testGroupGeo(self):
     moduleCount = theNet().moduleCount()
     gip = self._LargeGroup()
     bp = gip.getBox()
     (x, y, z) = bp.getCenter()
     self.assertEqual((x, y, z),
                      (1.6700575000000002, 0.0, 0.40254699999999999))
     # delete
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #33
0
 def __init(self, negMsgHandler):
     """called from __update
        start rwCovise and connects to COVER
        send params to GUI"""
     _infoer.function = str(self.__init)
     _infoer.write(" ")
     if self.rwCovise == None:
         self.rwCovise = RWCovise()
         theNet().add(self.rwCovise)
         VisItem.connectToCover(self, self)
         self.__connected = True
Beispiel #34
0
    def __update(self):
        """ __update is called from the run method to update the module parameter before execution
            + update module parameters """
        _infoer.function = str(self.__update)
        _infoer.write("")
        if self.coverDocument==None:
            self.coverDocument = CoverDocument()
            theNet().add(self.coverDocument)

        #update params
        self.coverDocument.set_Filename(self.params.imageName)
        self.coverDocument.set_Title(self.params.documentName)
Beispiel #35
0
 def testTransientGroupGeo(self):
     moduleCount = theNet().moduleCount()
     gip = self._TransientGroup()
     bp = gip.getBox()
     (x, y, z) = bp.getCenter()
     self.assertEqual(
         (x, y, z),
         (0.099999999999999978, 0.012500000000000011, 0.050000000000000003))
     # delete
     gip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #36
0
    def __update(self):
        """ __update is called from the run method to update the module parameter before execution
            + update module parameters """
        _infoer.function = str(self.__update)
        _infoer.write("")
        if self.coverDocument == None:
            self.coverDocument = CoverDocument()
            theNet().add(self.coverDocument)

        #update params
        self.coverDocument.set_Filename(self.params.imageName)
        self.coverDocument.set_Title(self.params.documentName)
Beispiel #37
0
 def __update(self, negMsgHandler):
     """ __update is called from the run method to update the module parameter before execution
         + do init of the IsoCutter module if necessary
         + update module parameters """
     self.__init(negMsgHandler)
     PartModuleVis._update(self, negMsgHandler)
     if not self.params.variable == 'unset': 
         PartColoredVis._update(self, negMsgHandler)
     else: 
         self._dataInputNames = []
         theNet().disconnect(self.__myColors, 'DataOut0', self.__myCollect, 'DataIn0')
         theNet().disconnect(self._module, 'DataOut0', self.__myColors, 'DataIn0')    
Beispiel #38
0
    def __init(self):
        """ start COVISE modules and connect output to COVER """
        if self.__colors==None and self.__collect==None:
            self.__colors = Colors()
            theNet().add(self.__colors)
            self.__colorsIn = ConnectionPoint(self.__colors, 'GridIn0')

            self.__collect = Collect()
            theNet().add(self.__collect)
            self.__collectOut = ConnectionPoint(self.__collect, 'GeometryOut0')
            connect( self.importModule.geoConnectionPoint(), ConnectionPoint(self.__collect, 'GridIn0') )

            VisItem.connectToCover( self, self )
Beispiel #39
0
    def __init(self):
        """ start COVISE modules and connect output to COVER """
        if self.__colors == None and self.__collect == None:
            self.__colors = Colors()
            theNet().add(self.__colors)
            self.__colorsIn = ConnectionPoint(self.__colors, 'GridIn0')

            self.__collect = Collect()
            theNet().add(self.__collect)
            self.__collectOut = ConnectionPoint(self.__collect, 'GeometryOut0')
            connect(self.importModule.geoConnectionPoint(),
                    ConnectionPoint(self.__collect, 'GridIn0'))

            VisItem.connectToCover(self, self)
Beispiel #40
0
 def test_TransientReduceSetGeo(self):
     moduleCount = theNet().moduleCount()
     gip_core = self._TransientGroup()
     gip = ImportGroupReduceSet(gip_core)
     gip.setReductionFactor(2)
     gip.executeGeo()
     bp = gip.getBox()
     (x,y,z) = bp.getCenter()
     self.assertEqual((x,y,z),(0.55000000000000004, -0.25, 0.050000000000000003))
     # delete
     gip.delete()
     gip_core.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #41
0
 def delete(self):
     if hasattr(self, "_geo") and self._geo: self._geo.remove()
     if hasattr(self, "_data"):
         for module in self._data.values():
             module.remove()
     if hasattr(self, "_oct") and self._oct: theNet().remove(self._oct)
     if hasattr(self, "_octTreeWriter") and self._octTreeWriter:
         theNet().remove(self._octTreeWriter)
     if hasattr(self, "_bb") and self._bb: theNet().remove(self._bb)
     if hasattr(self, "_ImportModule__bbFromGeoRWCovise"
                ) and self.__bbFromGeoRWCovise:
         theNet().remove(self.__bbFromGeoRWCovise)
     if hasattr(self, "_minMax") and self._minMax:
         theNet().remove(self._minMax)
Beispiel #42
0
    def testSample(self):
        moduleCount = theNet().moduleCount()
        #ip = testSampleImportModule1()
        ip = self._SampleGroup()
        ip.executeGeo()
        #ip.executeOct()
#        ip.executeSampleData(COMPOSED_VELOCITY) # commented out: does not work at the moment
        #(a,b) = ip.getDataMinMax('rotvel')#COMPOSED_VELOCITY)
        #print("min, max " , a, b)
        #ip.executeSampleData('Temperature')
        # delete
        ip.delete()
        self._RemoveImportGroupModules()
        self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #43
0
 def testSample(self):
     moduleCount = theNet().moduleCount()
     #ip = testSampleImportModule1()
     ip = self._SampleGroup()
     ip.executeGeo()
     #ip.executeOct()
     #        ip.executeSampleData(COMPOSED_VELOCITY) # commented out: does not work at the moment
     #(a,b) = ip.getDataMinMax('rotvel')#COMPOSED_VELOCITY)
     #print("min, max " , a, b)
     #ip.executeSampleData('Temperature')
     # delete
     ip.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #44
0
    def executeData(self, varName):
        self.__initData(varName)

        # reconnect data
        if varName in self.__dataConnectionPoints.keys():
            theNet().disconnectAllFromModulePort(self.__dataInConnectionPoints[varName].module, self.__dataInConnectionPoints[varName].port)
            theNet().connect(ParentClass.dataConnectionPoint(self, varName).module, ParentClass.dataConnectionPoint(self, varName).port,
                             self.__dataInConnectionPoints[varName].module, self.__dataInConnectionPoints[varName].port)

            # reconnect geometry port
            theNet().disconnectAllFromModulePort(self.__dataInConnectionPoints[varName].module, 'GridIn0')
            theNet().connect(ParentClass.geoConnectionPoint(self).module, ParentClass.geoConnectionPoint(self).port,
                             self.__dataInConnectionPoints[varName].module, 'GridIn0')


        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeData(self, varName) == True:
            self.__needExecuteData[varName] = False
            return True

        if not self.__needExecuteData[varName]:
            return False
        self.__needExecuteData[varName] = False

        if varName in self.__dataInConnectionPoints.keys():
            saveExecute(self.__dataInConnectionPoints[varName].module)
        return True
Beispiel #45
0
 def __update(self, negMsgHandler):
     """ __update is called from the run method to update the module parameter before execution
         + do init of the IsoCutter module if necessary
         + update module parameters """
     self.__init(negMsgHandler)
     PartModuleVis._update(self, negMsgHandler)
     if not self.params.variable == 'unset':
         PartColoredVis._update(self, negMsgHandler)
     else:
         self._dataInputNames = []
         theNet().disconnect(self.__myColors, 'DataOut0', self.__myCollect,
                             'DataIn0')
         theNet().disconnect(self._module, 'DataOut0', self.__myColors,
                             'DataIn0')
Beispiel #46
0
    def executeData(self, vname):
        one_executed = False
        initialized = self._initData(vname)
        collectData = self._collectDataPerName[vname]

        # reconnecting
        part_cnt = 0
        numModules = 0
        numPorts = 0
        for part in self._parts:
            varname = self._varInPart(vname, part_cnt)
            # dont reconnect BlockCollect inter-connections
            if (numPorts % 15 == 0) and (numModules != 0):
                numPorts += 1
            theNet().disconnectAllFromModulePort(
                collectData[numModules].objInConnectionPoint(numPorts %
                                                             15).module,
                collectData[numModules].objInConnectionPoint(numPorts %
                                                             15).port)
            theNet().connect(
                part.dataConnectionPoint(varname).module,
                part.dataConnectionPoint(varname).port,
                collectData[numModules].objInConnectionPoint(numPorts %
                                                             15).module,
                collectData[numModules].objInConnectionPoint(numPorts %
                                                             15).port)
            part_cnt += 1
            numPorts += 1
            if numPorts % 15 == 0:
                numModules = numModules + 1

        part_cnt = 0
        numModules = 0
        for part in self._parts:
            varname = self._varInPart(vname, part_cnt)

            part_cnt += 1
            if part_cnt % 15 == 0:
                numModules = numModules + 1
            _infoer.function = str(self.executeData)
            _infoer.write("Loading file " + varname)
            if part.executeData(varname):
                one_executed = True
        if not one_executed and self._firstTimeData.get(vname, True):
            for bc in self._collectDataPerName[vname]:
                bc.execute()
                one_executed = True
        self._firstTimeData[vname] = False
        return one_executed
Beispiel #47
0
    def executeSampleData(self, vname, bbox=None, outside=USER_DEFINED):
        one_executed = False
        initialized = self._initSample(vname, outside)
        part_cnt = 0
        numModules = 0
        numPorts = 0
        collectSampleData = self._collectSampleDataPerName[(vname, outside)]
        collectSampleGeo = self._collectSampleGeoPerName[(vname, outside)]
        for part in self._parts:
            varname = self._varInPart(vname, part_cnt)
            # dont reconnect BlockCollect inter-connections
            if (numPorts % 15 == 0) and (numModules != 0):
                numPorts += 1
            theNet().disconnectAllFromModulePort(
                collectSampleData[numModules].objInConnectionPoint(numPorts %
                                                                   15).module,
                collectSampleData[numModules].objInConnectionPoint(numPorts %
                                                                   15).port)
            theNet().connect(
                part.dataSampleConnectionPoint(varname, outside).module,
                part.dataSampleConnectionPoint(varname, outside).port,
                collectSampleData[numModules].objInConnectionPoint(numPorts %
                                                                   15).module,
                collectSampleData[numModules].objInConnectionPoint(numPorts %
                                                                   15).port)
            theNet().disconnectAllFromModulePort(
                collectSampleGeo[numModules].objInConnectionPoint(numPorts %
                                                                  15).module,
                collectSampleGeo[numModules].objInConnectionPoint(numPorts %
                                                                  15).port)
            theNet().connect(
                part.geoSampleConnectionPoint(varname, outside).module,
                part.geoSampleConnectionPoint(varname, outside).port,
                collectSampleGeo[numModules].objInConnectionPoint(numPorts %
                                                                  15).module,
                collectSampleGeo[numModules].objInConnectionPoint(numPorts %
                                                                  15).port)
            part_cnt += 1
            numPorts += 1
            if numPorts % 15 == 0:
                numModules = numModules + 1

        part_cnt = 0
        numModules = 0
        for part in self._parts:
            varname = self._varInPart(vname, part_cnt)
            part_cnt += 1
            if part_cnt % 15 == 0:
                numModules = numModules + 1
            if part.executeSampleData(varname, bbox, outside):
                one_executed = True
        if not one_executed and self._firstTimeSample.get(vname, True):
            for i in range(len(self._collectSampleGeoPerName[(vname,
                                                              outside)])):
                self._collectSampleGeoPerName[(vname, outside)][i].execute()
                self._collectSampleDataPerName[(vname, outside)][i].execute()
                one_executed = True
        self._firstTimeSample[vname] = False
        return one_executed
Beispiel #48
0
 def test_TransientReduceSetGeo(self):
     moduleCount = theNet().moduleCount()
     gip_core = self._TransientGroup()
     gip = ImportGroupReduceSet(gip_core)
     gip.setReductionFactor(2)
     gip.executeGeo()
     bp = gip.getBox()
     (x, y, z) = bp.getCenter()
     self.assertEqual((x, y, z),
                      (0.55000000000000004, -0.25, 0.050000000000000003))
     # delete
     gip.delete()
     gip_core.delete()
     self._RemoveImportGroupModules()
     self.assertEqual(theNet().moduleCount(), moduleCount)
Beispiel #49
0
def testGroupData(gip):
    value = 'Temperature'
    c = Colors()
    theNet().add(c)
    connect( gip.dataConnectionPoint(value), ConnectionPoint( c, 'Data' ) )
    gip.executeData(value)

    coll = Collect()
    theNet().add(coll)
    connect( gip.geoConnectionPoint(value), ConnectionPoint( coll, 'grid' ) )
    theNet().connect( c, 'texture', coll, 'textures' )
    r = Renderer()
    theNet().add(r)
    theNet().connect( coll, 'geometry', r, 'RenderData')
    c.execute()
Beispiel #50
0
    def getDataMinMax( self, variable):
        """ return min and max value of variable """
        if variable==None:
            return

        if self._minMax==None:
            self._minMax = Colors()
            theNet().add(self._minMax)
        theNet().disconnectAllFromModulePort( self._minMax, 'DataIn0' )
        connect(self.dataConnectionPoint(variable), ConnectionPoint(self._minMax, 'DataIn0'))

        if not self.executeData( variable ):
            saveExecute(self._minMax)
            
        return ( float(self._minMax.getParamValue('MinMax')[0]),\
                 float(self._minMax.getParamValue('MinMax')[1]) )
Beispiel #51
0
 def delete(self):
     if hasattr(self, "_geo") and self._geo: self._geo.remove()
     if hasattr(self, "_data"):
         for module in self._data.values(): module.remove()
     if hasattr(self, "_oct") and self._oct: theNet().remove(self._oct)
     if hasattr(self, "_octTreeWriter") and self._octTreeWriter: theNet().remove(self._octTreeWriter)
     if hasattr(self, "_bb") and self._bb: theNet().remove(self._bb)
     if hasattr(self, "_ImportModule__bbFromGeoRWCovise") and self.__bbFromGeoRWCovise: theNet().remove(self.__bbFromGeoRWCovise)
     if hasattr(self, "_minMax") and self._minMax: theNet().remove(self._minMax)
Beispiel #52
0
    def executeGeo(self):
        # reconnect geometry
        if self.__reduceSetModules != []:
            theNet().disconnectAllFromModulePort(self.__reduceSetModules[0].geoInConnectionPoint().module, self.__reduceSetModules[0].geoInConnectionPoint().port)
            connect( ParentClass.geoConnectionPoint(self), self.__reduceSetModules[0].geoInConnectionPoint() )

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeGeo(self) == True:
            return True

        if not self.__needExecute:
            return False
        self.__needExecute = False

        if self.__reduceSetModules != []:
            self.__reduceSetModules[0].execute()
        return True
Beispiel #53
0
    def getBoxFromGeoRWCovise(self):
        """ return the bounding box from the originally unfiltered geometry """

        if self.__boundingBoxFromGeoRWCovise == None:
            self.__bbFromGeoRWCovise = BoundingBox()
            theNet().add(self.__bbFromGeoRWCovise)
            connect( self._geo.connectionPoint(), ConnectionPoint(self.__bbFromGeoRWCovise, 'GridIn0'))

            # Clear info queue so we dont read a previous BB output.
            # (If something goes wrong with the queue, this could be the reason.)
            coviseStartup.globalReceiverThread.infoQueue_.clear()
            saveExecute(self.__bbFromGeoRWCovise)
            boxParser = BoundingBoxParser()
            boxParser.parseQueue(coviseStartup.globalReceiverThread.infoQueue_)
            self.__boundingBoxFromGeoRWCovise = boxParser.getBox()

        return self.__boundingBoxFromGeoRWCovise
Beispiel #54
0
 def _initOct(self):
     self._initGeo()
     if self._oct==None:
         # create or use disk-cached octtrees
         if enableCachedOctTrees == True and self._dim == 3:
             basename, extension = os.path.splitext(self._part.filename)
             self._octTreeFileName = basename + ".octtree" + extension
             print("self._octTreeFileName = ", self._octTreeFileName)
             if os.path.isfile(self._octTreeFileName) == False:
                 # create disk-cached octtree
                 self._octTreeFileExists = False
                 self._oct = MakeOctTree()
                 theNet().add(self._oct)
                 self._octIn  = ConnectionPoint( self._oct, 'inGrid' )
                 self._octOut = ConnectionPoint( self._oct, 'outOctTree' )
                 connect( self.geoConnectionPoint(), self._octIn )
                 
                 # connect RWCovise to MakeOctTree
                 self._octTreeWriter = RWCovise()       # writable
                 theNet().add(self._octTreeWriter)
                 self._octTreeWriter.set_grid_path(self._octTreeFileName)
                 connect(self._octOut, ConnectionPoint(self._octTreeWriter, 'mesh_in'))
             else:
                 # use disk-cached octtree
                 self._octTreeFileExists = True
                 self._oct = RWCovise()
                 theNet().add(self._oct)
                 self._oct.set_grid_path(self._octTreeFileName)
                 # cached octtrees must never get an input connection (RWCovise!)
                 self._octIn = None # ConnectionPoint(self._oct, 'mesh_in')
                 self._octOut = ConnectionPoint(self._oct, 'mesh')
         else:
             self._oct = MakeOctTree()
             theNet().add(self._oct)
             self._octIn  = ConnectionPoint( self._oct, 'inGrid' )
             self._octOut = ConnectionPoint( self._oct, 'outOctTree' )
             connect( self.geoConnectionPoint(), self._octIn )
     else:
         if enableCachedOctTrees == True and self._octTreeFileExists == True:
             # no reconnect necessary, if using disk-cached octtree
             pass
         else:
             # reconnect OctTree
             theNet().disconnectAllFromModulePort(self._oct, 'inGrid')
             connect(self.geoConnectionPoint(), self._octIn)
Beispiel #55
0
    def executeData(self, varName):
        # reconnect data
        if varName in self.__dataConnectionPoints.keys():
            theNet().disconnectAllFromModulePort(self.__dataConnectionPoints[varName].module, self.__dataConnectionPoints[varName].port.replace("out", "in"))
            theNet().connect(ParentClass.dataConnectionPoint(self, varName).module, ParentClass.dataConnectionPoint(self, varName).port,
                             self.__dataConnectionPoints[varName].module, self.__dataConnectionPoints[varName].port.replace("out", "in"))

        # wenn voriges Modul tatsaechlich executed wurde, dann nicht mehr selbst executen
        if ParentClass.executeData(self, varName) == True:
            return True

        if not self.__needExecute:
            return False
        self.__needExecute = False

        for rS in self.__reduceSetModules:
            rS.execute()
        return True
Beispiel #56
0
    def __init(self):
        """ start COVISE ReadCAD Module """
        if self.__readCad==None :
            self.__readCad = ReadCAD()
            theNet().add(self.__readCad)
            self.__readCadPolyOut = ConnectionPoint( self.__readCad, 'mesh' )
            self.__readCadNormalsOut = ConnectionPoint( self.__readCad, 'Normals' )
            self.__readCadColorsOut = ConnectionPoint( self.__readCad, 'colorOut' )
            self.__readCad.set_catia_server('obie')
            self.__readCad.set_catia_server_port('7000')
            self.__readCad.set_partIndex(self.__index)
            self.__readCad.set_file_path( self.__filename )

            self.__collect = Collect()
            theNet().add(self.__collect)
            connect( self.__readCadPolyOut, ConnectionPoint(self.__collect, 'GridIn0') )
            connect( self.__readCadNormalsOut, ConnectionPoint(self.__collect, 'DataIn1' ) )
            connect( self.__readCadColorsOut, ConnectionPoint(self.__collect, 'DataIn0' ) )
            self.__connectGeoOut =  ConnectionPoint(self.__collect, 'GeometryOut0' )