mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 18:57:17 +00:00
add sending gantt data on pressing generate gantt chart in blender
This commit is contained in:
@@ -58,12 +58,13 @@ function handleBlenderDisconnect(blenderId) {
|
|||||||
// Function to handle 'gantt_data' event
|
// Function to handle 'gantt_data' event
|
||||||
function handleGanttData(data) {
|
function handleGanttData(data) {
|
||||||
const blenderId = data["blenderId"];
|
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(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.hasOwnProperty(blenderId)) {
|
||||||
if (!connectedClients[blenderId].shown) {
|
if (!connectedClients[blenderId].shown) {
|
||||||
|
|||||||
@@ -1544,13 +1544,8 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
def generate_gantt_browser_chart(
|
def generate_gantt_browser_chart(
|
||||||
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
||||||
) -> None:
|
) -> None:
|
||||||
with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html"), "w") as f:
|
gantt_data = {"tasks": task_json, "word_schedule": json.dumps(work_schedule.get_info(recursive=True))}
|
||||||
with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.mustache"), "r") as t:
|
tool.Web.send_webui_data(extra_data=gantt_data, extra_data_key="gantt_data", event="gantt_data")
|
||||||
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"))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_filter_by_active_schedule(cls) -> bool:
|
def is_filter_by_active_schedule(cls) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user