Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Variant Class / CreateNailboard Method
Name of the new nailboard. No two nailboards in the project can have the same name.
Harnesses from which this nailboard will be derived. Only harnesses from one type of designer are allowed (all from Workspaces or all from Workdesks).
Display configuration. Obtain from Project.GetDefaultNailboardDisplayConfiguration or Project.GetNailboardDisplayConfigurations.
Electrical configuration. Obtain from GetElectricalConfigurations. (Optional: If you do not set any electrical configuration, no electrical configuration filter will be used and all existing objects will be used.)
Example
In This Topic
    CreateNailboard Method
    In This Topic
    Create new nailboard in this variant.
    Syntax

    Parameters

    name
    Name of the new nailboard. No two nailboards in the project can have the same name.
    harnesses
    Harnesses from which this nailboard will be derived. Only harnesses from one type of designer are allowed (all from Workspaces or all from Workdesks).
    displayConfiguration
    Display configuration. Obtain from Project.GetDefaultNailboardDisplayConfiguration or Project.GetNailboardDisplayConfigurations.
    electricalConfiguration
    Electrical configuration. Obtain from GetElectricalConfigurations. (Optional: If you do not set any electrical configuration, no electrical configuration filter will be used and all existing objects will be used.)

    Return Value

    New nailboard
    Exceptions
    Example
    // API is a singleton.
    HpdApi api = HpdApi.GetInstance();
    
    // Initialize API and load HpD.
    api.Init();
    
    // Open a project.
    Project project = api.OpenProject("path to my project");
    
    // Get all display configurations in the project and find the one called "My favourite display configuration".
    NailboardDisplayConfigurationInfo displayConfiguration = project.GetNailboardDisplayConfigurations().Where(n => n.Name == "My favourite display configuration").FirstOrDefault();
    
    // If your favourite display configuration was not found, grab the default one.
    if (displayConfiguration == null)
    displayConfiguration = project.GetDefaultNailboardDisplayConfiguration();
    
    // Open a variant.
    // Let us assume there is only one variant in the project, so we simply pick it.
    Variant variant = project.GetVariants().FirstOrDefault();
    
    // Get list of all harnesses in this variant.
    // You will not get the real harness objects, just a little structure that contains basic info about the harness such as ID, name and the same info about its parent document.
    List<WireHarnessInfo> allHarnesses = variant.GetAllWireHarnessInfos();
    
    // Now we filter only harnesses from document "MyWorkspace" and only the ones with name starting with underscore.
    IEnumerable<WireHarnessInfo> selectedHarnesses = allHarnesses.Where(n => n.DocumentName == "MyWorkspace")
    .Where(n => n.Name.StartsWith("_"));
    
    // Now let us derive the final nailboard using information we gathered.
    Nailboard newNailboard = variant.CreateNailboard("New nailboard name", selectedHarnesses, displayConfiguration);
    
    // Now we can do stuff with our new nailboard. For example we can revise it.
    // Or we can just throw this object away, since we can always get it using variant.GetNailboards();
    newNailboard.Revise();
    
    // Save and close the project.
    project.Save();
    project.Close();
    
    // Close the API.
    api.Close();
    This example shows how to create nailboard from specific electrical configuration.
    Variant variant = ...
    
    List<WireHarnessInfo> allHarnesses = variant.GetAllWireHarnessInfos();
    
    NailboardDisplayConfigurationInfo displayConfiguration = project.GetDefaultNailboardDisplayConfiguration();
    
    // Select your favourite electrical configuration.
    ElectricalConfigurationInfo elConfiguration = variant.GetElectricalConfiguration().First();
    
    Nailboard newNailboard = variant.CreateNailboard("New nailboard name", allHarnesses, displayConfiguration, elConfiguration);
    
    project.Save();
    project.Close();
    See Also