diff --git a/Cabinet v2.5 con eje.glb b/Cabinet v2.5 con eje.glb new file mode 100644 index 0000000..c3da2bf Binary files /dev/null and b/Cabinet v2.5 con eje.glb differ diff --git a/GUI_Standby.png b/GUI_Standby.png new file mode 100644 index 0000000..0488fdc Binary files /dev/null and b/GUI_Standby.png differ diff --git a/check_indices.js b/check_indices.js new file mode 100644 index 0000000..0fd9da3 --- /dev/null +++ b/check_indices.js @@ -0,0 +1,22 @@ +const fs = require('fs'); + +function checkIndices(filePath) { + const buffer = fs.readFileSync(filePath); + const jsonLen = buffer.readUInt32LE(12); + const jsonBuf = buffer.slice(20, 20 + jsonLen); + const gltf = JSON.parse(jsonBuf.toString()); + + [37, 41].forEach(idx => { + console.log(`Node [${idx}]:`, gltf.nodes[idx] ? gltf.nodes[idx].name : 'OUT OF RANGE'); + if (gltf.nodes[idx] && gltf.nodes[idx].mesh !== undefined) { + const meshIdx = gltf.nodes[idx].mesh; + console.log(` Mesh [${meshIdx}]:`, gltf.meshes[meshIdx].name); + } + }); + + [37, 41].forEach(idx => { + console.log(`Mesh [${idx}]:`, gltf.meshes[idx] ? gltf.meshes[idx].name : 'OUT OF RANGE'); + }); +} + +checkIndices('Cabinet v2.5 con eje.glb'); diff --git a/compare.html b/compare.html new file mode 100644 index 0000000..af7fa7a --- /dev/null +++ b/compare.html @@ -0,0 +1,166 @@ + + + + + Model Comparison Tool + + + +

🔍 GLB Model Comparison Tool

+
Loading models...
+
+ + + + + + diff --git a/compare_models.js b/compare_models.js new file mode 100644 index 0000000..d4bd78f --- /dev/null +++ b/compare_models.js @@ -0,0 +1,22 @@ +import * as THREE from 'three'; +import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; +import fs from 'fs'; +import { Blob } from 'buffer'; + +// Simulating a browser environment for Three.js in Node +global.Blob = Blob; + +async function inspectModels() { + const loader = new GLTFLoader(); + + const file1 = 'd:/Bitua-3D-Explorer/Bita-3D-Explorer/V2.5.1 AAA ENSAMBLE CABINET MAIN REVIT puerta cerrada.glb'; + const file2 = 'd:/Bitua-3D-Explorer/Bita-3D-Explorer/V2.5.1 AAA ENSAMBLE CABINET MAIN REVIT puerta abierta.glb'; + + console.log('--- Model Comparison ---'); + + // Note: In Node we can't easily load GLB directly with GLTFLoader without more setup + // I will use a simple script in the browser console instructions instead if this is too complex for Node. + // However, I can just use Three.js in the browser directly. +} + +console.log('Inspector script ready. Actually, I can just update index.html to log these comparisons.'); diff --git a/extract_hinges.js b/extract_hinges.js new file mode 100644 index 0000000..61ae0e8 --- /dev/null +++ b/extract_hinges.js @@ -0,0 +1,50 @@ +const fs = require('fs'); + +try { + const data = fs.readFileSync('Cabinet v2.5 con eje.glb').toString('binary'); + const names = new Set(); + + // Find json part + const jsonStart = data.indexOf('{"'); + if (jsonStart > -1) { + let jsonEnd = data.indexOf('BIN\x00'); + if (jsonEnd === -1) { + jsonEnd = data.indexOf('BIN'); + } + let jsonStr; + if (jsonEnd > -1) { + // 8 bytes chunk header before BIN + jsonStr = data.slice(jsonStart, jsonEnd - 8); + } else { + jsonStr = data.slice(jsonStart, Math.min(jsonStart + 1000000, data.length)); + } + + try { + const parsed = JSON.parse(jsonStr); + const nodes = parsed.nodes || []; + nodes.forEach(n => { + if (n.name && n.name.toUpperCase().includes('BISAGRA')) { + names.add(n.name); + } else if (n.name && (n.name.toUpperCase().includes('FIJA') || n.name.toUpperCase().includes('MOVIL') || n.name.toUpperCase().includes('PANEL'))) { + names.add(n.name); + } + }); + console.log("JSON Parse successful."); + console.log([...names].sort()); + } catch (e) { + console.log("Failed parsing JSON:", e.message); + // fallback + const parts = data.split('"name":"'); + for (let i = 1; i < parts.length; i++) { + const name = parts[i].split('"')[0]; + if (name.toUpperCase().includes('BISAGRA') || name.toUpperCase().includes('FIJA') || name.toUpperCase().includes('MOVIL') || name.toUpperCase().includes('PANEL')) { + names.add(name); + } + } + console.log("Fallback extraction:"); + console.log([...names].sort()); + } + } +} catch(e) { + console.error(e); +} diff --git a/find_led.js b/find_led.js new file mode 100644 index 0000000..c9702e1 --- /dev/null +++ b/find_led.js @@ -0,0 +1,23 @@ +const fs = require('fs'); + +function findBarra(filePath) { + const buffer = fs.readFileSync(filePath); + const content = buffer.toString('utf8'); + + // Find all occurrences of names starting with "Bar" or "led" + const regex = /"name"\s*:\s*"([^"]*bar[^"]*)"/gi; + let match; + const results = new Set(); + while ((match = regex.exec(content)) !== null) { + results.add(match[1]); + } + + const regex2 = /"name"\s*:\s*"([^"]*led[^"]*)"/gi; + while ((match = regex2.exec(content)) !== null) { + results.add(match[1]); + } + + console.log('Found names:', Array.from(results)); +} + +findBarra('Cabinet v2.5 con eje.glb'); diff --git a/index.html b/index.html new file mode 100644 index 0000000..341fef4 --- /dev/null +++ b/index.html @@ -0,0 +1,1741 @@ + + + + + + + Bitua 3D Explorer - Interactive + + + + + +
+
Initializing Experience...
+
+
+
+
+ +
+

