Collection of markups for a document

Properties

ActiveCount

#Since v9.0
public int ActiveCount { get; }
Returns number of markups in the table, excluding deleted markups.

ActiveIndex

#Since v9.0
public int ActiveIndex { get; }
Index of the markup being viewed or edited, or -1 when none is (including while creating a new markup).

ComponentType

#Since v9.0
public override ModelComponentType ComponentType { get; }

Count

#Since v9.0
public int Count { get; }
Returns number of markups in the table, including deleted markups.

Document

#Since v9.0
public RhinoDoc Document { get; }
Document that owns this table.

Indexers

this[]

#Since v9.0
public Markup this[int index] { get; }
Conceptually, the markup table is an array of markups. The operator[] can be used to get individual markups. A markup is either active or deleted and this state is reported by Markup.IsDeleted.
Remarks:

Detaching a worksession reference model, or purging a linked instance definition, removes its markups but leaves the table slots they occupied empty. The slots cannot be closed up, because table indices are persistent references that objects store. Count spans the empty slots, and they accumulate for the life of the document - one per purge.

An index that lands on an empty slot returns a Markup that throws DocumentCollectedException on every property access, so code that walks this table by index must expect it. To tell a real markup from an empty slot, compare the index you asked for with Markup.Index: an empty slot never reports the index you asked for. Enumerating the table with foreach goes through the document manifest rather than the raw table array, so it does not visit empty slots at all and is the safer way to walk the table. See RH-97389.

index (int)zero based array index.
Reference to the markup. If index is out of range, null is returned. Note this reference may become invalid after AddMarkup() is called.

Methods

Add

#Since v9.0
public int Add(Markup markup)
Adds a new markup with specified definition to the table.
markup (Markup)Definition of new markup. The information in markup is copied. If markup.Name is empty then a unique name of the form "Markup 01" will be automatically created.
Index of new markup type or -1 on error.

AddReferenceMarkup

#Since v9.0
public int AddReferenceMarkup(Markup markup)
Adds a reference markup that will not be saved in files.
markup (Markup)Definition of new markup. The information in markup is copied. If markup.Name is empty then a unique name of the form "Markup 01" will be automatically created.
Index of new markup or -1 on error.

Cancel

#Since v9.0
public bool Cancel()
Discards the current markup edit or create session, or stops viewing a markup.
true if a markup session or view was ended.

Clear

public void Clear()
Marks all items as deleted.
inherited fromCommonComponentTable<T>

Create

#Since v9.0
public int Create(RhinoView view, IEnumerable<GeometryBase> geometry, IEnumerable<ObjectAttributes> attributes)
Adds a markup and its content without a markup session, as one undo step. The geometry is added to the document as the markup's content, and the view, captured before it is added, becomes the background. Any geometry type is allowed. It should lie on a plane parallel to the view, as markup tools draw it, but this is not enforced.
view (RhinoView)The view the markup is made in. Its viewport is stored with the markup.
geometry (IEnumerable<GeometryBase>)The markup's content. Copies are added to the document.
attributes (IEnumerable<ObjectAttributes>)Attributes for each geometry item, in the same order. May be null, shorter or contain null; those items get the markup HUD's current color and linetype.
Index of the new markup, or -1 on failure, including while the document is in markup mode.

Create

#Since v9.0
public int Create(RhinoView view, IEnumerable<GeometryBase> geometry)
Adds a markup and its content without a markup session, as one undo step. The geometry is added to the document as the markup's content, and the view, captured before it is added, becomes the background. Any geometry type is allowed. It should lie on a plane parallel to the view, as markup tools draw it, but this is not enforced.
view (RhinoView)The view the markup is made in. Its viewport is stored with the markup.
geometry (IEnumerable<GeometryBase>)The markup's content. Copies are added to the document.
Index of the new markup, or -1 on failure, including while the document is in markup mode.

Delete

#Since v9.0
public bool Delete(int index, bool quiet)
Deletes a markup.
index (int)zero based index of markup to delete.
quiet (bool)If true, no warning message box appears if a markup is in use.
true if successful. false if index is out of range or the markup is referenced by active geometry.

