Skip to content

Support 4.x graphviz format 2 - #20

Open
aothms wants to merge 9 commits into
masterfrom
support-4.x-graphviz-format-2
Open

Support 4.x graphviz format 2#20
aothms wants to merge 9 commits into
masterfrom
support-4.x-graphviz-format-2

Conversation

@aothms

@aothms aothms commented Jul 30, 2026

Copy link
Copy Markdown
Member

Sorry for the three reverts, I accidentally started off from an old branch point and quickest was to revert and reapply on top due to the large refactoring commit.

aothms added 9 commits July 30, 2026 12:09
Port the validation behavior from the reverted master commit into the refactored model implementation.

Generated with the assistance of an AI coding tool.
Port GlobalId-based export handling into the refactored extraction path.

Generated with the assistance of an AI coding tool.
Port the parent-default safeguard through the refactored immutable rule traversal.

Generated with the assistance of an AI coding tool.
@aothms
aothms force-pushed the support-4.x-graphviz-format-2 branch from ef1f990 to 230f85a Compare August 13, 2026 07:33
@aothms
aothms requested a review from Ghesselink August 23, 2026 08:48
@Ghesselink

Ghesselink commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Nice :) I tested it on models in validate and found a couple of small errors (incl fixes)

see also
https://github.com/opensourceBIM/python-mvdxml/pull/21/changes

1. _parse_mvdxml_token rejects unquoted parameter values.
Every value goes through ast.literal_eval, accepting python literals but mvdXML writes them unquoted, so ContextType[Value]=Model raises ValueError: malformed node or string on line 1: <ast.Name object> and CRSName[Value]=EPSG:5555 raises SyntaxError. There are 419 of them in ReferenceView_V1-2.mvdxml, and one of them takes down its whole concept. fix would be to to fall back to the stripped string,

2. validate() selects expressions one level too shallow.
[value[0] for value in self.rules()] assumes a flat list, but parse_template_rules isn't.. That gives TypeError: 'node' object is not iterable, IndexError: tuple index out of range on an empty group, and drops every ;-separated expression after the first: 16 checks skipped were skipped with 9 concepts (in ReferenceView_V1-2).

**3. [Type] assumes an ifcopenshell entity.instance **
is_a() doesn't have a type checkt, so str resulted in AttributeError: 'str' object has no attribute 'is_a'.fixed by using isinstance(item, ifcopenshell.entity_instance) first.

4. The graphviz test fixture cannot construct an instance.
It subclasses entity_instance, whose __setattr__/__getattr__ go through wrapped_data and a recursive without the underlying C++ class went on forever: RecursionError: maximum recursion depth exceeded. fix is to use a Mock spec'd on entity_instance

##tests

Running ReferenceView_V1-2 end-to-end, concepts that crash:

model concepts run crashing before after
Molio_with_URIs.ifc 144 46 0
DuplexHouse_Heating_RME.ifc 96 28 0
Duplex_MEP.ifc 80 14 0

@Ghesselink Ghesselink left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :) I tested it on models in validate and found a couple of small errors (incl fixes)

see also
https://github.com/opensourceBIM/python-mvdxml/pull/21/changes

Is it OK to merge into support-4.x-graphviz-format-2?

1. _parse_mvdxml_token rejects unquoted parameter values.
Every value goes through ast.literal_eval, accepting python literals but mvdXML writes them unquoted, so ContextType[Value]=Model raises ValueError: malformed node or string on line 1: <ast.Name object> and CRSName[Value]=EPSG:5555 raises SyntaxError. There are 419 of them in ReferenceView_V1-2.mvdxml, and one of them takes down its whole concept. fix would be to to fall back to the stripped string,

2. validate() selects expressions one level too shallow.
[value[0] for value in self.rules()] assumes a flat list, but parse_template_rules isn't.. That gives TypeError: 'node' object is not iterable, IndexError: tuple index out of range on an empty group, and drops every ;-separated expression after the first: 16 checks skipped were skipped with 9 concepts (in ReferenceView_V1-2).

**3. [Type] assumes an ifcopenshell entity.instance **
is_a() doesn't have a type checkt, so str resulted in AttributeError: 'str' object has no attribute 'is_a'.fixed by using isinstance(item, ifcopenshell.entity_instance) first.

4. The graphviz test fixture cannot construct an instance.
It subclasses entity_instance, whose __setattr__/__getattr__ go through wrapped_data and a recursive without the underlying C++ class went on forever: RecursionError: maximum recursion depth exceeded. fix is to use a Mock spec'd on entity_instance

##tests

Running ReferenceView_V1-2 end-to-end, concepts that crash:

model concepts run crashing before after
Molio_with_URIs.ifc) 144 46 0
DuplexHouse_Heating_RME.ifc 96 28 0
Duplex_MEP.ifc 80 14 0

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.

2 participants