Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Variant Class / CreateNailboardFromTemplate Method
Name of the new nailboard. No two nailboards in the project can have the same name.
Path to the template file (*.hxnt).
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. If not provided then it is taken from the template.
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
    CreateNailboardFromTemplate Method
    In This Topic
    Create new nailboard from template in this variant.
    Syntax

    Parameters

    name
    Name of the new nailboard. No two nailboards in the project can have the same name.
    templatePath
    Path to the template file (*.hxnt).
    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. If not provided then it is taken from the template.
    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
    This example shows how to create new nailboard from template file.
    // 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");
    
    // Open a variant.
    // Let's 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 smaller structures which contain the 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 those, whose name starts with underscore.
    IEnumerable<WireHarnessInfo> selectedHarnesses = allHarnesses.Where(n => n.DocumentName == "MyWorkspace").Where(n => n.Name.StartsWith("_"));
    
    // Now let's derive the final nailboard using information we gathered.
    Nailboard newNailboard = variant.CreateNailboard("New nailboard name", "Path to the template file", selectedHarnesses);
    
    // Save and close the project.
    project.Save();
    project.Close();
    
    // Close the API.
    api.Close();
    This example shows how to create nailboard from template and override display configuration from template using selected display configuration.
    Variant variant = ...
    
    List<WireHarnessInfo> allHarnesses = variant.GetAllWireHarnessInfos();
    
    // Override display configuration from template using this display configuration.
    NailboardDisplayConfigurationInfo displayConfiguration = project.GetDefaultNailboardDisplayConfiguration();
    
    Nailboard newNailboard = variant.CreateNailboardFromTemplate("New nailboard name", "Path to the template file", allHarnesses, displayConfiguration);
    
    project.Save();
    project.Close();
    This example shows how to create nailboard from template and from selected electrical configuration.
    Variant variant = ...
    
    List<WireHarnessInfo> allHarnesses = variant.GetAllWireHarnessInfos();
    
    // Select your favourite electrical configuration.
    ElectricalConfigurationInfo elConfiguration = variant.GetElectricalConfiguration().First();
    
    Nailboard newNailboard = variant.CreateNailboardFromTemplate("New nailboard name", "Path to the template file", allHarnesses, null, elConfiguration);
    
    project.Save();
    project.Close();
    See Also