//NOTE: there is not API method to create new ceiling //a possible workaround is to duplicate an existing one and edit its profile private RevitCeiling CeilingToSpeckle(DB.Ceiling revitCeiling) { var profiles = GetProfiles(revitCeiling); var speckleCeiling = new RevitCeiling(); speckleCeiling.type = Doc.GetElement(revitCeiling.GetTypeId()).Name; speckleCeiling.outline = profiles[0]; if (profiles.Count > 1) { speckleCeiling.voids = profiles.Skip(1).ToList(); } speckleCeiling.offset = GetParamValue <double>(revitCeiling, BuiltInParameter.CEILING_HEIGHTABOVELEVEL_PARAM); speckleCeiling.level = ConvertAndCacheLevel(revitCeiling, BuiltInParameter.LEVEL_PARAM); GetAllRevitParamsAndIds(speckleCeiling, revitCeiling, new List <string> { "LEVEL_PARAM", "CEILING_HEIGHTABOVELEVEL_PARAM" }); GetHostedElements(speckleCeiling, revitCeiling); var mesh = new Geometry.Mesh(); (mesh.faces, mesh.vertices) = GetFaceVertexArrayFromElement(revitCeiling, new Options() { DetailLevel = ViewDetailLevel.Fine, ComputeReferences = false }); speckleCeiling["@displayMesh"] = mesh; return(speckleCeiling); }
/// <summary> /// Create a Ceiling from a user selected Element. /// </summary> /// <param name="ceiling"></param> /// <param name="isRevitOwned"></param> /// <returns></returns> internal static Ceiling FromExisting(Autodesk.Revit.DB.Ceiling ceiling, bool isRevitOwned) { return(new Ceiling(ceiling) { IsRevitOwned = isRevitOwned }); }
/// <summary> /// Initialize a ceiling element /// </summary> private void InitCeiling(List <CurveLoop> profiles, Autodesk.Revit.DB.CeilingType ceilingType, Autodesk.Revit.DB.Level level) { TransactionManager.Instance.EnsureInTransaction(Document); // we assume the ceiling is not structural here, this may be a bad assumption Autodesk.Revit.DB.Ceiling ceiling = Autodesk.Revit.DB.Ceiling.Create(Document, profiles, ceilingType.Id, level.Id); InternalSetCeiling(ceiling); TransactionManager.Instance.TransactionTaskDone(); ElementBinder.CleanupAndSetElementForTrace(Document, InternalCeiling); }
public bool CanConvertToSpeckle(object @object) { return(@object switch { DB.DetailCurve _ => true, DB.DirectShape _ => true, DB.FamilyInstance _ => true, DB.Floor _ => true, DB.Level _ => true, DB.View _ => true, DB.ModelCurve _ => true, DB.Opening _ => true, DB.RoofBase _ => true, DB.Area _ => true, DB.Architecture.Room _ => true, DB.Architecture.TopographySurface _ => true, DB.Wall _ => true, DB.Mechanical.Duct _ => true, DB.Mechanical.Space _ => true, DB.Plumbing.Pipe _ => true, DB.Electrical.Wire _ => true, DB.CurtainGridLine _ => true, //these should be handled by curtain walls DB.Architecture.BuildingPad _ => true, DB.Architecture.Stairs _ => true, DB.Architecture.StairsRun _ => true, DB.Architecture.StairsLanding _ => true, DB.Architecture.Railing _ => true, DB.Architecture.TopRail _ => true, DB.Ceiling _ => true, DB.PointCloudInstance _ => true, DB.Group _ => true, DB.ProjectInfo _ => true, DB.ElementType _ => true, DB.Grid _ => true, DB.ReferencePoint _ => true, DB.Structure.AnalyticalModelStick _ => true, DB.Structure.AnalyticalModelSurface _ => true, DB.Structure.BoundaryConditions _ => true, _ => (@object as Element).IsElementSupported() });
public Ceiling(DB.Ceiling ceiling) : base(ceiling) { }
/// <summary> /// Set the InternalCeiling property and the associated element id and unique id /// </summary> /// <param name="ceiling"></param> private void InternalSetCeiling(Autodesk.Revit.DB.Ceiling ceiling) { InternalCeiling = ceiling; InternalElementId = ceiling.Id; InternalUniqueId = ceiling.UniqueId; }
/// <summary> /// Initialize a ceiling element /// </summary> private void InitCeiling(Autodesk.Revit.DB.Ceiling ceiling) { InternalSetCeiling(ceiling); }
/// <summary> /// Private constructor /// </summary> private Ceiling(Autodesk.Revit.DB.Ceiling ceiling) { SafeInit(() => InitCeiling(ceiling)); }
public static Ceiling Wrap(Autodesk.Revit.DB.Ceiling ele, bool isRevitOwned) { return(Ceiling.FromExisting(ele, isRevitOwned)); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static oM.Architecture.Elements.Ceiling CeilingFromRevit(this Autodesk.Revit.DB.Ceiling ceiling, RevitSettings settings = null, Dictionary <string, List <IBHoMObject> > refObjects = null) { if (ceiling == null) { return(null); } settings = settings.DefaultIfNull(); oM.Architecture.Elements.Ceiling bHoMCeiling = refObjects.GetValue <oM.Architecture.Elements.Ceiling>(ceiling.Id); if (bHoMCeiling != null) { return(bHoMCeiling); } oM.Physical.Constructions.Construction construction = (ceiling.Document.GetElement(ceiling.GetTypeId()) as HostObjAttributes).ConstructionFromRevit(null, settings, refObjects); ISurface location = null; Dictionary <PlanarSurface, List <PlanarSurface> > surfaces = ceiling.PanelSurfaces(null, settings); if (surfaces != null && surfaces.Count != 0) { List <ISurface> locations = new List <ISurface>(); foreach (KeyValuePair <PlanarSurface, List <PlanarSurface> > kvp in surfaces) { locations.Add(new PlanarSurface(kvp.Key.ExternalBoundary, kvp.Value.Select(x => x.ExternalBoundary).ToList())); } if (locations.Count == 1) { location = locations[0]; } else { location = new PolySurface { Surfaces = locations } }; } else { ceiling.NoPanelLocationError(); } bHoMCeiling = new oM.Architecture.Elements.Ceiling { Surface = location, Construction = construction }; bHoMCeiling.Name = ceiling.FamilyTypeFullName(); // Add ceiling patterns List <BH.oM.Geometry.Line> ceilingPatterns = new List <BH.oM.Geometry.Line>(); if (location is PlanarSurface) { ceilingPatterns.AddRange(ceiling.CeilingPattern(settings, location as PlanarSurface)); } else if (location is PolySurface) { foreach (ISurface surface in ((PolySurface)location).Surfaces) { if (surface is PlanarSurface) { ceilingPatterns.AddRange(ceiling.CeilingPattern(settings, surface as PlanarSurface)); } } } if (ceilingPatterns.Count != 0) { bHoMCeiling.Tiles = BH.Engine.Architecture.Compute.CeilingTiles(bHoMCeiling, ceilingPatterns); } if (surfaces.Values.Where(x => x != null).Sum(x => x.Count) != 0) { BH.Engine.Reflection.Compute.RecordWarning("Currently ceiling openings are not taken into account when generating ceilings."); } //Set identifiers, parameters & custom data bHoMCeiling.SetIdentifiers(ceiling); bHoMCeiling.CopyParameters(ceiling, settings.ParameterSettings); bHoMCeiling.SetProperties(ceiling, settings.ParameterSettings); refObjects.AddOrReplace(ceiling.Id, bHoMCeiling); return(bHoMCeiling); }