Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / RoutePathSegment Method / RoutePathSegment(IControlPoint,IControlPoint,IEnumerable<IOccCableTray>) Method
First point of the segment to route.
Second point of the segment to route.
A collection of cable trays through which we want to route the segment.
Example
In This Topic
    RoutePathSegment(IControlPoint,IControlPoint,IEnumerable<IOccCableTray>) Method
    In This Topic
    Routes a path segment between two control points through a cable tray / cable trays.
    Syntax

    Parameters

    segmentPoint1
    First point of the segment to route.
    segmentPoint2
    Second point of the segment to route.
    routeTargets
    A collection of cable trays through which we want to route the segment.
    Exceptions
    ExceptionDescription
    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.
    The object is in invalid state. Obtain a new one.
    Thrown when input control points lie on a different path.
    Thrown when input control points are not neighboring.
    Remarks
    Segment must be from the EPLAN.Harness.API.Occurrences.Interfaces.ISegmentRoutable occurrence (or its top layer if it is a cable). The segment to route has to be specified by two neighboring control points which lie on one part of a path.
    Example
    This example shows how to route a segment between two control points into a cable tray.
    var api = Studio.GetInstance();
    api.Init();
    
    var project = api.OpenProject($"{myProjectPath}");
    var wsp = project.GetVariants().FirstOrDefault()?.GetWorkspaces().FirstOrDefault(w => w.Name.Contains("MyWorkspace"));
    wsp.Open(false, false);
    
    var cp = wsp.GetAllOccurrences().FirstOrDefault(o => o.Name == "cp_1") as IControlPoint;
    var cp2 = wsp.GetAllOccurrences().FirstOrDefault(o => o.Name == "cp_2") as IControlPoint;
    var tray = wsp.GetAllOccurrences().FirstOrDefault(o => o.Name == "tray_1") as IOccCableTray;
    
    wsp.RoutePathSegment(cp, cp2,  new[] { tray });
    
    wsp.Save();
    wsp.Close();
    project.Save();
    project.Close();
    See Also