sgenoud / replicad

The library to build browser based 3D models with code.
https://replicad.xyz
MIT License
323 stars 38 forks source link

Import STEP file in my scene #111

Closed maelp closed 8 months ago

maelp commented 8 months ago

Hi,

I'd like to use replicad to build an object, but one of the elements of this object should be imported from an existing mesh (as .glb or .step file), is that possible?

maelp commented 8 months ago

Just saw this so I guess I can close the issue 😅 https://github.com/sgenoud/replicad/blob/main/packages/replicad/src/importers.ts#L13

raydeleu commented 8 months ago

Can you show an example how you use this function? I struggle to make the workbench read a file and display the shape. I tried something like the code below but it doesn't work.

const {importSTEP} = replicad;

function main() {

async function readFile(file) { try { const contents = await file.text(); const blob = new Blob([contents], { type: 'text/plain' }); return blob } catch (err) { console.error('Error reading file:', err); } }

let bigblob = readFile("/Users/test/Downloads/holder.step"); let shape = importSTEP(bigblob);

return shape }

On Tue, Oct 17, 2023 at 12:25 AM Mael @.***> wrote:

Closed #111 https://github.com/sgenoud/replicad/issues/111 as completed.

— Reply to this email directly, view it on GitHub https://github.com/sgenoud/replicad/issues/111#event-10671270787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJB7JL3SYZXNRMCMCXCUMM3X7WX7NAVCNFSM6AAAAAA6C32WVCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJQGY3TCMRXGA3TQNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>