Skip to content

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

Description

@ido-cu

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;
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions