Collection of markups for a document

Properties

ActiveCount

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

ActiveIndex

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

ComponentType

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

Count

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

Document

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

Indexers

this[]

#Since v9.0
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.
public Markup this[
index
zero based array index.
] { get; }
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.

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
Adds a new markup with specified definition to the table.
public int Add(
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
Adds a reference markup that will not be saved in files.
public int AddReferenceMarkup(
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
Discards the current markup edit or create session, or stops viewing a markup.
public bool Cancel()
true if a markup session or view was ended.

Clear

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

Create

#Since v9.0
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.
public int Create(
view,
The view the markup is made in. Its viewport is stored with the markup.
geometry,
The markup's content. Copies are added to the document.
attributes
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
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.
public int Create(
view,
The view the markup is made in. Its viewport is stored with the markup.
geometry
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
Deletes a markup.
public bool Delete(
index,
zero based index of markup to delete.
quiet
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
Deletes a markup.
public override bool Delete(
item
The markup to delete.
)
true if successful, false otherwise.

Delete

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

Duplicate

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

Edit

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

Find

#Since v9.0
Finds a markup with a matching ID.
public int Find(
id,
The ID of the markup to be found.
ignoreDeletedMarkups
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
Finds the markup with a given name.
public int Find(
name
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

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.
public virtual T FindId(
id
ID of model component to search for.
)
inherited fromCommonComponentTable<T>
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

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

FindName

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

GetActiveObjectIds

#Since v9.0
Ids of the document objects in the open markup create or edit session, including a new markup not yet saved to the table.
public Guid[] GetActiveObjectIds()
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
Ids of the document objects that make up a markup's content. Editable only during Edit(int).
public Guid[] GetObjectIds(
index
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
Gets unused markup name used as default when creating new markups.
public string GetUnusedMarkupName()
The unused name.

Modify

#Since v9.0
Modify markup settings.
public bool Modify(
markup,
New markup settings. This information is copied.
index,
Zero based index of markup to set.
quiet
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
Saves the current markup edit or create session, like the on-screen checkmark. Undoable as one step.
public bool Save()
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(
item
)

View

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