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

DomCR / ACadSharp / 16495001507

24 Jul 2025 10:57AM UTC coverage: 75.172% (-0.006%) from 75.178%
16495001507

Pull #721

github

web-flow
Merge 641226dfb into aea407c1e
Pull Request #721: SVG paper units

6037 of 8826 branches covered (68.4%)

Branch coverage included in aggregate %.

55 of 66 new or added lines in 5 files covered. (83.33%)

11 existing lines in 2 files now uncovered.

23971 of 31093 relevant lines covered (77.09%)

78825.0 hits per line

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

82.61
/src/ACadSharp/IO/SVG/SvgConfiguration.cs
1
using ACadSharp.Objects;
2
using System;
3
using System.ComponentModel;
4

5
namespace ACadSharp.IO
6
{
7
        /// <summary>
8
        /// Configuration for writing SVG files.
9
        /// </summary>
10
        public class SvgConfiguration : CadWriterConfiguration
11
        {
12
                /// <summary>
13
                /// The <see cref="Entities.Entity.LineWeight"/> will be divided by this value to process the stroke-width in the svg.
14
                /// </summary>
15
                /// <remarks>
16
                /// The default value is 100, which matches with the line weight real value in mm.
17
                /// </remarks>
18
                public double LineWeightRatio { get; set; } = 100;
1,226✔
19

20
                /// <summary>
21
                /// Radius applied for the points.
22
                /// </summary>
23
                /// <remarks>
24
                /// In svg the points will be drawn as circles.
25
                /// </remarks>
26
                public double PointRadius { get; set; } = 0.1;
574✔
27

28
                /// <summary>
29
                /// Get the value of the stroke-width.
30
                /// </summary>
31
                /// <param name="lineweightType"></param>
32
                /// <returns></returns>
33
                public double GetLineWeightValue(LineweightType lineweightType)
34
                {
92✔
35
                        double value = (double)lineweightType;
92✔
36
                        if (lineweightType == LineweightType.W0)
92✔
37
                        {
1✔
38
                                value = 0.001;
1✔
39
                        }
1✔
40

41
                        return ToPixelSize(Math.Abs(value) / this.LineWeightRatio, PlotPaperUnits.Milimeters);
92✔
42
                }
92✔
43

44
                public static double ToPixelSize(double value, PlotPaperUnits units)
45
                {
2,638✔
46
                        switch (units)
2,638!
47
                        {
48
                                case PlotPaperUnits.Inches:
49
                                        return value * 96;
47✔
50
                                case PlotPaperUnits.Milimeters:
51
                                        return value * 96 / 25.4;
2,591✔
52
                                case PlotPaperUnits.Pixels:
NEW
53
                                        return value;
×
54
                                default:
NEW
55
                                        throw new InvalidEnumArgumentException(nameof(units), (int)units, typeof(PlotPaperUnits));
×
56
                        }
57
                }
2,638✔
58
        }
59
}
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