Rhino C++ API  8.6
Public Types | Public Member Functions | List of all members
CRhinoFileImportPlugIn Class Referenceabstract

#include <rhinoSdkPlugIn.h>

Inheritance diagram for CRhinoFileImportPlugIn:
CRhinoPlugIn ON_Object

Public Types

enum  file_import_plug_in_proc_message_id { file_import_plug_in_force_32bit = 0xFFFFFFFF }
 
- Public Types inherited from CRhinoPlugIn
enum  license_capabilities {
  no_capabilities = 0x0, can_be_purchased = 0x1, can_be_specified = 0x2, can_be_evaluated = 0x4,
  evaluation_is_expired = 0x8, supports_rhino_accounts = 0x10, supports_standalone = 0x20, supports_zoo_per_user = 0x40,
  supports_zoo_per_core = 0x80, supports_license_discovery = 0x100, license_dialog_buttons_force_32bit = 0xFFFFFFFF
}
 
enum  plug_in_proc_message_id { plug_in_force_32bit = 0xFFFFFFFF }
 
enum  plugin_load_time {
  load_plugin_disabled = 0, load_plugin_when_needed = 2, load_plugin_at_startup = 1, load_plugin_when_needed_ignore_docked = 6,
  load_plugin_when_needed_or_optionsdlg = 10, load_plugin_when_needed_or_tabbed_dockbar = 18, plugin_load_time_force_32bit = 0xFFFFFFFF
}
 
enum  plugin_type : unsigned int {
  unknown_plugin_type = 0, render_plugin = 0x01, file_export_plugin = 0x02, file_import_plugin = 0x04,
  digitizer_plugin = 0x08, utility_plugin = 0x10, display_pipeline_plugin = 0x20, display_engine_plugin = 0x40
}
 
- Public Types inherited from ON_Object
enum  UserDataConflictResolution : unsigned char {
  UserDataConflictResolution::destination_object = 0, UserDataConflictResolution::source_object = 1, UserDataConflictResolution::source_copycount_gt = 2, UserDataConflictResolution::source_copycount_ge = 3,
  UserDataConflictResolution::destination_copycount_gt = 4, UserDataConflictResolution::destination_copycount_ge = 5, UserDataConflictResolution::delete_item = 6
}
 

Public Member Functions

 CRhinoFileImportPlugIn ()
 
 ~CRhinoFileImportPlugIn ()
 
virtual void AddFileType (ON_ClassArray< CRhinoFileType > &ext_list, const CRhinoFileReadOptions &opts)=0
 
virtual void DisplayOptionsDialog (HWND parent, const CRhinoFileType &fileType)
 
virtual LRESULT FileImportPlugInProc (UINT message, WPARAM wParam, LPARAM lParam)
 This will be used to extend this class without breaking the SDK. More...
 
virtual BOOL32 GetFileDialogPreviewImageAndNotes (const wchar_t *lpsFileName, class CRhinoDib &dib, class CRhinoUiRichEditCtrl &ctrlNotes)
 
BOOL32 MakeReferenceTableName (const wchar_t *lpsName, ON_wString &new_name) const
 
plugin_type PlugInType () const override
 
virtual BOOL32 ReadFile (const wchar_t *lpsFileName, int index, CRhinoDoc &doc, const CRhinoFileReadOptions &options)=0
 
- Public Member Functions inherited from CRhinoPlugIn
 CRhinoPlugIn ()
 
virtual ~CRhinoPlugIn ()
 
virtual void AddPagesToDocumentPropertiesDialog (CRhinoOptionsPageCollection &collection)
 
virtual void AddPagesToObjectPropertiesDialog (CRhinoPropertiesPanelPageCollection &collection)
 
virtual void AddPagesToOptionsDialog (CRhinoOptionsPageCollection &collection)
 
virtual BOOL32 AddToPlugInHelpMenu () const
 
virtual BOOL32 CallWriteDocument (const CRhinoFileWriteOptions &options)
 
const ON_SimpleArray< CRhinoCommand * > & CommandList () const
 
bool DisplayPlugInErrorDialog (const wchar_t *message) const
 
const ON_UUID GetLicenseId ()
 
virtual void GetMenuMessageString (HMENU hMenu, UINT nID, ON_wString &wMessage) const
 
BOOL32 GetPlugInFileName (ON_wString &result) const
 
BOOL32 GetPlugInFolder (ON_wString &result) const
 
virtual LPUNKNOWN GetPlugInObjectInterface (const ON_UUID &iid)
 
