Properties Management
CadSDK provides comprehensive control over element properties including colors, line types, weights, and layer assignments. Properties can be set directly or inherited from layers and blocks.
Colors and PropertyMethod
Elements can be colored using ARGB hex strings, with color inheritance controlled via PropertyMethod. For convenience, common CAD colors are predefined in the AciColors class.
// Using custom ARGB color (Alpha, Red, Green, Blue)
element.ColorARGB = "FF0088FF"; // Fully opaque light blue
element.ColorMethod = PropertyMethod.Custom;
// Using predefined ACI colors
element.ColorARGB = AciColors.Red; // "FFFF0000"
element.ColorARGB = AciColors.Green; // "FF00FF00"
element.ColorARGB = AciColors.Blue; // "FF0000FF"
element.ColorMethod = PropertyMethod.Custom;
// Inheriting colors
element.ColorMethod = PropertyMethod.ByLayer; // Use layer's color
element.ColorMethod = PropertyMethod.ByBlock; // Use block's color (for elements within blocks)
// Example with layer
var layer = new Layer
{
Name = "ColoredLayer",
ColorARGB = "FF00FF00" // Green
};
session.AddLayer(layer);
var circle = new Circle(Vector3.Zero, 10)
{
LayerName = layer.Name,
ColorMethod = PropertyMethod.ByLayer // Will use green from layer
};
# Coming soon...