// API is a singleton.
HpdApi api = HpdApi.GetInstance();
// Initialize API and load HpD.
api.Init();
// Open a project.
Project project = api.OpenProject(@"d:\MyProject.hxproj");
// Select a variant.
Variant variant = project.GetVariants()[0];
// Select and open a nailboard.
Nailboard drawing = variant.GetNailboards().FirstOrDefault(d => d.Name == "WH_1");
drawing.Open(false, false);
// Select two control points.
BaseNbControlPoint cp1 = drawing.GetAllOccurrences<BaseNbControlPoint>().FirstOrDefault(o => o.Name == "End point:3_");
BaseNbControlPoint cp2 = drawing.GetAllOccurrences<BaseNbControlPoint>().FirstOrDefault(o => o.Name == "cp_00060");
// Place and get the custom control point.
OccNbCustomPoint cp = drawing.PlaceControlPoint(cp1, cp2, "50mm");
// Save and close the project.
project.Save();
project.Close();
// Close the API.
api.Close();