Esempio n. 1
0
        /***************************************************/

        public static FamilyInstance FamilyInstance(Document document, FamilySymbol familySymbol, Curve curve, Element host = null, RevitSettings settings = null)
        {
            if (document == null || familySymbol == null || curve == null)
            {
                return(null);
            }

            settings = settings.DefaultIfNull();

            switch (familySymbol.Family.FamilyPlacementType)
            {
            case FamilyPlacementType.TwoLevelsBased:
                return(Create.FamilyInstance_TwoLevelsBased(document, familySymbol, curve, host, settings));

            case FamilyPlacementType.WorkPlaneBased:
                return(Create.FamilyInstance_WorkPlaneBased(document, familySymbol, curve, host, settings));

            case FamilyPlacementType.CurveBased:
                return(Create.FamilyInstance_CurveBased(document, familySymbol, curve, host, settings));

            case FamilyPlacementType.CurveDrivenStructural:
                return(Create.FamilyInstance_CurveDrivenStructural(document, familySymbol, curve, host, settings));

            case FamilyPlacementType.ViewBased:
            case FamilyPlacementType.CurveBasedDetail:
                familySymbol.FamilyPlacementTypeDraftingError();
                return(null);

            default:
                BH.Engine.Reflection.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} does not support curve locations. Revit ElementId: {familySymbol.Id.IntegerValue}");
                return(null);
            }
        }
Esempio n. 2
0
        /***************************************************/
        /****              Public methods               ****/
        /***************************************************/

        public static FamilyInstance FamilyInstance(Document document, FamilySymbol familySymbol, XYZ origin, Transform orientation = null, Element host = null, RevitSettings settings = null)
        {
            if (document == null || familySymbol == null || origin == null)
            {
                return(null);
            }

            settings = settings.DefaultIfNull();

            switch (familySymbol.Family.FamilyPlacementType)
            {
            case FamilyPlacementType.OneLevelBased:
                return(Create.FamilyInstance_OneLevelBased(document, familySymbol, origin, orientation, host, settings));

            case FamilyPlacementType.OneLevelBasedHosted:
                return(Create.FamilyInstance_OneLevelBasedHosted(document, familySymbol, origin, orientation, host, settings));

            case FamilyPlacementType.TwoLevelsBased:
                return(Create.FamilyInstance_TwoLevelBased(document, familySymbol, origin, orientation, host, settings));

            case FamilyPlacementType.WorkPlaneBased:
                return(Create.FamilyInstance_WorkPlaneBased(document, familySymbol, origin, orientation, host, settings));

            case FamilyPlacementType.ViewBased:
            case FamilyPlacementType.CurveBasedDetail:
                familySymbol.FamilyPlacementTypeDraftingError();
                return(null);

            default:
                BH.Engine.Reflection.Compute.RecordError($"Revit family placement type named {familySymbol.Family.FamilyPlacementType} does not support point locations. Revit ElementId: {familySymbol.Id.IntegerValue}");
                return(null);
            }
        }