Closed assaad97 closed 3 years ago
Exec is asynchronous, so I'm guessing COLLADA2GLTF is being run before IfcConvert is finished writing the file and the XML parser quits because the input is not valid.
Try execSync.
https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options
@lasalvavida thanks for your help, it worked, you actually saved me the weekend xD, thanks again for your help
what im trying to do, is convert ifc files to gltf files, the process is the following :
1) convert if to dae using IfcConvert from this link : http://ifcopenshell.org/ifcconvert 2) convert dae to gltf using COLLADA2GLTF
i needed to automate this process in js using exec from the module child_process, here is the js code
`const { exec } = require("child_process");
function IfcConvertor(file) {
} `
the problem that happens is when i run the script this error is raised : `error: Command failed: COLLADA2GLTF-bin -i sample.dae -o sample.gltf I/O warning : failed to load external entity "sample.dae"
stdout: IfcOpenShell IfcConvert 0.6.0b0 (OCC 7.3.0) Scanning file... Done scanning file Parsing input file took 0 seconds Creating geometry... Done creating geometry (9 objects)
Conversion took 0 seconds`
i cant figure out why it is happening, so i tried to do it manually in the CLI, and it worked