Ejemplo n.º 1
0
        private RevitFloor FloorToSpeckle(DB.Floor revitFloor)
        {
            var profiles = GetProfiles(revitFloor);

            var speckleFloor = new RevitFloor();

            speckleFloor.type    = Doc.GetElement(revitFloor.GetTypeId()).Name;
            speckleFloor.outline = profiles[0];
            if (profiles.Count > 1)
            {
                speckleFloor.voids = profiles.Skip(1).ToList();
            }

            speckleFloor.level      = ConvertAndCacheLevel(revitFloor, BuiltInParameter.LEVEL_PARAM);
            speckleFloor.structural = GetParamValue <bool>(revitFloor, BuiltInParameter.FLOOR_PARAM_IS_STRUCTURAL);

            GetAllRevitParamsAndIds(speckleFloor, revitFloor, new List <string> {
                "LEVEL_PARAM", "FLOOR_PARAM_IS_STRUCTURAL"
            });

            speckleFloor.displayMesh = GetElementDisplayMesh(revitFloor, new Options()
            {
                DetailLevel = ViewDetailLevel.Fine, ComputeReferences = false
            });

            GetHostedElements(speckleFloor, revitFloor);
            //Report.Log($"Converted Floor {revitFloor.Id}");
            return(speckleFloor);
        }
Ejemplo n.º 2
0
        public List <ApplicationPlaceholderObject> AnalyticalSurfaceToNative(Element2D speckleElement)
        {
            List <ApplicationPlaceholderObject> placeholderObjects = new List <ApplicationPlaceholderObject> {
            };

            switch (speckleElement.property.type)
            {
            case Structural.PropertyType2D.Wall:
                Geometry.Line baseline         = GetBottomLine(speckleElement.topology);
                double        lowestElvevation = speckleElement.topology.Min(node => node.basePoint.z);
                double        topElevation     = speckleElement.topology.Max(node => node.basePoint.z);
                Node          bottomNode       = speckleElement.topology.Find(node => node.basePoint.z == lowestElvevation);
                Node          topNode          = speckleElement.topology.Find(node => node.basePoint.z == topElevation);
                var           bottemLevel      = LevelFromPoint(PointToNative(bottomNode.basePoint));
                var           topLevel         = LevelFromPoint(PointToNative(topNode.basePoint));
                RevitWall     revitWall        = new RevitWall(speckleElement.property.name, speckleElement.property.name, baseline, bottemLevel, topLevel);
                return(WallToNative(revitWall));

                break;

            default:
                var        polycurve  = PolycurveFromTopology(speckleElement.topology);
                var        level      = LevelFromPoint(PointToNative(speckleElement.topology[0].basePoint));
                RevitFloor revitFloor = new RevitFloor(speckleElement.property.name, speckleElement.property.name, polycurve, level);
                return(FloorToNative(revitFloor));

                break;
            }
            return(placeholderObjects);
        }