Skip to content

Commit

Permalink
properly handle bit-coded boundary path types
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed May 10, 2020
1 parent c658e7c commit 190c463
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/IxMilia.Dxf.Test/DxfEntityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2221,9 +2221,9 @@ public void ReadHatchBoundaryPathDataTest()
91
2
999
============================ start of polyline boundary path
=================== start of external polyline boundary path
92
2
3
72
1
73
Expand Down
6 changes: 4 additions & 2 deletions src/IxMilia.Dxf/Entities/DxfHatch.BoundaryPath.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) IxMilia. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using IxMilia.Dxf.Collections;
Expand All @@ -8,11 +9,12 @@ namespace IxMilia.Dxf.Entities
{
public partial class DxfHatch
{
[Flags]
public enum BoundaryPathType
{
Default = 0,
External = 1,
// Polyline = 2, // handled manually, not exposed
Polyline = 2,
Derived = 4,
Textbox = 8,
Outermost = 16,
Expand Down Expand Up @@ -50,7 +52,7 @@ internal virtual bool TrySetPair(DxfCodePair pair)

internal static BoundaryPathBase CreateFromType(BoundaryPathType type)
{
if ((int)type == 2)
if ((type & BoundaryPathType.Polyline) == BoundaryPathType.Polyline)
{
// special polyline case
return new PolylineBoundaryPath();
Expand Down

0 comments on commit 190c463

Please sign in to comment.