Eplan Platform API
EPLAN API / User Guide / API MasterData / Working with parts database
In This Topic
    Working with parts database
    In This Topic

    The following example show how to open default parts database:

    MDPartsManagement oPartsManagement = new MDPartsManagement();
    MDPartsDatabase partsDatabase = oPartsManagement.OpenDatabase();
    

     

    There is also possibility to open choosen parts database from file:

    MDPartsDatabase partsDatabase = new MDPartsManagement().OpenDatabase("C:\\PathToDirectory\\DataBase.alk");
    

     

    Then you can check information about open database:

    //Show database name
    var bdName = MDPartsManagement.SelectedPartsDatabaseAsString;
    new Decider().Decide(EnumDecisionType.eOkDecision, bdName, "DB", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
    
    //Check if database is open
    if (partsDatabase.IsOpen);
        new Decider().Decide(EnumDecisionType.eOkDecision, "DataBase is open", "DB", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
    
    //Check if database is readonly
    if (!partsDatabase.IsReadOnly) ;
        new Decider().Decide(EnumDecisionType.eOkDecision, "DataBase is not readolny", "DB", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
    
    //Get database version
    var dataBaseVersion = partsDatabase.Version;
    
    //Get database type
    var dataBaseType = partsDatabase.Type;
    
    //Check if database scheme is up to date
    if (partsDatabase.IsSchemeUpToDate) ;
      new Decider().Decide(EnumDecisionType.eOkDecision, "Scheme is up to date", "DB", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK);
    

     

    and finally close database

    partsDatabase.Close();