def main(): factory = ShapeFactory() shapes = [] # read from input file lines = getFileContents() # create the board that is used for drawing board = factory.createBoard(lines[0]) # create the shapes from the file for line in lines: newShape = factory.createShape(line) if newShape is not None: shapes.append(newShape) # draw each shape on the board for shape in shapes: shape.draw(board) # get the painted result from the board and write the it into an output file result = board.showBoard() f = open("output.txt", "w") f.write(result) f.close()
def create_robot(self): bot = DynamicObject() bot.model = loader.loadModel('data/QuadRotor') bot.model.reparentTo(render) bot.model.setPos(1.29,0.7,2.5) bot.body = OdeBody(self.world) M = OdeMass() M.setBox(5,0.6,0.45,0.15) bot.body.setMass(M) bot.body.setPosition(bot.model.getPos(render)) bot.body.setQuaternion(bot.model.getQuat(render)) bot.geom = OdeBoxGeom(self.space, 0.6,0.45,0.15) bot.geom.setCollideBits(BitMask32(0x00000001)) bot.geom.setCategoryBits(BitMask32(0x00000001)) bot.geom.setBody(bot.body) self.obj_list.append(bot) cube = sf.makeCube(self,1,1,1,5) cube.setpos((1.2,1,1.5)) self.obj_list.append(cube)