Refactor: Integrate activeLayer and builder store into SelectFloorPlan and LoadBlueprint components; enhance getWallPointsFromBlueprint function with additional parameters for wall creation; update wall handling in WallCreator and PolygonGenerator components.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import useLayoutStore from "../../store/builder/uselayoutStore";
|
||||
import { useDfxUpload } from "../../store/builder/store";
|
||||
import { useActiveLayer, useDfxUpload } from "../../store/builder/store";
|
||||
import DxfParser from "dxf-parser";
|
||||
import { getWallPointsFromBlueprint } from "../../modules/builder/dfx/functions/getWallPointsFromBlueprint";
|
||||
import { convertDXFToThree } from "../../modules/builder/dfx/functions/convertDxfToThree";
|
||||
import { AIIcon } from "../icons/ExportCommonIcons";
|
||||
import { useBuilderStore } from "../../store/builder/useBuilderStore";
|
||||
import { useSceneContext } from "../../modules/scene/sceneContext";
|
||||
type DXFData = any;
|
||||
const SelectFloorPlan: React.FC = () => {
|
||||
// Access layout state and state setters
|
||||
@@ -12,10 +14,13 @@ const SelectFloorPlan: React.FC = () => {
|
||||
// Access DXF-related states and setters
|
||||
const { setDfxUploaded, setDfxGenerate, setObjValue, objValue } =
|
||||
useDfxUpload();
|
||||
|
||||
const { activeLayer } = useActiveLayer();
|
||||
const { wallThickness, wallHeight, insideMaterial, outsideMaterial } = useBuilderStore();
|
||||
const { wallStore } = useSceneContext();
|
||||
const { addWall } = wallStore();
|
||||
// Local state to store the parsed DXF file
|
||||
const [parsedFile, setParsedFile] = useState<DXFData | undefined>(undefined);
|
||||
|
||||
const { walls } = wallStore();
|
||||
// Flag to trigger generation after file upload
|
||||
const [generate, setGenerate] = useState<boolean>(false);
|
||||
|
||||
@@ -60,6 +65,7 @@ const SelectFloorPlan: React.FC = () => {
|
||||
parsedData: parsedFile,
|
||||
setDfxGenerate,
|
||||
objValue,
|
||||
wallThickness, wallHeight, outsideMaterial, insideMaterial, activeLayer, addWall, walls
|
||||
});
|
||||
}
|
||||
}, [generate]);
|
||||
|
||||
Reference in New Issue
Block a user