v2.44
 
IModel Interface Reference

Allows to obtain and edit model objects. More...

Public Member Functions

HRESULT CreateNewEntityArgs ([out, retval] INewEntityArgs **ppArgs)
 Creates arguments for creating a new entity.
 
HRESULT CreateObject ([in] INewEntityArgs *pArgs, [out, retval] IModelObject **ppModelObject)
 Creates a new model object.
 
HRESULT CreateOperation ([out, retval] IOperation **ppOperation)
 Creates an operation.
 
HRESULT DeleteObjectById ([in] int id_)
 Deletes a model object by its local identifier.
 
HRESULT DeleteObjectByUniqueId ([in] GUID uniqueId_)
 Deletes a model object by its unique identifier.
 
HRESULT DeleteObjectByUniqueIdS ([in] BSTR uniqueId_)
 Same as DeleteObjectByUniqueId, but accepting GUID as a string.
 
HRESULT GetIdFromUniqueId ([in] GUID uniqueId_, [out, retval] int *id_)
 Returns the local identifier of the object of this model by it's unique identifier.
 
HRESULT GetIdFromUniqueIdS ([in] BSTR uniqueId_, [out, retval] int *id_)
 Same as GetIdFromUniqueId, but accepting GUID as a string.
 
HRESULT GetObjects ([out, retval] IModelObjectCollection **ppModelObjectCollection)
 Returns a collection of all objects present in the model.
 
HRESULT GetUniqueIdFromId ([in] int id_, [out, retval] GUID *uniqueId_)
 Returns the unique identifier of the object of this model by it's local identifier.
 
HRESULT GetUniqueIdFromIdS ([in] int id_, [out, retval] BSTR *uniqueId_)
 Same as GetUniqueIdFromId, but returning GUID as a string.
 

Properties

GUID Id [get]
 The identifier of the model.
 

Detailed Description

Allows to obtain and edit model objects.

This interface can be obtained with IProject::Model (building model) property. It also can be obtained
as an additional interface from IEntity if the entity is an Assembly (IProject::Assemblies) or a Drawing (IProject::Drawings2).

Member Function Documentation

◆ CreateNewEntityArgs()

HRESULT CreateNewEntityArgs ( [out, retval] INewEntityArgs ** ppArgs)

Creates arguments for creating a new entity.

Parameters
[out]ppArgsThe arguments for creating a new entity.
See also
INewEntityArgs

◆ CreateObject()

HRESULT CreateObject ( [in] INewEntityArgs * pArgs,
[out, retval] IModelObject ** ppModelObject )

Creates a new model object.

Parameters
[in]pArgsArguments for creating a model object.
[out]ppModelObjectThe created model object instance.

A table of matching types of objects that can be created and models in which they can be created:

Object type Building model Assembly model Drawing model
AssemblyInstance + + -
Beam + + -
Column + + -
Door + + -
DrawingText - - +
DrawingLine - - +
DrawingLinkedDrawing - - +
DrawingLinkedImage - - +
Element + + -
Equipment + - -
Floor + + -
Hatch + - -
Hole + + -
IsolatedFoundation + + -
Level + - -
LinkedDrawing + + -
LinkedImage + + -
LinkedModel + + -
Line3D + + -
MechanicalEquipment + - -
ModelText + - -
Opening + + -
Plate + + -
PlumbingFixture + - -
Railing + + -
Ramp + + -
Roof + - -
Room + - -
Stair + + -
Wall + + -
WallFoundation + + -
Window + + -

For dependent objects:

Note
When creating Equipment, MechanicalEquipment or a PlumbingFixture, you must specify style id in INewEntityArgs::StyleId.
When creating a LinkedImage, a LinkedModel, a LinkedDrawing, a DrawingLinkedDrawing, or a DrawingLinkedImage, you must specify the file path in INewEntityArgs::FilePath.
Returns
The created model object instance.
See also
Entity types

◆ CreateOperation()

HRESULT CreateOperation ( [out, retval] IOperation ** ppOperation)

Creates an operation.

To modify any model object you need to create an operation and start it before the modifications are done, and apply it afterwards.

Deprecated
This method is deprecated, use IProject::CreateOperation instead
Returns
The newly created operation.

◆ DeleteObjectById()

HRESULT DeleteObjectById ( [in] int id_)

Deletes a model object by its local identifier.

Parameters
[in]id_Local identifier of the object being deleted.
See also
DeleteObjectByUniqueId

◆ DeleteObjectByUniqueId()

HRESULT DeleteObjectByUniqueId ( [in] GUID uniqueId_)

Deletes a model object by its unique identifier.

Parameters
[in]uniqueId_Unique identifier of the object being deleted.
See also
DeleteObjectById

◆ DeleteObjectByUniqueIdS()

HRESULT DeleteObjectByUniqueIdS ( [in] BSTR uniqueId_)

Same as DeleteObjectByUniqueId, but accepting GUID as a string.

Parameters
[in]uniqueId_Unique identifier of the object being deleted as a string.
See also
DeleteObjectByUniqueId

◆ GetObjects()

HRESULT GetObjects ( [out, retval] IModelObjectCollection ** ppModelObjectCollection)

Returns a collection of all objects present in the model.

Returns
Collection of model objects.