def load(dir): if (os.path.isdir(dir) and os.path.exists(os.path.join(dir, "jcae3d"))): reader = AmibeToMesh(dir) print("Loading " + dir) viewable = MyViewableMesh() viewable.addTriangles(reader.getTriangles()) viewable.addBeams(reader.getBeams()) return viewable return None
def load(dir): if (os.path.isdir(dir) and os.path.exists(os.path.join(dir, "jcae3d"))): reader = AmibeToMesh(dir) print("Loading "+dir) viewable = MyViewableMesh() viewable.addTriangles(reader.getTriangles()) viewable.addBeams(reader.getBeams()) return viewable return None
if (len(args) != 1): parser.print_usage() sys.exit(1) xmlDir = args[0] frame = JFrame("jCAE Demo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) canvas = View() frame.add(canvas, BorderLayout.CENTER) if (os.path.isdir(xmlDir)): if (os.path.exists(os.path.join(xmlDir, "jcae3d"))): reader = AmibeToMesh(xmlDir) viewable = ViewableMesh(Palette(32)) viewable.addTriangles(reader.getTriangles()) viewable.addBeams(reader.getBeams()) elif (os.path.exists(os.path.join(xmlDir, "oemm"))): oemm = Storage.readOEMMStructure(xmlDir) viewable = ViewableOEMM(oemm) else: raise IOError, "Cannot find file" elif (xmlDir.endswith(".unv")): viewable = ViewableMesh(UNVToMesh(xmlDir, Collections.EMPTY_LIST).getMesh()) else: viewable = ViewableCAD(xmlDir) canvas.add(viewable) frame.setSize(800,600) class MyKeyListener(KeyListener): def __init__(self, view):
if (len(args) != 1): parser.print_usage() sys.exit(1) xmlDir = args[0] frame = JFrame("jCAE Demo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) canvas = View() frame.add(canvas, BorderLayout.CENTER) if (os.path.isdir(xmlDir)): if (os.path.exists(os.path.join(xmlDir, "jcae3d"))): reader = AmibeToMesh(xmlDir) viewable = ViewableMesh(Palette(32)) viewable.addTriangles(reader.getTriangles()) viewable.addBeams(reader.getBeams()) elif (os.path.exists(os.path.join(xmlDir, "oemm"))): oemm = Storage.readOEMMStructure(xmlDir) viewable = ViewableOEMM(oemm) else: raise IOError, "Cannot find file" elif (xmlDir.endswith(".unv")): viewable = ViewableMesh( UNVToMesh(xmlDir, Collections.EMPTY_LIST).getMesh()) else: viewable = ViewableCAD(xmlDir) canvas.add(viewable) frame.setSize(800, 600)