2021 Method
Changes 4
M

Document.NewAreaBoundaryConditions

Description:
Creates a new Area BoundaryConditions element on a reference.
Remarks:
This method will only function with the Autodesk Revit Structure application.
Overloads (2):
NewAreaBoundaryConditions(Reference,TranslationRotationValue,Double,TranslationRotationValue,Double,TranslationRotationValue,Double)
public BoundaryConditions NewAreaBoundaryConditions(
	Reference reference,
	TranslationRotationValue X_Translation,
	double X_TranslationSpringModulus,
	TranslationRotationValue Y_Translation,
	double Y_TranslationSpringModulus,
	TranslationRotationValue Z_Translation,
	double Z_TranslationSpringModulus
)
Return Value nullNothingnullptr If successful, NewAreaBoundaryConditions returns an object for the newly created BoundaryConditions with the BoundaryType = 2 - "Area". null Nothing nullptr a null reference ( Nothing in Visual Basic) is returned if the operation fails.
bool CreateAreaConditionWithReference(Wall wall, Autodesk.Revit.Creation.Document docCreation)
 {
     // Get the Geometry reference to the wall
     Reference profileReference = null;
     AnalyticalModel analytical = wall.GetAnalyticalModel() as AnalyticalModel;
     if (null == analytical)
     {
         return false; // the profile reference can't be retrieved.
     }

     // loop through the curves of the wall and get the first one as a reference
     foreach (Curve curve in analytical.GetCurves(AnalyticalCurveType.ActiveCurves))
     {
         profileReference = curve.Reference;
         if (null != profileReference)
         {
             break;
         }
     }

     BoundaryConditions condition = null;
     // Create the Area Boundary Conditions if we have a profileReference
     if (null != profileReference)
     {
         // Create Area Boundary Conditions with profile reference.
         condition = docCreation.NewAreaBoundaryConditions(profileReference, TranslationRotationValue.Fixed, 0,
                                                                             TranslationRotationValue.Fixed, 0,
                                                                             TranslationRotationValue.Fixed, 0);
     }
     return (null != condition);
}