// Initialize API
HpdApi api = HpdApi.GetInstance();
api.Init();
// Open a project and a workdesk.
Project project = api.OpenProject(@"d:\Harness proD 2.9\Projects\Demo\Demo.hxproj");
Variant variant = project.GetVariants()[0];
Designer designer = variant.GetWorkdesks().FirstOrDefault(w => w.Name == "Workdesk_1");
designer.Open(false, false);
// Select a constraint and togle its master and slave.
IOccConstraintSimple constraint = workdesk.GetAllOccurrences<IOccConstraintSimple>().FirstOrDefault(c => c.Name == "cp_00026 :: cn_00001");
constraint.Toggle();
// Save changes and close documents.
designer.Save();
designer.Close();
project.Close();