Beispiel #1
0
 def accept(save=False):
     dia.acceptData()
     print("RESULTS", dia.results)
     if dia.results['render/mode'].startswith('smooth'):
         res = utils.subDict(dia.results, 'render/', strip=False)
         matname = dia.results['render/material']
         matdata = utils.subDict(dia.results, 'material/')
         # Currently, set both in cfg and Material db
         pf.cfg['material/%s' % matname] = matdata
         pf.GUI.materials[matname] = canvas.Material(matname, **matdata)
     else:
         res = utils.selectDict(dia.results,
                                ['render/mode', 'render/lighting'])
     res['_save_'] = save
     print("RES", res)
     updateSettings(res)
     print(pf.cfg)
     vp = pf.GUI.viewports.current
     vp.resetLighting()
     #if pf.cfg['render/mode'] != vp.rendermode:
     print("SETMODE %s %s" %
           (pf.cfg['render/mode'], pf.cfg['render/lighting']))
     vp.setRenderMode(pf.cfg['render/mode'], pf.cfg['render/lighting'])
     print(vp.rendermode, vp.settings.lighting)
     vp.update()
     toolbar.updateLightButton()
Beispiel #2
0
def setMaterial():
    """Set the material"""
    global section,material
    if model is None:
        warn()
        return
    removeHighlight()
    hicolor('purple')
    res = askItems(autoprefix=True,items=[
        _G('Material',[ _I(k,material[k]) for k in [
            'name','young_modulus','poisson_ratio','density']]),
        _G('Section',[ _I(k,section[k]) for k in [
            'name','sectiontype','thickness']]),
        _I('reduced_integration',False),
        ])

    material = utils.subDict(res,'Material/')
    section = utils.subDict(res,'Section/')
    section['material'] = material['name']
    
    if res:
        K = pickElements()
        if K:
            for k in range(len(parts)):
                e = getPickedElems(K,k) + model.celems[k]
                eltype = abq_eltype[model.elems[k].eltype.name()]
                if res['reduced_integration']:
                    eltype += 'R'
                print(k,e)
                if len(e) > 0:
                    PDB.elemProp(set=e,eltype=eltype,section=ElemSection(section=section,material=material))
 def accept(save=False):
     dia.acceptData()
     res = dia.results
     pf.debug(res)
     pf.cfg['render/lightmodel'] = res['render/lightmodel']
     pf.canvas.resetLighting()
     pf.app.processEvents()
     mt = utils.subDict(res,'render/material/')
     l0 = utils.subDict(res,'render/light0/')
     res = dict([ i for i in res.items() if not (i[0].startswith('render/material/') or  i[0].startswith('render/light0/'))])
     res['_save_'] = save
     res['render/material'] = mt
     res['render/light0'] =l0
     updateSettings(res)
 def accept(save=False):
     dia.acceptData()
     res = dia.results
     res['_save_'] = save
     pf.debug(res)
     ok_plugins = utils.subDict(res,'_plugins/')
     res['gui/plugins'] = [ p for p in ok_plugins if ok_plugins[p]]
     updateSettings(res)
     plugins.loadConfiguredPlugins()
Beispiel #5
0
 def accept(save=False):
     dia.acceptData()
     res = dia.results
     res['_save_'] = save
     ok_plugins = utils.subDict(res,'_plugins/')
     res['gui/plugins'] = [ p for p in ok_plugins if ok_plugins[p]]
     res['gui/actionbuttons'] = [ t for t in _actionbuttons if res['_gui/%sbutton'%t ] ]
     if res['webgl/script'] == 'custom':
         res['webgl/script'] = 'file:'+res['_webgl_script']
     if res['webgl/guiscript'] == 'custom':
         res['webgl/guiscript'] = res['_webgl_guiscript']
     updateSettings(res)
     plugins.loadConfiguredPlugins()
Beispiel #6
0
 def accept(save=False):
     dia.acceptData()
     print("RESULTS",dia.results)
     if dia.results['render/mode'].startswith('smooth'):
         res = utils.subDict(dia.results,'render/',strip=False)
         matname = dia.results['render/material']
         matdata = utils.subDict(dia.results,'material/')
         # Currently, set both in cfg and Material db
         pf.cfg['material/%s' % matname] = matdata
         pf.GUI.materials[matname] = canvas.Material(matname,**matdata)
     else:
         res = utils.selectDict(dia.results,['render/mode','render/lighting'])
     res['_save_'] = save
     print("RES",res)
     updateSettings(res)
     print(pf.cfg)
     vp = pf.GUI.viewports.current
     vp.resetLighting()
     #if pf.cfg['render/mode'] != vp.rendermode:
     print("SETMODE %s %s" % (pf.cfg['render/mode'],pf.cfg['render/lighting']))
     vp.setRenderMode(pf.cfg['render/mode'],pf.cfg['render/lighting'])
     print(vp.rendermode,vp.settings.lighting)
     vp.update()
     toolbar.updateLightButton()
Beispiel #7
0
 def accept(save=False):
     dia.acceptData()
     res = dia.results
     res['_save_'] = save
     ok_plugins = utils.subDict(res, '_plugins/')
     res['gui/plugins'] = [p for p in ok_plugins if ok_plugins[p]]
     res['gui/actionbuttons'] = [
         t for t in _actionbuttons if res['_gui/%sbutton' % t]
     ]
     if res['webgl/script'] == 'custom':
         res['webgl/script'] = 'file:' + res['_webgl_script']
     if res['webgl/guiscript'] == 'custom':
         res['webgl/guiscript'] = res['_webgl_guiscript']
     updateSettings(res)
     plugins.loadConfiguredPlugins()
 def accept(save=False):
     dia.acceptData()
     print "RESULTS", dia.results
     if dia.results["render/mode"].startswith("smooth"):
         res = utils.subDict(dia.results, "render/", strip=False)
         matname = dia.results["render/material"]
         matdata = utils.subDict(dia.results, "material/")
         # Currently, set both in cfg and Material db
         pf.cfg["material/%s" % matname] = matdata
         pf.GUI.materials[matname] = canvas.Material(matname, **matdata)
     else:
         res = utils.selectDict(dia.results, ["render/mode", "render/lighting"])
     res["_save_"] = save
     print "RES", res
     updateSettings(res)
     print pf.cfg
     vp = pf.GUI.viewports.current
     vp.resetLighting()
     # if pf.cfg['render/mode'] != vp.rendermode:
     print "SETMODE %s %s" % (pf.cfg["render/mode"], pf.cfg["render/lighting"])
     vp.setRenderMode(pf.cfg["render/mode"], pf.cfg["render/lighting"])
     print vp.rendermode, vp.lighting
     vp.update()
     toolbar.updateLightButton()