public void Toggle()
public void Toggle()
Exception | Description |
---|---|
EPLAN.Harness.API.Exceptions.HpdApiNotInitializedException | Api is not in an initialized state. You can get current state from EPLAN.Harness.API.Studio.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.Studio.Init method. If API is in failed state, you can not resurrect it. |
EPLAN.Harness.API.Exceptions.ObjectInvalidException | The object is in invalid state. Obtain a new one. |
EPLAN.Harness.API.Exceptions.ArgumentNullException | Argument is null. |
EPLAN.Harness.API.Exceptions.OccurrenceDeletedException | The exception that is thrown when you trying to access to already deleted occurrence. |
EPLAN.Harness.API.Exceptions.FileOpenedAsReadOnlyException | You can not perform this action on a document opened as read only. |
// Initialize API Studio api = Studio.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();