BOOL32 GetPlugInRegistryKey (ON_wString &result) const
 
class CRhPlugInPrivate * GetPrivateData ()
 Get extended data from plug-in. More...
 
BOOL32 InsertPlugInItemToRhinoMenu (HMENU hTargetMenu, UINT index, MENUITEMINFO *pMi)
 
BOOL32 InsertPlugInMenuToRhinoMenu (HMENU hmenu, int index)
 
BOOL32 InsertPlugInMenuToRhinoMenu (HMENU hmenu, LPCTSTR title)
 
bool IsRhinoCommonPlugIn () const
 
virtual void LoadProfile (LPCTSTR lpszSection, CRhinoProfileContext &pc)
 
virtual const wchar_t * LocalPlugInDescription () const
 
virtual const wchar_t * LocalPlugInName () const
 
virtual BOOL32 OnDisplayPlugInHelp (HWND hWnd) const
 
virtual void OnInitPlugInMenuPopups (WPARAM wparam, LPARAM lparam)
 
virtual int OnLoadPlugIn ()
 
virtual bool OnLoadPlugInErrorString (ON_wString &msg)
 
virtual BOOL32 OnPlugInMenuCommand (WPARAM wparam)
 
virtual void OnRegisterPlugIn (bool bDone)
 
virtual void OnSaveAllSettings ()
 
virtual void OnUnloadPlugIn ()
 
virtual const wchar_t * PlugInDescription () const
 
const wchar_t * PlugInFileName () const
 
virtual HICON PlugInIcon (const ON_2iSize &size)
 
virtual GUID PlugInID () const =0
 
HINSTANCE PlugInInstance () const
 
virtual plugin_load_time PlugInLoadTime ()
 
AFX_MODULE_STATE * PlugInModuleState () const
 
virtual const wchar_t * PlugInName () const =0
 
virtual LRESULT PlugInProc (UINT message, WPARAM wParam, LPARAM lParam)
 This will be used to extend this class without breaking the SDK. More...
 
void PlugInTypeString (ON_wString &wResult) const
 
virtual const wchar_t * PlugInVersion () const =0
 
virtual BOOL32 ReadDocument (CRhinoDoc &doc, ON_BinaryArchive &archive, const CRhinoFileReadOptions &options)
 
virtual void RemoveDocumentPropertiesDialogTabs (CRhinoDocumentPropertiesTabs &tab_manager)
 
BOOL32 RemovePlugInMenuFromRhino (HMENU hTargetMenu)
 
virtual void ResetMessageBoxes ()
 
virtual bool SaveAsV3 (const CRhinoFileWriteOptions &options)
 
virtual void SaveProfile (LPCTSTR lpszSection, CRhinoProfileContext &pc)
 
void SaveSettings ()
 
CRhinoSettingsSettings ()
 
virtual BOOL32 WriteDocument (CRhinoDoc &doc, ON_BinaryArchive &archive, const CRhinoFileWriteOptions &options)
 
- Public Member Functions inherited from ON_Object
 ON_Object () ON_NOEXCEPT
 
 ON_Object (const ON_Object &)
 
virtual ~ON_Object ()
 
virtual ON_AggregateComponentStatus AggregateComponentStatus () const
 
bool AttachUserData (class ON_UserData *pUserData)
 
unsigned int ClearAllComponentStates () const
 
virtual unsigned int ClearComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_clear) const
 
virtual unsigned int ClearComponentStates (ON_ComponentStatus states_to_clear) const
 
void CopyUserData (const ON_Object &source_object)
 
unsigned int CopyUserData (const ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution)
 
virtual ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
virtual bool DeleteComponents (const ON_COMPONENT_INDEX *ci_list, size_t ci_count)
 
virtual void DestroyRuntimeCache (bool bDelete=true)
 
bool DetachUserData (class ON_UserData *pUserData)
 
virtual void Dump (ON_TextLog &) const
 
void EmergencyDestroy ()
 
class ON_UserDataFirstUserData () const
 
virtual unsigned int GetComponentsWithSetStates (ON_ComponentStatus states_filter, bool bAllEqualStates, ON_SimpleArray< ON_COMPONENT_INDEX > &components) const
 
class ON_UserDataGetUserData (const ON_UUID &userdata_uuid) const
 
bool GetUserString (const wchar_t *key, ON_wString &string_value) const
 
int GetUserStringKeys (ON_ClassArray< ON_wString > &user_string_keys) const
 
int GetUserStrings (ON_ClassArray< ON_UserString > &user_strings) const
 
