# HG changeset patch # User mdd # Date 1491488481 -7200 # Node ID ff1941c85fd3fcac93fce75227e2fcdd92d51bf4 # Parent dee15870206a70f779512ef3ba7b30d29eaa23ae added 2d image to 3d viewer diff -r dee15870206a -r ff1941c85fd3 cylindertransport-web.py --- a/cylindertransport-web.py Thu Apr 06 15:41:04 2017 +0200 +++ b/cylindertransport-web.py Thu Apr 06 16:21:21 2017 +0200 @@ -6,12 +6,14 @@ import cgi, data, json, config from cylindertransport import CylinderSpacerCalculator +import base64 +import cStringIO # enable debugging #import sys #sys.stderr = sys.stdout -#import cgitb -#cgitb.enable() +import cgitb +cgitb.enable() def do_action(args): """ @@ -21,9 +23,14 @@ cylinders = args.getlist("cylinders[]") calc = CylinderSpacerCalculator(cylinders) calc.calculate() + image = calc.render_image() + buffer = cStringIO.StringIO() + image.save(buffer, format="PNG") + img_str = base64.b64encode(buffer.getvalue()) print json.dumps({ "objects": calc.circles, - "scale3d": config.SCALE3D + "scale3d": config.SCALE3D, + "image": img_str }) else: print "unknown Action %s" % args["action"].value diff -r dee15870206a -r ff1941c85fd3 js/images/ui-bg_flat_0_aaaaaa_40x100.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-bg_flat_0_aaaaaa_40x100.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1302 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + b7d0c70 + + Jun 6, 2016 + + + +
+ + @TravisCarden + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 86 Bytes +
+
+ + + +
+
+ ui-bg_flat_0_aaaaaa_40x100.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_444444_256x240.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-icons_444444_256x240.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-icons_444444_256x240.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + cc37fe7 + + Nov 30, 2016 + + + +
+ + @scottgonzalez + @peritpatrio + @jaspermdegroot + @joliss + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 3.19 KB +
+
+ + + +
+
+ ui-icons_444444_256x240.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_555555_256x240.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-icons_555555_256x240.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-icons_555555_256x240.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + cc37fe7 + + Nov 29, 2016 + + + +
+ + @scottgonzalez + @peritpatrio + @jaspermdegroot + @joliss + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 3.2 KB +
+
+ + + +
+
+ ui-icons_555555_256x240.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_777620_256x240.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-icons_777620_256x240.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-icons_777620_256x240.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + cc37fe7 + + Nov 29, 2016 + + + +
+ + @scottgonzalez + @peritpatrio + @jaspermdegroot + @joliss + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 3.19 KB +
+
+ + + +
+
+ ui-icons_777620_256x240.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_777777_256x240.png Binary file js/images/ui-icons_777777_256x240.png has changed diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_cc0000_256x240.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-icons_cc0000_256x240.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-icons_cc0000_256x240.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + cc37fe7 + + Nov 29, 2016 + + + +
+ + @scottgonzalez + @peritpatrio + @jaspermdegroot + @joliss + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 3.19 KB +
+
+ + + +
+
+ ui-icons_cc0000_256x240.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 js/images/ui-icons_ffffff_256x240.png --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/js/images/ui-icons_ffffff_256x240.png Thu Apr 06 16:21:21 2017 +0200 @@ -0,0 +1,1317 @@ + + + + + + + + + + + + + + + + + + + + + + + jquery-ui/ui-icons_ffffff_256x240.png at master · jquery/jquery-ui · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+
+
+ + + + + + +
+
+ + + + +Permalink + + + +
+ +
+ + +
+ +
+
+ + Switch branches/tags +
+ +
+
+ +
+
+ +
+
+ + + + + +
+
+
+ +
+ + Find file + + +
+ +
+ + + +
+ + + cc37fe7 + + Nov 29, 2016 + + + +
+ + @scottgonzalez + @peritpatrio + @jaspermdegroot + @joliss + @PeterDaveHello + + +
+ + +
+ +
+
+
+ + + + +
+ +
+ +
+ 3.19 KB +
+
+ + + +
+
+ ui-icons_ffffff_256x240.png +
+
+ +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + + + +
+ + + You can't perform that action at this time. +
+ + + + + + + + + +
+ + You signed in with another tab or window. Reload to refresh your session. + You signed out in another tab or window. Reload to refresh your session. +
+ + + + + + diff -r dee15870206a -r ff1941c85fd3 stlviewer.css --- a/stlviewer.css Thu Apr 06 15:41:04 2017 +0200 +++ b/stlviewer.css Thu Apr 06 16:21:21 2017 +0200 @@ -68,20 +68,29 @@ } -#infocontainer { +.infocontainer { width: 300px; - padding-left: 10px; - padding-bottom: 10px; - overflow-y: auto; - overflow-x: auto; float: right; border: 1px solid #eee; color: #fff; background: rgba(0,0,0,0.5); text-align: left; } + +.infocontainer img { + margin-top: 10px; + width: 100%; + cursor: pointer; +} + +#infocontainer { + padding-left: 10px; + padding-bottom: 10px; + overflow-y: auto; + overflow-x: auto; +} #infocontainer ul { margin-left: 0; padding: 0; list-style-position: inside; -} \ No newline at end of file +} diff -r dee15870206a -r ff1941c85fd3 stlviewer.html --- a/stlviewer.html Thu Apr 06 15:41:04 2017 +0200 +++ b/stlviewer.html Thu Apr 06 16:21:21 2017 +0200 @@ -33,7 +33,9 @@ -
+
+
+
diff -r dee15870206a -r ff1941c85fd3 stlviewer.js --- a/stlviewer.js Thu Apr 06 15:41:04 2017 +0200 +++ b/stlviewer.js Thu Apr 06 16:21:21 2017 +0200 @@ -32,6 +32,27 @@ for (i =0; i<10; i++) clear_scene(); }); update_scene(); + + $("#image2d").click(function() { + var img = $("#image2d").clone(); + //img.css('width', '100%'); + img.css('margin', '0 auto'); + $("
") + .append(img) + .dialog({ + modal: true, + draggable: false, + resizable: false, + title: "2D Layout view", + height: window.innerHeight, + width: window.innerWidth, + buttons: { + Close: function() { + $( this ).dialog( "close" ); + } + } + }); + }); } ); function clear_scene() { @@ -98,6 +119,8 @@ $("#infocontainer").html(content); + $("#image2d").attr('src', 'data:image/png;base64,' + data.image); + } }); }