assimpWpfImporter ReadModel3D from stream
#1
Hi,

just a question.

I read STL file with assimpwpf importer and everything is ok.

Now i stored stl file into a database in binary mode and i need to use wpf importer not from file but from a memory stream read from my database.
How i have to do? Is it possible?

Thanks
#2
Instead of calling ReadModel3D method that takes fileName as parameter use the overload that accepts a stream:

Code:
       /// <summary>
       /// ReadModel3D method reads 3D models from stream and returns the 3D models as Model3DGroup or GeomentryModel3D.
       /// When the model have additional textures, the resolveResourceFunc must be set a method that converts the resource name into a Stream.
       /// </summary>
       /// <param name="fileStream">file stream</param>
       /// <param name="formatHint">file extension to serve as a hint to Assimp to choose which importer to use - for example ".dae"</param>
       /// <param name="resolveResourceFunc">method that converts the resource name into Stream - used to read additional resources (materials and textures)</param>
       /// <returns>WPF Model3D object</returns>
       public Model3D ReadModel3D(Stream fileStream, string formatHint, Func<string, Stream> resolveResourceFunc = null)
Andrej Benedik
#3
Hi,

I tried to use overload but i received the error:
Assimp.AssimpException: 'Error importing file: Invalid parameters passed to ReadFileFromMemory()'

I simply create a memorystream from a bytes array and passed to read3dmodel overlay:
mystl=assimpWpfImporter.ReadModel3D(mystream, ".stl")
  


Forum Jump:


Users browsing this thread:
1 Guest(s)