Arc Example
This example demonstrates creating circular arcs with layer-based colors. It shows how to define an arc using its center, radius, plane, and start/end angles.
using CadSDK;
using CadSDK.Elements;
using CadSDK.Enums;
using CadSDK.Geometry;
using System.Numerics;
// Create a drawing session
var session = new DrawingSession
{
ExportFormat = ExportFormat.DWG,
CadVersion = CadVersion.Cad2018
};
// Define layers
var arcLayer = new Layer { Name = "TestLayer_Arc", ColorARGB = AciColors.Magenta };
session.AddLayer(arcLayer);
// Arc using layer color
var arc = new Arc(Plane3D.WorldXY, new Vector3(0, 50, 0), 20, MathF.PI / 2, MathF.PI)
{
LayerName = arcLayer.Name
};
session.AddElement(arc);
// Export the drawing
// You can signup and get your free API key
string apiKey = "your-api-key"; // Get your free API key from the dashboard
string outputPath = "drawing.dwg";
await session.ExportAndSaveAsync(apiKey, outputPath);
# Coming soon...
Key Points
- Arcs are defined by a center point, radius, and start/end angles.
- The Plane property also defines the orientation of the arc in 3D space.
- Each arc is assigned to a specific layer for organization.
- The arc's color is inherited from its assigned layer.