AB4D Forum

Full Version: error adding Assimp64.dll reference
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I everybody,

I'm a new member and i suppose i need your help.
I try to read a 'STL' file using assimp libs but i receive an error creating reference for Assimp64.dll
Visual studio tells me that the componend is not valid. Why?

My project is a vb form project in visual studio 2017
Anyone can help me?
To use assimp library you need to add references to AssimpNet.dll and Ab3d.PowerToys.Assimp. Then you need to make sure that the Assimp64.dll in copied to the same folder as the exe of your project - this can be achieved with setting the Assimp64.dll file as "Content" and "Copy if newer" (in the Visual Studio file properties). Note that if you will only use Assimp64.dll, then you also need to set your application to be compiled only for x64 and not for AnyCPU.
Do you tell me not to add a reference on the proj just copy .dll in bin folder?

Thank you, May be i will need a little help in the future...?
Yes, Assimp64 is not a .Net assembly (dll) but a a native dll (C++ project) so it cannot be added as a reference. But it needs to be available so that .net can load it - it is best to be in the same folder as exe. In this case the library will be automatically loaded. But if you want you can also put it into some other folder and then load the library with calling: AssimpWpfImporter.LoadAssimpNativeLibrary(assimp32Folder, assimp64Folder);
Perfect! It works!

I wrote my 'hello world' code to read STL files

<code> Dim myimporter As New AssimpWpfImporter


No error found but i don't know how visualiza the scene.
I created an 'elementhost' control bu i can't display nothing.

Can i have some example code in winform to load, display and manipulate the 3D scene?

No matter, i solved!
I used Ab3d.Visuals.AssimpModelVisual3D to read STL file and show them on a elementhost, but STL are displayed with default material.
Can i modify material for each object in STL file?
I would advise you to read the 3D model in code with using ReadModel3D method on AssimpWpfImporter class (see the AssimpWpfImporterSample.xaml.cs sample).

This will give you a WPF's Model3D object. If you are not familiar with WPF 3D object check the internet - (some useful links can be found on https://www.ab4d.com/Links.aspx).

After that you can go through the hierarchy of read 3D models and change the material on each GeometryModel3D.

As shown in the sample, you can show the loaded Model3D with first creating a ModelVisual3D object, assign Model3D to its Content and then adding the ModelVisual3D object to Viewport3D.Children collection (the above sample shows the model with using WireframeVisual3D, but there are also many other samples that show you on how to show a loaded 3D model).

I would also advise you to check also other samples and check what part of the samples you can also use.
Ok, but AssimpModelVisual3D is ok for what i have to do.
Just a question.
Can i create handler (mpouseclick, mouseleave) on a AssimpModelVisual3D imported scene?
As you have probably already seen there are many samples in the samples project that demonstrate how to add mouse handlers to 3D objects.
thanks for reply.

I solved my problems... but I'm yet not able to manipulate meshes after reading STL file.
Is there a sample that can help me?
Pages: 1 2 3