Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parseGLTFIntoXKTModel] RangeError: Invalid array length #143

Open
kushal154 opened this issue Apr 13, 2024 · 13 comments
Open

[parseGLTFIntoXKTModel] RangeError: Invalid array length #143

kushal154 opened this issue Apr 13, 2024 · 13 comments

Comments

@kushal154
Copy link

I have a IFC with size of 650MB which I want to convert and use in XKT format.

Here is what I have done:

Step 1: Used ifc2gltfcxconverter (version 3.1) to create glb files.

Command (used default configuration json): linux/bin/ifc2gltfcxconverter -i model.ifc -o model.glb -m metadata.json -s 250 -c linux/bin/ifc2gltfcxconverter.json

__ IFC to GLTF converter __ version: 3.1 ____________
Loading input config file: linux/bin/ifc2gltfcxconverter.json
Loading file "model.ifc": 100%
Converting IFC geometry: 100%
Exporting to gltf: 100%
Accessors: 88843, reused: 450898, compression: 83%
Exporting metadata: 100%done in 67 minutes, 34 seconds

Following files are created:
model.glb - 220M
metadata.json - 22M
model.glb.manifest.json

Step 2: Used xeokit-convert (version v1.1.15-beta-8) to create the xkt file

Command: node xeokit-convert-1.1.15-beta-8/convert2xkt.js -a model.glb.manifest.json -o model.xkt.manifest.json -l

[convert2xkt] Running convert2xkt v1.1.15-beta-8...
[convert2xkt] Using configs in ./convert2xkt.conf.js
[convert2xkt] Converting glTF files in manifest model.glb.manifest.json...
[convert2xkt] Reading input file: model.glb
[convert2xkt] Input file size: 230364.62 kB
[convert2xkt] Not embedding metadata in XKT
TextEncoder constructor called with encoding label, which is ignored.
[convert2xkt] [ERROR]: [parseGLTFIntoXKTModel] RangeError: Invalid array length

Is there a way to get the model as a single XKT file?

@kushal154
Copy link
Author

Can someone please help here?

@xeolabs
Copy link
Member

xeolabs commented Apr 18, 2024

Hi, if you represent one of our enterprise users, please log this issue with our Jira issue tracker and we'll prioirtise.

To reproduce this issue on our end, we'll also need to borrow the IFC file you're trying to convert (which we'll not share and will discard afterwards of course).

@kushal154
Copy link
Author

How do I share the IFC file privately with your team to take this forward?

@xeolabs
Copy link
Member

xeolabs commented Apr 19, 2024

Please get in contact here: https://creoox.com/en/contact/

@kushal154
Copy link
Author

@xeolabs I have sent you details via contact form. Kindly check.

@xeolabs
Copy link
Member

xeolabs commented Apr 26, 2024

@kushal154 try the latest ifc2gltf release - there's an update there that may resolve this issue.

@kushal154
Copy link
Author

@xeolabs As per your and Wlod's input, I used the split option with “-s 100” to generate GLB files and then used the convert2xkt to create the XKT files. However, I now have the 3 XKT files with a combined size of approx. 750 MB and the original IFC file size is 466 MB. So instead of compression, file size has increased by 60% after conversion. I have shared the link to the IFC file with Wlod in case you want to look at it. Please note I used the latest version 3.2 of ifc2gltf.

@xeolabs
Copy link
Member

xeolabs commented Apr 26, 2024

@kushal154 while most IFC files we convert will reduce in size once converted with ifc2gltf and convert2xkt, it is still possible for the IFC to contain geometry that is defined in such a way that once triangulated by ifc2gltf the file size actually ends up larger.

An example is an IfcShapeRepresentation, which can define a geometry using a list of 2D coordinates representing a profile that is to be swept or rotated, to generate a triangle mesh. For this geometry, the IFC contains a compact list of 2D points. Then, when converted to glTF/glb by ifc2gltf, the profile is swept, to generate a triangle mesh for the geometry, which can require much more storage in the glTF/glb file, and in the XKT file once that's converted by convert2xkt.

So, when an IFC contains these sort of geometries, there will often be an increase in file size when converting IFC->glTF/glb->XKT.

Fortunately, most IFC building models we encounter do not have large numbers of IfcShapeRepresentation elements and so we do get good compression.

I will look at this file though and see what we can recommend.

@kushal154
Copy link
Author

kushal154 commented Apr 28, 2024

@xeolabs Thank you. I shall await your thoughts and guidance as it has become a hurdle for us to move ahead.

@kushal154
Copy link
Author

@xeolabs Please let me know if there is any update.

@xeolabs
Copy link
Member

xeolabs commented May 1, 2024

@kushal154 I haven't received any Jira issue yet.

In the meantime, perhaps try a larger value for '-s', eg.

ifc2gltfcxconverter -i model.ifc -o myGLBFiles/model.glb -m myGLBFiles/model.json -s 100

@kushal154
Copy link
Author

@xeolabs I have raised the Jira issue XCD-73.

When I use -s as 200, it leads to "RangeError: Invalid array length" during conversion. Thus I tried with a lower value of 100.

@xeolabs
Copy link
Member

xeolabs commented May 2, 2024

@kushal154 OK I found the issue now, will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants