Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceRapidPrototypeCable Method
Position of the first insulator end.
Middle control points of the insulator.
Position of the second insulator end.
Connections of wires of this cable.
Rapid prototype cable definition. If the definition is null the default values from settings are used.
Example
In This Topic
    PlaceRapidPrototypeCable Method
    In This Topic
    Place a rapid prototype cable.
    Syntax

    Parameters

    insulatorEnd1
    Position of the first insulator end.
    insulatorControlPoints
    Middle control points of the insulator.
    insulatorEnd2
    Position of the second insulator end.
    connections
    Connections of wires of this cable.
    definition
    Rapid prototype cable definition. If the definition is null the default values from settings are used.

    Return Value

    Placed rapid prototype cable.
    Exceptions
    ExceptionDescription
    This file is not opened.
    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 occurrence is not part of this document.
    Remarks

    No connector pin may be a child of a ribbon pin.

    Count of connections must be less than or equal to the count of wires of the rapid prototype cable.

    Example
    This example shows how to place a black rapid prototype cable (outside diameter 4 mm) with 2 red wires (outside diameter 2 mm) to the specific points (insulator ends). Cable wires will be connected to specific pins.
    // Obtain workdesk beforehand.
    Workdesk workdesk = ...
    
    List<Connection> connections = new List<Connection>();
    
    // Connection for the first cable wire.
    // First cable wire will be connected to these two pins:
    OccWdPin connector1Pin1 = ...
    OccWdPin connector2Pin1 = ...
    connections.Add(new Connection(connector1Pin1, connector2Pin1));
    
    // Connection for the second cable wire.
    // The second cable wire will be connected to these two pins:
    OccWdPin connector1Pin2 = ...
    OccWdPin connector2Pin2 = ...
    connections.Add(new Connection(connector1Pin2, connector2Pin2));
    
    // Position of the first insulator end.
    TransformProperty<LengthProperty> insulatorEnd1 = new TransformProperty<LengthProperty>
    (
    	new LengthProperty(-80, Unit.Millimeter),
    	new LengthProperty(220, Unit.Millimeter),
    	new LengthProperty(140, Unit.Millimeter)
    );
    
    // Position of the second insulator end.
    TransformProperty<LengthProperty> insulatorEnd2 = new TransformProperty<LengthProperty>
    (
    	new LengthProperty(-50, Unit.Millimeter),
    	new LengthProperty(120, Unit.Millimeter),
    	new LengthProperty(70, Unit.Millimeter)
    );
    
    IOccCable cable = workdesk.PlaceRapidPrototypeCable(
    	new PlacePosition(insulatorEnd1),
    	new List<TransformProperty<LengthProperty>>(),
    	new PlacePosition(insulatorEnd2),
    	connections,
    	new RapidCableDefinition()
    	{
    		NumberOfWires = 2,
    		CableColor = Color.Black,
    		WireColor = Color.Red,
    		OutsideDiameter = new LengthProperty(4, Unit.Millimeter),
    		WireOutsideDiameter = new LengthProperty(2, Unit.Millimeter)
    	}
    );
    This example shows how to place a rapid prototype cable with the default values from settings which has several control points.
    // Obtain workspace before.
    Workspace workspace = ...
    
    List<Connection> connections = ...
    
    TransformProperty<LengthProperty> insulatorEnd1 = ...
    TransformProperty<LengthProperty> insulatorEnd2 = ...
    
    // Control points in defined positions in space.
    TransformProperty<LengthProperty> controlPoint1 = ...
    TransformProperty<LengthProperty> controlPoint2 = ...
    TransformProperty<LengthProperty> controlPoint3 = ...
    
    IOccCable cable = workspace.PlaceRapidPrototypeCable(new PlacePosition(insulatorEnd1), new List<TransformProperty<LengthProperty>> { controlPoint1, controlPoint2, controlPoint3 }, new PlacePosition(insulatorEnd2), connections);
    This example shows options how to connect cable wires to a grouped pin. Wires of the cable can be connected to: virtual pins of the grouped pin, only to the grouped pin, or you can leave some wires latent (unconnected).
    // Obtain workdesk beforehand.
    Workdesk workdesk = ...
    
    OccWdConnector connector1 = ...
    OccWdConnector connector2 = ...
    
    List<Connection> connections = new List<Connection>();
    
    // Wire 1: To the first virtual pin of group pins.
    OccWdBasePin cablePin1 = connector1.Children.OfType<OccWdVirtualPin>().First();
    OccWdBasePin cablePin2 = connector2.Children.OfType<OccWdVirtualPin>().First();
    connections.Add(new Connection(cablePin1, cablePin2));
    
    // Wire 2: To the last virtual pin of group pins.
    cablePin1 = connector1.Children.OfType<OccWdVirtualPin>().Last();
    cablePin2 = connector2.Children.OfType<OccWdVirtualPin>().Last();
    connections.Add(new Connection(cablePin1, cablePin2));
    
    // Wire 3 will be latent:
    cablePin1 = null;
    cablePin2 = null;
    connections.Add(new Connection(cablePin1, cablePin2));
    
    // Wire 4: Only to the group pin. Will not connect to any virtual pin.
    cablePin1 = connector1.Children.OfType<OccWdPin>().First();
    cablePin2 = connector2.Children.OfType<OccWdPin>().First();
    connections.Add(new Connection(cablePin1, cablePin2));
    
    // Missing connection for the fifth wire => this wire will be latent.
    
    IOccCable cable = workdesk.PlaceRapidPrototypeCable(
    	new PlacePosition(new TransformProperty<LengthProperty>(new LengthProperty(-10, Unit.Millimeter), new LengthProperty(10, Unit.Millimeter), new LengthProperty(10, Unit.Millimeter))),
    	new List<TransformProperty<LengthProperty>>(),
    	new PlacePosition(new TransformProperty<LengthProperty>(new LengthProperty(50, Unit.Millimeter), new LengthProperty(10, Unit.Millimeter), new LengthProperty(10, Unit.Millimeter))),
    	connections,
    	new RapidCableDefinition()
    	{
    		NumberOfWires = 5,
    	}
    );
    This example shows options how to connect a cable insulator directly to grouped pins.
    // Obtain workspace beforehand.
    Workspace workspace = ...
    
    OccWsConnector connector1 = ...
    OccWsConnector connector2 = ...
    
    // Grouped pins of these connectors.
    OccWsGroupedPin groupedPin1 = connector1.Children.OfType<OccWsGroupedPin>().First();
    OccWsGroupedPin groupedPin2 = connector2.Children.OfType<OccWsGroupedPin>().First();
    
    List<Connection> connections = new List<Connection>();
    connections.Add(...);
    // Add connections of the cable wires to virtual pins.
    
    // Connect cable insulator directly to the grouped pins.
    IOccCable cable = workspace.PlaceRapidPrototypeCable(new PlacePosition(groupedPin1), new List<TransformProperty<LengthProperty>>(), new PlacePosition(groupedPin2), connections);
    See Also