diff --git a/src/Mod/Arch/importWebGL.py b/src/Mod/Arch/importWebGL.py index 3558dca0a8..e2e2302200 100644 --- a/src/Mod/Arch/importWebGL.py +++ b/src/Mod/Arch/importWebGL.py @@ -38,6 +38,7 @@ """FreeCAD WebGL Exporter""" import FreeCAD,Mesh,Draft,Part,OfflineRenderingUtils,json,six +import textwrap if FreeCAD.GuiUp: import FreeCADGui @@ -60,291 +61,324 @@ base = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#$%&()*+- baseFloat = ',.-0123456789' def getHTMLTemplate(): - return """ + return textwrap.dedent("""\ + $pagetitle - - - + + + + + - """ + """) def export( exportList, filename, colors = None, camera = None ): """Exports objects to an html file""" @@ -772,11 +858,10 @@ def export( exportList, filename, colors = None, camera = None ): html = html.replace('$version',version[0] + '.' + version[1] + '.' + version[2]) # Remove data compression in JS - if disableCompression: html = html.replace('$disableCompression','true') - else: html = html.replace('$disableCompression','false') + data['compressed'] = not disableCompression + data['base'] = base + data['baseFloat'] = baseFloat - html = html.replace('$base', base) - html = html.replace('$float', baseFloat) html = html.replace('$data', json.dumps(data, separators=(',', ':')) ) # Shape Data if six.PY2: