Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / LockEndPointsToConnector Method
Collections of endpoints
Example
In This Topic
    LockEndPointsToConnector Method
    In This Topic
    Lock position between master and slave objects. The simple constraint is created. The slave objects are moved and rotated with the master together.
    Syntax

    Parameters

    endPoints
    Collections of endpoints

    Return Value

    Created constraint.
    Exceptions
    ExceptionDescription
    Api is not in an initialized state. You can get current state from EPLAN.Harness.API.HpdApi.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.HpdApi.Init method. If API is in failed state, you can not resurrect it.
    The object is in invalid state. Obtain a new one.
    This file is not opened.
    Example
    Lock positions between a cable's end point and a conector.
    // 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];
    variant.Open(false, false);
    Designer designer = variant.GetWorkdesks().FirstOrDefault(w => w.Name == "Workdesk_1");
    designer.Open(false, false);
    
    // Lock position between a control point and a connected connector.
    IOccEndControlPoint cp = workdesk.GetAllOccurrences<IOccEndControlPoint>().FirstOrDefault(c => c.Name == "cp_00158");
    designer.LockEndPointsToConnector(new [] { cp });
    
    // Save changes and close documents.
    designer.Save();
    designer.Close();
    variant.Close();
    project.Close();
    api.Close();
    See Also