1+ using ACadSharp . Entities ;
2+ using CSMath ;
3+ using System . Collections . Generic ;
4+
5+ namespace ACadSharp . Examples . Entities
6+ {
7+ internal class CircleHatchExample
8+ {
9+ public static Hatch CreateCircleHatch ( XY center , double radius )
10+ {
11+ Hatch hatch = new Hatch ( ) ;
12+ hatch . IsSolid = true ;
13+ hatch . SeedPoints . Add ( new XY ( ) ) ;
14+ hatch . Color = new Color ( 15 ) ;
15+
16+ List < Hatch . BoundaryPath . Line > edges = new List < Hatch . BoundaryPath . Line > ( ) ;
17+
18+ Hatch . BoundaryPath . Arc arc = new ( ) ;
19+ arc . Center = center ;
20+ arc . CounterClockWise = true ;
21+ arc . Radius = radius ;
22+ arc . StartAngle = 0 ;
23+ arc . EndAngle = MathHelper . TwoPI ;
24+
25+ Hatch . BoundaryPath path = new Hatch . BoundaryPath ( ) ;
26+ path . Edges . Add ( arc ) ;
27+ hatch . Paths . Add ( path ) ;
28+
29+ return hatch ;
30+ }
31+
32+ /// <summary>
33+ /// Create some circle hatches and add them to the model
34+ /// </summary>
35+ public static void AddInsertIntoModel ( )
36+ {
37+ var hatches = new List < Hatch > ( ) ;
38+ hatches . Add ( CreateCircleHatch ( new XY ( 0 , 15 ) , 10 ) ) ;
39+ hatches . Add ( CreateCircleHatch ( new XY ( 30 , 12 ) , 5 ) ) ;
40+ hatches . Add ( CreateCircleHatch ( new XY ( 50 , 50 ) , 25.3 ) ) ;
41+ hatches . Add ( CreateCircleHatch ( new XY ( 100 , 50 ) , 5 ) ) ;
42+ hatches . Add ( CreateCircleHatch ( new XY ( - 30 , 10 ) , 30 ) ) ;
43+
44+ CadDocument doc = new CadDocument ( ) ;
45+ doc . ModelSpace . Entities . AddRange ( hatches ) ;
46+
47+ //Once the file is saved you will have some circular hatches added to its modelspace
48+ }
49+ }
50+ }
0 commit comments