Download Revit 2013 API Developer Guide - The Building Coder
Transcript
Reference curveReference = analyticalModelFrame.GetReference(amSelector);
// test the stable reference to the start point of the curve
amSelector.CurveSelector = AnalyticalCurveSelector.StartPoint;
Reference startPointReference = analyticalModelFrame.GetReference(amSelector);
// test the stable reference to the start point of the curve
amSelector.CurveSelector = AnalyticalCurveSelector.EndPoint;
Reference endPointReference = analyticalModelFrame.GetReference(amSelector);
}
return true;
}
GetPoint()
If the AnalyticalModel can be expressed by a single point (i.e. Structural Footing), this method will return that point. Otherwise, it will throw an
Autodesk.Revit.Exceptions.InapplicableDataException. The IsSinglePoint() method can be used to determine if the AnalyticalModel can be expressed by a single point.
The following example demonstrates how to get the analytical location for a structural footing.
Code Region 29-11: Getting the location for a structural footing
// retrieve and iterate current selected element
UIDocument uidoc = commandData.Application.ActiveUIDocument;
ElementSet selection = uidoc.Selection.Elements;
foreach (Element e in selection)
{
// if the element is structural footing
FamilyInstance familyInst = e as FamilyInstance;
if (null != familyInst && familyInst.StructuralType == StructuralType.Footing)
{
AnalyticalModel model = familyInst.GetAnalyticalModel();
// structural footing should be expressable as a single point
if (model.IsSinglePoint() == true)
{
XYZ analyticalLocationPoint = model.GetPoint();
}
}
}
GetCurve()
If the AnalyticalModel can be expressed by a single curve (i.e. Structural Column or Structural Framing), this method will return that Curve. Otherwise, it will throw an
Autodesk.Revit.Exceptions.InapplicableDataException. The IsSingleCurve() method can be used to determine if the AnalyticalModel can be expressed by a single curve.
Code Region 29-12: Getting the curve for a structural column
public void GetColumnCurve(FamilyInstance familyInst)
{
// get AnalyticalModel from structural column
if (familyInst.StructuralType == StructuralType.Column)
{
AnalyticalModel modelColumn = familyInst.GetAnalyticalModel();
// column should be represented by a single curve
if (modelColumn.IsSingleCurve() == true)