AlignPartByInsertionPointAndCutInToStraight Method


Align the part by its insertion point to a point and rotation on a straight. This will automatically size and connect the part being cut into, if possible.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2018

Syntax

C#
public static bool AlignPartByInsertionPointAndCutInToStraight(
	Document document,
	ElementId straightId,
	ElementId partId,
	XYZ position,
	double rotation,
	double slope,
	bool flip
)
Visual Basic
Public Shared Function AlignPartByInsertionPointAndCutInToStraight ( _
	document As Document, _
	straightId As ElementId, _
	partId As ElementId, _
	position As XYZ, _
	rotation As Double, _
	slope As Double, _
	flip As Boolean _
) As Boolean
Visual C++
public:
static bool AlignPartByInsertionPointAndCutInToStraight(
	Document^ document, 
	ElementId^ straightId, 
	ElementId^ partId, 
	XYZ^ position, 
	double rotation, 
	double slope, 
	bool flip
)

Parameters

document
Type: Autodesk.Revit.DBDocument
The document.
straightId
Type: Autodesk.Revit.DBElementId
The element identifier of the straight to be cut in to.
partId
Type: Autodesk.Revit.DBElementId
The element identifier of the part to align and cut in with.
position
Type: Autodesk.Revit.DBXYZ
The position to move the parts insertion point to.
rotation
Type: SystemDouble
The rotation in radians.
slope
Type: SystemDouble
The slope value to flex to match if possible in fractional units (eg.1/50). Positive values are up, negative are down. Slopes can only be applied to fittings, whilst straights will inherit the slope from the piece it is connecting to.
flip
Type: SystemBoolean
Flip the part to allow for flow direction.

Return Value

True if the alignment succeeds, false otherwise.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException The element is not a fabrication part. -or- Not all of the fabrication part's connectors are open. -or- The part is not a straight. -or- The fabrication parts do not have matching domain types. -or- The position is not on the straight.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsInvalidOperationException Failed to align the part to the straight to cut in to.

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →