Click or drag to resize

CTInterface Class

CTInterface exposes CUSTOMTOOLS' events for script add-ins.
Inheritance Hierarchy
SystemObject
  ATR.CT.CTInterfaceCTInterface

Namespace:  ATR.CT.CTInterface
Assembly:  CTInterface (in CTInterface.dll)
Syntax
public class CTInterface

The CTInterface type exposes the following members.

Properties
  NameDescription
Public propertyActiveDatabase
Currently active database of CUSTOMTOOLS.
Public propertySldWorksInstance
Currently running SOLIDWORKS instance (SldWorks).
Top
Methods
  NameDescription
Public methodAddErrorToExportList
Call this while Export command is active to add error to specific listview row. After adding all possible errors, call VerifyExportListContent.
Public methodClearExportListError
When the Export dialog box is shown call this to remove a specific error from given listview row.
Public methodStatic memberGetSWDocManager
Get licensed instance of SOLIDWORKS Document Manager. Instance is available only if CTInterface has been initialized by CUSTOMTOOLS.
Public methodGetXMLData
When OnSaveToStoragePre is invoked (during document save-operation), this function can be used to retrieve current CustomScope data in XML. Modified data can be sent back for CUSTOMTOOLS with SetXMLData using the same key.
Public methodSetXMLData
When OnSaveToStoragePre is invoked (during document save-operation), this function can be used to manipulate CustomScope data in XML. Data that CUSTOMTOOLS was about to store can be accessed with GetXMLData using the same key.
Public methodVerifyExportListContent
When the Export dialog box is shown call this to verify content of given listview in the Export dialog box. Verification rules defined to the currently selected Export Profile are executed and possible errors added by add-in scripts are considered. The export window status is updated per verification result.
Top
Events
  NameDescription
