Radial Dimension Example
This example demonstrates creating radial dimensions with layer-based colors. It shows how to define a radial dimension for a circle or arc.
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 geoLayer = new Layer { Name = "TestLayer_Dimensions_Geometry", ColorARGB = AciColors.LightPink3 };
var dimLayer = new Layer { Name = "TestLayer_Dimensions", ColorARGB = AciColors.MediumCyan };
session.AddLayer(geoLayer);
session.AddLayer(dimLayer);
// Circle and radial dimension using layer colors
var circle1 = new Circle()
{
Center = new Vector3(150, 150, 0),
Radius = 30f,
LayerName = geoLayer.Name
};
session.AddElement(circle1);
var radialDim1 = new RadialDim(
referenceElementGuid: circle1.Guid,
dimLinePos: circle1.Center,
textHeight: 3f)
{
LayerName = dimLayer.Name,
ArrowheadSize = 2f
};
session.AddElement(radialDim1);
// 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
- Radial dimensions measure the radius of a
Circle
element. - They require the GUID of the referenced circle (
ReferenceElementGuid
) and a point to define the dimension line/text location (DimLinePos
). - The
TextHeight
property controls the size of the dimension text. - The dimension's color is inherited from its assigned layer.