How can I use c++ api to convert skp file to image?

hi! I want convert skp file to image in my c++ application, is there any api I can used!

There is an SDK that include C language importers and exports, maybe that would do:

https://extensions.sketchup.com/en/developer_center/sketchup_sdk

It sounds like you want to render the model to get an image? If that is the case, you could use the SDK to read the file, then use OpenGL to render the model, and then save the rendered output.

1 Like

yes,do you which api is used for this

I know this sdk, but I do not know how to use it to convert skp file to image.

I don’t know the API yet, I’m still trying to figure it out myself. In my case I want to write an importer, but in your case you want to read the skp file externally.

You would need to open the model, read each face, and pass each face over to OpenGL - and if you haven’t used OpenGL before, then you are going to struggle. I’ve dabbled with OpenTK (The C# wrapper for OpenGL), and it took me weeks to months before I could render my models adequately.

If you can just do with the thumbnail representation of the model, then a possible alternative is to open the SKP file and search for the PNG header, extracting the image should be simple.

1 Like

OK, I know, thanks a lot

The C API doesn’t have any functionality to export 2D images from the SKP model.

Only the Ruby API - running inside SketchUp - can do that, using the current viewport.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.