Click or drag to resize
Reader3dsReadFile Method
Reads 3ds file from file or stream and returns its data in Model3DGroup object.
Overload List
  NameDescription
Public methodCode exampleReadFile(Stream)
Reads 3ds file from stream and returns its data in Model3DGroup object.
Public methodReadFile(String)
Reads 3ds file and returns its data in Model3DGroup object
Public methodCode exampleReadFile(Stream, Viewport3D)
Reads the 3ds file from stream and adds the 3d objects (as MeshGeometry3D, Lights, Materials) to Viewport3D Also if the 3ds file contains camera information set the Viewport3D's camera to the first camera in 3ds file
Public methodCode exampleReadFile(String, Viewport3D)
Reads the 3ds file and adds the 3d objects (as MeshGeometry3D, Lights, Materials) to Viewport3D Also if the 3ds file contains camera information set the Viewport3D's camera to the first camera in 3ds file
Public methodCode exampleReadFile(Stream, Viewport3D, Int32)
Reads the 3ds file from stream and adds the 3d objects (as MeshGeometry3D, Lights, Materials) to Viewport3D If cameraIndex >= 0 than also sets the camera (if there is one in 3ds file) to Viewport3D
Public methodReadFile(String, Viewport3D, Int32)
Reads the 3ds file and adds the 3d objects (as MeshGeometry3D, Lights, Materials) to Viewport3D If cameraIndex >= 0 than also sets the camera (if there is one in 3ds file) to Viewport3D
Top
Examples
The following example reads the 3ds file from a file robotArm.3ds from temp directory and shows the 3D objects in Viewport1 Viewport3D.
Ab3d.Instance.ReadFile(@"c:\temp\robotArm.3ds", Viewport1);
The following example reads the 3ds file from a file stored in application's resources (in Visual Studio marked as Resource - not Embedded resource). This can be very useful for creating a xbap applications.
Uri fileUri = new Uri("pack://application:,,,/SampleApp;component/models/testModel.3ds", UriKind.Absolute);
using (Stream stream = Application.GetResourceStream(fileUri).Stream)
{
    Ab3d.Instance.ReadFile(stream, Viewport1);
}
See Also