ElementDataModel.GetOrCreateDesignRef method
Create-or-reuse a design keyed by a stable, connector-chosen sourceId. First call references seedElement’s design; subsequent calls with the same SourceId return the existing design and ignore seedElement/designName. Idempotent within a model build.
public IDesign GetOrCreateDesignRef(IElement seedElement, string designName, string sourceId)
| parameter | description |
|---|---|
| seedElement | The IElement whose design is referenced on first creation. Must already carry geometry/model hierarchy. |
| designName | A name for the design. Ignored if the design already exists. |
| sourceId | The design's source identifier — the Id of the corresponding design in the authoring connector/application. The idempotency key, and the value surfaced as SourceId. |
Return Value
The newly created or already-existing design.
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | Thrown when sourceId is null or empty, or when seedElement or designName is null or empty on first creation. |
| ArgumentException | Thrown when seedElement does not contain geometry or model hierarchy on first creation, or when seedElement is not an SDK-provided IElement implementation. |
Remarks
When a design with the same SourceId already exists, that design is returned and seedElement and designName are ignored.
See Also
- interface IDesign
- interface IElement
- class ElementDataModel
- namespace Autodesk.DataExchange.DataModels