2

I have a program, and when I press the button "add Catalog" I can add a catalog which contains many .obj files (3d models).

When I select the directory of the catalog I need to save the .obj as .png in a particular folder.

I am using helixtoolkit and I have already added the nuget packet and got everything else ready but just not the preview saver as .png.

https://searchcode.com/codesearch/view/10564694/

halfer
  • 19,824
  • 17
  • 99
  • 186
  • So what *does* happen when you use your existing code? It looks like you already have the code to try to save it as a png... – Jon Skeet Jun 12 '18 at 21:03
  • No I dont have it actually. I dont know how to use the given functions of the .cs That´s why I am asking for help. –  Jun 12 '18 at 21:07
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Jun 12 '18 at 21:23
  • I'm sorry if that sounded so rude. –  Jun 12 '18 at 21:55

1 Answers1

3

The HelixViewport3D class ha as method called Export(). So when you define your Viewport in e.g. MainWindow.xaml like that:

<h:HelixViewport3D x:Name="MyViewport">

you can access the HelixViewport3D your MainWindow.xaml.cs and use the Export() function:

MyViewport.Export("<somepath>/img.png");
Quergo
  • 888
  • 1
  • 8
  • 21
  • Oh that works for a single obj.Do you actually know if its a bit customizable ,so that I don´t even need the WPF Application to be open . So when I click in my main Form add catalog that all x 50 different object datas get saved without opening the wpf form ? –  Jun 12 '18 at 23:37
  • The problem is that the Export() function renders the Viewport control to generate the image. You can try create a Viewport not in xaml but in a separate class without showing it. Then load and export each model. – Quergo Jun 13 '18 at 00:02
  • Is it not possible to hide the WPF while it´s doing exactly this ? –  Jun 13 '18 at 11:03
  • So your program where you can add catalogs is not an wpf app? – Quergo Jun 13 '18 at 20:29
  • The WindowForm we use to interact has an add catalog button ,we select an catalog which has folders with obj mtl and sometimes textures within a subfolder.The program should button press , create for every .obj an preview (.png )saved in a path. –  Jun 14 '18 at 13:33
  • 1
    So for me it looks like you need a obj to image converter. You can try write a console application which acceps as input a filepath or a list of filespath. It then loads one or multipe obj into a viewport and creates a snapshot. – Quergo Jun 15 '18 at 11:32