Revit 2025 API
Direct |
Creates a DirectShape object and adds it to document.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static DirectShape CreateElement( Document document, ElementId categoryId )
Public Shared Function CreateElement ( document As Document, categoryId As ElementId ) As DirectShape
public: static DirectShape^ CreateElement( Document^ document, ElementId^ categoryId )
static member CreateElement : document : Document * categoryId : ElementId -> DirectShape
Parameters
- document Document
- Document to which the created element will be added.
- categoryId ElementId
- Id of the category assigned to this DirectShape. Must be a valid category id.
Return Value
DirectShapeThe created DirectShape object.

Exception | Condition |
---|---|
ArgumentException | Document document may not contain DirectShape or DirectShapeType objects. -or- Element id categoryId may not be used as a DirectShape category. |
ArgumentNullException | A non-optional argument was null |
See Also