WebGL export

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: WebGL export

Post by yorik »

microelly2 wrote:The cause for this error seems to be print calls in the code when the script is executed from a Qt Gui.
Hm interesting info... Hopefully when we switch to python3 all these problems will be gone because the exchange of text between python and Qt is greatly simplified (all python is unicode <-> all qt is exchanged as utf8)
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

microelly2 wrote:The cause for this error seems to be print calls in the code when the script is executed from a Qt Gui.
I had the same problem last days.
Go through the code and deactivate all prints.
I still have no idea to redirect print in such cases.
Thanks for confirmation and feedback. Indeed print statements were the issue for me too.
yorik wrote:
microelly2 wrote:The cause for this error seems to be print calls in the code when the script is executed from a Qt Gui.
Hm interesting info... Hopefully when we switch to python3 all these problems will be gone because the exchange of text between python and Qt is greatly simplified (all python is unicode <-> all qt is exchanged as utf8)
Hopefully things will sort itself out indeed but just in case i created this "test case":

Code: Select all

import sys
from PySide.QtCore import *
from PySide.QtGui import *

class Form(QDialog):

    def __init__(self, parent = None):
        super(Form, self).__init__(parent)
        self.setWindowTitle("My Form")
        self.edit = QLineEdit("Write my name here")
        self.button = QPushButton("Show Greetings")
        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        layout.addWidget(self.button)
        self.setLayout(layout)
        self.button.clicked.connect(self.greetings)

    def greetings(self):
        print ("Hello : " + self.edit.text())

if __name__ == '__main__':
    form = Form()
    form.show()
I adapted the code from here. Removing CadQuery module from Mod folder removes that error. Therefore i reported the issue to CadQuery module developer to take a look. And i cross-referenced it here if maybe there is an issue inside FreeCAD to be looked at.

https://github.com/jmwright/cadquery-fr ... /issues/63
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: WebGL export

Post by microelly2 »

Import/link of community software is necessary but difficult.
Changing the base can cause a lot of problems. Changing to python3 is a big thing, and I thank Yorik to do the hard job to inspect all the code.
To port the 3rd party products will be a task for somebody else ...
I have worked on a lot of php platforms.
In TYPO3 an extensions is killed on a syntax error or a runtime error. There is a good security support
MOODLE (may be it's now better) crashed completely. This was a nightmare for the admin, one error during the time, when a examination of students was running - and you are stoned.
As long as FreeCAD is a standalone program there is no problem.
compile, run the regression tests and when okay you can deliver.
Otherwise debug, make the next test case ..

But Computer Aided Industry is so complex, there cannot be the Singing Ringing Tree.
So how to make the system open and secure?
I think its worth to discuss about this. There should be concepts, how components can communicate in a secure manner. And we should have these concepts running before problems turn up.
I think this is not a specific problem of the cad query module (I have to change my sources too), but in general.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

Yes there is always risk of running any code on the computer. Improving this therefore probably can't be done on technical level in FreeCAD but the code would need to be audited by some trustworthy authority.

But that would probably take substantial amount of work for FreeCAD project developers to audit 3rd Party modules. That probably will remain responsibility of individual users unless in the future FreeCAD project would actually become interested in doing this work for whatever reason involved.
User avatar
bill
Posts: 376
Joined: Fri Jan 09, 2015 9:25 pm

Re: WebGL export

Post by bill »

As a minimum, secure hashes should be generated and checked on all macros and WBs.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

microelly2 wrote:The cause for this error seems to be print calls in the code when the script is executed from a Qt Gui.
I had the same problem last days.
Go through the code and deactivate all prints.
I still have no idea to redirect print in such cases.
It should now be possible to use latest CadQuery module without mentioned issue.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: WebGL export

Post by bernd »

Just tried the webgl export with FreeCAD.

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7569 (Git)
Build type: Release
Branch: master
Hash: f6cdf8b4709baa79fc89e8c24cf8cbfa84d55501
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Attached the file I tested with. The html file has lots of lines, but the browserwindow of Firefox keeps staying a white board nothing else ?!?
Attachments
test.FCStd
(103.93 KiB) Downloaded 121 times
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: WebGL export

Post by rockn »

Hold right click and drag down your mouse, you will see something ;)
I remember having hard time to get the right view directly from a fresh export, something like moving all geometry far from where it is...
Formations - Assistance - Développement : https://freecad-france.com
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: WebGL export

Post by bernd »

Thanks rockn, Ahh yeah we had this allready. Wasn't it because of the way the viewer (and thus scalling and camera view point) is implemented is not optimized to view something huuuuuge like a building ...
Attachments
webgl.png
webgl.png (76.93 KiB) Viewed 4837 times
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

Post Reply