示例#1
0
def build(mods, consume=False, io=None):
    if io is None: io = di.fetch_info()['exporter']
    elif type(io) is type(''): io = iotypes[io]
    if not type(mods) is type([]): mods = [mods]
    for mdx in range(len(mods)):
        m = mods[mdx]
        if issubclass(m.__class__, dm.model):
            mods[mdx] = dsg.node(models=[m])
    if consume:
        consumenode = dsg.node(children=mods, consumption=True)
        mods = [consumenode]
    sgr = dsg.sgraph(nodes=mods)
    #sgr.graph(iotypes[io])
    sgr.graph(io)
示例#2
0
def build(mods,consume = False,io = None):
    if io is None:io = di.fetch_info()['exporter']
    elif type(io) is type(''):io = iotypes[io]
    if not type(mods) is type([]):mods = [mods]
    for mdx in range(len(mods)):
        m = mods[mdx]
        if issubclass(m.__class__,dm.model): 
            mods[mdx] = dsg.node(models = [m])
    if consume:
        consumenode = dsg.node(children = mods,consumption = True)
        mods = [consumenode]
    sgr = dsg.sgraph(nodes = mods)
    #sgr.graph(iotypes[io])
    sgr.graph(io)
示例#3
0
文件: osm.py 项目: ctogle/dilapidator
def test():
    user_info = di.fetch_info()
    osmdata = user_info['osmdata']
    oworld = read_xml(osmdata)

    ax = dtl.plot_axes()
    ax = oworld.plot_boundary(ax)
    ax = oworld.plot_all_routes(ax)
    #ax = oworld.plot_way_by_name('I 95',ax)
    #ax = oworld.plot_way_by_name('I 64',ax)
    #ax = oworld.plot_way_by_name('360',ax)
    plt.show()

    pdb.set_trace()
示例#4
0
文件: osm.py 项目: ctogle/dilapidator
def test():
    user_info = di.fetch_info()
    osmdata = user_info['osmdata']
    oworld = read_xml(osmdata)

    ax = dtl.plot_axes()
    ax = oworld.plot_boundary(ax)
    ax = oworld.plot_all_routes(ax)
    #ax = oworld.plot_way_by_name('I 95',ax)
    #ax = oworld.plot_way_by_name('I 64',ax)
    #ax = oworld.plot_way_by_name('360',ax)
    plt.show()



    pdb.set_trace()
示例#5
0
def write_world_script(io = None,world_dir = None,**kws):
    if world_dir is None:world_dir = os.getcwd()
    if io is None:io = di.fetch_info()['exporter']
    io = iotypes[io]
    if hasattr(io,'write_world_script'):
        io.write_world_script(world_dir)
示例#6
0
def realize(context,years = 0,io = None,**kws):
    if io is None:io = di.fetch_info()['exporter']
    elif type(io) is type(''):io = iotypes[io]
    context.generate(worn = years)
    context.graph(io,**kws)
示例#7
0
def build2(mod,io = None):
    if io is None:io = di.fetch_info()['exporter']
    elif type(io) is type(''):io = iotypes[io]
    io.build_model2(mod)
示例#8
0
import dilap.core.base as db
import dilap.core.uinfo as di
#import dilap.core.material as dma
import dilap.modeling.material as dma

#import cStringIO as sio
from io import StringIO as sio
import os, shutil, pdb
user_info = di.fetch_info()

#world_dir = user_info['contentdir']

#########################################################################
### materials
#########################################################################


# initialize the materials script
def write_materials(world_dir):
    matfile = os.path.join(world_dir, 'materials.mtl')
    matstring = sio()
    matstring.write('\n')
    write_default_materials_mtl(matstring)
    matstring.write('\n')
    with open(matfile, 'w') as h:
        h.write(matstring.getvalue())
    for dm in def_mats:
        shutil.copy(db.resource_path(dm.dtexture), world_dir)
    print('new materials file', matfile)

示例#9
0
def build2(mod, io=None):
    if io is None: io = di.fetch_info()['exporter']
    elif type(io) is type(''): io = iotypes[io]
    io.build_model2(mod)
示例#10
0
文件: obj.py 项目: ctogle/dilapidator
import dilap.core.base as db
import dilap.core.uinfo as di
#import dilap.core.material as dma
import dilap.modeling.material as dma

#import cStringIO as sio
from io import StringIO as sio
import os,shutil,pdb
user_info = di.fetch_info()

#world_dir = user_info['contentdir']

#########################################################################
### materials
#########################################################################

# initialize the materials script
def write_materials(world_dir):
    matfile = os.path.join(world_dir,'materials.mtl')
    matstring = sio()
    matstring.write('\n')
    write_default_materials_mtl(matstring)
    matstring.write('\n')
    with open(matfile,'w') as h:
        h.write(matstring.getvalue())
    for dm in def_mats:
        shutil.copy(db.resource_path(dm.dtexture),world_dir)
    print('new materials file',matfile)

def_mats = []
def write_default_materials_mtl(msio):
示例#11
0
def write_world_script(io=None, world_dir=None, **kws):
    if world_dir is None: world_dir = os.getcwd()
    if io is None: io = di.fetch_info()['exporter']
    io = iotypes[io]
    if hasattr(io, 'write_world_script'):
        io.write_world_script(world_dir)
示例#12
0
def realize(context, years=0, io=None, **kws):
    if io is None: io = di.fetch_info()['exporter']
    elif type(io) is type(''): io = iotypes[io]
    context.generate(worn=years)
    context.graph(io, **kws)