SetOffset Method


Sets the offset of the analytical model at end.

Namespace: Autodesk.Revit.DB.Structure
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2011

Syntax

C#
public void SetOffset(
	AnalyticalElementSelector selector,
	XYZ offset
)
Visual Basic
Public Sub SetOffset ( _
	selector As AnalyticalElementSelector, _
	offset As XYZ _
)
Visual C++
public:
void SetOffset(
	AnalyticalElementSelector selector, 
	XYZ^ offset
)

Parameters

selector
Type: Autodesk.Revit.DB.Structure AnalyticalElementSelector
End of analytical model to offset.
offset
Type: Autodesk.Revit.DB XYZ
New offset for end of analytical model.

Examples

Copy C#
// extend the analytical model by 1 foot at each end. Direction of offset is parallel to the analytical model curve.
AnalyticalModel model = familyInstance.GetAnalyticalModel();
Curve curve = model.GetCurve();
XYZ tangentDirection0 = curve.ComputeDerivatives(0, true).BasisX.Normalize().Negate();
XYZ tangentDirection1 = curve.ComputeDerivatives(1, true).BasisX.Normalize();
model.SetOffset(AnalyticalElementSelector.StartOrBase, tangentDirection0);
model.SetOffset(AnalyticalElementSelector.EndOrTop, tangentDirection1);
Copy VB.NET
' extend the analytical model by 1 foot at each end. Direction of offset is parallel to the analytical model curve.
Dim model As AnalyticalModel = familyInstance.GetAnalyticalModel()
Dim curve As Curve = model.GetCurve()
Dim tangentDirection0 As XYZ = curve.ComputeDerivatives(0, True).BasisX.Normalize().Negate()
Dim tangentDirection1 As XYZ = curve.ComputeDerivatives(1, True).BasisX.Normalize()
model.SetOffset(AnalyticalElementSelector.StartOrBase, tangentDirection0)
model.SetOffset(AnalyticalElementSelector.EndOrTop, tangentDirection1)

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration
Autodesk.Revit.Exceptions InvalidOperationException Function only work for curve-based elements.

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →