Pattern hatches with a predefined pattern (ANSI31, …) render as a solid fill - #7
Merged
albertwoo merged 1 commit intoSep 22, 2026
Conversation
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.
Problem
EntityRenderDispatcher.DrawHatchdecides that a hatch is a solid fill withHatch.PatternTypeis DXF group 76. The DXF reference defines that group as hatch pattern type:0 = user-defined, 1 = predefined, 2 = custom. ACadSharp's enum names the value 1
SolidFill(
HatchPatternType.SolidFill = 1), but that is only a name: a hatch read from a DWG or DXF with a stockpattern such as ANSI31 carries group 76 = 1 and group 70 (
IsSolid) = 0. Whether a hatch is a solid fill isgroup 70 alone.
The second half of the condition therefore catches every predefined-pattern hatch read from a file, which is
the most common kind, and fills it solid. The pattern path below it (
ExplodePattern,MaxHatchLines) iscorrect but is only reached by hatches built in code with
PatternType = PatternFill, which is why the existingtests pass.
Fix
A solid hatch always has
IsSolidset; the library's ownSquareHatch(solid: true)andSyntheticSamplessetboth, so nothing that is solid today stops being solid.
Test
PredefinedPatternHatchDrawsItsPatternRatherThanAFillbuilds the existing pattern hatch fixture withPatternType = SolidFillandIsSolid = false, as a file reader produces it, and asserts lines are drawn andno fill. It fails before the change (
FillPathis called) and passes after.