CreateHanger Method (Document, FabricationServiceButton, ElementId, Connector, Double, Boolean)


Creates a hanger on the fabrication part.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 17.0.0.0 (17.0.484.0)
Since: 2016

Syntax

C#
public static FabricationPart CreateHanger(
	Document document,
	FabricationServiceButton button,
	ElementId hostId,
	Connector hostConnector,
	double distance,
	bool attachToStructure
)
Visual Basic
Public Shared Function CreateHanger ( _
	document As Document, _
	button As FabricationServiceButton, _
	hostId As ElementId, _
	hostConnector As Connector, _
	distance As Double, _
	attachToStructure As Boolean _
) As FabricationPart
Visual C++
public:
static FabricationPart^ CreateHanger(
	Document^ document, 
	FabricationServiceButton^ button, 
	ElementId^ hostId, 
	Connector^ hostConnector, 
	double distance, 
	bool attachToStructure
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document.
button
Type: Autodesk.Revit.DB FabricationServiceButton
The fabrication service button to use. It finds the matching condition automatically if the button has multiple condition.
hostId
Type: Autodesk.Revit.DB ElementId
The host part id. The host should be one horizontal straight part.
hostConnector
Type: Autodesk.Revit.DB Connector
The connector of the host.
distance
Type: System Double
The distance from the input connector of the host part. Units are in feet (ft).
attachToStructure
Type: System Boolean
Attach to the nearest structural element. The structural element might be one of Floor/Roof/Stair/Structure Framing.

Return Value

The newly-created fabrication hanger.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException Hangers may only be placed on straight horizontal fabrication segments and some kind of fittings. -or- Invalid fabrication service button. -or- The distance is out of range.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions InvalidOperationException cannot place hanger on the host.

See Also