Refactor: Update project handling and sharing functionalities; integrate shared projects retrieval; enhance user data structure and loading mechanisms; improve input handling in MultiEmailInvite component; adjust wall generation callbacks in DXF processing.
This commit is contained in:
@@ -76,7 +76,7 @@ const DxfFile = () => {
|
||||
// Recalculate wall points based on new position
|
||||
getWallPointsFromBlueprint({
|
||||
objValue: { x: position.x, y: position.y, z: position.z },
|
||||
setDfxGenerate: () => { },
|
||||
setDxfWallGenerate: () => { },
|
||||
wallThickness, wallHeight, outsideMaterial, insideMaterial, activeLayer, addWall, walls
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ type DXFEntity = any; // Replace with actual DXF entity type
|
||||
type WallLineVertex = [Vector3, string, number, string]; // Represents a wall segment with start point, ID, weight, and type
|
||||
interface Props {
|
||||
parsedData?: DXFData; // Parsed DXF file data
|
||||
setDfxGenerate?: any; // Callback to set generated walls
|
||||
setDxfWallGenerate?: any; // Callback to set generated walls
|
||||
objValue: any; // Object position values for offset calculation
|
||||
wallThickness: number;
|
||||
wallHeight: number;
|
||||
@@ -25,12 +25,12 @@ interface Props {
|
||||
*
|
||||
* @param {Props} params - Configuration parameters
|
||||
* @param {DXFData} params.parsedData - Parsed DXF file data
|
||||
* @param {Function} params.setDfxGenerate - Callback to store generated walls
|
||||
* @param {Function} params.setDxfWallGenerate - Callback to store generated walls
|
||||
* @param {Object} params.objValue - Contains x,y,z offsets for position adjustment
|
||||
*/
|
||||
export function getWallPointsFromBlueprint({
|
||||
parsedData,
|
||||
setDfxGenerate,
|
||||
setDxfWallGenerate,
|
||||
objValue,
|
||||
wallThickness,
|
||||
wallHeight,
|
||||
@@ -46,6 +46,16 @@ export function getWallPointsFromBlueprint({
|
||||
|
||||
const unit = 1000; // Conversion factor from millimeters to meters
|
||||
const wallVertex: any[] = []; // Array to store wall vertices
|
||||
const findExistingPoint = (vec: Vector3): Point | undefined => {
|
||||
for (const wall of wallVertex) {
|
||||
for (const pt of wall.points) {
|
||||
const pos = new Vector3(...pt.position);
|
||||
if (pos.equals(vec)) return pt;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
// Process each entity in the DXF file
|
||||
parsedData.entities.forEach((entity: DXFEntity) => {
|
||||
// Handle LINE entities
|
||||
@@ -64,17 +74,19 @@ export function getWallPointsFromBlueprint({
|
||||
).add(new Vector3(objValue.x, 0, objValue.z));
|
||||
|
||||
// Create start and end points
|
||||
const startPoint: Point = {
|
||||
pointUuid: MathUtils.generateUUID(), // Generate unique ID for new points
|
||||
pointType: "Wall", // Type identifier
|
||||
position: [startVec.x, startVec.y, startVec.z], // Position in 3D space
|
||||
layer: activeLayer, // Default weight
|
||||
const existingStart = findExistingPoint(startVec);
|
||||
const startPoint: Point = existingStart || {
|
||||
pointUuid: MathUtils.generateUUID(),
|
||||
pointType: "Wall",
|
||||
position: [startVec.x, startVec.y, startVec.z],
|
||||
layer: activeLayer,
|
||||
};
|
||||
|
||||
const endPoint: Point = {
|
||||
pointUuid: MathUtils.generateUUID(), // Generate unique ID for new points
|
||||
pointType: "Wall", // Type identifier
|
||||
position: [endVec.x, endVec.y, endVec.z], // Position in 3D space
|
||||
const existingEnd = findExistingPoint(endVec);
|
||||
const endPoint: Point = existingEnd || {
|
||||
pointUuid: MathUtils.generateUUID(),
|
||||
pointType: "Wall",
|
||||
position: [endVec.x, endVec.y, endVec.z],
|
||||
layer: activeLayer,
|
||||
};
|
||||
|
||||
@@ -113,14 +125,16 @@ export function getWallPointsFromBlueprint({
|
||||
).add(new Vector3(objValue.x, 0, objValue.z));
|
||||
|
||||
// Create start and end points
|
||||
const startPoint: Point = {
|
||||
const existingStart = findExistingPoint(startVec);
|
||||
const startPoint: Point = existingStart || {
|
||||
pointUuid: MathUtils.generateUUID(), // Generate unique ID for new points
|
||||
pointType: "Wall", // Type identifier
|
||||
position: [startVec.x, startVec.y, startVec.z], // Position in 3D space
|
||||
layer: activeLayer,
|
||||
};
|
||||
|
||||
const endPoint: Point = {
|
||||
const existingEnd = findExistingPoint(endVec);
|
||||
const endPoint: Point = existingEnd || {
|
||||
pointUuid: MathUtils.generateUUID(), // Generate unique ID for new points
|
||||
pointType: "Wall", // Type identifier
|
||||
position: [endVec.x, endVec.y, endVec.z], // Position in 3D space
|
||||
@@ -200,14 +214,16 @@ export function getWallPointsFromBlueprint({
|
||||
const endVec = arcPoints[i + 1];
|
||||
|
||||
// Create start and end points
|
||||
const startPoint: Point = {
|
||||
const existingStart = findExistingPoint(startVec);
|
||||
const startPoint: Point = existingStart || {
|
||||
pointUuid: MathUtils.generateUUID(),
|
||||
pointType: "Wall",
|
||||
position: [startVec.x, startVec.y, startVec.z],
|
||||
layer: activeLayer,
|
||||
};
|
||||
|
||||
const endPoint: Point = {
|
||||
const existingEnd = findExistingPoint(endVec);
|
||||
const endPoint: Point = existingEnd || {
|
||||
pointUuid: MathUtils.generateUUID(),
|
||||
pointType: "Wall",
|
||||
position: [endVec.x, endVec.y, endVec.z],
|
||||
@@ -236,7 +252,7 @@ export function getWallPointsFromBlueprint({
|
||||
console.error("Unsupported entity type:", entity.type);
|
||||
}
|
||||
});
|
||||
|
||||
console.log("wallVertex: ", wallVertex);
|
||||
// Return the generated walls through callback if provided
|
||||
setDfxGenerate && setDfxGenerate(wallVertex);
|
||||
}
|
||||
setDxfWallGenerate && setDxfWallGenerate(wallVertex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user