diff --git a/src/bonsai/bonsai/bim/module/csv/operator.py b/src/bonsai/bonsai/bim/module/csv/operator.py index 23f48b7ace..480dae7458 100644 --- a/src/bonsai/bonsai/bim/module/csv/operator.py +++ b/src/bonsai/bonsai/bim/module/csv/operator.py @@ -254,7 +254,7 @@ class ExportIfcCsv(bpy.types.Operator): schedule_creator = scheduler.Scheduler() schedule_creator.schedule(self.filepath, tool.Drawing.get_path_with_ext(self.filepath, "svg")) if props.format == "web": - if not context.scene.WebProperties.is_running and not context.scene.WebProperties.is_connected: + if not context.scene.WebProperties.is_connected: bpy.ops.bim.connect_websocket_server() tool.Web.send_webui_data(data=ifc_csv.dataframe.to_csv(index=False), data_key="csv_data", event="csv_data") diff --git a/src/bonsai/bonsai/tool/sequence.py b/src/bonsai/bonsai/tool/sequence.py index 960abd2f42..d54d8a090e 100644 --- a/src/bonsai/bonsai/tool/sequence.py +++ b/src/bonsai/bonsai/tool/sequence.py @@ -1541,20 +1541,10 @@ class Sequence(bonsai.core.tool.Sequence): def generate_gantt_browser_chart( cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance ) -> None: - if bpy.context.scene.WebProperties.is_connected: - gantt_data = {"tasks": task_json, "work_schedule": work_schedule.get_info(recursive=True)} - tool.Web.send_webui_data(data=gantt_data, data_key="gantt_data", event="gantt_data") - return - - with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html"), "w") as f: - with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.mustache"), "r") as t: - task_b64 = base64.b64encode(bytes(json.dumps(task_json), "utf-8")).decode("utf-8") - f.write( - pystache.render( - t.read(), {"json_data": task_b64, "data": json.dumps(work_schedule.get_info(recursive=True))} - ) - ) - webbrowser.open("file://" + os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html")) + if not bpy.context.scene.WebProperties.is_connected: + bpy.ops.bim.connect_websocket_server() + gantt_data = {"tasks": task_json, "work_schedule": work_schedule.get_info(recursive=True)} + tool.Web.send_webui_data(data=gantt_data, data_key="gantt_data", event="gantt_data") @classmethod def is_filter_by_active_schedule(cls) -> bool: