xeokit-convert icon indicating copy to clipboard operation
xeokit-convert copied to clipboard

Exclude element without reading his full info

Open g-rodigy opened this issue 2 years ago • 4 comments

When I try to convert ifc model wich has element IfcGrid without axis names, parse failing even if set excludeTypes: ['IfcGrid'].

Code example

const {convert2xkt} = require('@xeokit/xeokit-convert/dist/convert2xkt.cjs.js')
const WebIFC = require('web-ifc/web-ifc-api-node.js')

const file = 'path/to/model'
const output = 'path/to/output'

convert2xkt({
    WebIFC,
    source: file,
    output,
    excludeTypes: ['IfcGrid', 'IfcGridAxis'],
})

Log output:

INFO:  Parsing Model using IFC2X3 Schema
TypeError: Cannot read properties of null (reading 'map')
    at 3009204131 (...\node_modules\web-ifc\web-ifc-api-node.js:12645:381)
    at IfcAPI2.GetLine (....\node_modules\web-ifc\web-ifc-api-node.js:63239:84)
    at ...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15944:51
    at Array.forEach (<anonymous>)
    at parseRelatedItemsOfType (...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15942:25)
    at parseSpatialChildren (...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15890:5)
    at ...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15946:21
    at Array.forEach (<anonymous>)
    at parseRelatedItemsOfType (...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15942:25)
    at parseSpatialChildren (...\node_modules\@xeokit\xeokit-convert\dist\convert2xkt.cjs.js:15882:5)

g-rodigy avatar Jul 04 '23 13:07 g-rodigy

Looks like an issue with web-ifc..

xeolabs avatar Jul 04 '23 13:07 xeolabs

Yes, it is web-ifc issue, but i mean can skip element before fully reading his data?

g-rodigy avatar Jul 04 '23 13:07 g-rodigy

If I understand correctly, we have no means to configure conversion to ignore certain IFC elements by ID. This seems to be a useful potential feature though, but outside of our priorities at the moment. If anyone has time for to make a PR, I'd consider merging that though.

xeolabs avatar Jul 04 '23 13:07 xeolabs

Not by ID, by element type as is in the constructor excludeTypes. If I understand correctly code https://github.com/xeokit/xeokit-convert/blob/ef646ca47ffee6777ebc96097e8c01131f33841c/src/parsers/parseIFCIntoXKTModel.js#L279-L320 Firstrly take some element, then his releated elements and read their data, if element type is excluded then he skiped. The bug happen just in the place where the data is reading (.getLine(...)) for after checking type and other.

g-rodigy avatar Jul 04 '23 14:07 g-rodigy