Elliptical Arc Example
This example demonstrates creating elliptical arcs with layer-based colors. It shows how to define an elliptical arc using its center point, major/minor radii, 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_EllipticalArc", ColorARGB = AciColors.Amber };
session.AddLayer(arcLayer);
// Elliptical arc using layer color
var ellipticalArc = new EllipticalArc(
center: new Vector3(200, 300, 0),
radiusX: 40f,
radiusY: 20f,
startAngle: MathF.PI / 4,
endAngle: 5 * MathF.PI / 4)
{
LayerName = arcLayer.Name
};
session.AddElement(ellipticalArc);
// 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
- Elliptical arcs extend the ellipse concept by adding start and end angles.
- They are defined by:
- Center point
- Major and minor radii (
RadiusX
andRadiusY
) - Start and end angles (in radians)
- The elliptical arc's color is inherited from its assigned layer.