## X3DObject.AddModel

### Description

Creates a new model given a list of children objects and a name. The new model is parented under this X3DObject.

### C# Syntax

    Model X3DObject.AddModel( Object in_inputObjects, Object in_strName );

### Scripting Syntax

    oReturn = X3DObject.AddModel( [Items], [Name] );

### Return Value

Model

### Parameters

Parameter | Type | Description
--- | --- | ---
Items | XSICollection or X3DObject | An X3DObjectCollection or a single X3DObject
Name | String | Name of new Model

### Examples

#### 1. JScript Example

    NewScene( null, false );

    var oRoot = Application.ActiveSceneRoot;

    var oNull = oRoot.AddNull( "MyNull" );

    // Put the Null in a model

    oRoot.AddModel( oNull, "ModelForNull" );

    // Create 3 objects and put them in an XSICollection

    var oCollection = XSIFactory.CreateActiveXObject( "XSI.Collection" );

    oCollection.Add( oRoot.AddNull("AnotherNull") );

    oCollection.Add( oRoot.AddPrimitive("Camera") );

    oCollection.Add( oRoot.AddGeometry("Sphere", "MeshSurface") );

    // Put all of these objects into another Model

    oRoot.AddModel( oCollection, "ModelForOtherStuff" );

    // Create a model with nothing in it

    oCollection.RemoveAll();

    oRoot.AddModel( oCollection, "EmptyModel" );

#### 2. VBScript Example

    Option Explicit

    NewScene , false

    main()

    sub main()

    	dim oRoot

    	set oRoot = Application.ActiveProject.ActiveScene.Root

    	oRoot.AddModel oRoot.Children, "Sally"

    	WriteModels oRoot

    end sub

    function WriteModels( in_obj )

    	dim list, n, i, mdls

    	set mdls = in_obj.Models(0)

    	n = mdls.Count

    	if n = 0 then

    		exit function

    	end if

    	for i=0 to n-1

    		Application.LogMessage mdls(i).Name

    		WriteModels mdls(i)

    	next

    end function

    ' Expected results:

    'INFO : Sally