// Init API
HpdApi api = HpdApi.GetInstance();
// Open project.
Project project = api.OpenProject(@"d:\MyProject.hxproj");
// Get a default nailboard display configuration
DisplayConfiguration dc = project.NailboardDisplayConfigurations.DefaultDisplayConfiguration;
// Hatches are included in the library. Get the library connection and select a pattern of the hatch by its name.
ActiveLibraryConnection lc = project.ActiveConnection;
HatchInfo hi = lc.GetHatches().FirstOrDefault(h => h.Name == "Loom");
// Allow overriding of the hatch and set it up.
dc.Bundle.HatchOverride = true;
dc.Bundle.Hatch = hi;
// Save and close the project.
project.Save();
project.Close();