用tornado框架做后端……,用bootstrap做前端
先上效果图:
生成出来的G代码:
g.py源码:
class MainHandler(tornado.web.RequestHandler): def post(self,*args,**kwargs): a=int(self.get_argument('x')) b=int(self.get_argument('y')) c=int(self.get_argument('r')) d=int(self.get_argument('l')) j1=int(self.get_argument('f')) l1='G00'+str(c1)+y+str(c2)+'</br>'+"Z5"+'</br>' l2=g+'Z'+str(d)+'F'+str(j1)+'</br>' l4=g+'Y'+l3+'F'+str(j1)+'</br>' application = tornado.web.Application([ (r"/index", MainHandler), if __name__ == "__main__": tornado.ioloop.IOLoop.instance().start()
html源码:
<title>在线G代码平面铣工具</title> <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script> <center><div style="width:550px;height:900px id="wingMap"> <center><h1>在线G代码平面铣工具</h1></center> <form method="post" action="/index"> <form class="form-horizontal" role="form"> <label for="firstname" class="col-sm-2 control-label">毛坯长度</label> <input type="text" name="x" class="form-control" id="firstname" <label for="lastname" class="col-sm-2 control-label">毛坯宽度:</label> <input type="text" name="y" class="form-control" id="lastname" <label for="lastname" class="col-sm-2 control-label">刀具直径:</label> <input type="text" name="r" class="form-control" id="lastname" <label for="lastname" class="col-sm-2 control-label">下刀深度:</label> <input type="text" name="l" class="form-control" id="lastname" <label for="lastname" class="col-sm-2 control-label">进给速度:</label> <input type="text" name="f" class="form-control" id="lastname" <button type="submit" name="submit" class="btn btn-primary">生成</button>
效果图
服务端效果图:
生成速度非常快(10w行代码只要几秒)!
转载于:https://www.cnblogs.com/ksxh/p/9051109.html
|