Import a .step filein unity with C# code? - c#

I would like to import a file ".step" to use it with unity 2018.3.1f1 but I don't know how to do it
I didn't found any topic.
Any one could help me please ?

.step is a cad file, right? This isn't supported by unity out of the box. You may need to buy an asset store plugin to open cad files, or roll your own importer. You would need to read up on the file format and build a new mesh based on interpretation of the file format.
Documentation on building a mesh from scratch: https://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html

Related

Read, modify, and display .STL file 3D model using c#

I used Solidworks to build a 3D model and save as a .STL file. I would like to use C# to read the file and change the data while displaying the model.
Can any one give me some references?
Any help would be greatly appreciated.
Thanks in advance.
You may user batu92k's STL Viewer.
Project url is below.
https://github.com/batu92k/STL-Viewer
And also you may open stl in a text editor and modify the file by changing related parameters.

EXIF lat/long from image in Unity

I need a c# script for unity that can read the EXIF lat/long data from a photo. i would like to place a posTransform at that location. not sure if this is possible within Unity. i would like to load my images into unity and have a script read the EXIF: 1-GPS lat/long, 2-rotation, 3-timestamp from photographs. i haven't found any info that says this can be done within unity, however, i've read about exiflib github project and other ways outside of unity.
THANKS in advance for help
I maintain a project for extracting metadata from images that will give you what you need.
https://github.com/drewnoakes/metadata-extractor-dotnet
The library supports .NET 3.5 so should work under Unity, though I haven't tested it before.
With it, you would write:
var directories = ImageMetadataReader.ReadMetadata(filePath);
var gpsDirectory = directories.OfType<GpsDirectory>().FirstOrDefault();
if (gpsDirectory != null)
{
var location = gpsDirectory.GetGeoLocation();
Console.WriteLine($"Photo was taken at {location.Latitude},{location.Longitude}");
}
The answer from Drew Noakes doesn't work because it has dependencies on .NET that Unity doesn't support.
In my opinion, the best option right now, after a few days of research, is this project:
https://www.codeproject.com/Articles/5251929/CompactExifLib-Access-to-EXIF-Tags-in-JPEG-TIFF-an
This is a simple one-file project that you can drag in your unity project and that has no external dependencies. And it can read and update EXIF tags for JPG, PNG and TIFF files.

Blender file import assimp

I want to import a blender file using Assimp (in c#), all classic format like .obj works.
I saw here that the better way to do it is to convert the blender file in one more usual, like obj.
You need to open your file .blend and export it to .3ds, .obj etc.
How do you load Blender files using Assimp?
But my question is how can I convert it, I searched in Assimp Documentation, there's nothing for convert and I can't import blender file so I can't export it in another kind.
I search for another library but I also find nothing.
You can run Blender via command line, allowing it to run a python script, to open .blend, then export to another format, then run that through a custom assimp process you were trying to do. Not sure your target format, but you could also just have blender go right to that instead of assimp.
This is something semi-similar, but you will need to connect the dots.
http://indygamedev.com/blender/automating-fbx-model-export-process/
Use Blender 2.79 (not 8.x).
Pack all textures, then save the *.blend to your data directory.
Then unpack all images which will put them in "textures*.*".
Resave the file after the Unpack -
Assimp should now see your textures.

Import any 3d file at runtime in WPF

I asked a similair question earilier, but it was not generic enough, so here's another attempt.
I currently have a whole bunch of 3d .obj and .jpg files which I want to display in my WPF application. However, I want to do this at runtime, so converting them using Blend is not an option.
I don't mind having to convert to other types of 3d files, as long as this can be done at runtime (either programmaticly or by using a command line tool).
So I guess my question is: Is there any way to import a 3d file in WPF at runtime?
Thanks!
I don't think there's a built in way. You'll most likely have to write an importer for your own specific needs. You can find some file format information here> http://en.wikipedia.org/wiki/Wavefront_.obj_file
Thanks to #MattDavey
I managed to get The HelixToolkit (http://helixtoolkit.codeplex.com/) to work and got what I wanted using the ModelImporter.Load method.

XNA Text Drawing from a DLL

I am planning on building a 2D game library for XNA, and one of the components I want to include is a simple text drawer for debug purposes. Now, to draw text with SpriteBatch you need a .spritefont file, which is an xml format file, and these seem to need to compile into a separate folder. I would prefer not to have to copy that around with the dll, so here is my question:
can i build some sort of text renderer for XNA that
A: does not require me to carry around external files with the dll (if you can embed the sprite font into a dll then that works) and
B: does not force me to rewrite a fair amount of underlying (is it managed directx? a different part of xna?) code that makes the SpriteBatch.DrawString code work.
Could you not just require that a SpriteFont be passed into your library, so that whoever is using the library has to supply that component? That would seem to be the best solution, since then they could use whatever font they wanted. Or you could write in a component that generates the spritefont xml file based on a given font name, because it's not all that complicated of a file. Disregard. I forgot that XNA compiles its resources.
You can precompile the project and then grab the xnb file for the spritefont. Then add the file to the project Content folder as a content file. It should then be deployed together with the library. However u will need to build a separate xnb file for each platform you wish to support (xbox360, windows, zune) and deploy the correct file.
Or why don't u just create a XNA Content Library project?

Categories

Resources