mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Fix launching of IfcTester webapp with Bonsai
This commit is contained in:
@@ -337,9 +337,21 @@ class StartIfcTesterWebapp(bpy.types.Operator):
|
|||||||
websocket_server_thread = threading.Thread(target=run_websocket_server, daemon=True)
|
websocket_server_thread = threading.Thread(target=run_websocket_server, daemon=True)
|
||||||
websocket_server_thread.start()
|
websocket_server_thread.start()
|
||||||
|
|
||||||
|
py_version = sys.version_info
|
||||||
|
bonsai_lib_path = (
|
||||||
|
Path(bpy.utils.user_resource("EXTENSIONS"))
|
||||||
|
/ ".local"
|
||||||
|
/ "lib"
|
||||||
|
/ f"python{py_version.major}.{py_version.minor}"
|
||||||
|
/ "site-packages"
|
||||||
|
)
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["BONSAI_LIB_PATH"] = str(bonsai_lib_path)
|
||||||
|
env["BONSAI_VERSION"] = tool.Blender.get_bonsai_version()
|
||||||
|
|
||||||
# Start the Flask server as subprocess
|
# Start the Flask server as subprocess
|
||||||
webapp_process = subprocess.Popen(
|
webapp_process = subprocess.Popen(
|
||||||
[sys.executable, webapp_serve_path, "--host", "127.0.0.1", "--port", str(webapp_port)]
|
[sys.executable, webapp_serve_path, "--host", "127.0.0.1", "--port", str(webapp_port)], env=env
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update properties
|
# Update properties
|
||||||
|
|||||||
@@ -174,6 +174,14 @@ If there are changes to the IfcOpenShell binaries, you may replace the two
|
|||||||
``*ifcopenshell_wrapper*`` files with new ones downloaded from the automated
|
``*ifcopenshell_wrapper*`` files with new ones downloaded from the automated
|
||||||
`IfcOpenShell builds directory <https://builds.ifcopenshell.org/>`__.
|
`IfcOpenShell builds directory <https://builds.ifcopenshell.org/>`__.
|
||||||
|
|
||||||
|
If you wish to run the IfcTester webapp, you will also need to have ``npm`` and
|
||||||
|
setup IfcTester:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd src/ifctester
|
||||||
|
make webapp-prepare
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
There is a `useful Blender Addon
|
There is a `useful Blender Addon
|
||||||
|
|||||||
@@ -17,8 +17,18 @@
|
|||||||
# along with IfcTester. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcTester. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
|
||||||
|
bonsai_lib_path = os.environ.get("BONSAI_LIB_PATH")
|
||||||
|
print(os.environ)
|
||||||
|
print(bonsai_lib_path)
|
||||||
|
bonsai_version = os.environ.get("BONSAI_VERSION")
|
||||||
|
|
||||||
|
if bonsai_lib_path:
|
||||||
|
sys.path.insert(0, bonsai_lib_path)
|
||||||
|
|
||||||
from flask import Flask, send_from_directory, send_file
|
from flask import Flask, send_from_directory, send_file
|
||||||
|
|
||||||
# Browsers expecting this specific MIME type for .mjs files,
|
# Browsers expecting this specific MIME type for .mjs files,
|
||||||
|
|||||||
Reference in New Issue
Block a user