bool IsCorrupt (bool bRepair, bool bSilentError, class ON_TextLog *text_log) const
 
bool IsKindOf (const ON_ClassId *pClassId) const
 
virtual void MarkAggregateComponentStatusAsNotCurrent () const
 
virtual void MemoryRelocate ()
 
virtual ON_UUID ModelObjectId () const
 
void MoveUserData (ON_Object &source_object)
 
unsigned int MoveUserData (ON_Object &source_object, ON_UUID source_userdata_item_id, ON_Object::UserDataConflictResolution userdata_conflict_resolution, bool bDeleteAllSourceItems)
 
virtual ON::object_type ObjectType () const
 
ON_Objectoperator= (const ON_Object &)
 
void PurgeUserData ()
 
virtual bool Read (ON_BinaryArchive &binary_archive)
 
virtual unsigned int SetComponentStates (ON_COMPONENT_INDEX component_index, ON_ComponentStatus states_to_set) const
 
virtual unsigned int SetComponentStatus (ON_COMPONENT_INDEX component_index, ON_ComponentStatus status_to_copy) const
 
bool SetUserString (const wchar_t *key, const wchar_t *string_value)
 
int SetUserStrings (int count, const ON_UserString *user_strings, bool bReplace)
 
virtual unsigned int SizeOf () const
 
bool ThisIsNullptr (bool bSilentError) const
 
void TransformUserData (const class ON_Xform &xform)
 
virtual bool UpdateReferencedComponents (const class ON_ComponentManifest &source_manifest, const class ON_ComponentManifest &destination_manifest, const class ON_ManifestMap &manifest_map)
 
int UserStringCount () const
 
virtual bool Write (ON_BinaryArchive &binary_archive) const
 

Additional Inherited Members

- Static Public Member Functions inherited from CRhinoPlugIn
static class CRhinoPlugInRecordGetLoadedPlugIn (ON_UUID uuid)
 
static class CRhinoPlugInRecordGetPlugIn (const wchar_t *lpsFileName)
 
static class CRhinoPlugInRecordGetPlugIn (int nIndex)
 
static class CRhinoPlugInRecordGetPlugIn (ON_UUID uuid)
 
static bool GetPlugInList (class ON_ClassArray< CRhinoPlugInRecord > &result, int nPlugInTypes=0xFFFFFFFF)
 
static int LoadPlugIn (const ON_UUID &uuid, bool bQuietly, bool ignore_load_failed)
 
static bool PlugInConstructionPermitted ()
 
static int PlugInCount ()
 
static const wchar_t * PlugInTypeString (int type)
 
static bool SaveLoadProtectionToRegistry (ON_UUID plugin_uuid, int load_protection)
 
- Protected Member Functions inherited from CRhinoPlugIn
bool GetLicense ()
 
bool GetLicense (unsigned int capabilities, const wchar_t *text_mask)
 
bool GetLicenseOwner (ON_wString &registeredOwner, ON_wString &registeredOrganization)
 
bool IsValid (ON_TextLog *text_log=nullptr) const override
 
bool ReturnLicense ()
 
void SetLicenseCapabilities (const wchar_t *format_string, CRhinoPlugIn::license_capabilities capabilities, ON_UUID licenseId)
 
- Protected Attributes inherited from CRhinoPlugIn
bool m_is_rhino_common_plug_in
 

Detailed Description

class CRhinoFileImportPlugIn

Description: Derive plug-in control object from this class to create a file import plug-in. This class provides interfaces for extending the Rhino file open dialog, drawing custom preview images and reading files.

Member Enumeration Documentation

◆ file_import_plug_in_proc_message_id

Enumerator
file_import_plug_in_force_32bit 

for internal use only, this allows adding additional values without breaking the SDK in the future

Constructor & Destructor Documentation

◆ CRhinoFileImportPlugIn()

CRhinoFileImportPlugIn::CRhinoFileImportPlugIn ( )

◆ ~CRhinoFileImportPlugIn()

CRhinoFileImportPlugIn::~CRhinoFileImportPlugIn ( )

Member Function Documentation

◆ AddFileType()

virtual void CRhinoFileImportPlugIn::AddFileType ( ON_ClassArray< CRhinoFileType > &  ext_list,
const CRhinoFileReadOptions opts 
)
pure virtual

Description: When Rhino gets ready to display the open file dialog, it calls AddFileType() once for each loaded CRhinoFileImportPlugIn.

Parameters: ON_ClassArray<CRhinoFileType>& ext_list = Append your supported file types to this list const CRhinoFileReadOptions& opts = File read options,

