// 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();