The API Parts Management Extension feature can be used to add your own custom information to parts stored in the EPLAN parts database. It is intended for information that you don't want to set as part properties.
You store this information in your own database and can attach it to the part and visualize it. When a part which references such custom information is exported or stored in a project, the information is stored as a sting in the indexed ARTICLE_CUSTOM_DATA_INDEX and ARTICLE_CUSTOM_DATA_VALUE properties. The first property contains the name of the add-in to which the information belongs, and the second property contains the data string at the same index position.
To use this feature, you must call the MDPartsManagement.RegisterAddin(<Add-inName>, <ActionName>) and MDPartsManagement.RegisterItem(<Add-inName>, <ItemType>) methods in your add-in. As <ItemType> you set the string "eplan.part" (There is also the possibility to register other custom items in the parts management tree by setting other values for <ItemType>). As <Add-inName> you set the assembly name of your add-in, which is usually the DLL title without the extension .dll. In your add-in, you implement an action with the name you set in the parameter <ActionName>.
Your action will then be called on different events in the parts management. It has a different set of parameters passed in the ActionCallingContext on each time. The action parameter tells you what kind of "event" is called. The parameter can contain the following values:
"Action" value | Description | Parameters | |
---|---|---|---|
input | output | ||
GetRootLevel | The first tree level is requested. | itemtype: Type of the item for which the root node is being requested | key: Identifying key text: Text to display in the tree subnode: (bool) Are further sub nodes available? (1 = yes, 0 = no) |
GetNextLevel | The next level of the tree is requested. | itemtype: Type of the item being expanded in the tree key: Node below which the next tree level is requested |
key: Identifying key text: Text to display in the tree subnode: (bool) Are further sub nodes available? (1 = yes, 0 = no) |
CreateDatabase | A new parts database was created. | database: Name of the created database | |
OpenDatabase | A new parts database was opened. | database: (string) Name of the newly opened database readonly: (bool) Read-only status of the opened parts database (1 = "read-only", 0 = "read/write") |
|
CloseDatabase | The current database was closed. | ||
SelectItem | An item / part was selected in parts management. | itemtype: Item type of the selected element partnr: Selected part number (if only one part is selected) variant: Selected part variant (if only one variant is selected) key: Identifying key of the selected element |
|
PreShowTab | An item / part was selected in parts management. You have now the possibility to show / hide tab sheets that are registered for this element. | itemtype: Item type of the selected element partnr: Selected part number (if only one part is selected) variant: Selected part variant (if only one variant is selected) key: Identifying key of the selected element tabsheet: Tab sheet to be checked. The tab sheet was previously registered using MDPartsManagement.RegisterTabsheet(...) |
show: (bool) Should the tab sheet be displayed? (1 = yes (default), 0 = no) |
SaveItem | An item / part was saved in parts management. | partnr: Selected part number (if only one part is selected) variant: Selected part variant (if only one variant is selected) itemtype: Item type of the selected element key: Identifying key of the selected element |
|
CopyItem | An item / part was copied in parts management (by the context menu items Copy and Paste). | itemtype: Item type of the copied element key: Identifying key of the currently selected element (optional) sourcekey: Identifying key of the element to copy |
|
CutCopyItem | An item / part was cut in parts management (by the context menu items Cut and Paste). | itemtype: Item type of the cut element key: Identifying key of the currently selected element (optional) sourcekey: Identifying key of the element to cut |
key: Identifying key of the created element |
SelectCopyItem | The context menu item Copy was clicked in parts management tree. | itemtype: Item type of the copied element key: Identifying key of the selected element (optional) |
|
SelectCutItem | The context menu item Cut was clicked in parts management tree. | itemtype: Item type of the cut element key: Identifying key of the selected element (optional) |
|
SelectPasteItem | The context menu item Paste was clicked in parts management tree. | itemtype: Item type of the pasted element key: Identifying key of the selected element (optional) |
|
NewItem | An item / part was created in parts management. | itemtype: Item type of the newly created element key: Identifying key of the currently selected element (optional) |
key: Identifying key of the created element |
DeleteItem | An item / part is being deleted from parts management. | itemtype: Item type of the currently selected to be deleted element partnr: Selected part number (if only one part is selected) variant: Selected part variant (if only one variant is selected) key: Identifying key of the element to be deleted |
|
AddPartToProject | A part from parts management is stored in the project. The add-in can add additional custom data to the stored part. | itemtype: Item type of the stored part (always "eplan.part") key: Identifying key of the stored part |
value: (string) Custom part data to be stored with the part inside the project (in properties ARTICLE_CUSTOM_DATA_INDEX and ARTICLE_CUSTOM_DATA_VALUE) |
AddPartToDatabase | A part is synchronized from the project to the parts management. The additional custom data can now be extracted and stored by the add-in. | itemtype: Item type of the synchronized part (always "eplan.part") key: Identifying key of the synchronized part value: (string) Custom part data stored with the part inside the project |
|
AddItemToProject | An item (part, manufacturer, drilling pattern, ...) is stored in the project. The add-in can add additional custom data to the stored item. | itemtype: Item types of stored items (eplan.part, eplan.manufacturer, ...) key: Identifying field of stored item's name: name of the stored items (abbreviated name of the manufacturer, name of drilling pattern, ...) |
value: (string) Custom data stored with an item inside a project (in properties ARTICLE_CUSTOM_DATA_INDEX and ARTICLE_CUSTOM_DATA_VALUE) |
ExportEplanItem | A part is exported from parts management to a file. The additional custom data from the add-in can now be added to the export file. | itemtype: Type of the item to export (always "eplan.part") key: Identifying key of the part to export |
value: (string) Custom part data to be added to the export file |
ImportEplanItem | A part is imported to parts management. The additional custom data from the file can now be extracted and stored by the add-in. | itemtype: Item type of the part to import (always "eplan.part") key: Identifying key of the imported part mode: Import mode. Possible values: 0 = Append new records only 1 = Update existing records only 2 = Update existing records and append new ones value: (string) Custom part data to be extracted from the file and stored by the add-in. |
|
ExportCustomItem | All custom items of the respective item type are exported from parts management. Please mind that this only works with the XML export ("XPamExportXml" converter). |
itemtype: Type of the item to export | value: Custom data of all items to be exported |
ImportCustomItem | All custom items of the respective item type are imported from a file into parts management. They have to be saved by the add-in. Please mind that this only works with the XML import ("XPamExportXml" converter). |
itemtype: Type of the item to import value: Custom data of all items to be imported mode: Import mode. Possible values: 0 = Append new records only 1 = Update existing records only 2 = Update existing records and append new ones |
|
WillDeleteItem | An item / article is to be deleted in parts management | itemtype: Item type of the selected item key: Identifying field of the currently selected element partnr: Selected item number (only if an item is selected) variant: Selected variant (only if an article is selected) objectid: ID of a transient object being modified, (before changes) |
allow: If set to 0, then DeleteItem is not called (delete is not executed) |
WillSaveItem | An item / part will be saved in parts management | itemtype: Item type of the selected element key: Identifying key of the selected element partnr: Selected part number (if only one part is selected) variant: Selected part variant (if only one variant is selected) objectid: ID of a transient object being modified (before changes) |
allow: When set to 0, SaveItem is not called (save is not performed) |