im working on a 3d geoinformation system and currenty i try to import skp file format. Is there something i can reuse? Im not a big fan of reinventing the wheel and im sure, something similar has been developed already.
There are three possible ways for me:
1.) Some kind of converter, which converts skp to xml of some kind
2.) Some kind of reader in C++ oder java (C++ would be used with JNI (not my favorite solution)
3.) A java application reading the binary format (obviously i like this solution the most)
Has anyone any experience with this topic or even some java code i can use?
The .skp file format is not publicly documented, so the way to do it is (2.) to use SketchUp’s C/C++ SDK for reading and writing .skp files. Obviously this is not a pure java solution and also not completely operating-system independent. The SDK is available for Windows (32&64bit) and OS X (64bit).
Thank you for the quick answer.
But is there a ready c/c++ lib for reading/writing skp. I mean a dll or something which i can call with JNI. Anyone has an idea?
Never heard of one…The SDK is a raw interface to the SketchUp file. Another means of access such as JNI would need to be layered on top of this - a non-trivial task.
By “bridge” I mean a library that provides a way for code written in one language (C# or java in your case) to invoke functions written in a different language, including adapting the data structures used by those functions. I’ve not heard of anyone manipulating SketchUp files from java or C# by bridging to the C/C++ SDK, so you might be on your own trying to create one.
isn’t it possible to develop a C++ code that obtains data (surface , orientation …) from the skp file and generate the results in an xml file, and use that file by the java C# application ?
thank you soooo much one more question is it possible to execute this C++ code from the java code, so that the C++ finish it’s execution and automatically the java application use that xml file that was generated ? sorry for the “too much” questions
Yes, if you write a C/C++ program to export the contents of a SketchUp file, you can write a java program that exec’s that C/C++ program and then uses files written by it. But that’s a general programming question that has little to do with SketchUp or the SketchUp SDK. It’s also a different technique than directly calling C/C++ from within a java program.
Hi Andreas,
this comes a bit late, but I developed a C#.NET API wrapping the SketchUp SDK so you can use it directly in .NET. Its an Open Source Project, available here: https://github.com/moethu/SketchUpNET