Baixe o app para aproveitar ainda mais
Prévia do material em texto
CimatronE SDK CimatronE 10.0 User Guide CimatronE 10.0 CimatronE SDK User Guide ⎪i Table of Contents CimatronE SDK..............................................................................................................................1 CimatronE SDK ..........................................................................................................................1 Starting a Visual Basic Application with the CimatronE API ......................................................1 To start using API in your Visual Basic application you have to: .....................................2 Starting a C++ Application with the CimatronE API ...................................................................2 To start using API in your C++ application you have to:..................................................3 CimatronE API............................................................................................................................4 CimatronE API Chart........................................................................................................4 Object Containers ............................................................................................................5 DI..................................................................................................................................129 NC ................................................................................................................................131 Tools, Commands and Interaction ...............................................................................133 Procedures ...................................................................................................................200 Sketcher and Sketcher Objects....................................................................................771 Topological Objects......................................................................................................809 Geometrical Information...............................................................................................854 Filters............................................................................................................................967 Attributes ......................................................................................................................992 CimatronE API Enums .................................................................................................996 Examples....................................................................................................................1037 CimESuite API......................................................................................................................1037 CimatronE CimESuite API .........................................................................................1037 CimSuite.....................................................................................................................1038 CimSuiteAssy.............................................................................................................1039 CimSuiteCommands ..................................................................................................1042 CimSuiteDI .................................................................................................................1044 CimSuiteDM ...............................................................................................................1045 CimSuiteGeneral ........................................................................................................1053 CimSuiteGeomData ...................................................................................................1059 CimSuiteMath.............................................................................................................1076 CimSuiteNC................................................................................................................1081 CimSuitePickTool .......................................................................................................1081 CimSuiteReferences ..................................................................................................1086 CimSuiteSketcher ......................................................................................................1092 CimSuiteSolid.............................................................................................................1103 CimSuiteSurface ........................................................................................................1118 CimSuiteTransform ....................................................................................................1126 CimSuiteWireFrame...................................................................................................1130 CimSuite API Enums..................................................................................................1139 CimatronE 10.0 CimatronE SDK User Guide ⎪ii Examples....................................................................................................................1158 Index .........................................................................................................................................1173 CimatronE 10.0 CimatronE SDK User Guide ⎪1 CimatronE SDK CimatronE SDK The CimatronE SDK (Software Development Kit) consists of the CimatronE API (Application Programming Interface) which shows the capabilities of CimatronE and enables you to write external (out-of-process, *.exe) and internal (in-process, *.dll) user- programmable applications. This is a COM based API that provides you the means to write your own applications that interact with CimatronE. User applications can be written in any COM supported language such as Visual C++, Visual Basic, Delphi etc. or scripting languages such as Visual Basic Script or JavaScript. The CimatronE API provides the ability for: • Document management (Pdm ); • Creating a sketch (MdSketcher , Sketcher ); • Creating modeling features (extrude, revolve and other procedures); • Assembly features (Add, Connect and other procedures); • Editing features; • Entity retrieval with filters; • Creating sets of entities; • Attaching and reading entities attributes; • Executing CimatronE commands (PoolCommands); • Creating external commands; • Tool interaction (Tool); • Picking an entity functionality that allows you to make a selection in interactive mode (PickTool, Arrow figure); • Generating a linear model (getting triangulation data, ILmGenerator); • CimatronE standard GUI (Feature Guide, Guidebar, SP-Figure). Starting a Visual Basic Application with the CimatronE API As CimatronE API uses the COM based approach, to start working with it in a Visual Basic application, you need to add references to all type libraries you going to use. CimatronE API uses the hierarchical object model. This means that if an object stays at the top of the hierarchy, other objects are derived from it. These kinds of objects are the Application objects of CimatronE API. To get an Application object of a running active CimatronE application, use the AppAccess object. Its interface (IAppAccess) allows you to connect to a running active CimatronE application by returning a pointer to the IApplication interface of the Application object. CimatronE 10.0 CimatronE SDK User Guide ⎪2 If there is no running CimatronE application or you want to start a new one, you have to create an instance of the Application object and receive a pointer to the IApplication interface. Once you have a pointer to the IApplication interface, you can start to execute a task of your user application. There is no any special requirement for the type of project you can create in MS Visual Basic. To start using API in your Visual Basic application you have to: • Createreferences to CimatronE API type libraries by opening menu Project -> References and selecting all type libraries you are going to use. It is recomended to attach all CimatronE API type libraries: CimAppAccess.tlb, CimatronE.tlb, CimBaseAPI.tlb, CimMdlrAPI.tlb, CimServicesAPI.tlb. • After referencing the type libraries you have definitions of all API interfaces. Next step is to get an IApplication interface. Dim gAppAccess As New AppAccess 'Define an AppAccess object to get running active application Dim gApp As Application 'Define an Application object Set gApp = gAppAccess.GetApplication 'Getting running active application If gApp Is Nothing Then 'There is no running CimatronE Application Set gApp = New Application 'Creating new instance of CimatronE application End If • Now you are ready to use the power of CimatronE API. Starting a C++ Application with the CimatronE API As CimatronE API uses the COM based approach, there are several ways to start working with it. One of the most convenient ways is to use the #import directive in Visual C++. All examples in the help documentation use this approach to work with API. The compiler directive #import generates a _com_ptr_t template class for each interface. An object of this class encapsulates a COM interface pointer and is called a "smart" pointer. This template class manages resource allocation and deallocation, via function calls to the IUnknown member functions and automates the required calls to the AddRef, Release, and QueryInterface functions. Using this approach simplifies the work with COM objects and error checking. If an error occurs, the system generates a _com_error object that represents an exception condition CimatronE 10.0 CimatronE SDK User Guide ⎪3 and contains all information provided by the COM object about the error, the HRESULT error code and any associated IErrorInfo object. For more information about Compiler COM Support Classes, please see the MSDN documentation. CimatronE API uses the hierarchical object model. This means that if an object stays at the top of the hierarchy, other objects are derived from it. These kinds of objects are the Application objects of CimatronE API. To get an Application object of a running active CimatronE application, use the AppAccess object. This object is created by calling the CoCreateInstance method in a user application. Its interface (IAppAccess) allows you to connect to a running active CimatronE application by returning a pointer to the IApplication interface of the Application object. If there is no running CimatronE application or you want to start a new one, you have to create an instance of the Application object by calling the CoCreateInstance method in a user application and receive a pointer to the IApplication interface. Once you have a pointer to the IApplication interface, you can start to execute a task of your user application. There is no any special requirement for the type of project you can create in Visual C++. To start using API in your C++ application you have to: • Import the necessary type libraries using the #import directive. An alternative way is to use the CimAPIinc.h header file. This file is coded so that it excludes any redefinitions of interfaces that occur in other CimatronE API type libraries. This file creates the CimAPI namespace that encapsulates all CimatronE API interfaces. • After importing the type libraries you have definitions of all API interfaces. The next step is to get an IApplication interface. CimAPI::IApplicationPtr gCimApp = NULL; //CimatronE Application CimAPI::IAppAccessPtr aAppAccess; //An application access helper object CoInitialize( NULL ); aAppAccess.CreateInstance( __uuidof( CimAPI::AppAccess ), NULL, CLSCTX_ALL ); if(aAppAccess == NULL) { AfxMessageBox("Unable to create AppAccess object"); exit(1); } gCimApp = aAppAccess->GetApplication( ); if( gCimApp == NULL ) { CimatronE 10.0 CimatronE SDK User Guide ⎪4 gCimApp.CreateInstance( __uuidof( CimAPI::Application ), NULL, CLSCTX_ALL ); //Creating new instance of CimatronE Application object } • Now you are ready to use the power of CimatronE API. CimatronE API CimatronE API Chart CimatronE 10.0 CimatronE SDK User Guide ⎪5 Object Containers Object Containers CimatronE 10.0 CimatronE SDK User Guide ⎪6 CimatronE 10.0 CimatronE SDK User Guide ⎪7 Application CimatronE Application AppAccess AppAccess IAppAccess IAppAccess This interface allows you to access the current active running CimatronE application. Properties None Methods IUnknown GetApplication ( ) IAppAccess::GetApplication Description This method allows you to access the current active running CimatronE application. Syntax Application = GetApplication( ); Return: (IUnknown) ApplicationCurrent running active CimatronE application. Application Application CimatronE 10.0 CimatronE SDK User Guide ⎪8 IApplication IApplication This interface allows you to access CimatronE. Properties None Methods IPoolCommands GetPoolCommands ( ); IDocument GetActiveDoc ( ); IPdm GetPdm ( ); SetActiveDocument ( IDocument ); IAttributeFactory GetAttributeFactory ( ); IDI GetDI ( ) ICimLicense GetLicense ( ) SetRestriction ( RestrictionEnumType, Boolean ) IApplication::SetRestriction Description This method allows you to block operations and functionality in CimatronE such as Executing Commands, Closing views, receiving Mouse & Keyboard events, etc Syntax SetActiveDocument ( Type, Status ); Input: (RestrictionEnumType) TypeSet type of restriction. Input: (Boolean) Status Set restriction status TRUE - Enable restriction. Remarks IApplication::GetLicense Description This method allows you to get a reference to the license manager. Syntax Lic = GetLicense ( ); Return: (ICimLicense) Lic Reference to license manager. IApplication::GetDI Description This method allows you to get a reference to the DI (Data Interface) manager. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪9 DI = GetDI ( ); Return: (IDI) DI Reference to DI manager. IApplication::GetActiveDoc Description This method allows you to get the current active file in CimatronE. Syntax Document = GetActiveDoc( ); Return: (IDocument) Document Current active file in CimatronE. IApplication::GetAttributeFactory Description This method allows you to get the reference to the interface that is responsible for the entity's attribute creation. Syntax AttributeFactory = GetAttributeFactory( ); Return: (IAttributeFactory) AttributeFactory A reference to the attribute creation interface. IApplication::GetPdm Description This method allows you to get a reference to the PDM manager. Syntax Pdm = GetPdm( ); Return: (IPdm) Pdm Reference to PDM manager. IApplication::GetPoolCommands Description This method allows you to get a reference to the IPoolCommands interface. Syntax PoolCommands = GetPoolCommands( ); Return: (IPoolCommands) PoolCommands Reference to IPoolCommands interface. IApplication::SetActiveDocument Description This method allows you to set one of the open files as an active file. Syntax SetActiveDocument( Document ); CimatronE 10.0 CimatronE SDK User Guide ⎪10 Input: (IDocument) Document Reference to file to be set as active. ICimLicense CimLicense This interface allows you to use the CimatronE License Manager. Properties None Methods Boolean GrabModule ( String ); Long GetLicenseLastError ( Boolean ); GetIDs ( String, String, String, String ); Boolean CheckModule ( String ); Boolean ReleaseModule ( String ); ICimLicense::GrabModule Description This method allows you to grab a license module in CimatronE. Syntax Status = GrabModule ( ModuleName ); Input: (String) ModuleName Set the module name to be grabbed. Return: (Boolean)Status Get the License status of the selected module name TRUE = There is a license for selected module. Remarks 1. If FALSE you can call the method GetLicenseLastError, this will show the error dialog with a short description of the problem. 2. The grabbed license will be automatically released: • when there is no file open in CimatronE. • when CimatronE is closed. ICimLicense::GetLicenseLastError Description This method allows you to get a license error number/message. Syntax ErrNum = CheckModule ( ShowMessage ); Input: (Boolean) ShowMessage TRUE - show a license error message box FALSE - Don't show a license error message box Return: (Long) ErrNum Get the error number. Remarks CimatronE 10.0 CimatronE SDK User Guide ⎪11 Use this option in cases where CheckModule or GrabModule methods return FALSE. ICimLicense::GetIDs Description This method allows you to get hardware IDs. Syntax GetIDs ( HaspID, OldHaspID, EthernetID, DiskSerNum ); Output: (String) HaspID Hasp ID (8-12 digits) Output: (String) OldHaspID Old Hasp ID (4 digits) Output: (String) EthernetID Ethernet ID (12 digits) Output: (String) DiskSerNumDisk Serial Number (8 digits) Remarks ICimLicense::CheckModule Description This method allows you to check the license status for each module in CimatronE. Syntax Status = CheckModule ( ModuleName ); Input: (String) ModuleName Set the module name to be checked. Return: (Boolean) Status Get the License status of the selected module name TRUE = There is a license for selected module. Remarks If FALSE, you can call the method GetLicenseLastError, this will show the error dialog with a short description of the problem. ICimLicense::ReleaseModule Description This method releases the currently grabbed license module in CimatronE. Syntax Status = ReleaseModule ( ModuleName ); Input: (String) ModuleName Set the module name to be released. Return: (Boolean) Status Get the License status of the selected module name TRUE = There is a license for selected module. Remarks 1. If FALSE you can call the method GetLicenseLastError, this will show the error dialog with a short description of the problem. 2. The grabbed license will be automatically released: CimatronE 10.0 CimatronE SDK User Guide ⎪12 • when there is no file open in CimatronE. • when CimatronE is closed. Data Management Data Management Pdm PDM IPdm IPdm Example This interface allows you to manage files in CimatronE. Properties Get Query (String, DocumentEnumType, DocumentEnumUnit ) Variant Methods CloseModel (IModel ) IDocument CreateDocument ( String, DocumentEnumType, DocumentEnumUnit ) CreateFolder ( String ) CreateLocation ( String ) IModel CreateModel ( String, DocumentEnumType, DocumentEnumUnit ) DeleteDocument ( String ) DeleteFolder ( String ) DeleteLocation ( String ) IDocument GetDocumentByPath ( String ) CimatronE 10.0 CimatronE SDK User Guide ⎪13 Variant GetListOfDocuments ( String ) String GetLocationRealPath ( String ) IModel GetModel ( String ) Variant GetOpenDocuments ( ) Variant GetRelatedDocuments ( String ) IDocument OpenDocFromBrowser ( ) IDocument OpenDocument ( String ) OpenDocumentAsync ( String ) RenameDocument ( String, String ) RetriveDocAttribute ( String, Variant, String ) RetriveLinkAttribute ( String, String, Variant, String ) SaveModel (IModel ) String SelectFromBrowser ( ) Variant SelectMultiFromBrowser ( ) UpdateDocAttribute ( String, Variant, String, AccessMode ) UpdateLinkAttribute ( String, String, Variant, String, AccessMode ) IPdm::CloseModel Description This method allows you to close a file that contains a given model. Syntax CloseModel( Model ); Input: (IModel) Model The model to close. IPdm::CreateDocument Description This method allows you to create a new file. Syntax Document = CreateDocument( DocumentPath, DocumentType, DocumentUnit ); Input: (String) DocumentPath Path and name of new file. Input: (DocumentEnumType) DocumentType Type of new file. Input: (DocumentEnumUnit) DocumentUnit New file units. Return: (IDocument) Document Created file. CimatronE 10.0 CimatronE SDK User Guide ⎪14 Note A path to a new file is the same string as in the CimatronE Browser. For example \ Documents\Location\Folder\DocumentToCreate. If the path is not supplied, then a file will be created and when you close it you will get the CimatronE Browser dialog to select the path. If a file already exists with the same name as the new file, you will get its name, an underscore and an ordinal number. For example, if the file name "Test" already exists, then the file will be saved as "Test#1". IPdm::CreateFolder Description This method allows you to create a new folder. Syntax CreateFolder( FolderPath ); Input: (String) FolderPath The path to created folder. For example \Documents\LocationName\[SubFolders]\FolderToCreate . IPdm::CreateLocation Description This method allows you to create a new location. Syntax CreateLocation( LocationName, LocationRealPath ); Input: (String) LocationName The name of a new location. Input: (String) LocationRealPath The physical path on storage device for a new location. Example IPdm.CreateLocation( "NewLocation", "C:\NewLocationRealPath" ); IPdm::CreateModel Description This method allows you to create a new file and get its model without opening. Syntax Model = CreateModel( DocumentPath, DocumentType, DocumentUnit ); CimatronE 10.0 CimatronE SDK User Guide ⎪15 Input: (String) DocumentPath Path and name of new file. Input: (DocumentEnumType) DocumentType Type of new file. Input: (DocumentEnumUnit) DocumentUnit New file units. Return: (IModel) Model Model of created file. Note A path to a new file is the same string as in the CimatronE Browser. For example \ Documents\Location\Folder\DocumentToCreate. If the path is not supplied, then a file will be created and when you close it you will get the CimatronE Browser dialog to select the path. If a file already exists with the same name as the new file, you will get its name, an underscore and an ordinal number. For example, if the file name "Test" already exists, then the file will be saved as "Test_1". IPdm::DeleteDocument Description This method allows you to delete a file specified by name and path. Syntax DeleteDocument( DocumentPath ); Input: (String) DocumentPathPath and name of file to delete. Note The path has the same look as in IPdm::CreateDocument. IPdm::DeleteFolder Description This method allows you to delete a folder. Syntax DeleteFolder( FolderPath ); Input: (String) FolderPath Path to folder. For example \Documents\LocationName\[SubFolders]\FolderToDelete. IPdm::DeleteLocation Description This method allows you to delete an existing location. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪16 DeleteLocation( LocationPath ); Input: (String) LocationPath The path to location. For example \Documents\LocationToDelete IPdm::GetDocumentByPath Description This method allows you to get a File Interface of an open file by it's full path. Syntax Document= GetDocumentByPath( iPath); Input: (String) iPath Path to file. For example \Files\Location\Folder\File. Return: (IDocument) Document The interface of the relevant opened file. IPdm::GetListOfDocuments Description This method allows you to get files from a given location/folder. Syntax ListOfDocuments = GetListOfDocuments( FolderPath ); Input: (String) FolderPath Path to location/folder from which to get a list of included files. For example \Documents\LocationName\[SubFolders]\Folder. Return: (Variant) ListOfDocuments Variant type array each element of which contain two dimensioned string type array of files under current location/folder. Note In stringarray the first element is a name of file type, for example "Drafting", "Modeler", "Assembly", "NC", and the second is a name of file. IPdm::GetLocationRealPath Description This method allows you to get the path on a disk for a selected location. Syntax DiskPath = GetLocationRealPath( LocationPath ); Input: (String) LocationPath Path to location. For example \Documents\LocationName. CimatronE 10.0 CimatronE SDK User Guide ⎪17 Return: (String) DiskPath The physical path on storage device where the files are saved. IPdm::GetModel Description This method allows you to get a model of file. Syntax Model = GetModel( DocumentPath ); Input: (String) DocumentPath Path to file. For example \Documents\Location\Folder\Document. Return: (IModel) Model The model of the file. IPdm::GetOpenDocuments Description This method allows you to get a list of the names of all open files. Syntax DocumentsList = GetOpenDocuments ( ); Return: (Variant) DocumentsList Variant array that includes the name of all open files. Note IPdm::GetRelatedDocuments Description This method allows you to get related files from compound types of files, for example Assembly or Drawing. Syntax RelatedDocuments = GetRelatedDocuments ( DocumentPath ); Input: (String) DocumentPath Path to file. For example \Documents\Location\Folder\Document. The file must be Assembly or Drawing. Return: (Variant) RelatedDocuments Variant type array each element of which contain two dimensioned string type array of files related to selected one. Note In a string array the first element is the name of a file type, for example "Drafting", "Modeler", "Assembly", "NC", and the second the name of a file. IPdm::OpenDocFromBrowser CimatronE 10.0 CimatronE SDK User Guide ⎪18 Description This method displays the CimatronE Explorer and allows you to open a file selected from it. Syntax Document = OpenDocFromBrowser( ); Input: (IDocument) Document An opened file. IPdm::OpenDocument Description This method allows you to open a file by specifying by its path and name. Syntax Document = OpenDocument( PathToDocument ); Input: (String) PathToDocument Path and name of file. For example \Documents\LocationName\[SubFolders]\Folder\Document. Return: (IDocument) Document Opened file. IPdm::OpenDocumentAsync Description This method allows you to open a file by specifying by its path and name. The file opens without waiting for confirmation that the file is open. Syntax Document = OpenDocumentAsync( iDocPath ); Input: (String) iDocPath Path and name of file. For example \Documents\LocationName\[SubFolders]\Folder\Document. IPdm::Query Description This property allows you to check if a file specified by its name, type and measure units exists. Syntax Property get: Status = Query( DocumentName, Type, Path ); CimatronE 10.0 CimatronE SDK User Guide ⎪19 Input: (String) DocumentName Document name to check for existence. Input: (DocumentEnumType) Type Document type to check for existence. Input: (String) Path Path to folder in which to check for file existent. If you want to look in all folders pass an empty string. Return: (Variant) Status Variant that contains string type one dimensional array with pathes to folders in which the file with specified parameters exist. Note The parameter Unit temporary does not take affect so you get TRUE result if found file with given DocumentName and Type. IPdm::RenameDocument Description This method allows you to rename a file. Syntax RenameDocument( DocumentPathOld, DocumentPathNew ); Input: (String) DocumentPathOld Path and name of old file. Input: (String) DocumentPathNew Path and name of new file. Possible to set only new name. IPdm::RetriveDocAttribute Description This method allows you to retrieve file attributes from a given file. Syntax RetriveDocAttribute( DocumentPath, DocumentAttributes, Owner ); Input: (String) DocumentPath Path and name of file from which to retrieve attributes. Input/Output: (Variant) DocumentAttributes Array of retrieved attributes. Input: (String) Owner Owner of file. Note It is possible to retrieve only some of the existing file attributes. To do this, fill in the DocumentAttributes argument with file attributes you want to get before calling the property. CimatronE 10.0 CimatronE SDK User Guide ⎪20 The parameter Owner temporary does not take affect. Set its value to "guest". IPdm::RetriveLinkAttribute Description This method allows you to retrieve link attributes from a given link defined by the path to the inclusive file and the path to the included file. Syntax RetriveLinkAttribute( InclusiveDocPath, IncludedDocPath, DocumentAttributes, Owner ); Input: (String) InclusiveDocPath Path and name of file that contains a link from which to retrieve attributes. Input: (String) IncludedDocPath Path and name of linked file. Input: (Variant) DocumentAttributes Array of retrived attributes. Input: (String) Owner Owner of file. Note If an inclusive file contains an included file more than once, only one link is created for this file. The parameter Owner temporary does not take affect. Set its value to "guest". IPdm::SaveModel Description This method allows you to save a file that contains a given model. Syntax SaveModel( Model ); Input: (IModel) Model The model of a file to save. IPdm::SelectFromBrowser Description This method allows you to get the file path name selected from the CimatronE Explorer. Syntax DocPathName= SelectFromBrowser ( ); Return: (String) DocPathName Return the name of the file selected from the CimatronE Explorer. Remarks If one of the file names appears without a path, the file hasn't been saved yet. CimatronE 10.0 CimatronE SDK User Guide ⎪21 IPdm::SelectMultiFromBrowser Description This method allows you to get the multiple file path names selected from the CimatronE Explorer. Syntax oPaths= SelectMultiFromBrowser ( ); Return: (Variant) oPaths A list containing the names of the files selected from the CimatronE Explorer. Remarks If one of the file names appears without a path, the file hasn't been saved yet. IPdm::UpdateDocAttribute Description This method allows you to add a new attribute to a file or change data in an existing attribute. Syntax UpdateDocAttribute( DocumentPath, DocumentAttributes, Owner, AccessMode ); Input: (String) DocumentPath Path and name of file in which to update attributes. Input: (Variant) DocumentAttributes Array of attributes to be updated or inserted. Input: (String) Owner Owner of file. Input: (AccessMode) AccessMode Mode in which to make update. Note If there are attributes in a file with the same names as in a called method, these attribute value will be changed with the new one. Additional new attributes will be attached to the file. The parameter Owner temporary does not take affect. Set its value to "guest". The parameter AccessMode temporary does not take affect. IPdm::UpdateLinkAttribute Description This method allows you to add a new attribute to a link of files or change data in an existing attribute. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪22 UpdateLinkAttribute( InclusiveDocPath, IncludedDocPath, DocumentAttributes, Owner, AccessMode ); Input: (String) InclusiveDocPath Path and name of file that contains a link from which to retrieve attributes. Input: (String) IncludedDocPath Path and name of linked file. Input: (Variant) DocumentAttributes Array of attributes to be updated or inserted. Input: (String) Owner Owner of file. Input: (AccessMode) AccessMode Mode in which to make update. Note If there are attributes in a link of files with the same names as in a called method, these attribute values will be changedwith the new ones. Additional new attributes will be attached to a link of files. Temporary doesn't work. PDMHooks PDMHooks IPdmHooks IPdmHooks This interface allows you to receive notification about, and override the default processing of, data management events that occur in CimatronE. The CLSID of the corresponding COM component will be registered (by you) in the system registry. The component will be invoked upon launching CimatronE. When an event occurs the application will call appropriate interface methods from the component. The registry entry of the COM component: HKEY_LOCAL_MACHINE/Cimatron/Cimatron E/<Ver>/Hooks_Class = <CLSID>. (where "<Ver>" is the appropriate CimatronE version number). The Interface Before and After processing CimatronE 10.0 CimatronE SDK User Guide ⎪23 Two methods are added to the interface for each event. Before These events are invoked when the event is about to be triggered. This makes it possible to substitute user-defined processing for default processing of the event or cancel the processing. The method returns the user's choice, which can be one of the following: Processed - the user processes the event; Cancel - the user cancels the event's processing; Continue - the user passes the control to CimatronE; the default processing of the event will be performed. After These events are invoked after the event has been processed. This method passes the user the result of the event's processing, which can be one of the following: Cancelled - the event's processing is cancelled; Processed - the event is processed; Succeeded - the event is processed successfully; Failed - the event is processed and has resulted in failure. Events Identification A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Restrictions For some operations you are not allowed to cancel the operations and/or override their default processing. Two events, Open and Close Application, have only one method in the interface, an After method for Open Application and a Before method for Close Application. Possible restrictions are mentioned in the relevant events. Properties None Methods AfterActiveDocument ( Object, Variant, Long, String ) AfterCloseDocument ( Object, Variant, Long, String ) AfterGetAccess ( Object, Variant, Long, DmOperResult, String, AccessStatus ) CimatronE 10.0 CimatronE SDK User Guide ⎪24 AfterGetLockInfo ( Object, Variant, Long, String, String ) AfterNewDocument ( Object, Variant, Long, String ) AfterOpenDocument ( Object, Variant, Long, String ) AfterReconnect ( IDispatch*, Variant, Integer, String, Short ) AfterSaveAs ( Object, Variant, Long, DmOperResult, String ) AfterSaveDocument ( Object, Variant, Long, DmOperResult, String ) AfterSelectByTree ( Object, Variant, Long, DmOperResult, String) AfterUiDocPlacement ( Object, Variant, Long, DmOperResult, String) AfterUiNewDocument ( Object, Variant, Long, DmOperResult, String, DocumentEnumType, DocumentEnumUnit ) AfterUnLock ( Object, Variant, Long, String ) Integer BeforeActiveDocument ( Object, Variant, Long, String ) Integer BeforeCloseDocument ( Object, Variant, Long, String ) AccessStatus, Integer BeforeGetAccess ( Object, Variant, Long, String, HookAccessMode ) String, Integer BeforeGetLockInfo ( Object, Variant, Long, String ) Integer BeforeNewDocument ( Object, Variant, Long, String, DocumentEnumType, DocumentEnumUnit ) Integer BeforeOpenDocument ( Object, Variant, Long, String ) Short*, Short* BeforeReconnect ( IDispatch*, Variant, Integer, String ) String, Integer BeforeSaveAs ( Object, Variant, Long, DmOperToDoQuestion, String ) Integer BeforeSaveDocument ( Object, Variant, Long, String, String ) String, Integer BeforeSelectByTree ( Object, Variant, Long, DocumentEnumType, Long, String ) String, String, Integer BeforeUiDocPlacement ( Object, Variant, Long, DocumentEnumType ) String, DocumentEnumType, DocumentEnumUnit, Integer BeforeUiNewDocument ( Object, Variant, Long ) Integer BeforeUnLock ( Object, Variant, Long, String ) CloseApplication ( Object, Variant ) OpenApplication ( Object, Variant ) IPdmHooks::AfterActiveDocument Description CimatronE 10.0 CimatronE SDK User Guide ⎪25 An event occurs when the window of an opened file becomes active (receives focus). This method takes the full path of the file. See BeforeActiveDocument. Syntax AfterActiveDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Restrictions You cannot override the default processing of the event. IPdmHooks::AfterCloseDocument Description An event occurs when you close the window of an open file. This method takes the full path of the closed file. See BeforeCloseDocument. Syntax AfterCloseDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) A unique number, relative to the CimatronE session, which identifies each CimatronE 10.0 CimatronE SDK User Guide ⎪26 iOperation event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Restrictions You cannot override the default processing of the event. IPdmHooks::AfterGetAccess Description An event occurs when CimatronE tries to get access for writing to/reading from a file. For example, it will happen when the first geometrical change occurs. Note: When the file is write-accessed, the system locks it so that consecutive write- accesses to the same file from other instances of CimatronE will fail until the file is unlocked. You must conform to this protocol in the case of overriding the default processing of the event. The method takes the full path of the file and the access status. See BeforeGetAccess. Syntax AfterGetAccess(iApp, iData, iOperation, iDmOperResult, iDocPath, iAccessStatus) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the CimatronE 10.0 CimatronE SDK User Guide ⎪27 scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) iDmOperResultThe result of the event process: Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. Input: (String) iDocPath Full path name of the .elt file. Input: (AccessStatus) iAccessStatus Status of the attempt to access the file. IPdmHooks::AfterGetLockInfo Description An event occurs when CimatronE gets the lock information of a locked file. This happens when the system attempts to write-access the file and the attempt fails. This method takes the full path and the lock information of the file. See BeforeGetLockInfo. Syntax AfterGetLockInfo(iApp, iData, iOperation, iDocPath, iLockInfo) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one CimatronE 10.0 CimatronE SDK User Guide ⎪28 event. Input: (String) iDocPath Full path name of the .elt file. Input: (String) iLockInfo The lock information of the file. IPdmHooks::AfterNewDocument Description An event occurs when CimatronE creates a new file. In particular, this happens after selecting a file type and units of measure from the New File dialog. This method passes you the full path of the created file. See BeforeNewDocument. Syntax AfterNewDocument(iApp, iData, iOperation, iDocTemplatePath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocTemplatePath Full path name of the template file. IPdmHooks::AfterOpenDocument Description An event occurs when CimatronE opens an existing file. This method passes you the full path of the opened file. See BeforeOpenDocument. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪29 AfterOpenDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Restrictions You cannot override the default processing of the event. IPdmHooks::AfterReconnect Description This method is called just after an action is taken in the method BeforeConnect and is an acknowledge that the .elt file is to be opened or not (depending on the value of iResult). Syntax AfterReconnect(iApp, iData, iOperation, iDocPath, iResult) Input: (IDispatch) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Integer) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event CimatronE 10.0 CimatronE SDK User Guide ⎪30 nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Input: (Short) iResult The result of the event process: Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. IPdmHooks::AfterSaveAs Description An event occurs when you choose File/Save As from the CimatronE menu bar. This method takes a list of the full paths of saved-as files. It is guaranteed that the number of files and their order in the list will be the same as in the list passed to the BeforeSaveAs method. Syntax AfterSaveAs(iApp, iData, iOperation, iDmOperResult, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) iDmOperResult The result of the event process: CimatronE 10.0 CimatronE SDK User Guide ⎪31 Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. Input: (String) iDocPath Full path name of the .elt file. Restrictions You cannot override the default processing of the event. IPdmHooks::AfterSaveDocument Description An event occurs when CimatronE saves a file, in particular, when you choose the Save command from the main menu. If according to the save policy the dependent file(s) must be saved, the event occurs for each saved file. This method takes the full path of the saved file. See BeforeSaveDocument. Syntax AfterSaveDocument(iApp, iData, iOperation, iDmOperResult, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) The result of the event process: CimatronE 10.0 CimatronE SDK User Guide ⎪32 iDmOperResult Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. Input: (String) iDocPath Full path name of the .elt file. Restrictions You cannot override the default processing of the event. IPdmHooks::AfterSelectByTree Description An event occurs when you are requested to select files for such operations as Open, Get From Catalog, Import, etc.. This method takes a vector of the selected files (full paths). See BeforeSelectByTree. Syntax AfterSelectByTree(iApp,iData, iOperation, iOperResult, iDocs) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) iOperResult The result of the event process: Processed The event was processed. CimatronE 10.0 CimatronE SDK User Guide ⎪33 Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. Input: (String) iDocs Full path name of the .elt file. IPdmHooks::AfterUiDocPlacement Description An event occurs when the file's full path is requested for such operations as Save (the first save of a new file), Save As, etc.. This method takes the full path and the name of the file. See BeforeUiDocPlacement. Syntax AfterUiDocPlacement(iApp, iData, iOperation, iDmOperResult, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) iOperResult The result of the event process: Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. CimatronE 10.0 CimatronE SDK User Guide ⎪34 Cancelled The event's processing was cancelled. Input: (String) iDocPath Full path name of the .elt file. IPdmHooks::AfterUiNewDocument Description An event occurs when you press New File. Note: The event does not create a file, this is only a request for parameters to create a file. If BeforeUiNewDocument was successful, this method passes you the type, the units of measure and the template path of a file to be created. Syntax AfterUiNewDocument(iApp, iData, iOperation, iDmOperResult, iDocTemplatePath, iDocType, iUnitType) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperResult) iOperResult The result of the event process: Processed The event was processed. Succeeded The event was processed successfully. Failed The event was processed and has resulted in failure. Cancelled The event's processing was cancelled. CimatronE 10.0 CimatronE SDK User Guide ⎪35 Input: (String) iDocTemplatePath Full path name of the template file. Input: (DocumentEnumType) iDocType Type of file. Input: (DocumentEnumUnit) iUnitType Type of measurement unit. IPdmHooks::AfterUnLock Description An event occurs when CimatronE tries to unlock a file previously locked by Get Access. This happens each time when the file is closed. This method takes the full path of the unlocked file. See BeforeUnLock. Syntax AfterUnLock(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. IPdmHooks::BeforeActiveDocument Description An event occurs when the window of an opened file becomes active (receives focus). This method takes the full path of the file. CimatronE 10.0 CimatronE SDK User Guide ⎪36 See AfterActiveDocument. Syntax oMode = BeforeActiveDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of the event. IPdmHooks::BeforeCloseDocument Description An event occurs when you close the window of an open file. This method takes the full path of the file to be closed. See AfterCloseDocument. Syntax oMode = BeforeCloseDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. CimatronE 10.0 CimatronE SDK User Guide ⎪37 Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of the event. IPdmHooks::BeforeGetAccess Description An event occurs when CimatronE tries to get access for writing to/reading from a file. For example, it will happen when the first geometrical change occurs. Note: When the file is write-accessed, the system locks it so that consecutive write- accesses to the same file from other instances of CimatronE will fail until the file is unlocked. You must conform to this protocol in the case of overriding the default processing of the event. This method takes the full path of the file and an accessmode (read/write). If you override the default processing, the method returns the status of the attempt to access the file. See AfterGetAccess. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪38 oAccessStatus, oMode = BeforeGetAccess(iApp, iData, iOperation, iDocPath, iAccessMode) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Input: (HookAccessMode) iAccessMode Access mode (read/write). Return: (AccessStatus) oAccessStatus Status of the attempt to access the file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. IPdmHooks::BeforeGetLockInfo Description An event occurs when CimatronE gets the lock information of a locked file. This happens when the system attempts to write-access the file and the attempt fails. This method takes the full path of the file. If you override the default processing of the event, it returns the lock information (string) of the file. See AfterGetLockInfo. CimatronE 10.0 CimatronE SDK User Guide ⎪39 Syntax oLockInfo, oMode = BeforeGetLockInfo(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (String) oLockInfo Lock information of the file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. IPdmHooks::BeforeNewDocument Description An event occurs when CimatronE creates a new file. In particular, this happens after selecting a file type and units of measure from the New File dialog. This method passes you the full path, the type and the units of measure of a file to be created. The full path is a temporary path until the first save of the file. See AfterNewDocument. Syntax oMode = BeforeNewDocument(iApp, iData, iOperation, iDocTemplatePath, iDocType, iUnitType) CimatronE 10.0 CimatronE SDK User Guide ⎪40 Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocTemplatePath Full path name of the template file. Input: (DocumentEnumType) iDocType Type of file. Input: (DocumentEnumUnit) iUnitType Type of measurement unit. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of this event (this method can return either "Continue" or "Cancel"). IPdmHooks::BeforeOpenDocument Description An event occurs when CimatronE opens an existing file. This method passes you the full path of the file to be opened. See AfterOpenDocument. CimatronE 10.0 CimatronE SDK User Guide ⎪41 Syntax oMode = BeforeOpenDocument(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of the event. IPdmHooks::BeforeReconnect Description When CimatronE is about to open a file, it tests the existence of each "server" file, and if a server doesn't appear in the expected place this method allows you to open the Reconnect dialog by specifying the path and name of the .elt file. Syntax oResult, oMode = BeforeReconnect(iApp, iData, iOperation, iDocPath) Input: (IDispatch) iApp Pointer to the application. CimatronE 10.0 CimatronE SDK User Guide ⎪42 Input: (Variant) iData Not applicable. Input: (Integer) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (Short) oResult User entered result: ( 1 [default] = Continue; 0 = Stop process ). Return: (Short) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. IPdmHooks::BeforeSaveAs Description An event occurs when you choose File/Save As from the CimatronE menu bar. This method takes a list of the full paths of files to be saved-as, a replace mode (yes, yes to all, no, no to all, not defined) and the full path of the target folder (root folder). See AfterSaveAs. Syntax oPathTargetFolder, oMode = BeforeSaveAs(iApp, iData, iOperation, iReplaceMode, iDocPath, ) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. CimatronE 10.0 CimatronE SDK User Guide ⎪43 Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event.For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DmOperToDoQuestion) iReplaceMode A replace mode (yes, yes to all, no, no to all, not defined). Input: (String) iDocPath Full path name of the .elt file. Return: (String) oPathTargetFolder The full path of the target folder (root folder). Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of the event. IPdmHooks::BeforeSaveDocument Description An event occurs when CimatronE saves a file, in particular, when you choose the Save command from the main menu. If according to the save policy the dependent file(s) must be saved, the event occurs for each saved file. This method takes the full path of the file to be saved. See AfterSaveDocument. Syntax CimatronE 10.0 CimatronE SDK User Guide ⎪44 oMode = BeforeSaveDocument(iApp, iData, iOperation, iDocName, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocName Name of the .elt file. Input: (String) iDocPath Full path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. Restrictions You cannot override the default processing of the event. IPdmHooks::BeforeSelectByTree Description An event occurs when you are requested to select files for such operations as Open, Get From Catalog, Import, etc.. This method takes a vector of relevant file types, the maximum number of files allowed to be selected and a default string (the default string appears in the Select edit box of the CimatronExplorer dialog, which is launched in the case of default processing). CimatronE 10.0 CimatronE SDK User Guide ⎪45 If you override the default processing of the event, this method returns a vector of selected files (vector of full paths). See AfterSelectByTree Syntax oDocIDs, oMode = BeforeSelectByTree(iApp, iData, iOperation, iDocType, iMaxNumber, iDefaultString) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DocumentEnumType) iDocType Type of file. Input: (Long) iMaxNumber The maximum number of files allowed to be selected. Input: (String) iDefaultString The default string (the default string appears in the Select edit box of the CimatronE Explorer dialog, which is launched in the case of default processing). Return: (String) oDocIDs If you override the default processing of the event, this method returns a vector of selected files (vector of full paths). Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's CimatronE 10.0 CimatronE SDK User Guide ⎪46 processing. IPdmHooks::BeforeUiDocPlacement Description An event occurs when the file's full path is requested for such operations as Save (the first save of a new file), Save As, etc.. This method takes the type of the file. If you override the default processing of the event, the method returns the name and the full path of the file. See AfterUiDocPlacement. Syntax oDocName, oPath, oMode = BeforeUiDocPlacement(iApp, iData, iOperation, iDocType) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (DocumentEnumType) iDocType Type of file. Return: (String) oDocName Name of .elt file. Return: (String) oPath Path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. CimatronE 10.0 CimatronE SDK User Guide ⎪47 Cancel The user cancels the event's processing. IPdmHooks::BeforeUiNewDocument Description An event occurs when you press New File. Note: The event does not create a file, this is only a request for parameters to create a file. If you process the event by yourself, this method returns the type, the units of measure and the template path (optional parameter) of a file to be created. See AfterUiNewDocument. Syntax oDocTemplatePath, oDocType, oUnitType, oMode = BeforeUiNewDocument(iApp, iData, iOperation) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Return: (String) oDocTemplatePath Full path name of the template file. Return: (DocumentEnumType) oDocType Type of file. Return: (DocumentEnumUnit) oUnitType Type of measurement unit. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. CimatronE 10.0 CimatronE SDK User Guide ⎪48 Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's processing. IPdmHooks::BeforeUnLock Description An event occurs when CimatronE tries to unlock a file previously locked by Get Access. This happens each time when the file is closed. This method takes the full path of the file to be unlocked. See AfterUnLock.Syntax oMode = BeforeUnLock(iApp, iData, iOperation, iDocPath) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Input: (Long) iOperation A unique number, relative to the CimatronE session, which identifies each event. For two consecutive events, the second (later) event will be identified by a greater number than the first. This identifier is passed to both the Before and After methods of the event. This gives you the ability to determine the scope of an event. Otherwise, due to event nesting, it would be difficult to associate a pair of Before and After method calls with one event. Input: (String) iDocPath Full path name of the .elt file. Return: (Integer) oMode The event process mode as defined by the user: Process The user processes the event. Continue The user passes the control to CimatronE; the default processing of the event will be performed. Cancel The user cancels the event's CimatronE 10.0 CimatronE SDK User Guide ⎪49 processing. IPdmHooks::CloseApplication Description An event occurs when CimatronE is closed. This event has only one method. The event does not need to be identified (the interface method doesn't take an event identifier number). Syntax CloseApplication(iApp, iData) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. IPdmHooks::OpenApplication Description An event occurs when CimatronE is launched. This event has only one method. The event does not need to be identified (the interface method doesn't take an event identifier number). Syntax OpenApplication(iApp, iData) Input: (Object) iApp Pointer to the application. Input: (Variant) iData Not applicable. Context Context ICimContext ICimContext This interface enables you to manipulate entities in CimatronE. Properties CimatronE 10.0 CimatronE SDK User Guide ⎪50 Get, Set ActiveModel IModel ICimContext::ActiveModel Description This property allows you to get and set the active model that the user defines. Syntax Property get: ActiveModel = ActiveModel( ); Return: (IModel)) ActiveModel Gets the active model that the user defines Property set: ActiveModel (NewVal); Input: (IModel) NewVal Sets the active model that the user defines Models Models CimatronE 10.0 CimatronE SDK User Guide ⎪51 MdlrModel MdlrModel IMdlrModel IMdlrModel This interface represents a part file model. Properties Get ModelProcedures ICimEntityList Get EntityModel IModel Get, Set ActiveObject ICimEntity Get,Set ActivateUcs ICimEntity Methods IMdProcedure CreateProcedure ( MdProcedureType ) IDimension GetDimensionByName ( String ) IDimension GetDimensionByInternalName ( String ) IGeomServices GetGeomServicesObj ( ) ImportModelFromBrowser ( ) ImportModelByPath ( String ) CimatronE 10.0 CimatronE SDK User Guide ⎪52 SetDimensionByName ( IDimension ) DeleteProcedure ( IMdProcedure ) SuppressProcedure ( Variant , Long ) IMdProcedure GetProcById ( Long ) Regenerate ( ) Variant GetDimensions ( ) UpdateDimensions ( ) DeActivateObjects ( ) IMdlrModel::CreateProcedure Description This method allows you to create different types of procedures. To get more information about procedures in CimatronE visit Procedures . Syntax Procedure = CreateProcedure( ProcedureType ); Input: (MdProcedureType) ProcedureTypeA type of procedure to be created. Return: (IMdProcedure) Procedure Created procedure. IMdlrModel::DeleteProcedure Description This method deletes an existing procedure. Syntax DeleteProcedure( ProcedureToDelete ); Return: (IMdProcedure) ProcedureToDeleteA procedure to be deleted. IMdlrModel::EntityModel Description This property allows you to get a model in which a given entity was created. It is useful when you have imported objects from other models. Syntax Model = EntityModel( Entity ); Input: (ICimEntity) An entity to get a model in which it was created. Return: (IModel) ModelModel in which a given entity was created. IMdlrModel::GetDimensionByName Description CimatronE 10.0 CimatronE SDK User Guide ⎪53 This method allows you to get dimensions defined by its given name . Syntax Dimension = GetDimensionByName( Name ); Input: (String) Name A given name of a dimension. Return: (IDimension) Dimension A dimension that corresponds to this name. IMdlrModel::GetProcById Description This method allows you to get a procedure by its number. Syntax Procedure = GetProcById( ProcedureNumber ); Input: (Long) ProcedureNumber A procedure number. Return: (IMdProcedure) ProcedureA procedure with a given number. IMdlrModel::ModelProcedures Description This property allows you to get a list of all procedures in a current model. Syntax Property get Procedures = ModelProcedures( ); Return: (ICimEntityList) ProceduresList of all procedures in a current model. Note Doesn't work if the current model contains imported models. IMdlrModel::Regenerate Description This method allows you to regenerate a model. After executing this procedure you are unable to call the UNDO command. Syntax Regenerate ( ); IMdlrModel::SetDimensionByName Description This method allows you to set new values for an existing dimension. For example, if you have an existing dimension you may change it using the IDimension interface and then call this method to set updated values. To evaluate changes, call the IMdlrModel::UpdateDimension method. CimatronE 10.0 CimatronE SDK User Guide ⎪54 Syntax SetDimensionByName( NewDimension ); Input: (IDimension) NewDimension A dimension with new values. IMdlrModel::SuppressProcedure This is preliminary documentation and subject to change. Description This method allows you to suppress procedures. Syntax SuppressProcedure( SuppressProcedureList, Suppress ); Input: (Variant) SuppressProcedureList Variant that contains an array of MdProcedures elements that have to be suppressed. Input: (Boolean) Suppress If TRUE (=1) then suppress all procedures inthe list, otherwise unsuppress. IMdlrModel::UpdateDimensions Description This method allows you to update dimensions in the model after you set new values using the IMdlrModel::SetDimensionByName method. Syntax UpdateDimensions( ); IMdlrModel::ActivateUcs Description This method allows you to get a current active UCS and set another UCS as active. Syntax Property get: ActiveUcs = ActivateUcs( ); Return: (ICimEntity) ActiveUcsCurrent active UCS entity. Property set: ActivateUcs( UcsToActivate ); Return: (ICimEntity) UcsToActivateA UCS entity to activate. IMdlrModel::ActiveObject Description CimatronE 10.0 CimatronE SDK User Guide ⎪55 This property allows you to get the current active object or activate an object. An active object may be a non- wireframe body, solid object or standalone face. By default a first created solid body (also standalone face) or imported model object is active. Syntax Property Set: Entity = ActiveObject( ); Return: (ICimEntity) Entity Current active object. Property Get: ActiveObject( Entity ); Inupt: (ICimEntity) Entity Object to be activated. IMdlrModel::DeActivateObjects Description This method allows you to deactivate a current active object in a model. Syntax DeActivateObjects( ); Note After executing deactivation, there is no active object in a model. You have to activate an object before carrying out procedures that require an active object like adding an extrusion or the removal of a solid object. IMdlrModel::GetDimensionByInternalName Description This method allows you to get a dimension defined by its internal name. Syntax Dimension = GetDimensionByInternalName( Name ); Input: (String) Name An internal dimensionn name. Return:
Compartilhar