SketchUp C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions
SketchUpModelImporterInterface Struct Referenceabstract

A valid SketchUp "importer" plugin must support the following interface. See the SDK samples for an example. More...

#include <SketchUpAPI/import_export/modelimporterplugin.h>

Public Member Functions

virtual std::string GetIdentifier () const =0
 Returns a unique ASCII (non-localized) identifier for the importer. For example, all SketchUp supplied importers use the following convention for the id name: com.sketchup.importers.extension. This id is used to identify the current default importer and saved between invocations of SketchUp. More...
 
virtual int GetFileExtensionCount () const =0
 The number of extensions supported by the importer. Must be > 0. More...
 
virtual std::string GetFileExtension (int index) const =0
 Each extension, assumed to be ASCII and case independent with no leading dot. More...
 
virtual std::string GetDescription () const =0
 Return a brief description of the importer for the file drop down box. For example, "AutoCAD DWG Files". SketchUp uses this description together with all the extensions to form a single entry in the import dialog drop down list: e.g., "AutoCAD DWG Files (*.dwg,*.dxf)". More...
 
virtual bool SupportsOptions () const
 Indicates whether the importer supports an options dialog. More...
 
virtual
SketchUpOptionsDialogResponse 
ShowOptionsDialog ()
 Displays a modal dialog which controls options supported by the importer. Implementing this is required if SupportOptions is true. Options should be saved someplace which persists between this method and ConvertToSkp as well as between sessions. More...
 
virtual bool SupportsProgress () const
 Indicates whether the plugin supports the progress callback. More...
 
virtual bool ConvertToSkp (const std::string &input, const std::string &output_skp, SketchUpPluginProgressCallback *progress, void *reserved)=0
 This performs the conversion from the selected input file to the given temporary output file using options set during the ShowOptionsDialog method. The output file is then inserted into the current model using rules defined by the GetImporterBehavior method. More...
 
virtual void ShowSummaryDialog ()
 Displays a modal dialog showing an optional summary of the import process. The default does nothing. Note that Ruby scripting often disables this dialog.
 
virtual
SketchUpModelImporterBehavior 
GetImporterBehavior () const
 Defines the method SketchUp uses when placing the imported model.
 

Detailed Description

A valid SketchUp "importer" plugin must support the following interface. See the SDK samples for an example.

Member Function Documentation

virtual bool SketchUpModelImporterInterface::ConvertToSkp ( const std::string &  input,
const std::string &  output_skp,
SketchUpPluginProgressCallback progress,
void *  reserved 
)
pure virtual

This performs the conversion from the selected input file to the given temporary output file using options set during the ShowOptionsDialog method. The output file is then inserted into the current model using rules defined by the GetImporterBehavior method.

Parameters
[in]inputThe user selected input file. The file name is specified in UTF-8 and may require conversion to a platform dependent format (i.e. UTF-16) for proper support of international file names.
[in]output_skpA temporary output file in UTF-8.
[in]progressThe importer should support this progress interface. See that for details. The method should be tolerant to a NULL progress callback.
reservedReserved for internal use.
Returns
  • true on success
  • false on failure or cancellation
virtual std::string SketchUpModelImporterInterface::GetDescription ( ) const
pure virtual

Return a brief description of the importer for the file drop down box. For example, "AutoCAD DWG Files". SketchUp uses this description together with all the extensions to form a single entry in the import dialog drop down list: e.g., "AutoCAD DWG Files (*.dwg,*.dxf)".

Returns
  • The description retrieved
virtual std::string SketchUpModelImporterInterface::GetFileExtension ( int  index) const
pure virtual

Each extension, assumed to be ASCII and case independent with no leading dot.

Parameters
[in]indexThe index of the extension
Returns
  • The file extension retrieved
virtual int SketchUpModelImporterInterface::GetFileExtensionCount ( ) const
pure virtual

The number of extensions supported by the importer. Must be > 0.

Returns
  • The number of file extensions supported by this plugin
virtual std::string SketchUpModelImporterInterface::GetIdentifier ( ) const
pure virtual

Returns a unique ASCII (non-localized) identifier for the importer. For example, all SketchUp supplied importers use the following convention for the id name: com.sketchup.importers.extension. This id is used to identify the current default importer and saved between invocations of SketchUp.

Returns
  • A unique string identifier for the plugin
virtual SketchUpOptionsDialogResponse SketchUpModelImporterInterface::ShowOptionsDialog ( )
inlinevirtual

Displays a modal dialog which controls options supported by the importer. Implementing this is required if SupportOptions is true. Options should be saved someplace which persists between this method and ConvertToSkp as well as between sessions.

Warning
*** Breaking Change: The behavior of this method was changed in SketchUp 2019.2, API 7.1 on the Windows API and SketchUp 2020, API 8.0 on the MacOS API. In previous releases, the method returned void. Now it will return SketchUpOptionsDialogResponse.
Returns
SketchUpOptionsDialogResponse IMPORTER_OPTIONS_UNAVAILABLE if unable to display options, IMPORTER_OPTIONS_CANCELLED if options were cancelled, IMPORTER_OPTIONS_ACCEPTED if options were accepted
virtual bool SketchUpModelImporterInterface::SupportsOptions ( ) const
inlinevirtual

Indicates whether the importer supports an options dialog.

Returns
  • true if the importer supports an options dialog. If so, the "Options" button will be enabled when your importer is chosen, and selecting that button will call the importer's ShowOptionsDialog method.
virtual bool SketchUpModelImporterInterface::SupportsProgress ( ) const
inlinevirtual

Indicates whether the plugin supports the progress callback.

Returns
  • true if the exporter supports the progress callback. If true, the plugin should periodically update the status with messages and percent complete as well as check if the user pressed the cancel button. If false, SketchUp will provide limited feedback on the progress of the export step.

The documentation for this struct was generated from the following file: