NewArcLengthDimension Method (View, Arc, Reference, Reference, Reference)


Creates a new arc length dimension object using the default dimension type.

Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public Dimension NewArcLengthDimension(
	View view,
	Arc arc,
	Reference arcRef,
	Reference firstRef,
	Reference secondRef
)
Visual Basic
Public Function NewArcLengthDimension ( _
	view As View, _
	arc As Arc, _
	arcRef As Reference, _
	firstRef As Reference, _
	secondRef As Reference _
) As Dimension
Visual C++
public:
Dimension^ NewArcLengthDimension(
	View^ view, 
	Arc^ arc, 
	Reference^ arcRef, 
	Reference^ firstRef, 
	Reference^ secondRef
)

Parameters

view
Type: Autodesk.Revit.DB View
The view in which the dimension is to be visible.
arc
Type: Autodesk.Revit.DB Arc
The extension arc of the dimension.
arcRef
Type: Autodesk.Revit.DB Reference
Geometric reference of the arc to which the dimension is to be bound. This reference must be parallel to the extension arc.
firstRef
Type: Autodesk.Revit.DB Reference
The first geometric reference to which the dimension is to be bound. This reference must intersect the arcRef reference.
secondRef
Type: Autodesk.Revit.DB Reference
The second geometric reference to which the dimension is to be bound. This reference must intersect the arcRef reference.

Return Value

If creation was successful the new arc length dimension is returned, otherwise an exception with failure information will be thrown.

Remarks

The currently user set default style is used for the created dimension.

Examples

Copy C#
public Dimension CreateArcDimension(Document document, SketchPlane sketchPlane)
{
    Autodesk.Revit.Creation.Application appCreate = document.Application.Create;
    Line gLine1 = Line.CreateBound(new XYZ(0, 2, 0), new XYZ(2, 2, 0));
    Line gLine2 = Line.CreateBound(new XYZ(0, 2, 0), new XYZ(2, 4, 0));
    Arc arctoDim = Arc.Create(new XYZ(1, 2, 0), new XYZ(-1, 2, 0), new XYZ(0, 3, 0));
    Arc arcofDim = Arc.Create(new XYZ(0, 3, 0), new XYZ(1, 2, 0), new XYZ(0.8, 2.8, 0));

    Autodesk.Revit.Creation.FamilyItemFactory creationFamily = document.FamilyCreate;
    ModelCurve modelCurve1 = creationFamily.NewModelCurve(gLine1, sketchPlane);
    ModelCurve modelCurve2 = creationFamily.NewModelCurve(gLine2, sketchPlane);
    ModelCurve modelCurve3 = creationFamily.NewModelCurve(arctoDim, sketchPlane);
    //get their reference
    Reference ref1 = modelCurve1.GeometryCurve.Reference;
    Reference ref2 = modelCurve2.GeometryCurve.Reference;
    Reference arcRef = modelCurve3.GeometryCurve.Reference;

    Dimension newArcDim = creationFamily.NewArcLengthDimension(document.ActiveView, arcofDim, arcRef, ref1, ref2);
    if (newArcDim == null)
    {
        throw new Exception("Failed to create new arc length dimension.");
    }

    return newArcDim;
}
Copy VB.NET
Public Function CreateArcDimension(document As Document, sketchPlane As SketchPlane) As Dimension
    Dim appCreate As Autodesk.Revit.Creation.Application = document.Application.Create
    Dim gLine1 As Line = Line.CreateBound(New XYZ(0, 2, 0), New XYZ(2, 2, 0))
    Dim gLine2 As Line = Line.CreateBound(New XYZ(0, 2, 0), New XYZ(2, 4, 0))
    Dim arctoDim As Arc = Arc.Create(New XYZ(1, 2, 0), New XYZ(-1, 2, 0), New XYZ(0, 3, 0))
    Dim arcofDim As Arc = Arc.Create(New XYZ(0, 3, 0), New XYZ(1, 2, 0), New XYZ(0.8, 2.8, 0))

    Dim creationFamily As Autodesk.Revit.Creation.FamilyItemFactory = document.FamilyCreate
    Dim modelCurve1 As ModelCurve = creationFamily.NewModelCurve(gLine1, sketchPlane)
    Dim modelCurve2 As ModelCurve = creationFamily.NewModelCurve(gLine2, sketchPlane)
    Dim modelCurve3 As ModelCurve = creationFamily.NewModelCurve(arctoDim, sketchPlane)
    'get their reference
    Dim ref1 As Reference = modelCurve1.GeometryCurve.Reference
    Dim ref2 As Reference = modelCurve2.GeometryCurve.Reference
    Dim arcRef As Reference = modelCurve3.GeometryCurve.Reference

    Dim newArcDim As Dimension = creationFamily.NewArcLengthDimension(document.ActiveView, arcofDim, arcRef, ref1, ref2)
    If newArcDim Is Nothing Then
        Throw New Exception("Failed to create new arc length dimension.")
    End If

    Return newArcDim
End Function

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException Thrown when any input argument is a null reference ( Nothing in Visual Basic) .
Autodesk.Revit.Exceptions ArgumentException Thrown when the argument arcRef/ref1/ref2 is invalid.
Autodesk.Revit.Exceptions InvalidOperationException Thrown when the creation failed.

See Also