ReadOnlyComplex

Namespace: Digi21.DigiNG.Entities
Assembly: Digi21.DigiNG

Read-only complex: an entity with its own codes composed of other entities. The type of complexes returned by drawing files when iterating through their entities.

public class ReadOnlyComplex : Entity

Inheritance: Object → Entity → ReadOnlyComplex

Derived types: Complex.

Implements: the interfaces of Entity. Unlike lines and polygons, a complex does not implement ISnapable, IClippable or ITrimable.

The class has no public constructors. To create a complex, use Complex.

Members inherited from Entity are described in Entity.

Properties

Property Description
IEnumerable<Entity> Entities { get; } Complex entities, in order, with each entity's type.

Methods

Method Description
Complex Clone() Read/write copy of the complex, with a copy of each entity.
string ToString() Localized text with the type and Entity data. Does not include the complex's entities.

Example

This program lists a .bind file's complexes with the type and code of each contained entity:

using Digi21.DigiNG.Entities;
using Digi21.DigiNG.IO.BinDouble;

if (args.Length != 1)
{
    Console.WriteLine("Uso: LeeComplejos <entrada.bind>");
    return 1;
}

using var entrada = new BinDouble(args[0], true);

foreach (var entidad in entrada)
{
    if (entidad.Deleted || entidad is not ReadOnlyComplex complejo)
        continue;

    Console.WriteLine($"Complejo {complejo.Codes[0].Name}");

    foreach (var parte in complejo.Entities)
        Console.WriteLine($"  {parte.GetType().Name} {parte.Codes[0].Name}");
}

return 0;