Drawing Organization
CadSDK provides several ways to organize and structure your drawings for better maintainability and reusability.
Using Blocks for Reusability
// Create a reusable component as a block
var blockDef = new BlockDefinition
{
Name = "WindowSymbol",
ReferencePoint = Vector3.Zero
};
// Add geometry to the block
var outline = new Rectangle(...); // Window outline
var glass = new Hatch(...); // Glass fill
blockDef.AddElement(outline);
blockDef.AddElement(glass);
// Use the block multiple times
var window1 = new BlockReference("WindowSymbol", new Vector3(0, 0, 0));
var window2 = new BlockReference("WindowSymbol", new Vector3(100, 0, 0));
# Coming soon...
Layer Organization
// Create layers for different drawing aspects
var wallsLayer = new Layer
{
Name = "Walls",
ColorARGB = AciColors.Red,
LineWeight = 0.5f
};
var dimensionsLayer = new Layer
{
Name = "Dimensions",
ColorARGB = AciColors.Blue,
LineWeight = 0.25f
};
session.AddLayer(wallsLayer);
session.AddLayer(dimensionsLayer);
// Assign elements to layers
var wall = new Line(...) { LayerName = "Walls" };
var dimension = new LinearDim(...) { LayerName = "Dimensions" };
# Coming soon...
Hatch Patterns
// Create hatches with different patterns
var hatch1 = new Hatch
{
BoundaryElements = ..., // Define boundary
Pattern = HatchPattern.ANSI31, // Standard pattern
Scale = 1.0f,
Angle = 0f
};
var hatch2 = new Hatch
{
BoundaryElements = ..., // Define boundary
Pattern = HatchPattern.SOLID, // Solid fill
ColorARGB = AciColors.Gray // Gray color
};
# Coming soon...