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

DomCR / ACadSharp / 16421664328

21 Jul 2025 03:47PM UTC coverage: 75.103% (+0.003%) from 75.1%
16421664328

Pull #559

github

web-flow
Merge 189dbb327 into b070875e7
Pull Request #559: Issue 557 dimension block

5982 of 8767 branches covered (68.23%)

Branch coverage included in aggregate %.

326 of 468 new or added lines in 19 files covered. (69.66%)

1 existing line in 1 file now uncovered.

23866 of 30976 relevant lines covered (77.05%)

79057.23 hits per line

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

71.79
/src/ACadSharp/Entities/DimensionAngular2Line.cs
1
using ACadSharp.Attributes;
2
using CSMath;
3
using CSMath.Geometry;
4

5
namespace ACadSharp.Entities
6
{
7
        /// <summary>
8
        /// Represents a <see cref="DimensionAngular2Line"/> entity.
9
        /// </summary>
10
        /// <remarks>
11
        /// Object name <see cref="DxfFileToken.EntityDimension"/> <br/>
12
        /// Dxf class name <see cref="DxfSubclassMarker.Angular2LineDimension"/>
13
        /// </remarks>
14
        [DxfName(DxfFileToken.EntityDimension)]
15
        [DxfSubClass(DxfSubclassMarker.Angular2LineDimension)]
16
        public class DimensionAngular2Line : Dimension
17
        {
18
                /// <summary>
19
                /// Definition point for diameter, radius, and angular dimensions (in WCS).
20
                /// </summary>
21
                [DxfCodeValue(15, 25, 35)]
22
                public XYZ AngleVertex { get; set; }
1,605✔
23

24
                /// <summary>
25
                /// Gets the center point of the measured arc.
26
                /// </summary>
27
                public XYZ Center
28
                {
29
                        get
30
                        {
1✔
31
                                Line3D l1 = LineExtensions.CreateFromPoints<Line3D, XYZ>(this.DefinitionPoint, this.AngleVertex);
1✔
32
                                Line3D l2 = LineExtensions.CreateFromPoints<Line3D, XYZ>(this.FirstPoint, this.SecondPoint);
1✔
33

34
                                return l1.FindIntersection(l2);
1✔
35
                        }
1✔
36
                }
37

38
                /// <summary>
39
                /// Point defining dimension arc for angular dimensions (in OCS).
40
                /// </summary>
41
                [DxfCodeValue(16, 26, 36)]
42
                public XYZ DimensionArc { get; set; }
1,556✔
43

44
                /// <summary>
45
                /// Definition point for linear and angular dimensions (in WCS).
46
                /// </summary>
47
                [DxfCodeValue(13, 23, 33)]
48
                public XYZ FirstPoint { get; set; }
1,619✔
49

50
                /// <inheritdoc/>
51
                public override double Measurement
52
                {
53
                        get
54
                        {
41✔
55
                                var v1 = this.SecondPoint - this.FirstPoint;
41✔
56
                                var v2 = this.DefinitionPoint - this.AngleVertex;
41✔
57

58
                                return v1.AngleBetweenVectors(v2);
41✔
59
                        }
41✔
60
                }
61

62
                /// <inheritdoc/>
63
                public override string ObjectName => DxfFileToken.EntityDimension;
927✔
64

65
                /// <inheritdoc/>
66
                public override ObjectType ObjectType => ObjectType.DIMENSION_ANG_2_Ln;
17✔
67

68
                /// <summary>
69
                /// Definition point offset relative to the <see cref="Center"/>.
70
                /// </summary>
71
                public virtual double Offset
72
                {
73
                        get { return this.SecondPoint.DistanceFrom(this.DefinitionPoint); }
×
74
                        set
75
                        {
13✔
76
                                XYZ dir = this.SecondPoint - this.FirstPoint;
13✔
77
                                XYZ v = XYZ.Cross(this.Normal, dir).Normalize(); //Perpendicular to SecondPoint
13✔
78

79
                                this.DefinitionPoint = this.SecondPoint + v * value;
13✔
80
                        }
13✔
81
                }
82

83
                /// <summary>
84
                /// Definition point for linear and angular dimensions (in WCS).
85
                /// </summary>
86
                [DxfCodeValue(14, 24, 34)]
87
                public XYZ SecondPoint { get; set; }
1,632✔
88

89
                /// <inheritdoc/>
90
                public override string SubclassMarker => DxfSubclassMarker.Angular2LineDimension;
2,738✔
91

92
                /// <summary>
93
                /// Default constructor.
94
                /// </summary>
95
                public DimensionAngular2Line() : base(DimensionType.Angular)
393✔
96
                {
393✔
97
                }
393✔
98

99
                /// <inheritdoc/>
100
                public override void ApplyTransform(Transform transform)
101
                {
×
102
                        base.ApplyTransform(transform);
×
103

104
                        this.FirstPoint = transform.ApplyTransform(this.FirstPoint);
×
105
                        this.SecondPoint = transform.ApplyTransform(this.SecondPoint);
×
106
                        this.AngleVertex = transform.ApplyTransform(this.AngleVertex);
×
107
                        this.DimensionArc = transform.ApplyTransform(this.DimensionArc);
×
108
                }
×
109

110
                /// <inheritdoc/>
111
                public override BoundingBox GetBoundingBox()
112
                {
1✔
113
                        return new BoundingBox(this.FirstPoint, this.SecondPoint);
1✔
114
                }
1✔
115

116
                /// <inheritdoc/>
117
                /// <remarks>
118
                /// For <see cref="DimensionAngular2Line"/> the generation of the block is not yet implemented
119
                /// due its complexity.
120
                /// </remarks>
121
                public override void UpdateBlock()
NEW
122
                {
×
123
                        //Needs a lot more investigation
NEW
124
                        return;
×
125

126
                        base.UpdateBlock();
127

128
                        var v1 = this.SecondPoint - this.FirstPoint;
129
                        var v2 = this.DefinitionPoint - this.AngleVertex;
130

131
                        this._block.Entities.Add(createDefinitionPoint(FirstPoint));
132
                        this._block.Entities.Add(createDefinitionPoint(SecondPoint));
133
                        this._block.Entities.Add(createDefinitionPoint(AngleVertex));
134
                        this._block.Entities.Add(createDefinitionPoint(DefinitionPoint));
135

136
                        if (this.Center.IsNaN())
137
                        {
138
                                return;
139
                        }
140

141
                        var startAngle = XYZ.AxisX.AngleBetweenVectors(this.AngleVertex);
142
                        var endAngle = XYZ.AxisX.AngleBetweenVectors(this.FirstPoint);
143

144
                        this._block.Entities.Add(new Arc(this.Center, this.Offset, startAngle, endAngle));
NEW
UNCOV
145
                }
×
146
        }
147
}
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

© 2026 Coveralls, Inc