add sending gantt data on pressing generate gantt chart in blender

This commit is contained in:
Ziad-I
2024-06-29 22:06:47 +03:00
committed by Dion Moult
parent 25e964788c
commit c0216efffe
2 changed files with 8 additions and 12 deletions
@@ -58,12 +58,13 @@ function handleBlenderDisconnect(blenderId) {
// Function to handle 'gantt_data' event
function handleGanttData(data) {
const blenderId = data["blenderId"];
const ganttTasks = data["data"]["tasks"];
// const ganttWorkSched = data["data"]["schedule"];
const ganttWorkSched = {};
const filename = data["data"]["IFC_File"];
console.log(data);
console.log(ganttTasks);
const filename = data["data"]["IFC_File"];
const ganttTasks = data["data"]["gantt_data"]["tasks"];
// const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
const ganttWorkSched = {};
if (connectedClients.hasOwnProperty(blenderId)) {
if (!connectedClients[blenderId].shown) {
+2 -7
View File
@@ -1544,13 +1544,8 @@ class Sequence(blenderbim.core.tool.Sequence):
def generate_gantt_browser_chart(
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
) -> None:
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())})
)
webbrowser.open("file://" + os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html"))
gantt_data = {"tasks": task_json, "word_schedule": json.dumps(work_schedule.get_info(recursive=True))}
tool.Web.send_webui_data(extra_data=gantt_data, extra_data_key="gantt_data", event="gantt_data")
@classmethod
def is_filter_by_active_schedule(cls) -> bool: