ScaleToBox Method


Move and resize the bar to fit within a specified box. The arguments are interpreted as an arbitrary rectangle in 3D with vertices: origin, origin+xVec, origin+xVec+yVec, origin+yVec. The algorithm then proceeds as follows. First the bar is given the default values of the shape parameters from the shape definition. Then, if it is possible to do so without violating the shape definition, the parameter values are scaled so that the width and height of the shape (including bar thickness) match the lengths of xVec and yVec. If there is no way to do this within the shape definition due to overconstraining, a compromise is attempted, such as scaling the whole shape until either the width or the height is correct. Finally the shape is rotated to match the coordinate system of the box. The algorithm is the same one used in one-click placement.

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

Syntax

C#
public void ScaleToBox(
	XYZ origin,
	XYZ xVec,
	XYZ yVec
)
Visual Basic
Public Sub ScaleToBox ( _
	origin As XYZ, _
	xVec As XYZ, _
	yVec As XYZ _
)
Visual C++
public:
void ScaleToBox(
	XYZ^ origin, 
	XYZ^ xVec, 
	XYZ^ yVec
)

Parameters

origin
Type: Autodesk.Revit.DB XYZ
One corner of the rectangle.
xVec
Type: Autodesk.Revit.DB XYZ
Vector representing the first edge of the rectangle. The length must be positive.
yVec
Type: Autodesk.Revit.DB XYZ
Vector representing the second edge of the rectangle. Must be perpendicular to xVec.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException xVec has zero length. -or- yVec has zero length.
Autodesk.Revit.Exceptions DisabledDisciplineException None of the following disciplines is enabled: Structural.
Autodesk.Revit.Exceptions InapplicableDataException This Rebar is an instance of a spiral or multiplanar shape.
Autodesk.Revit.Exceptions InvalidOperationException The operation has failed for geometric reasons, such as the box being too small given the bar diameter.

See Also