FabricationPart.CreateHanger(Document, FabricationServiceButton, Int32, ElementId, Connector, Double, Boolean) Method

FabricationPartCreateHanger(Document, FabricationServiceButton, Int32, ElementId, Connector, Double, Boolean) Method

Creates a hanger on the fabrication part.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public static FabricationPart CreateHanger(
	Document document,
	FabricationServiceButton button,
	int condition,
	ElementId hostId,
	Connector hostConnector,
	double distance,
	bool attachToStructure
)
Public Shared Function CreateHanger ( 
	document As Document,
	button As FabricationServiceButton,
	condition As Integer,
	hostId As ElementId,
	hostConnector As Connector,
	distance As Double,
	attachToStructure As Boolean
) As FabricationPart
public:
static FabricationPart^ CreateHanger(
	Document^ document, 
	FabricationServiceButton^ button, 
	int condition, 
	ElementId^ hostId, 
	Connector^ hostConnector, 
	double distance, 
	bool attachToStructure
)
static member CreateHanger : 
        document : Document * 
        button : FabricationServiceButton * 
        condition : int * 
        hostId : ElementId * 
        hostConnector : Connector * 
        distance : float * 
        attachToStructure : bool -> FabricationPart 

Parameters

document  Document
The document.
button  FabricationServiceButton
The fabrication service button to use.
condition  Int32
The condition index. If the button has multiple conditions.
hostId  ElementId
The host part id. The host should be one horizontal straight part.
hostConnector  Connector
The connector of the host.
distance  Double
The distance from the input connector of the host part. Units are in feet (ft).
attachToStructure  Boolean
Attach to the nearest structural element. The structural element might be one of Floor/Roof/Stair/Structural Framing.

Return Value

FabricationPart
The newly-created fabrication hanger.
Exceptions
ExceptionCondition
ArgumentException Hangers may only be placed on straight horizontal fabrication segments and some kind of fittings. -or- Invalid fabrication service button.
ArgumentNullException A non-optional argument was null
ArgumentOutOfRangeException The index condition is not larger or equal to 0 and less than ConditionCount.
InvalidOperationException the distance is out of range. -or- cannot find suitable fabrication part for the host. -or- cannot place hanger on the host.
See Also