Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceCableTie Method
Library part of the cable tie.
A part on which the cable tie is to be placed.
First edge point among which the cable tie is to be placed.
Second edge point among which the cable tie is to be placed.
Position of the cable tie.
Determines if part's accessories will be placed with part. Mandatory, Optional, both types or None accessories can be placed. This enum has the Flags attribute.
Example
In This Topic
    PlaceCableTie Method
    In This Topic
    Place a cable tie on a bundle or flat cable between two control points.
    Syntax

    Parameters

    part
    Library part of the cable tie.
    parentOcc
    A part on which the cable tie is to be placed.
    firstPoint
    First edge point among which the cable tie is to be placed.
    secondPoint
    Second edge point among which the cable tie is to be placed.
    position
    Position of the cable tie.
    linkType
    Determines if part's accessories will be placed with part. Mandatory, Optional, both types or None accessories can be placed. This enum has the Flags attribute.

    Return Value

    Placed cable tie.
    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.
    Thrown when the type of part can not be placed by the method.
    Thrown when both edge points do not lie on one part of path.
    Thrown when edge points do not lie next to each other.
    Remarks

    Controls points have to be neighboring.

    Example
    This example shows how to place a cable tie on a bundle.
    /// Obtain project and workspace beforehand and open for writing.
    Project proj = ...
    Workspace workspace = ...
    workspace.Open(false, false);
    
    // Special component library part. (assume the library connected to project contains the library part)
    var tieLibPart = proj.ActiveConnection.GetLibraryPartsByPartNumber("cable tie lib part").FirstOrDefault();
    
    // Obtain wire from workspace
    IOccBundle bundle = workspace.GetAllOccurrences<IOccBundle>().FirstOrDefault(occ => occ.Name.ToString() == "myBundle");
    
    // Obtain controls points from bundle.
    List<IControlPoint> controlPoints = bundle.GetAllControlPoints().ToList();
    IControlPoint firstPoint = controlPoints.FirstOrDefault(c => c.Name.ToString() == "occ_1");
    IControlPoint secondPoint = controlPoints.FirstOrDefault(c => c.Name.ToString() == "occ_2");
    
    // Position of the cable tie.
    TransformProperty<LengthProperty> position = new TransformProperty<LengthProperty>
    (
    	new LengthProperty(-50, Unit.Millimeter),
    	new LengthProperty(120, Unit.Millimeter),
    	new LengthProperty(70, Unit.Millimeter)
    );
    
    // Place attached part to occurrence.
    workspace.PlaceCableTie(tieLibPart, bundle, firstPoint, secondPoint, position);
    See Also