Download Revit 2013 API Developer Guide - The Building Coder
Transcript
Table 23: RadialArray Methods
Member
Description
Create(Document, View, ElementId, int, Line, double, ArrayAnchorMember)
Array one element in the project based on an input rotation axis.
Create(Document, View, ICollection<ElementId>, int, Line, double,
ArrayAnchorMember)
Array a set of elements in the project based on an input rotation axis.
ArrayElementWithoutAssociation(Document, View, ElementId, int, Line, double,
ArrayAnchorMember)
Array one element in the project based on an input rotation axis.. The resulting
elements are not associated with a linear array.
ArrayElementsWithoutAssociation(Document, View, ICollection<ElementId>, int, Line,
double, ArrayAnchorMember)
Array a set of elements in the project based on an input rotation axis.. The
resulting elements are not associated with a linear array.
The methods for arraying elements are useful if you need to create several instances of a component and manipulate them simultaneously. Every instance in an array can
be a member of a group.
Note When using the methods for arraying elements, the following rules apply:
• When performing Linear and Radial Array operations, elements dependent on the arrayed elements are also arrayed.
• Some elements cannot be arrayed because they cannot be grouped. See the Revit User's Guide for more information about restrictions on groups and arrays.
• Arrays are not supported by most annotation symbols.
Delete
The Revit Platform API provides Delete() methods to delete one or more elements in the project.
Table 23: Delete Members
Member
Description
Delete(Element)
Delete an element from the project.
Delete(ElementId)
Delete an element from the project using the element ID
Delete(ICollection<ElementId>)
Delete several elements from the project by their IDs.
You can delete the element specified using the element object or the ElementId. These methods delete a specific element and any elements dependent on it.
Code Region: Deleting an element based on object
view plaincopy to clipboardprint?
1. private void DeleteElement(Autodesk.Revit.DB.Document document, Element element)
2. {
3.
// Delete a selected element.
4.
ICollection<Autodesk.Revit.DB.ElementId> deletedIdSet = document.Delete(element);
5.
6.
if (0 == deletedIdSet.Count)
7.
{
8.
throw new Exception("Deleting the selected element in Revit failed.");
9.
}
10.
11.
String prompt = "The selected element has been removed and ";
12.
prompt += deletedIdSet.Count - 1;
13.
prompt += " more dependent elements have also been removed.";
14.
15.
// Give the user some information
16.
TaskDialog.Show("Revit",prompt);
17. }