Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / CableDrawing Class / PlaceOuterDimension Method
First control point.
Type of the 1st control point. Use EPLAN.Harness.API.Common.Enums.ApiDimensionPointType.Center if not known.
Second control point.
Type of the 2nd control point. Use EPLAN.Harness.API.Common.Enums.ApiDimensionPointType.Center if not known.
Position of the dimension number (text).
Example
In This Topic
    PlaceOuterDimension Method (CableDrawing)
    In This Topic
    Place outer dimension between two selected control points.
    Syntax

    Parameters

    controlPoint1
    First control point.
    pointType1
    Type of the 1st control point. Use EPLAN.Harness.API.Common.Enums.ApiDimensionPointType.Center if not known.
    controlPoint2
    Second control point.
    pointType2
    Type of the 2nd control point. Use EPLAN.Harness.API.Common.Enums.ApiDimensionPointType.Center if not known.
    position
    Position of the dimension number (text).

    Return Value

    Created occurrence of dimension.
    Exceptions
    ExceptionDescription
    Argument is null.
    Argument is invalid. The exception is thrown when a wrong argument is passed to the method or the setter of property.
    The operation was not successful.
    Example
    // Init API.
    HpdApi api = HpdApi.GetInstance();
    
    // Open rpoject.
    Project project = api.OpenProject(@"d:\Projects\Demo\Demo.hxproj");
    
    // Open and select variant and cable drawing.
    Variant variant = project.GetVariants()[0];
    Drawing2D drawing = variant.GetCableDrawings().FirstOrDefault(d => d.Name == "Cable drawing_1");
    drawing.Open(false, false);
    
    try
    {
    	// Select control points.
    	ICdControlPoint cp1 = drawing.GetAllOccurrences().OfType<ICdControlPoint>().FirstOrDefault(c => c.Name == "cp_00015");
    	ICdControlPoint cp2 = drawing.GetAllOccurrences().OfType<ICdControlPoint>().FirstOrDefault(c => c.Name == "cp_00008");
    
    	// Create the dimension.
    	OccCdOuterDimension dimension = (drawing as CableDrawing)?.PlaceOuterDimension(cp1, ApiDimensionPointType.Center, cp2, ApiDimensionPointType.Center, new Transform2DProperty<LengthProperty>("18mm", "-18mm"));
    }
    catch (Exception e)
    {
    	// Handle the exception here.
    }
    
    // Save changes and close documents.
    drawing?.Save();
    drawing?.Close();
    project?.Close();
    api?.Close();
    See Also