Skip to content

Conversation

@enriqueav
Copy link

@enriqueav enriqueav commented Jan 15, 2026

Bug description

When rendering a DXF document with the drawing addon's Frontend class and passing a custom layout properties parameter to the draw_layout method, entities with linetype set to "BYLAYER" (or no explicit linetype attribute, which defaults to "BYLAYER") are rendered as solid lines instead of using their layer's linetype pattern (dashes, dots, etc.).

This happens because of an initialization order bug in the RenderContext class:

During RenderContext initialization, the method that sets up the current layout is called before the line patterns are loaded from the document's linetype table
When layers are initialized and their properties are resolved, the line pattern dictionary is still empty, so all layers get cached with an empty continuous pattern (empty tuple)
When Frontend's draw_layout method receives a custom layout properties parameter, it skips calling the layout setup method again (which would re-cache the layers with correct patterns)
Entities that use BYLAYER linetype resolution inherit the empty patterns from the cached layer properties
The bug does NOT occur when:

The layout properties parameter is NOT passed to draw_layout (Frontend calls the layout setup method again, re-caching layers with correct patterns after line patterns are loaded)
Entities have explicit linetype attributes set directly (bypasses BYLAYER resolution and looks up patterns directly)

Fix

Call _load_line_pattern before self.set_current_layout in the __init__ of RenderContext.
Added a unit test and verified the other tests passed.

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