Model3D.OpenFile

This page contains reference documentation for the OpenFile function. This function opens a file from disk into the current model. The existing model is replaced.

Prototype

int OpenFile( string Filename )

Parameters

Function parameters are as follows:

Examples

Examples are as follows:

string file = Application.GetTempPath( "TempLinkCopyReferencesTransport.box", 0 );
// create and import a model
Model3D importModel = new Model3D;
if ( importModel.OpenFile( file ) )
{
   Group newParent = GetStandardAddGroup(); 

   for ( ; importModel.ChildCount != 0; )
   {
      // take the nodelink out of the imported model
      NodeLink importReference = (NodeLink)importModel.Children[ 0 ];
      Group nullGroup; 
      importReference.SetParent( nullGroup );

      // convert the absolute path to a relative path
      importReference.PathToFile = Application.MakeRelativePath( importReference.PathToFile , Model.Filename );

      // Moves the node from the imported model into the open document
      Model.AddNode( importReference, newParent, -1 );
   }
}
// clean up
delete importModel; 

Working Sample Code

For sample code: