From 2043712f5d3df4542d9d122bd642221db5dbfc93 Mon Sep 17 00:00:00 2001 From: Jerald-Golden-B Date: Tue, 1 Apr 2025 18:52:21 +0530 Subject: [PATCH] add backend api and socket for conveyor events --- app/.env | 7 +++- .../sidebarRight/visualization/data/Data.tsx | 2 +- .../geomentries/assets/addAssetModel.ts | 1 - .../builder/groups/floorItemsGroup.tsx | 3 +- .../scene/IntialLoad/loadInitialFloorItems.ts | 5 +-- .../simulation/behaviour/behaviour.tsx | 41 ++----------------- app/src/modules/simulation/simulation.tsx | 1 + .../assest/assets/getCategoryAsset.ts | 2 +- 8 files changed, 15 insertions(+), 47 deletions(-) diff --git a/app/.env b/app/.env index e0b0d16..5740621 100644 --- a/app/.env +++ b/app/.env @@ -7,8 +7,11 @@ REACT_APP_SERVER_SOCKET_API_BASE_URL=185.100.212.76:8000 # Base URL for the server REST API, used for HTTP requests to the backend server. REACT_APP_SERVER_REST_API_BASE_URL=185.100.212.76:5000 -# REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 -REACT_APP_SERVER_MARKETPLACE_URL=192.168.0.111:3501 +# Base URL for the server marketplace, used for market place model blob. +REACT_APP_SERVER_MARKETPLACE_URL=185.100.212.76:50011 + +# Base URL for the asset library server, used for asset library images and model blob id. +REACT_APP_SERVER_ASSET_LIBRARY_URL=192.168.0.111:3501 # base url for IoT socket server REACT_APP_IOT_SOCKET_SERVER_URL =185.100.212.76:5010 diff --git a/app/src/components/layout/sidebarRight/visualization/data/Data.tsx b/app/src/components/layout/sidebarRight/visualization/data/Data.tsx index 2c9b5c6..5f501a2 100644 --- a/app/src/components/layout/sidebarRight/visualization/data/Data.tsx +++ b/app/src/components/layout/sidebarRight/visualization/data/Data.tsx @@ -118,7 +118,7 @@ const Data = () => { }; }); }; - console.log("selectedChartId", selectedChartId); + // console.log("selectedChartId", selectedChartId); return (
diff --git a/app/src/modules/builder/geomentries/assets/addAssetModel.ts b/app/src/modules/builder/geomentries/assets/addAssetModel.ts index 0cf9f22..a4255bd 100644 --- a/app/src/modules/builder/geomentries/assets/addAssetModel.ts +++ b/app/src/modules/builder/geomentries/assets/addAssetModel.ts @@ -148,7 +148,6 @@ async function handleModelLoad( const organization = email ? email.split("@")[1].split(".")[0] : ""; getAssetEventType(selectedItem.id, organization).then(async (res) => { - console.log('res: ', res); if (res.type === "Conveyor") { const pointUUIDs = res.points.map(() => THREE.MathUtils.generateUUID()); diff --git a/app/src/modules/builder/groups/floorItemsGroup.tsx b/app/src/modules/builder/groups/floorItemsGroup.tsx index 7e7282b..2f2241e 100644 --- a/app/src/modules/builder/groups/floorItemsGroup.tsx +++ b/app/src/modules/builder/groups/floorItemsGroup.tsx @@ -306,8 +306,7 @@ const FloorItemsGroup = ({ itemsGroup, hoveredDeletableFloorItem, AttachedObject }, [deleteModels, transformMode, controls, selectedItem, state.camera, state.pointer, activeTool, activeModule]); useEffect(() => { - - console.log('floorItems: ', floorItems); + // console.log('floorItems: ', floorItems); }, [floorItems]) useFrame(() => { diff --git a/app/src/modules/scene/IntialLoad/loadInitialFloorItems.ts b/app/src/modules/scene/IntialLoad/loadInitialFloorItems.ts index 2b1b1f3..dfff78d 100644 --- a/app/src/modules/scene/IntialLoad/loadInitialFloorItems.ts +++ b/app/src/modules/scene/IntialLoad/loadInitialFloorItems.ts @@ -19,7 +19,6 @@ async function loadInitialFloorItems( const organization = (email!.split("@")[1]).split(".")[0]; const items = await getFloorAssets(organization); - console.log('items: ', items); localStorage.setItem("FloorItems", JSON.stringify(items)); await initializeDB(); @@ -133,7 +132,7 @@ async function loadInitialFloorItems( modelfileID: item.modelfileID, isLocked: item.isLocked, isVisible: item.isVisible, - eventData: item.eventData, + // eventData: item.eventData, }, ]); } else { @@ -198,7 +197,7 @@ function processLoadedModel( modelfileID: item.modelfileID, isLocked: item.isLocked, isVisible: item.isVisible, - eventData: item.eventData, + // eventData: item.eventData, }, ]); } else { diff --git a/app/src/modules/simulation/behaviour/behaviour.tsx b/app/src/modules/simulation/behaviour/behaviour.tsx index 3cb1df1..53af231 100644 --- a/app/src/modules/simulation/behaviour/behaviour.tsx +++ b/app/src/modules/simulation/behaviour/behaviour.tsx @@ -11,48 +11,16 @@ function Behaviour() { const newPaths: (Types.ConveyorEventsSchema | Types.VehicleEventsSchema)[] = []; floorItems.forEach((item: Types.FloorItemType) => { - if (item.modelfileID === "672a090f80d91ac979f4d0bd") { - const point1Position = new THREE.Vector3(0, 0.85, 2.2); - const middlePointPosition = new THREE.Vector3(0, 0.85, 0); - const point2Position = new THREE.Vector3(0, 0.85, -2.2); - - const point1UUID = THREE.MathUtils.generateUUID(); - const middlePointUUID = THREE.MathUtils.generateUUID(); - const point2UUID = THREE.MathUtils.generateUUID(); - + // console.log('item: ', item); + if (item.eventData && item.eventData.type === 'Conveyor') { const newPath: Types.ConveyorEventsSchema = { modeluuid: item.modeluuid, modelName: item.modelname, type: 'Conveyor', - points: [ - { - uuid: point1UUID, - position: [point1Position.x, point1Position.y, point1Position.z], - rotation: [0, 0, 0], - actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }], - triggers: [], - connections: { source: { pathUUID: item.modeluuid, pointUUID: point1UUID }, targets: [] }, - }, - { - uuid: middlePointUUID, - position: [middlePointPosition.x, middlePointPosition.y, middlePointPosition.z], - rotation: [0, 0, 0], - actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }], - triggers: [], - connections: { source: { pathUUID: item.modeluuid, pointUUID: middlePointUUID }, targets: [] }, - }, - { - uuid: point2UUID, - position: [point2Position.x, point2Position.y, point2Position.z], - rotation: [0, 0, 0], - actions: [{ uuid: THREE.MathUtils.generateUUID(), name: 'Action 1', type: 'Inherit', material: 'Inherit', delay: 'Inherit', spawnInterval: 'Inherit', isUsed: false }], - triggers: [], - connections: { source: { pathUUID: item.modeluuid, pointUUID: point2UUID }, targets: [] }, - }, - ], + points: item.eventData.points, position: [...item.position], rotation: [item.rotation.x, item.rotation.y, item.rotation.z], - speed: 'Inherit', + speed: item.eventData.speed, }; newPaths.push(newPath); @@ -80,7 +48,6 @@ function Behaviour() { setSimulationPaths(newPaths); }, [floorItems]); - return null; } diff --git a/app/src/modules/simulation/simulation.tsx b/app/src/modules/simulation/simulation.tsx index 739a92b..2d72a40 100644 --- a/app/src/modules/simulation/simulation.tsx +++ b/app/src/modules/simulation/simulation.tsx @@ -13,6 +13,7 @@ function Simulation() { const [processes, setProcesses] = useState([]); useEffect(() => { + // console.log('simulationPaths: ', simulationPaths); }, [simulationPaths]); // useEffect(() => { diff --git a/app/src/services/factoryBuilder/assest/assets/getCategoryAsset.ts b/app/src/services/factoryBuilder/assest/assets/getCategoryAsset.ts index 522e54c..a1ac727 100644 --- a/app/src/services/factoryBuilder/assest/assets/getCategoryAsset.ts +++ b/app/src/services/factoryBuilder/assest/assets/getCategoryAsset.ts @@ -1,4 +1,4 @@ -let BackEnd_url = `http://${process.env.REACT_APP_SERVER_MARKETPLACE_URL}`; +let BackEnd_url = `http://${process.env.REACT_APP_SERVER_ASSET_LIBRARY_URL}`; export const getCategoryAsset = async (categoryName: any) => { try { const response = await fetch(