Beispiel #1
0
def runWizard():

    parent = tool.getToolWindow()
    outputs=wizard.runWizard(hifun.project.projectimport, parent = parent)

    if outputs:
        projectname=outputs['FileChoosingPage']['projectname']
        mshfile=outputs['FileChoosingPage']['mshfile']
        bcs = outputs['allbcs']
	scale=str(outputs['Scale']['scale'])
#        cellzone = [(item[0], list(item[1])) for item in outputs['CellzoneOptionPage']['cellzone']]
	cellzone=[]
        for item in outputs['CellzoneOptionPage']['cellzone']:
		if item[1] == None:
 		       cellzone.append((item[0], None))
		else:
 		       cellzone.append((item[0], list(item[1])))
        zip_choice = str(int(outputs['FileChoosingPage']['zip']))

	interface=[]
        if 'InterfacePairPage' in outputs and 'IList' in outputs['InterfacePairPage']:
                ipair = outputs['InterfacePairPage']['IList']
		print ipair
            	for item in outputs['InterfacePairPage']['IList']:
		    if item[1]:
		       for k in item[1]:
		          if ((item[0], k) not in interface) and ((k, item[0]) not in interface):
			     interface.append((item[0], k))


        p=project.Project(projectname,mshfile,bcs,cellzone, outputs['dimension'],zip_choice,scale,interface)

        write_msh2geo(p,outputs)

        p.save()

        projectutils.addProject(p)

	file=open('hifunerr.log','w')
        file.write("HIFUN log file"+'\n')
        file.write("=============="+'\n')
	file.close()
Beispiel #2
0
def openProject(path):
    path = os.path.abspath(path)
    name = os.path.basename(path)
    items = storage.load(os.path.join(path, name))
    p = Project(items=items)
    projectutils.addProject(p)