def worker(): """The threaded function""" kwargs = dict(N=sg.N) if sg.first=='Dihedral' else {} group = sg.selected_group(**kwargs) dm = DataModel(group) dm.generate(6) def dinges(): ee = PoissonEditor(dm) ee.configure_traits() GUI.invoke_later(dinges)
def _load_fired(self): file_wildcard = '*.*' dialog = FileDialog(action="open", wildcard=file_wildcard, default_directory = self.filedir) dialog.open() if dialog.return_code == OK: try: ee = EdgeEditor(DataModel.load(dialog.path)) ee.filedir = dialog.directory ee.filename = dialog.filename ee.configure_traits() except: import traceback traceback.print_exc() print('error loading file')
def run(): """ starting the main thread needs to be isolated from module level, to avoid import deadlock issues """ if False: from escheresque.group.tetrahedral import ChiralTetrahedral as Group ## from tetrahedral import Null as Group ## from octahedral import Tetrahedral as Group ## from octahedral import Null as Group from escheresque.group.octahedral import Pyritohedral as Group ## from octahedral import ChiralOctahedral as Group ## from octahedral import Tetrahedral as Group ## from octahedral import Origin as Group ## from dihedral import ChiralDihedral as Group from escheresque.group.icosahedral import ChiralIcosahedral as Group ## from icosahedral import Icosahedral as Group dm = DataModel(Group()) # dm.generate(6) else: path = r'..\data' filename = 'turtles.sch' ## filename = 'angles_and_demons.sch' dm = DataModel.load(os.path.join(path, filename)) # dm.regenerate(5) if True: ## from .interface.edge_editor import EdgeEditor ## editor = EdgeEditor(dm) from escheresque.interface.poisson_editor import PoissonEditor editor = PoissonEditor(dm) else: from escheresque.interface.height_editor import HeightEditor editor = HeightEditor(dm) ## from .interface.pressure_editor import PressureEditor ## editor = PressureEditor(dm) editor.configure_traits()
return mesh, curve if __name__=='__main__': if True: # load .sch file and export parts to stl from escheresque.datamodel import DataModel from escheresque import stl, brushes import os path = r'..\data' filename = 'turtles.sch' datamodel = DataModel.load(os.path.join(path, filename)) # datamodel.generate(5) partitions = datamodel.partition() filename = r'..\data\part{0}.stl' for i, mesh in enumerate(partitions): mesh.vertices *= datamodel.sample(mesh.vertices)[:, None] thickness = 0.03 mesh = mesh.swept_extrude(thickness) assert mesh.is_orientated() stl.save_STL(filename.format(i), mesh) mesh.plot() quit()