Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / PlaceSurfaceProtection Method / PlaceSurfaceProtection(LibSurfaceProtection,IEnumerable<PlacePosition>,LengthProperty,ApiLinkType) Method
Surface protection from library.
List of positions in space or occurrences to which the bundle will be connected. The order of positions matters!
Outside diameter of the bundle. If not filled, the default value from settings is used.
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
    PlaceSurfaceProtection(LibSurfaceProtection,IEnumerable<PlacePosition>,LengthProperty,ApiLinkType) Method
    In This Topic
    Place surface protection in space.
    Syntax

    Parameters

    part
    Surface protection from library.
    positions
    List of positions in space or occurrences to which the bundle will be connected. The order of positions matters!
    outsideDiameter
    Outside diameter of the bundle. If not filled, the default value from settings is used.
    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 surface protection.
    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.
    This operation was denied because of your license.
    The exception that is thrown when the part cannot be placed to workspace/workdesk.
    This file is not opened.
    Remarks
    Conditions of placing the surface:
    Example
    This example shows how to place a new surface protection on a new bundle to positions in space.
    Workdesk workdesk = ...
    
    // Prepare positions.
    List<PlacePosition> placePositions = new List<PlacePosition>();
    placePositions.Add(new PlacePosition(new TransformProperty<LengthProperty>(new LengthProperty(0, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter))));
    placePositions.Add(new PlacePosition(new TransformProperty<LengthProperty>(new LengthProperty(100, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter))));
    
    // Prepare LibSurfaceProtection.
    LibSurfaceProtection surfaceProtection = ...
    
    IOccSurfaceProtection surfaceProtectionOccurrence = workdesk.PlaceSurfaceProtection(surfaceProtection, placePositions);
    This example shows how to start the new bundle from a control point of another bundle.
    Workdesk workdesk = ...
    OccWdBundle bundle = ...
    
    // Prepare positions.
    List<PlacePosition> placePositions = new List<PlacePosition>();
    placePositions.Add(new PlacePosition(bundle.GetAllControlPoints().First()));
    placePositions.Add(new PlacePosition(new TransformProperty<LengthProperty>(new LengthProperty(0, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter), new LengthProperty(0, Unit.Millimeter))));
    
    // Prepare LibSurfaceProtection
    LibSurfaceProtection surfaceProtection = ...
    
    workdesk.PlaceSurfaceProtection(surfaceProtection, placePositions);
    This example shows how to connect a bundle with leading parts.
    Workdesk workdesk = ...
    OccWdLeadingPartEndPoint leadingPartEndPoint = ...
    OccWdClipPoint clipPoint = ...
    OccWdLeadingPartEndPoint grommetEndPoint = ...
    
    // Prepare positions.
    List<PlacePosition> placePositions = new List<PlacePosition>();
    placePositions.Add(new PlacePosition(leadingPartEndPoint));
    placePositions.Add(new PlacePosition(clipPoint));
    placePositions.Add(new PlacePosition(grommetEndPoint));
    
    // Prepare LibSurfaceProtection
    LibSurfaceProtection surfaceProtection = ...
    
    workdesk.PlaceSurfaceProtection(surfaceProtection, placePositions);
    See Also