/// <summary> /// Create a Revit Structural Member - a special FamilyInstance /// </summary> /// <param name="curve">The curve path for the structural member</param> /// <param name="upVector">The up vector for the element - this is required to determine the orientation of the element</param> /// <param name="level">The level on which the member should appear</param> /// <param name="structuralType">The type of the structural element - a beam, column, etc</param> /// <param name="structuralFamilySymbol">The FamilySymbol representing the structural type</param> /// <returns></returns> public static StructuralFraming ByCurveLevelUpVectorAndType(Autodesk.DesignScript.Geometry.Curve curve, Level level, Autodesk.DesignScript.Geometry.Vector upVector, StructuralType structuralType, FamilySymbol structuralFamilySymbol) { if (curve == null) { throw new ArgumentNullException("curve"); } if (level == null) { throw new ArgumentNullException("level"); } if (upVector == null) { throw new ArgumentNullException("upVector"); } if (structuralFamilySymbol == null) { throw new ArgumentNullException("structuralFamilySymbol"); } return(new StructuralFraming(curve.ToRevitType(), upVector.ToXyz(), level.InternalLevel, structuralType.ToRevitType(), structuralFamilySymbol.InternalFamilySymbol)); }
/// <summary> /// Place a Revit family instance given the FamilyType (also known as the FamilySymbol in the Revit API) /// on a surface derived from a backing Revit face as reference, a reference direction and a point location where to place the family. /// /// Note: The FamilyType should be workplane based and the input surface must be created from a Revit Face. The reference direction defines the rotation of the instance on the reference, and thus cannot be perpendicular to the face. /// </summary> /// <param name="familyType">Family Type. Also called Family Symbol.</param> /// <param name="face">Surface geometry derived from a Revit face as reference element</param> /// <param name="location">Point on the face where the instance is to be placed</param> /// <param name="referenceDirection">A vector that defines the direction of placement of the family instance</param> /// <returns>FamilyInstance</returns> public static FamilyInstance ByFace(FamilyType familyType, Surface face, Point location, Vector referenceDirection) { if (familyType == null) { throw new ArgumentNullException("familyType"); } if (face == null) { throw new ArgumentNullException("face"); } if (location == null) { throw new ArgumentNullException("location"); } if (referenceDirection == null) { throw new ArgumentNullException("referenceDirection"); } var reference = ElementFaceReference.TryGetFaceReference(face); return(new FamilyInstance(familyType.InternalFamilySymbol, reference.InternalReference, location.ToXyz(), referenceDirection.ToXyz())); }