Search code examples
sketchup

How to use Sketchup Examples


I am trying to write a sketchup exporter. That will take a model that is currently inside sketchup and export it to a custom format.

I know that the sketchup sdk comes with some example projects such as skp2xml. How do I use this example file? It creates a dll file. How do I access this code within sketchup? Do I need to load it with ruby? If so how?

The deprecated documentation states:

A SketchUp plugin exporter is a piece of code that is dynamically loaded at runtime when a user indicates that they wish to export the model, view, section slice or image.

On the Windows platform an exporter is implemented by creating a COM DLL which contains a class that implements IEnumSketchUpExporter interface. See the SkpToXML Exporter example in the Examples folder for the details on how to do this.

The example is a visual studio project which I can compile into a dll. What do I do with the dll though? Do I need to place it in a special location?


Solution

  • Note that the skp_to_xml example will not work without Sketchup Pro.

    The XML Exporter sample builds an exporter plugin for SketchUp and runs in the same process. Due to its C++ interface, it has to be built with the same Visual Studio version as SketchUp, which is VS2010. If you let VS2012 upgrade the project, the resulting DLL will not be compatible and it will likely cause crashes.

    To use the Sketchup skp_to_xml project do the following:

    1. Build the Project file located in skp_to_xml/win. Make sure that you have the correct platform selected (32, 64) or Sketchup will not load it. It must be in release mode or Sketchup will crash.
    2. Copy the SkpToXML.dll to your sketchup/Exporters folder. Default location is: C:\Program Files\SketchUp\SketchUp 2015\Exporters
    3. Go File->Export->3D Model
    4. In the export model export type you will find the new .xml file format.

    Sources: https://groups.google.com/forum/#!topic/su-sdk-fileshare/xGCiGK2775k http://sketchucation.com/forums/viewtopic.php?f=180&t=53862