Public eventNotifyDialogAccess
Notifies when user opens and close defined CT dialog.
Public eventNotifyIdle
Notifies SW idle both pre CT handling and post CT handling Value determines whether this is pre-event (true) or post-event (false).
Public eventOnAddImportFile
Invoked at CUSTOMTOOLS Import for each individual file inserted to the list. Allows full control on what files are actually brought into the process. For instance it would be possible to unzip given file and add all unpacked files to the list via this event.
Public eventCode exampleOnAfterButtonFunction
Notification is sent after user has clicked a button representing a button function that is associated with a property in CUSTOMTOOLS Properties pane. Event is triggered when user has closed the dialog box associated with the button function.
Public eventOnAppExit
Notification that occurs when CUSTOMTOOLS is being unloaded. Can be used for instance to safely terminate asynchronous background tasks started by the script add-in.
Public eventCode exampleOnBatchOperationsCompleted
Notifies when all batch operations are completed. After this event, CUSTOMTOOLS shows possible conversion errors for the user and closes all documents that were opened during the process by the conversion engine. In case your add-in collected converted documents for collective post-processing, now would be good time to post-process them.
Public eventCode exampleOnBatchOperationsLaunched
Notifies when Batch Opearations have been launched. Not invoked for serialization run i.e. when the document processing happens later as a task. Useful to set up e.g. conversion document collection for upcoming OnPostFileConversion -events.
Public eventCode exampleOnBatchOperationTemplatePreLoad
Allows dynamic changes for Batch Operation Templates, and to attach a tag after the Template name. Note that if you are applying dynamic changes, user might save those changes to the object. Tag is useful to indicate for user that an add-in is attached for handling specific template(s). Othwise this event is very useful for pre-mapping Template IDs for possible OnBatchOperationsLaunched and OnBatchOperationsCompleted events.
Public eventOnBatchProcessPreCreateFlatView
Invoked just before conversion engine creates a flat view from a single body model to a drawing. Allows manipulating both the drawing and the model, and to force using named view instead of system generated FlatPattern -view. Not that this event is not invoked for multibody parts as using custom view for them is not possible.
Public eventOnBeforeMergeDocuments
Invoked just before a merge operation combines collected documents. Allows manipulating which files to merge and in which order.
Public eventOnChangeCustomProperty
Post-notifies when a customer property has been changed.
Public eventOnCloseCustomStructureDlg
Notification that occurs when user exits CUSTOMTOOLS Export window.
Public eventOnCustomCopyPreSavePropertyValue
Invoked at CUSTOMTOOLS Copy during the copy process, before the dirty properties are written. Allows manipulating values of dirty properties.
Public eventOnCustomCopyResolveInitialConfiguration
Invoked during CUSTOMTOOLS Copy process for all individual files when Configuration option at Properties is set to Property Specific. Allows setting configuration option per file.
Public eventOnCustomListGetColumns
A column query send for Search Groups which source is Custom.
Public eventCode exampleOnCustomListUpdate
Invoked for each Custom-type lookuplist at CUSTOMTOOLS start up and when 'Run' is clicked at Options for the Custom-type lookuplist in question. Allows full control over the lookuplist content.
Public eventOnCustomPropertiesFinished
Invoked after user exits CUSTOMTOOLS Properties with Ok/Apply and all related processes have completed.
Public eventOnCustomPropertiesLoaded
Invoked when CUSTOMTOOLS Properties are loaded.
Public eventOnCustomPropertiesLoading
Invoked when CUSTOMTOOLS Properties are loading.
Public eventOnCustomPropertyChanged
Invoked at CUSTOMTOOLS Properties when a value of a property that has Allow Scripting -option set changes. Allows manipulating all property values in context that have Allow Scripting -option set.
Public eventOnDeserializeSecondPhase
"Entry point" of the second execution phase. When the export is executed "On-Client" at PDM, the add-in may request a second execution phase by setting Handled to TRUE at OnSerializeForSecondPhase. If so, then when this event is invoked, the whole execution environment is already initialized for a completely new context and SerializationData contains everything that was stored there at OnSerializeForSecondPhase during the first phase. The second phase must be completely silent and require no user iteraction. Use CreateLogger to log information about the process. Set Handled to false if your deserialization fails or otherwise there is a fatal error that requires cancelling the process. The second execution phase is invoked for new instance at SOLIDWORKS context and in case the export profile defined any conversion rules and they were not cancelled at OnQueryExportSuccess during first phase, OnPreBatchProcessFile will be invoked for each individual conversion rule and document as if the export was originally executed in SOLIDWORKS context.
Public eventOnDimensionButtonClick
Invoked when button used to clear dimension property value in Properties is clicked. It's possible to override default functionality.
Public eventOnExecuteSearchGroupSearch
Invoked for Search Group searches that are defined to use Custom Handler. Allows full control over the returned Search Group data.
Public eventOnExportProfileSelected
Notification that is sent after user selects Export profile in the CUSTOMTOOLS Export dialog box. This notification is sent also when the Export dialog is opened and the last used Export profile is selected automatically.
Public eventOnFileSavePre
Invoked when a SOLIDWORKS document is being saved.
Public eventOnFinalizeSecondPhase
Finalize second execution phase. When the export is executed "On-Client" at PDM, the add-in may request a second execution phase by setting Handled to TRUE at OnSerializeForSecondPhase. If so, OnSerializeForSecondPhase is invoked for current add-in allowing to prepare for consequent OnPreBatchProcessFile -events by deserializing from SerializationData. This event is invoked after all conversions are done and same original SerializationData also is available during this event. If a logger was created at OnDeserializeSecondPhase, then use that for logging. Otherwise use CreateLogger to create one and log information about the process. Handled determines whether or not all conversions were succesfull. OnQueryExportSuccess will be invoked as event for second phase.
Public eventOnGetCustomImportRule
Invoked at CUSTOMTOOLS Import for each file right after they are added to the list. Allows showing custom columns, setting special import options, displaying different string than filename and disabling the row from process.
Public eventOnGetImportFiletypeFilters
Invoked at CUSTOMTOOLS Import when user adds file/files to the list. Allows adding new file name/extension filters to the file selection dialog.
Public eventOnImportFile
Notification triggered before importing a file.
Public eventOnImportFilePost
Invoked at CUSTOMTOOLS Import for each individual file right after one's import process is complete.
Public eventOnImportFilePre
Invoked at CUSTOMTOOLS Import for each file defined in OnGetCustomImportRule before the normal import procedure takes place.
Public eventOnImportFinished
Notification the is send then CUSTOMTOOLS Import procedure has finished.
Public eventOnItemDeletePre
Invoked when a feature is deleted from model's feature tree.
Public eventOnListViewExportRowRightClick
Invoked at CUSTOMTOOLS Export when user right clicks a row. Allows appending menu items which click events can be handled at OnPopupMenuChosen.
Public eventOnLookupListFill
Invoked when CUSTOMTOOLS fills up Lookuplist items for Hierarchical Combo. With this event it's possible to use value/key as saved value while displaying a different corresponding value/key in the GUI.
Public eventOnModelDocLoaded
Invoked when a SOLIDWORKS document has been loaded.
Public eventOnOptionsClosedNotify
Notifies when user exits CUSTOMTOOLS Options with OK. Invoked only when Options is accessed via SOLIDWORKS, and NOT from CUSTOMTOOLS Administration.
Public eventOnPopupMenuChosen
Invoked at CUSTOMTOOLS Export when user has right clicked a row and then selected popped up menu item defined at OnListViewExportRowRightClick.
Public eventCode exampleOnPostFileConversion
Invoked after CUSTOMTOOLS has performed file conversion.
Public eventOnPreBatchProcessFile
Invoked before CUSTOMTOOLS starts to perform file conversion.
Public eventOnPreFileConversion
Invoked before CUSTOMTOOLS performs file conversion task.
Public eventOnPreFillCopyFileTargets
Invoked at CUSTOMTOOLS Copy when filenames are generated. Allows manipulating target filenames, target project per file and check state of the row.
Public eventOnPrepareConversionEngine
This event is invoked once for every selected Batch File Conversion rule during a single Batch Operation Process. It allows modifying internal conversion engine settings as well as dynamically changing settings of the rule it self before they get processed by the engine.
Public eventOnPropertiesVisibilityOverride
Invoked when CUSTOMTOOLS Properties is first initialized and shown for a document. Allows changing visibility and selected value/option of special controls.
Public eventOnPropertyCustomDefinition
Invoked at CUSTOMTOOLS Options when user click Custom Definition button [...] at property's Advanced Options -page. Invoked only when Options is accessed via SOLIDWORKS, and NOT from CUSTOMTOOLS Administration.
Public eventOnQueryCancelExportConversions
Invoked at CUSTOMTOOLS Export before possible conversions are performed for each row in internal export data structure. Allows cancelling conversions before need for them is even validated.
Public eventOnQueryExportSuccess
If the export was ran silently, it's success status will be queried with this event. Success is assumed. This is also invoked for the second phase of the export process in case such phase was requested at OnSerializeForSecondPhase.
Public eventOnRebuildTaskBeforeOpen
Invoked for all documents separately during Rebuild -task. Allows cancelling the Rebuild of a file before its opened, or to otherwise prepare on it being opened and Rebuild.
Public eventOnRebuildTaskPostRebuild
Invoked for all documents separately during Rebuild -task after rebuild of the file. Carries success information of both rebuild procedure as well as file save procedure. Allows also setting a custom error message.
Public eventOnRebuildTaskPreRebuild
Invoked for all documents separately during Rebuild -task after the file is already opened and now about to be rebuild. Allows requesting save for the file after the operation even if the rebuild would fail.
Public eventOnRequestScriptButton
Invoked at CUSTOMTOOLS startup. Allows one script add-in to set up an extra button to CUSTOMTOOLS menu. Availability of the button is queried with OnRequestScriptButtonEnable and it's click event at OnScriptButtonClicked.
Public eventOnRequestScriptButtonEnable
Invoked multiple times at various cases. Allows setting availablity of the script button defined with OnRequestScriptButton.
Public eventCode exampleOnSavePost
Invoked after a SOLIDWORKS document has been saved.
Public eventOnSaveToStoragePost
Invoked after 3rdPartyData is saved to the model.
Public eventOnSaveToStoragePre
Invoked before 3rdPartyData is saved to the model. Use GetXMLData(String) and SetXMLData(String, String) to manipulate save content.
Public eventOnScriptButtonClicked
Notification that is send when user has clicked the script button defined with OnRequestScriptButton.
Public eventOnSerializeForSecondPhase
When the export is executed "On-Client" at PDM, the add-in may request a second execution phase by setting Handled to TRUE. Also any data can be stored to SerializationData for later retrieval at OnDeserializeSecondPhase and OnFinalizeSecondPhase. The second execution phase is invoked for new instance at SOLIDWORKS context and in case the export profile defined any conversion rules and they were not cancelled in OnQueryExportSuccess, OnPreBatchProcessFile will be invoked for each individual conversion rule and document as if the export was originally executed in SOLIDWORKS context. OnFinalizeSecondPhase will be called when all conversions are done. CreateLogger returns null for this event.
Public eventOnStrExport
Invoked at CUSTOMTOOLS Export when the xml data is ready but before it's saved as a file.
Public eventOnStrExportAddRow
Invoked at CUSTOMTOOLS Export for each row when the list is getting filled. Allows filling/changing column values.
Public eventOnStrExportFillColumns
Invoked at CUSTOMTOOLS Export before model structure is filled to the view. Allows hiding/adding of columns in the view.
Public eventOnStrExportFillListPost
Invoked at CUSTOMTOOLS Export after the model structure and values are filled into the Export view. Allows setting errors for rows.
Public eventOnStrExportFillListPre
Invoked at CUSTOMTOOLS Export before model structure is filled to the view. Allows manipulating the structure before it's shown.
Public eventOnStrExportPost
Invoked at CUSTOMTOOLS Export when the export procedure has finished and the xml data is saved as a file.
Public eventOnStrExportPre
Notification that occurs at CUSTOMTOOLS Export when user clicks export but before actual procedure is ran.
Public eventOnStrExportVerifyField
Invoked at CUSTOMTOOLS Export for each row and each field in the view. Allows checking the field value and setting an error message that prevents user for performing the export.
Public eventOnValidateCustomProperties
Invoked at CUSTOMTOOLS Properties when user clicks Ok/Apply and at least one property has Allow Scripting -option set. Allows manipulating property values, preventing exiting of Properties and displaying an error/warning message.
Top
See Also