Home > Working with SGWorld > Creator (ICreator6) > CreateModel

CreateModel

The CreateModel method loads an object from a file and places it in the 3D Window. Currently, TerraExplorer supports X and FLT formats (*.X, *.XPC, *.FLT, *.FPC, XPL,* XPL2,* DAE).

 

JavaScript

 

CreateModel(

      Position,

      FileName,

      Scale ,

      ModelType ,

      GroupID ,

      Description )

 

C#

 

ITerrainModel6 CreateModel(

      IPosition6     Position,

      string         FileName,

      double         Scale = 1,

      ModelTypeCode ModelType = ModelTypeCode.MT_NORMAL,

      int            GroupID = 0,

      string         Description = "")

 

C++

 

HRESULT CreateModel(

      IPosition6* Position,

      BSTR FileName,

      double Scale,

      ModelTypeCode ModelType,

      LONG_PTR GroupID,

      BSTR Description,

      ITerrainModel6** pITerrainModel6)

 

Parameters:

Position

An IPosition6 representing the position and orientation of the model on the terrain.

FileName

A full path name or a URL to the model that you want to load.

Scale

The scale factor for the model. The actual size of the model in the 3D World is the size of the model in its internal coordinate system times the Scale value. (i.e., if the model has a width of 5 units and the scale is set to 10 meters per pixel, the width of the object in the 3D World is 50 meters.)

ModelType

An enum that indicates the model type. The following are the possible ModelTypeCode enumeration values for thie code:

§  MT_NORMAL = 0
Regular model.

§  MT_ANIMATION = 1
Direct X animation model.

§  MT_PROGRESSIVE = 2
Reserved.

GroupID

The Project Tree group in which the model is created. If it is set to zero, the object is created under the root. You can obtain the GroupID by one of the following methods:

§   Create the group using IProjectTree6.CreateGroup.

§  Find the group, if you know the name, using IProjectTree6.FindItem.

§  Traverse the Tree using IProjectTree6 methods such as GetNextItem(), until you come to the desired GroupID.

Description

The name of the model as it appears in the Project Tree. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.

Return Value

pITerrainModel6

An ITerrainModel6 representing the newly created model.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.