Bitua

+

Smart Cabinet Series (Updated)

+
+ + + + +
+ +
Click to interact
+
Abiri con llave
+ + + +
+ +
+ 🖱️ Click to interact | Right-click to pan | Simulator on the right + +
+ +
+

+ Camera Debug + +

+
POS: 0, 0, 0
+
TGT: 0, 0, 0
+
Part: none
+
+ + +
+ +
+
+ + +
+
+
Press 'D' for Camera Coordinates
+ + + + + + + + \ No newline at end of file diff --git a/inspect_solid1_61.js b/inspect_solid1_61.js new file mode 100644 index 0000000..fd0c747 --- /dev/null +++ b/inspect_solid1_61.js @@ -0,0 +1,51 @@ +const fs = require('fs'); + +function inspectMesh(filePath, query) { + const buffer = fs.readFileSync(filePath); + const jsonLen = buffer.readUInt32LE(12); + const jsonBuf = buffer.slice(20, 20 + jsonLen); + const gltf = JSON.parse(jsonBuf.toString()); + + console.log(`Inspecting mesh named "${query}"...`); + + let targetMesh = null; + let targetNode = null; + + if (gltf.nodes) { + gltf.nodes.forEach((n, i) => { + if (n.name && n.name.toUpperCase().includes(query.toUpperCase())) { + console.log(`Node [${i}]: ${n.name}`); + targetNode = n; + if (n.mesh !== undefined) { + targetMesh = gltf.meshes[n.mesh]; + console.log(` Linked Mesh: ${targetMesh.name || 'unnamed'}`); + } + } + }); + } + + if (!targetMesh && gltf.meshes) { + gltf.meshes.forEach((m, i) => { + if (m.name && m.name.toUpperCase().includes(query.toUpperCase())) { + console.log(`Mesh [${i}]: ${m.name}`); + targetMesh = m; + } + }); + } + + if (targetMesh) { + console.log('\nMesh Details:'); + targetMesh.primitives.forEach((p, i) => { + console.log(` Primitive [${i}]:`); + console.log(` Attributes: ${Object.keys(p.attributes).join(', ')}`); + if (p.material !== undefined) { + const mat = gltf.materials[p.material]; + console.log(` Material: ${mat.name || 'unnamed'}`); + } + }); + } else { + console.log('Target mesh not found.'); + } +} + +inspectMesh('Cabinet v2.5 con eje.glb', 'Solid1_61'); diff --git a/list_names.js b/list_names.js new file mode 100644 index 0000000..a0e8140 --- /dev/null +++ b/list_names.js @@ -0,0 +1,21 @@ +const fs = require('fs'); + +function listAllNames(filePath) { + const buffer = fs.readFileSync(filePath); + + // Simple way to find names in a GLB: look for the JSON chunk + const jsonBuf = buffer.slice(20, 20 + buffer.readUInt32LE(12)); + const gltf = JSON.parse(jsonBuf.toString()); + + console.log('--- MESHES ---'); + if (gltf.meshes) { + gltf.meshes.forEach(m => console.log(m.name)); + } + + console.log('\n--- NODES ---'); + if (gltf.nodes) { + gltf.nodes.forEach(n => console.log(n.name)); + } +} + +listAllNames('Cabinet v2.5 con eje.glb'); diff --git a/print_hierarchy.js b/print_hierarchy.js new file mode 100644 index 0000000..99464f4 --- /dev/null +++ b/print_hierarchy.js @@ -0,0 +1,7 @@ +import * as THREE from 'three'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import fs from 'fs'; + +// To run this in node, I need to do something simpler since I don't have a DOM. +// Actually, let's just use `parse` from gltf-pipeline or just regular expression on the JSON string. +// I will just read the GLB JSON header. diff --git a/search_meshes.js b/search_meshes.js new file mode 100644 index 0000000..37c5862 --- /dev/null +++ b/search_meshes.js @@ -0,0 +1,28 @@ +const fs = require('fs'); + +function searchNames(filePath, query1, query2) { + const buffer = fs.readFileSync(filePath); + const jsonLen = buffer.readUInt32LE(12); + const jsonBuf = buffer.slice(20, 20 + jsonLen); + const gltf = JSON.parse(jsonBuf.toString()); + + console.log(`Searching for "${query1}" and "${query2}"...`); + + if (gltf.nodes) { + gltf.nodes.forEach((n, i) => { + if (n.name && (n.name.includes(query1) || n.name.includes(query2))) { + console.log(`Node [${i}]: ${n.name}`); + } + }); + } + + if (gltf.meshes) { + gltf.meshes.forEach((m, i) => { + if (m.name && (m.name.includes(query1) || m.name.includes(query2))) { + console.log(`Mesh [${i}]: ${m.name}`); + } + }); + } +} + +searchNames('Cabinet v2.5 con eje.glb', '37', '41'); diff --git a/search_target_meshes.js b/search_target_meshes.js new file mode 100644 index 0000000..f895f61 --- /dev/null +++ b/search_target_meshes.js @@ -0,0 +1,33 @@ +const THREE = require('three'); +const { GLTFLoader } = require('three/examples/jsm/loaders/GLTFLoader.js'); +const fs = require('fs'); +const { JSDOM } = require('jsdom'); + +// Mock window and document for GLTFLoader +const dom = new JSDOM(); +global.window = dom.window; +global.document = dom.window.document; +global.navigator = dom.window.navigator; + +const loader = new GLTFLoader(); + +const data = fs.readFileSync('Cabinet v2.5 con eje.glb'); +const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength); + +loader.parse(arrayBuffer, '', (gltf) => { + const targetNames = ['Solid1_114', 'Solid1_37', 'Solid1_41']; + console.log('--- Searching for specific meshes ---'); + gltf.scene.traverse((child) => { + if (targetNames.includes(child.name)) { + console.log(`Found: ${child.name} | Type: ${child.type} | Parent: ${child.parent ? child.parent.name : 'None'}`); + } + // Also check if they are contained in the name + targetNames.forEach(tn => { + if (child.name.includes(tn) && child.name !== tn) { + console.log(`Partial Match: ${child.name} (contains ${tn}) | Type: ${child.type}`); + } + }); + }); +}, (err) => { + console.error(err); +});