Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceSplice Method / PlaceSplice(LibSplice,ISpecialComponentHost,IControlPoint,IControlPoint,TransformProperty<LengthProperty>,ApiLinkType) Method
Library part of special component.
A part on which the special component is to be placed.
First edge point among which the special component is to be placed.
Second edge point among which the special component is to be placed.
Position of the special component.
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
    PlaceSplice(LibSplice,ISpecialComponentHost,IControlPoint,IControlPoint,TransformProperty<LengthProperty>,ApiLinkType) Method
    In This Topic
    Place a splice on a bundle or wire between two control points.
    Syntax

    Parameters

    part
    Library part of special component.
    parentOcc
    A part on which the special component is to be placed.
    firstPoint
    First edge point among which the special component is to be placed.
    secondPoint
    Second edge point among which the special component is to be placed.
    position
    Position of the special component.
    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 special component.
    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 placing this part failed.
    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. The bundle will be split into two new bundles.

    Example
    This example shows how to place a splice 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 spliceLib = proj.ActiveConnection.GetLibraryPartsByPartNumber("splice 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 splice.
    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.PlaceSplice(spliceLib, bundle, firstPoint, secondPoint, position);
    See Also