Circle Example

This example demonstrates creating circles with layer-based colors. It shows how to set up layers and create circles with styling inherited from their layer.

using CadSDK;
using CadSDK.Elements;
using CadSDK.Enums;
using CadSDK.Geometry;

// Create a drawing session
var session = new DrawingSession
{
    ExportFormat = ExportFormat.DWG,
    CadVersion = CadVersion.Cad2018
};

// Define layers
var circleLayer = new Layer { Name = "TestLayer_Circle", ColorARGB = AciColors.Cyan };
session.AddLayer(circleLayer);

// Circle using layer color
var circle = new Circle(
    plane: Plane3D.WorldXY,
    center: new Vector3(20, 0, 0),
    radius: 10f)
{
    LayerName = circleLayer.Name
};
session.AddElement(circle);

// 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

  • Circles are defined by their center point and radius.
  • Center points can be positioned in 3D space using Vector3 coordinates.
  • The circle's color is inherited from its assigned layer.