Skip to content

Ifc: keep property names unique in grouped Revit parameter sets - #337

Open
mahach666 wants to merge 1 commit into
mainfrom
fix/ifc-grouped-duplicate-names
Open

mahach666 wants to merge 1 commit into
mainfrom
fix/ifc-grouped-duplicate-names

Conversation

@mahach666

Copy link
Copy Markdown
Collaborator

What changes and why

With --ifc-revit-parameter-groups the IFC export could write one property set with several properties of the same Name. This breaks IfcPropertySet.WR32 (IFC2X3) and UniquePropertyNames (IFC4), and a viewer may keep only one of the values.

Cause: grouped mode names a built-in parameter by its public API name, and the API definitions in the repository give one name to several parameters of the same group (for example Top Offset). The suffix rule added in #330 ran only when --ifc-revit-parameter-names was set.

Grouped sets now use that rule too: every member of a clash gets [parameter id], followed by #n if the id repeats as well. In ExportPropertySets this changes one condition.

Compatibility: in grouped mode without a names option, a clashing property no longer appears under its plain name, so a lookup by that name does not find it in the affected set. Names that do not clash are unchanged.

How it was checked

  • dotnet build RvtIO.slnx -c Release has no warnings. It succeeds with 0 errors but reports warnings: compiler and analyzer warnings from the test project, and the System.IO.Hashing package notice for net8.0. No warning names the changed test file.
  • dotnet test passes. Run as dotnet test RvtIO.slnx -c Release --no-build: net10.0 12229 passed, net8.0 12225 passed, 0 failed, 453 skipped on each. RVTIO_TEST_FILES was not set, so tests that need private fixtures did not run.
  • Exports of the same files before and after are identical, or the differences are listed and intended (below).
  • No Revit models, customer data or vendor files are added.

Tests. A new test (IFC2X3 and IFC4) covers a clash inside a group, the same name in two groups (no suffix), a unique name (no suffix) and a repeated id (#n). It failed with duplicate property names before the fix. RevitParameterGroups_WritesApiNamesInGroupPropertySets added a parameter id that its test element already held, so it now uses another built-in of the same group.

Export comparison, base 59ca1714 against this branch, on local models that are not in the repository, with a fixed timestamp:

  • Byte-identical: exports without grouping (IFC2X3 without Revit parameters, with them, and with the names and units options; on one model also IFC4 and compact and full JSON), and grouped exports with --ifc-revit-parameter-names.
  • Different: grouped exports without a names option (IFC2X3 and IFC4; on one model also the legacy profile). Compared property set by property set:
    • no set has duplicate names after the change;
    • only the names of clashing properties changed; their descriptions and values are the same;
    • IfcRelDefinesByProperties links the same objects to the same sets, and every rooted entity keeps its GlobalId, type and name;
    • entity counts per type are the same except IfcPropertySingleValue. The current profile writes a few more of them, which fits renamed properties no longer sharing one cached value.
  • EXPRESS rules (ifcopenshell, express_rules=True), grouped IFC2X3 and IFC4 exports of one model: the duplicate-name violations of the base are gone and no violation is new. The other IFC2X3 violations of the base are unchanged.
  • The grouped exports have no _N property sets: the split into chunks applies only to the ungrouped list.

Grouped mode names a built-in parameter by its public API name, which
several parameters of one group can share, so a property set could hold
several properties of one name. IfcPropertySet requires unique names.

Grouped sets now follow the rule of the parameter names option: every
member of a clash gets " [parameter id]" appended, plus " #n" when the
id repeats too. Output without grouping is unchanged.

An older grouped test added a parameter id that its element already
held, so it now uses another built-in of the same group.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant