def __init__(self): ViewableMesh.__init__(self, palette) self.setSelectionType(Viewable.SelectionType.CELL)
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):
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)