CreateModel

Loads an object from a file and places it in the 3D Window. Currently, TerraExplorer supports X and FLT formats (.x, .xpc, .flt, .fpc, .3ds, .xpl, .xpl2 or .dae).

 

JavaScript

 

CreateModel(

       Position,

       FileName,

       Scale,

       ModelType,

       GroupID,

       Description )

 

C#

 

ITerrainModel80 CreateModel(

       IPosition80  Position,

       string        FileName,

       double        Scale = 1,

       ModelTypeCode       ModelType = ModelTypeCode.MT_NORMAL,

       string        GroupID = "",

       string        Description = "")

 

C++

 

HRESULT CreateModel(

       IPosition80* Position,

       BSTR FileName,

       double Scale,

       ModelTypeCode ModelType,

       BSTR GroupID,

       BSTR Description,

       ITerrainModel80** pITerrainModel80)

 

Parameters

Position

An IPosition80 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 values for this 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 an empty string, the object is created under the root. You can obtain the GroupID by one of the following methods:

·          Create the group using IProjectTree80.CreateGroup.

·          Find the group, if you know the name, using IProjectTree80.FindItem.

·          Traverse the Tree using IProjectTree80 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

pITerrainModel80

An ITerrainModel80 representing the newly created model.

Exceptions

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