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

"Expected value to be greater than or equal to 1" in Accessor.set_Count - probably corrupted element... #30

Open
ido-cu opened this issue Jan 1, 2023 · 0 comments

Comments

@ido-cu
Copy link

ido-cu commented Jan 1, 2023

Hi,
I got this "Expected value to be greater than or equal to 1"
when trying to generate a GLTF from an IFC file I have.
I think this element is corrupted since Revit (and other IFC viewers) cannot load this element.

I debugged it and saw that it happens when it one of the elements XbimShapeInstances has an empty bounding box.

Would you consider to add a filtering condition in 'GetShapeInstancesToRender' in the Builder class to avoid this crash (since we anyway can't get the GLTF for this shape) or will it lead to other problems?


    private static IEnumerable<XbimShapeInstance> GetShapeInstancesToRender(IGeometryStoreReader geomReader, HashSet<short> excludedTypes, HashSet<int> EntityLebels = null)
        {
            if (EntityLebels == null)
            {
                var shapeInstances = geomReader.ShapeInstances
                    .Where(s =>
                        s.RepresentationType == XbimGeometryRepresentationType.OpeningsAndAdditionsIncluded
                        &&
                        !excludedTypes.Contains(s.IfcTypeId));
                return shapeInstances;
            }
            var entityFilter = geomReader.ShapeInstances
                    .Where(s =>
                        s.RepresentationType == XbimGeometryRepresentationType.OpeningsAndAdditionsIncluded
                        &&
                        !excludedTypes.Contains(s.IfcTypeId)
                        &&
                        EntityLebels.Contains(s.IfcProductLabel)
                        && (s.BoundingBox.IsEmpty == false) //  <====== Maybe this check is required to filter corrupted shapes?    
                        );
            return entityFilter;
        }
    }
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

1 participant