Repository navigation
Give a graphic style and a category element no type from a guess - #359
Merged
Merged
Conversation
A graphic style (GStyleElem, class 2050) stores no name and no type, yet it got both from guesses, and its FamilyName followed a guessed type link. - The string walk of BlockParser accepted any bytes that read as a block header. A block repeats its size at its end; without that copy the bytes are not a block, and the text behind them went to the element whose id they happened to hold. A block is now taken only with the closing size. - The name of a style comes from the element name table of the file and from nowhere else: not from strings found in its blocks, not from strings near its id, not from a linked type. Its type name and family name are not filled through a type link either. Values copied from those names change with them: elements that took a name through a link to a style, the IFC Structural Material that pointed at a style (now the element id, not the style's name) and the fill pattern guess of a wall, which no longer accepts a style as a candidate. Tests use invented strings and synthetic blocks. Three ApiTests counts on a private fixture drop because styles no longer carry names.
A graphic style (GStyleElem, class 2050) and a category element (CategoryElem, class 632) store no type, yet the reader gave them one from their references, and took the name, the family and the values behind it from something that is no type. - A category element takes its name from the name its category stores (CategoryNames), not from a string near its id or from a linked type. - A guess of the type of an element that names a graphic style or a category element makes no type: the type id from references, the voted type parameters, the dim style of a weak dimension and the type that RvtDocument takes for an element that has none. Such an element has no type id and none of ELEM_TYPE_PARAM, SYMBOL_ID_PARAM and ELEM_FAMILY_AND_TYPE_PARAM unless the file stores one; a family the file stores (ELEM_FAMILY_PARAM) stays. - The two kinds of element no longer own a guessed type, so what they took through it goes: CLEAR_COVER_*, FAMILY_LEVEL_PARAM, STRUCTURAL_MATERIAL_PARAM, the fill pattern and the parameters of the elements of that type. They are no longer counted as types by TypeElementIds and WhereElementIsElementType when only a guess named them. - STRUCTURAL_MATERIAL_PARAM comes only from a MaterialElem, and the fill pattern guess of a wall only from a FillPatternElem. - A MaterialElem keeps the name the reader gave it. RvtDocument replaced it with the name of the element its ELEM_TYPE_PARAM names, which is a guess for a material, unless a graphic style happened to name the material as its type. The exemption is by class, not by the category of materials, which other elements inherit through their references. On the 53 private samples every difference of the element dumps before and after is explained by one of these rules; elements that only such a guess supported as evidence (votes, known types) may get another type or none. Two ApiTests on a private fixture expected the old material names and counts and now expect the names the file stores. Tests use synthetic documents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes and why
A graphic style (
GStyleElem, class 2050) and a category element (CategoryElem, class 632) store no type, and a graphic style stores no name either, yet the reader gave them both from guesses, and then took names, families and values from the things those guesses pointed at.BlockParsertakes a block only with its closing size. A category element takes its name from the name its category stores (CategoryNames), not from a string near its id or from a linked type. Neither takes a type name or aFamilyNamethrough a type link.RvtDocumenttakes for an element that has none. A graphic style or a category element itself gets no guessed type either. They now haveTypeId-1 and none ofELEM_TYPE_PARAM,SYMBOL_ID_PARAM,ELEM_FAMILY_AND_TYPE_PARAMunless the file stores one; a family the file stores (ELEM_FAMILY_PARAM) stays.CLEAR_COVER_*,FAMILY_LEVEL_PARAM,STRUCTURAL_MATERIAL_PARAM, the fill pattern, and the parameters of the elements of that type.TypeElementIdsandFilteredElementCollector.WhereElementIsElementTypeno longer count them as types when only a guess named them.STRUCTURAL_MATERIAL_PARAM(and so the IFCStructural Material) comes only from aMaterialElem; the fill pattern guess of a wall only from aFillPatternElem.RvtDocumentreplaced the name of aMaterialElemwith the name of the element itsELEM_TYPE_PARAMnames, which is a guess for a material; only a graphic style that happened to name the material as its type protected it. The exemption is by class (MaterialElem), not by the category of materials, which other elements inherit through their references and which still take the name of their type.Behavior that changes for callers:
TypeId, the type parameters and the values copied through them on those two kinds of element.WhereElementIsElementTypeandTypeElementIdsfor elements that only such a guess named as a type.How it was checked
dotnet build RvtIO.slnx -c Releasehas no warnings. The pinned SDK 10.0.100 was removed from the machine by an IDE update while this was being checked, so the last build and test runs used SDK 11.0.100 on a copy of the sources withoutglobal.json; that build passes but prints new warnings from the newer SDK. Earlier runs on SDK 10 were green.dotnet test, net10.0 and net8.0, without private files: no failures (net10.0 12474 passed, net8.0 12470 passed) before the final test-expectation edit below.dotnet testwith the private fixtures (RVTIO_TEST_FILES): net8.0 fails only the four tests that already fail on main with these fixtures (threeElementHeaderBoundingBoxTests.StoredOutline_IsTheElementBoxOfEveryReleasecases andRvtWriterSampleTests.SaveAs_...). net10.0 gave the same four plusContainerRewriterSampleTests.CopyThrough_..., which failed with "not enough space on the disk" and passed on rerun.IsType, every parameter) of the whole private sample set were compared before and after, and every difference traced to one of the rules above; none is unexplained. IFC and JSON exports were not compared separately for this change.Two
ReferenceApiTestson a private fixture (SearchBetonString,CheckWall290112) expected the old material names and counts; they now expect the names the file stores. They are skipped without the private files, which is why runs without them did not show it.The type-guess rules were mutation-checked (each mutation makes a new test fail), and the material exemption has a test that failed before the fix.