Table of Contents

Class DxfGroup

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A GROUP of a DXF file, as AutoCAD's Group: a named list of entities of the drawing, picked together where it is selectable, kept in the group dictionary (GroupDictionary, ACAD_GROUP) under its name.

public sealed class DxfGroup : DxfDBObject
Inheritance
DxfGroup
Inherited Members

Remarks

db.GroupDictionary.SetAt("BEAMS", new DxfGroup("Beams of grid A", true)) adds the group BEAMS, and group.Append(beam) puts an entity in it: the entity's handle is written last among the group's (340), and the group's handle into the entity's list of reactors (330 in {ACAD_REACTORS), as AutoCAD writes a member. Taken out, the entity leaves the list and the group its reactors.

The members are the entities the group lists that the drawing has: an entity erased leaves the group at once, as it leaves AutoCAD's, and the file saved lists it no longer. A group left empty is kept, named or anonymous, as AutoCAD 2021 keeps it whatever emptied it: its last member erased, Clear(), RemoveAt(int), or never given one; the groups G_ERASE, G_REMOVE and G_NEW_EMPTY so emptied, and the anonymous *A1, *A2 and *A3, are all in the drawing it saves, each of no member.

The look of every member is set at once by SetColorIndex(int), SetLayer(string) and the others: a group of a line and a circle given the colour 1 has both red.

Constructors

DxfGroup()

Initializes a group made in code, with no description, selectable, to be added to the group dictionary by SetAt(string, DxfDBObject), as AutoCAD's Group() is.

DxfGroup(string, bool)

Initializes a group made in code with its description, as AutoCAD's Group(description, selectable): new DxfGroup("Beams of grid A", true).

Properties

Description

Gets or sets the description of the group (group 300), as AutoCAD's Description; empty where the record gives none.

IsAnonymous

Gets whether the group is anonymous (group 70 of 1), as AutoCAD's IsAnonymous: named *A1, *A2 and on by the drawing.

IsNotAccessible

Gets whether the group cannot be reached, as AutoCAD's IsNotAccessible: AutoCAD says so of a group of an external reference loaded into the drawing; the groups of a DXF file are its own, so false.

Name

Gets or sets the name of the group, as AutoCAD's Name: the name of its entry in the dictionary that holds it, such as BEAMS, or *A1 for an anonymous group; null for a group in no dictionary.

NumEntities

Gets how many entities the group has, as AutoCAD's NumEntities: those it lists that the drawing has, an erased one not counted.

Selectable

Gets or sets whether the group is picked as a whole when one of its entities is (group 71 of 1), as AutoCAD's Selectable; true where the record gives none.

Methods

Append(DxfEntity)

Puts an entity last in the group, as AutoCAD's Append, the group written into its reactors.

Append(IEnumerable<DxfEntity>)

Puts entities last in the group, in their order, as AutoCAD's Append of a collection, in one writing of the group: for a large group, the way to fill it. One at a time is fine for groups as drawings have them, 8 000 entities in half a second, but each copies the group's record, so that 32 000 take some 15 seconds where this takes a few hundredths.

Clear()

Takes every entity out of the group, as AutoCAD's Clear, and the group out of their reactors; the group is kept, empty, named or anonymous, as AutoCAD 2021 keeps it.

Erase()

Erases the group, as AutoCAD's Erase: it is taken out of the file with the entry of its dictionary, its entities kept; their lists of reactors no longer hold it once the file is saved.

GetAllEntityIds()

Gets the entities of the group in its order, as AutoCAD's GetAllEntityIds gives their ids: the entities themselves, those it lists that the drawing has.

GetIndex(DxfEntity)

Gets where an entity stands in the group, as AutoCAD's GetIndex: 0 for the first.

Has(DxfEntity)

Gets whether an entity is in the group, as AutoCAD's Has.

InsertAt(int, DxfEntity)

Puts an entity in the group before the one at an index, as AutoCAD's InsertAt; the count of the group puts it last.

InsertAt(int, IEnumerable<DxfEntity>)

Puts entities in the group, in their order, before the one at an index, as AutoCAD's InsertAt of a collection.

Prepend(DxfEntity)

Puts an entity first in the group, as AutoCAD's Prepend.

Prepend(IEnumerable<DxfEntity>)

Puts entities first in the group, in their order, as AutoCAD's Prepend of a collection.

Remove(DxfEntity)

Takes an entity out of the group, as AutoCAD's Remove, and the group out of its reactors.

Remove(IEnumerable<DxfEntity>)

Takes entities out of the group, as AutoCAD's Remove of a collection.

RemoveAt(int)

Takes the entity at an index out of the group, as AutoCAD's RemoveAt.

RemoveAt(int, IEnumerable<DxfEntity>)

Takes entities out of the group, each found at or after an index, as AutoCAD's RemoveAt of an index and a collection.

Replace(DxfEntity, DxfEntity)

Puts an entity in the place of one of the group, as AutoCAD's Replace; nothing where the two are the same.

Reverse()

Turns the order of the group round, the last first, as AutoCAD's Reverse; nothing for a group of fewer than two.

SetAnonymous()

Makes the group anonymous, as AutoCAD's SetAnonymous: its flag set (group 70 of 1) and its entry renamed the first *A1, *A2 and on its dictionary has not; nothing where it is anonymous. A group made in code is made anonymous when it is added.

SetColor(DxfColor)

Gives every entity of the group a colour, as AutoCAD's SetColor, as Color sets one.

SetColorIndex(int)

Gives every entity of the group a colour of AutoCAD's index, as AutoCAD's SetColorIndex: 1 to 255, 0 for BYBLOCK and 256 for BYLAYER.

SetLayer(string)

Puts every entity of the group on a layer, as AutoCAD's SetLayer, as Layer sets one: a layer the table does not list is added.

SetLinetype(string)

Gives every entity of the group a linetype, as AutoCAD's SetLinetype, as Linetype sets one.

SetLinetypeScale(double)

Gives every entity of the group a scale of its linetype, as AutoCAD's SetLinetypeScale.

SetVisibility(bool)

Shows or hides every entity of the group, as AutoCAD's SetVisibility, as Visible sets it.

ToString()

Gives the group as a line for debugging: its type, its handle, its name and how many entities it has.

Transfer(int, int, int)

Moves a run of the group's entities to another place in it, as AutoCAD's Transfer: the run of numItems from fromIndex taken out and put back so that its first stands at toIndex, the others keeping their order. A group of A, B, C, D given (0, 2, 2) is C, D, A, B.