def readSelection(select=True,draw=True,multi=True): """Read a Formex (or list) from asked file name(s). If select is True (default), this becomes the current selection. If select and draw are True (default), the selection is drawn. """ types = utils.fileDescription(['pgf','all']) fn = askFilename(GD.cfg['workdir'],types,multi=multi) if fn: if not multi: fn = [ fn ] chdir(fn[0]) res = ODict() GD.GUI.setBusy() for f in fn: res.update(readGeomFile(f)) GD.GUI.setBusy(False) export(res) if select: oknames = [ k for k in res if isinstance(res[k],Formex) ] selection.set(oknames) GD.message("Set Formex selection to %s" % oknames) if draw: selection.draw() return fn
# 'custom', ] # Define a dictionary of planar cross sections cross_sections = ODict() # select the planar patterns from the simple module for cs in simple.Pattern: if re.search('[a-zA-Z]', simple.Pattern[cs][2:]) is None: cross_sections[cs] = simple.Pattern[cs] # add some more patterns cross_sections.update({ 'channel': 'l:1223', 'H-beam': 'l:11/322/311', 'sigma': 'l:16253', 'Z-beam': 'l:353', 'octagon': 'l:15263748', 'swastika': 'l:12+23+34+41', 'solid_square': '4:0123', 'solid_triangle': '3:012', 'swastika3': '3:012023034041', }) dialog_items = [ _I('nmod', 100, text='Number of cells along spiral'), _I('turns', 2.5, text='Number of 360 degree turns'), _I('rfunc', None, text='Spiral function', choices=rfuncs), _I('coeffs', (1., 0.5, 0.2), text='Coefficients in the spiral function'), _I('spiral3d', 0.0, text='Out of plane factor'), _I('spread', False, text='Spread points evenly along spiral'), _I('nwires', 1, text='Number of spirals'), _G('sweep',
# 'custom', ] # Define a dictionary of planar cross sections cross_sections_2d = ODict() # select the planar patterns from the simple module for cs in simple.Pattern: if re.search('[a-zA-Z]',simple.Pattern[cs]) is None: cross_sections_2d[cs] = simple.Pattern[cs] # add some more patterns cross_sections_2d.update({ 'swastika':'l:12+23+34+41', 'channel' : 'l:1223', 'H-beam' : 'l:11/322/311', 'sigma' : 'l:16253', 'octagon':'l:15263748', 'Z-beam': 'l:353', 'solid_square': '4:0123', 'solid_triangle': '3:012', 'swastika3': '3:012023034041', }) input_data = [ _I('nmod',100,text='Number of cells along spiral'), _I('turns',2.5,text='Number of 360 degree turns'), _I('rfunc',None,text='Spiral function',choices=rfuncs), _I('coeffs',(1.,0.5,0.2),text='Coefficients in the spiral function'), _I('spiral3d',0.0,text='Out of plane factor'), _I('spread',False,text='Spread points evenly along spiral'), _I('nwires',1,text='Number of spirals'),