Click or drag to resize
ExportTypeExtension Class
Base implementation of interface type ctExtensionInterfaceIExportType. Must implement at least GetParent. Override GetInterface2(ctExtensionInterface) in your extension and return your implementation of this interface when requested type is ctExtensionInterfaceIExportType. This enables your extension as new export profile type.
Inheritance Hierarchy
SystemObject
  CTExtensions.InterfacesExportTypeExtension

Namespace: CTExtensions.Interfaces
Assembly: CTInterface (in CTInterface.dll)
Syntax
public abstract class ExportTypeExtension : IExtensionInterface

The ExportTypeExtension type exposes the following members.

Methods
  NameDescription
Public methodAllowUseInSWPDM
Export Type Extensions need to specify whether or not they support running in SOLIDWORKS PDM context.
Public methodCreateExportProfileSettingsControl
Override majority of the settings page with your custom control.
Public methodDispose
Called when the settings page is closed. You may dispose everything.
Public methodExtraButtonClicked
Called when user clicks the [...] button next to profile type combo. The button is available for clicking only if GetSettingsViewOpts returns CTEngineLib.ctExportSettingsViewOpt.ctExportSettingsViewOptNone in its bitmask.
Public methodFieldChanging
Notification that user is about to edit given field.
Public methodFieldDeleting
Notification that user is about too delete given field.
Public methodGetParent
Must implement. Return parent CTExtension of this export extension.
Public methodGetSettingsViewOpts
Return arbitrary option flags for the settings page. See ctExportSettingsViewOpt for possible flags.
Public methodInit
Called when this extension is selected from the export type combo for the first time. Immediately after this TypeSelected is also called.
Public methodProfileOptionsComboString
Name that is shown in profile type combo. By default this is parents FriendlyName.
Public methodSave
Called when user clicks OK at export profile settings.
Public methodSupportsSilentExecution
Export extensions that support silent execution can be executed blindly on some host machine or on background. When executed silently, the export profile must not expect any user input. If you return true, your export extension MUST also subscribe to OnExportProfileSelected and execute silently when RequestSilentExport -flag is true. The add-in must also verify its silent export ability with VerifySilentExportSupport. If it's possible that the extension might fail to export in some cases, also OnQueryExportSuccess must be subscribed and handled in order to provide error information on silent export cases. Extensions ability to support silent execution is stored to export profile when the Export Profile is saved at the Profile Options so this must not be a dynamic ability of the extension. Silent export allows executing the export profile on separate host in PDM.
Public methodTypeDiscarded
Called when user had this export type selected, but then selected some other type. Return true to prevent user from changing to another type. This is mainly meant fot extensions to
Public methodTypeSelected
Notification that this type was just selected from profile type combo. If the selection happens for the first time during the setting dialogs lifetime, this call is preceeded with Init(CTExportProfile).
Top
Examples
Example extension that provides its own type selection at export profile settings and consumes all events during export procedure.
C#
// @AUTO-REFERENCE { [CT_INSTALL_PATH]\CTInterface.dll }
// @AUTO-REFERENCE { [CT_INSTALL_PATH]\Interop.CTEngineLib.dll }

using ATR.CT.CTInterface;
using CTExtensions;
using CTEngineLib;
using CTExtensions.Interfaces;

public class MyAddin : CTExtension
{

  private MyExportExtension moExpExt;

  public override bool Hook(CTInterface oCTInterface)
  {
    bool bHooked = false;
    if (oCTInterface != null)
    {
      // Hook to CTInterface events and set bHooked = true.
      // Since this extension returns customized ExportTypeExtension,
      // this implementation will consume all events during export procedure
      // if the export profile has this extension set as profile type.
    }
    return bHooked;
  }

  public override void UnHook(CTInterface oCTInterface)
  {
    if (oCTInterface != null)
    {
      // Un-Hook all handlers from CTInterface
    }
  }

  /// <summary>
  /// Return the custom interface on request.
  /// </summary>
  public override IExtensionInterface GetInterface(ctExtensionInterface eType)
  {
    if (eType == ctExtensionInterface.ctExtensionInterfaceIExportType)
    {
      if (moExpExt == null)
        moExpExt = new MyExportExtension(this);
      return moExpExt;
    }

    return null;
  }

  /// <summary>
  /// Create custom implementation for ExportTypeExtension.
  /// Minimal implementation needs only to return parent extension.
  /// </summary>
  class MyExportExtension : ExportTypeExtension
  {

    private MyAddin moParent;
    public MyExportExtension(MyAddin oParent)
    {
      moParent = oParent;
    }

    public override ICTExtension GetParent()
    {
      return moParent;
    }

  }

}
Availability

CUSTOMTOOLS 2017 SP1


See Also