Delete

#Since v9.0
public override bool Delete(Markup item)
Deletes a markup.
item (Markup)The markup to delete.
true if successful, false otherwise.

Delete

#Since v9.0
public int Delete(IEnumerable<int> markupIndices, bool quiet, int deleteWarning)
Delete multiple markups.
markupIndices (IEnumerable<int>)An enumeration of markup indices.
quiet (bool)If true, no warning message box appears if a markup is in use.
deleteWarning (int)Action to take when multiple delete warnings occur, where: 0 == No to all, 1 == Yes to all, 2 == Ask the user.
The number of markups that were deleted.

Delete

#Since v9.0
public int Delete(IEnumerable<int> markupIndices, bool quiet)
Delete multiple markups.
markupIndices (IEnumerable<int>)An enumeration of markup indices.
quiet (bool)If true, no warning message box appears if a markup is in use.
The number of markups that were deleted.

Duplicate

#Since v9.0
public int Duplicate(int index)
Duplicates a markup.
index (int)zero based index of markup to delete.
Index of new markup type or -1 on error.

Edit

#Since v9.0
public bool Edit(int index)
Starts editing a markup. Its content becomes editable document objects until Save() or Cancel().
index (int)Zero based index of the markup to edit.
true if the edit session started.

Find

#Since v9.0
public int Find(Guid id, bool ignoreDeletedMarkups)
Finds a markup with a matching ID.
id (Guid)The ID of the markup to be found.
ignoreDeletedMarkups (bool)If true, deleted markups are not checked.
If the markup was found, the markup index, >=0, is returned. If the markup was not found, -1 is returned.

Find

#Since v9.0
public int Find(string name)
Finds the markup with a given name.
name (string)The name of the markup to find. The search ignores case.
If the markup was found, the markup index, >=0, is returned. If the markup was not found, -1 is returned.

FindId

public virtual T FindId(Guid id)
Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
inherited fromCommonComponentTable<T>
id (Guid)ID of model component to search for.
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

#Since v9.0
public Markup FindIndex(int index)
Retrieves a markup based on Index. This type of search is discouraged. We are moving towards using only IDs for all tables.
index (int)The index to search for.
A SectionStyle object, or null if none was found.

FindName

#Since v9.0
public Markup FindName(string name)
Finds the markup with a given name.
name (string)The name of the markup to find.
The markup if found; otherwise null.

GetActiveObjectIds

#Since v9.0
public Guid[] GetActiveObjectIds()
Ids of the document objects in the open markup create or edit session, including a new markup not yet saved to the table.
The object ids; empty when no create or edit session is open.

GetEnumerator

#Since v9.0
public override IEnumerator<Markup> GetEnumerator()

GetObjectIds

#Since v9.0
public Guid[] GetObjectIds(int index)
Ids of the document objects that make up a markup's content. Editable only during Edit(int).
index (int)Zero based index of the markup.
The object ids; empty if the index is invalid or the markup has no objects.

GetUnusedMarkupName

#Since v9.0
public string GetUnusedMarkupName()
Gets unused markup name used as default when creating new markups.
The unused name.

Modify

#Since v9.0
public bool Modify(Markup markup, int index, bool quiet)
Modify markup settings.
markup (Markup)New markup settings. This information is copied.
index (int)Zero based index of markup to set.
quiet (bool)if false, information message boxes pop up when illegal changes are attempted.
true if successful. false if index is out of range.

Save

#Since v9.0
public bool Save()
Saves the current markup edit or create session, like the on-screen checkmark. Undoable as one step.
true if the markup was saved. false if no edit or create session is active, or saving failed.
Explicit

ICollection<Markup>.Add

#Since v9.0
void ICollection<Markup>.Add(Markup item)
item (Markup)

View

#Since v9.0
public bool View(int index)
Shows a markup in the active view, as the Markups panel does. Ends any current markup session first.
index (int)Zero based index of the markup to view.
true if the markup is now being viewed.