Load Model

Helix3D.LoadModel History

Hide minor edits - Show changes to output

October 17, 2013, at 07:09 PM by 136.159.7.119 -
Added line 11:
Added line 18:
October 17, 2013, at 07:08 PM by 136.159.7.119 -
Added lines 1-17:
To load a model from a file use the following.
First create a ModelVisual3D object which will be used to display the model and add it to the 3D viewport.

(:source lang=csharp tabwidth=2 :) [=
ModelVisual3D loadedModel = new ModelVisual3D();
viewport.Children.Add(loadedModel);
=]

Next load the model from your file system. You can either use resources in your project or files on your system.
Finally set it to the Content of the ModelVisual3D, which you created earlier.
(:source lang=csharp tabwidth=2 :) [=
var mi = new ModelImporter();
Model3D currentModel = mi.Load("PATH\\TO\\MODEL.3ds", Dispatcher.CurrentDispatcher);
//mi.Load("PATH\\TO\\MODEL.3ds", null, true);
loadedModel.Content = this.currentModel
=]
Note that the model will be created on the UI dispatcher. If you want to freeze the model, use the commented line.