engine_clay icon indicating copy to clipboard operation
engine_clay copied to clipboard

Add custom BufferGeometry to IFC

Open arcs- opened this issue 1 year ago • 0 comments

Describe the bug 📝

This may not be a bug and more an issue of understanding how to accomplish exporting a BufferGeometry. In my understanding I should be able to create a BufferGeometry, add it to a ClayObject and than add that to a site. Exporting this should result in an IFC that has that BufferGeometry. This is not the case:

const model = new Model();
await model.init();

const project = new Project(model);
const site = new Site(model, project);

/* add pyramid */

var geometry = new THREE.BufferGeometry();
const vertices = new Float32Array([
    // Base square (two triangles)
    -1, 0, -1, 1, 0, -1, 1, 0, 1,   // First triangle of the base
    -1, 0, -1, 1, 0, 1, -1, 0, 1,   // Second triangle of the base
    // Four triangles for the sides
    -1, 0, -1, 1, 0, -1, 0, 1.5, 0, // Front face
    1, 0, -1, 1, 0, 1, 0, 1.5, 0, // Right face
    1, 0, 1, -1, 0, 1, 0, 1.5, 0, // Back face
    -1, 0, 1, -1, 0, -1, 0, 1.5, 0, // Left face
]);
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));

const furnitureType = new SimpleFurnitureType(model);
furnitureType.body.baseGeometry = geometry;
furnitureType.update(true);

const furniture = furnitureType.addInstance();
site.children.add(furniture.attributes.expressID);

/* write to file */

fs.writeFileSync('test3.ifc', model.ifcAPI.SaveModel(model.modelID));
console.log('test3.ifc successfully created!');

I've written something very close to this using ifcopenshell, although it needed more relationships. It is not clear to me how I would add those within Clay. Is this the wrong approach?

I do have the same issue when I try to do it with the Demo (https://thatopen.github.io/engine_web-ifc/demo/)

Reproduction ▶️

No response

Steps to reproduce 🔢

No response

System Info 💻

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 692.38 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.3 - ~/.nvm/versions/node/v18.20.3/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.3/bin/npm
    pnpm: 9.12.1 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 131.0.6778.140
    Safari: 18.1.1

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • [X] Check that this is a concrete bug. For Q&A join our Community.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

arcs- avatar Dec 19 '24 15:12 arcs-