Ejemplo n.º 1
0
def _export(nodes):
    os.chdir(Utils.getProjPath())
    cr_Utils.createOutDirs()
    path = cr_Utils.getOutPathFor('root')
    path = os.path.join(path, 'sim.yml')
    if os.path.exists(path):
        os.remove(path)

    md = MDReaderFactory.build(path)

    for obj in nodes:
        obj.export(md)

    md.writeToDisk()
    del md
Ejemplo n.º 2
0
    def test_simulation(self):
        datasrc = CSVDataSource(resource='input/data/stationary/*.dat', delim=',', fields= [["id", "integer"], ["pos_z", "float"], ["pos_y", "float"], ["pos_x", "float"], ["euler_x", "float"], ["euler_y", "float"], ["euler_z", "float"]])
        dataobj = DataObject()
        dataobj.addDataSource(datasrc)

        sph = Sphere()
        robj = RenderObject(condition="id > 0", geometry=[sph.getSerialized()])

        sim = Simulation()
        sim.setData(dataobj)
        sim.addRenderObject(robj)

        md = MDReaderFactory.build('sim.yml')
        md.addElement(Simulation.getTypeName(), sim.getSerialized())
        md.writeToDisk()