Example: If your file import plug-in reads "My Geometry Files" that have a ".mygeo" extension, then your AddToFileType(....) would look like

CMyGeometryImportPlugIn::AddToFileType( ON_ClassArray<CRhinoFileType>& ft_list, const CRhinoFileReadOptions& opts) { CRhinoFileType ft( PlugInID(), L"My Geometry Files (*.mygeo)", L"mygeo"); ft_list.Append( ft); }

◆ DisplayOptionsDialog()

virtual void CRhinoFileImportPlugIn::DisplayOptionsDialog ( HWND  parent,
const CRhinoFileType fileType 
)
virtual

Description: Called when AddFileType was called, a CRhinoFileType was added passing a true as the includeOptionsButtonInFileDialog constructor parameter and the file type is selected in the file open dialog.

Parameters: parent = File dialog box handle to be used as the parent for the plug-in provided options dialog box. const wchar_t* lpsFileName = Name of file int nFileTypeIndex = Index of file extension added to list in AddToFileType() callback. const CRhinoFileReadOptions& options = File read options

Remarks: The plug-in is responsible for opening lpsFile, reading it and creating document geometry.

◆ FileImportPlugInProc()

virtual LRESULT CRhinoFileImportPlugIn::FileImportPlugInProc ( UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

This will be used to extend this class without breaking the SDK.

◆ GetFileDialogPreviewImageAndNotes()

virtual BOOL32 CRhinoFileImportPlugIn::GetFileDialogPreviewImageAndNotes ( const wchar_t *  lpsFileName,
class CRhinoDib dib,
class CRhinoUiRichEditCtrl ctrlNotes 
)
virtual

Description: OBSOLETE - See GetFileDialogPreviewImageAndNotes

When a user single clicks on a file in the file open dialog, Rhino displays a preview image of the file's contents. If you want to paint a preview image then override OnPaintFileDialogPreviewImage() and return true. If OnPaintFileDialogPreviewImage() returns false, then Rhino will clear the preview image. This method is only called if calling OnPaintFileDialogPreviewImageAndNotes() returns false.

Returns: true = This plug-in painted preview. false = This plug-in did not paint, let file dialog paint.

Parameters: const wchar_t* lpsFileName = File name (full path) HWND hWnd = Handle to preview window. ON_DEPRECATED virtual

BOOL32 OnPaintFileDialogPreviewImage( const wchar_t* lpsFileName, HWND hWnd);

Description: When a user single clicks on a file in the file open dialog, Rhino displays a preview image of the file's contents and notes associated with the file. If you want to paint a preview image or modify the notes control then override this method and return true. If this method returns false Rhino will clear the preview image.

Returns: true = This plug-in painted preview and/or updated the notes false = This plug-in did not paint, let file dialog paint.

Parameters: lpsFileName = File name (full path) dib = 24 bit DIB which is the size of the preview image window. ctrlNotes = Read-only rich edit control to display file information in

◆ MakeReferenceTableName()

BOOL32 CRhinoFileImportPlugIn::MakeReferenceTableName ( const wchar_t *  lpsName,
ON_wString new_name 
) const

Description: ReadFile should use this function to decorate table object names (such as layer names) with the file name when referencing a file.

Returns: true = ReadFile is being called by the Worksession commands Attach option and new_name now contains modified name. false = Not called at the correct time or lpsName is NULL string. Parameters: lpsName [in] = name to prefix new_name [out] = buffer to receive new name.

Remarks: This will only work when ReadFile is being called by the Worksession/Attach command.

◆ PlugInType()

plugin_type CRhinoFileImportPlugIn::PlugInType ( ) const
inlineoverridevirtual

Description: Identifies the type of plug-in. Returns: Codes described above. Remarks: Rhino will attempt to cast the one and only plug-in derived object when loading a plug-in. If it does not cast correctly then the plug-in will not be allowed to load.

Implements CRhinoPlugIn.

◆ ReadFile()

virtual BOOL32 CRhinoFileImportPlugIn::ReadFile ( const wchar_t *  lpsFileName,
int  index,
CRhinoDoc doc,
const CRhinoFileReadOptions options 
)
pure virtual

Description: Rhino calls ReadFile() to create document geometry.

Parameters: const wchar_t* lpsFileName = Name of file to read int nFileTypeIndex = Index of file extension added to list in AddToFileType() callback. CRhinoDoc& doc = Empty document containing nothing but a Default layer. const CRhinoFileReadOptions& options = File read options

Remarks: The plug-in is responsible for opening lpsFile, reading it and creating document geometry.