• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 16263272139

14 Jul 2025 09:33AM UTC coverage: 75.046% (+0.03%) from 75.014%
16263272139

Pull #710

github

web-flow
Merge b348803a5 into 9d213afc7
Pull Request #710: dimension reference points

5861 of 8589 branches covered (68.24%)

Branch coverage included in aggregate %.

49 of 58 new or added lines in 7 files covered. (84.48%)

4 existing lines in 3 files now uncovered.

23308 of 30279 relevant lines covered (76.98%)

81438.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/src/ACadSharp/Entities/DimensionAligned.cs
1
using ACadSharp.Attributes;
2
using CSMath;
3

4
namespace ACadSharp.Entities
5
{
6
        /// <summary>
7
        /// Represents a <see cref="DimensionAligned"/> entity.
8
        /// </summary>
9
        /// <remarks>
10
        /// Object name <see cref="DxfFileToken.EntityDimension"/> <br/>
11
        /// Dxf class name <see cref="DxfSubclassMarker.AlignedDimension"/>
12
        /// </remarks>
13
        [DxfName(DxfFileToken.EntityDimension)]
14
        [DxfSubClass(DxfSubclassMarker.AlignedDimension)]
15
        public class DimensionAligned : Dimension
16
        {
17
                /// <summary>
18
                /// Linear dimension types with an oblique angle have an optional group code 52.
19
                /// When added to the rotation angle of the linear dimension(group code 50),
20
                /// it gives the angle of the extension lines
21
                /// </summary>
22
                [DxfCodeValue(DxfReferenceType.Optional, 52)]
23
                public double ExtLineRotation { get; set; }
1,179✔
24

25
                /// <summary>
26
                /// Insertion point for clones of a dimension—Baseline and Continue (in OCS).
27
                /// </summary>
28
                [DxfCodeValue(13, 23, 33)]
29
                public XYZ FirstPoint { get; set; }
8,390✔
30

31
                /// <inheritdoc/>
32
                public override double Measurement
33
                {
34
                        get
35
                        {
167✔
36
                                return this.FirstPoint.DistanceFrom(this.SecondPoint);
167✔
37
                        }
167✔
38
                }
39

40
                /// <inheritdoc/>
41
                public override string ObjectName => DxfFileToken.EntityDimension;
2,486✔
42

43
                /// <inheritdoc/>
44
                public override ObjectType ObjectType => ObjectType.DIMENSION_ALIGNED;
17✔
45

46
                /// <summary>
47
                /// Definition point offset relative to the <see cref="SecondPoint"/>.
48
                /// </summary>
49
                public virtual double Offset
50
                {
NEW
51
                        get { return this.SecondPoint.DistanceFrom(this.DefinitionPoint); }
×
52
                        set
53
                        {
14✔
54
                                XYZ dir = this.SecondPoint - this.FirstPoint;
14✔
55
                                XYZ v = XYZ.Cross(this.Normal, dir).Normalize(); //Perpendicular to SecondPoint
14✔
56

57
                                this.DefinitionPoint = this.SecondPoint + v * value;
14✔
58
                        }
14✔
59
                }
60

61
                /// <summary>
62
                /// Definition point for linear and angular dimensions(in WCS).
63
                /// </summary>
64
                [DxfCodeValue(14, 24, 34)]
65
                public XYZ SecondPoint { get; set; }
8,421✔
66

67
                /// <inheritdoc/>
68
                public override string SubclassMarker => DxfSubclassMarker.AlignedDimension;
7,070✔
69

70
                /// <summary>
71
                /// Default constructor.
72
                /// </summary>
73
                public DimensionAligned() : base(DimensionType.Aligned) { }
4,314✔
74

75
                /// <summary>
76
                /// Constructor with the first and second point.
77
                /// </summary>
78
                /// <param name="firstPoint"></param>
79
                /// <param name="secondPoint"></param>
80
                public DimensionAligned(XYZ firstPoint, XYZ secondPoint) : this()
6✔
81
                {
6✔
82
                        this.FirstPoint = firstPoint;
6✔
83
                        this.SecondPoint = secondPoint;
6✔
84
                }
6✔
85

86
                protected DimensionAligned(DimensionType type) : base(type)
693✔
87
                {
693✔
88
                }
693✔
89

90
                /// <inheritdoc/>
91
                public override void ApplyTransform(Transform transform)
92
                {
×
93
                        XYZ newNormal = this.transformNormal(transform, this.Normal);
×
NEW
94
                        this.getWorldMatrix(transform, this.Normal, newNormal, out Matrix3 transOW, out Matrix3 transWO);
×
95

96
                        base.ApplyTransform(transform);
×
97

NEW
98
                        this.FirstPoint = this.applyWorldMatrix(this.FirstPoint, transform, transOW, transWO);
×
NEW
99
                        this.SecondPoint = this.applyWorldMatrix(this.SecondPoint, transform, transOW, transWO);
×
UNCOV
100
                }
×
101

102
                /// <inheritdoc/>
103
                public override BoundingBox GetBoundingBox()
104
                {
2✔
105
                        return new BoundingBox(this.FirstPoint, this.SecondPoint);
2✔
106
                }
2✔
107
        }
108
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc