API Help
EPLAN API / User Guide / API Miscellaneous / API Parts Management Extension
In This Topic
    API Parts Management Extension
    In This Topic

    The API Parts Management Extension feature can be used to add you own custom information to parts stored in the EPLAN parts database. It is meant for information, which 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 properties ARTICLE_CUSTOM_DATA_INDEX and ARTICLE_CUSTOM_DATA_VALUE. The first property contains the name of the addin to which the information belongs, the second property contains the data string at the same index position. 

    To use this feature, you need to call the methods MDPartsManagement.RegisterAddin(<AddinName>, <ActionName>) and MDPartsManagement.RegisterItem(<AddinName>, <ItemType>) in your addin. 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 <AddinName>, you set the assembly name of your addin, which is normally the dll title without the extension dll. In your addin, you implement an action with the name you set in the parameter <ActionName>. 

     

    Upon this, your action is called on different events in the parts management. It has a different set of parameters passed in the ActionCallingContext on each occasion. The parameter 'action' tells you, which kind of 'event' is called. The parameter can contain the following values: 

    List of 'action' calls:

    "Action" value Description Parameters
    input output
    GetRootLevel  The first tree level is requested.  itemtype : type of item for which the root node is 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 item which is 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 : type of item 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, which are registered for this element.  itemtype : type of item 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 : type of item 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 : type of item 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 : type of item 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 : type of item 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 : type of item 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 : type of item of the pasted element 
    key : identifying key of the selected element (optional) 
    NewItem  An item/part was created in parts management. itemtype : type of item of the newly created element 
    key : identifying key of the currently selected element (optional)
    key : identifying key of the created element 
    DeleteItem  item/part is being deleted from parts management.  itemtype : type of item 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 addin can add additional custom data to the stored part. itemtype : 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 addin. itemtype : type of the synchronized part (always 'eplan.part') 
    key : identifying key of the synchronized part 
    value : (string) custom part data which was stored with the part inside the project 
    AddItemToProject  An item (part, manufacturer, drilling pattern, ...) is stored in the project. The addin can add additional custom data to the stored item.   itemtype : item types of stored items (eplan.part, eplan.manufacturer, ...) 
     key : identifying field of stored items 
     name : name of the stored items (abbreviated name of the manufacturer, name of drilling pattern, ...) 
    value = (string) custom data which was 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 addin 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 addin.  itemtype : 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 addin. 
    ExportCustomItem  All custom items of the respective itemtype are exported from parts management. Please mind, that this only works with the XML export (Converter:"XPamExportXml").  itemtype : type of the item to export  value : custom data of all items to be exported. 
    ImportCustomItem  All custom items of the respective itemtype are imported from a file into parts management. They have to be saved by the addin. Please mind, that this only works with the XML import (Converter:"XPamExportXml").  itemtype : type of the item to import 
    value : custom data of all items to be imported 
    mode : import mode. 
       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 article management itemtype = name of the type of the selected item
    key = key 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)
      An item/part will be saved in parts management itemtype : type of item 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)