コード例 #1
0
        /// <summary>
        /// Creates a wall given its properties.
        /// </summary>
        /// <param name="properties"> Properties of the object.</param>
        private Wall CreateWall(WallProperty properties, string wallTypeName)
        {
            if (properties is null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            XYZ  p0 = GetXYZFromProperties(properties.Coordinate[0]);
            XYZ  p1 = GetXYZFromProperties(properties.Coordinate[1]);
            Wall wall;

            try
            {
                Curve curve = Line.CreateBound(p0, p1);
                // sellect wall type
                WallType wallType = revitDB.GetWallType(wallTypeName);

                // Creating the wall
                double height = UnitUtils.ConvertToInternalUnits(2.8, UnitTypeId.Meters);
                wall = Wall.Create(doc, curve, wallType.Id, baseLevel.Id, height, 0, false, false);
                wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(topLevel.Id);
                wall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(UnitUtils.ConvertToInternalUnits(-0.1, UnitTypeId.Meters));
            }
            catch (Exception e)
            {
                throw new Exception($"Erro ao inserir parede {properties}.", e);
            }
            Walls.Add(wall);
            return(wall);
        }
コード例 #2
0
        private void CreateParapetWall(CurveArray curveArray)
        {
            foreach (Curve curve in curveArray)
            {
                XYZ      curveMiddlePoint = GetCurveMiddlePoint(curve);
                WallType wallType         = revitDB.GetWallType(Properties.Settings.Default.WallTypeName);
                Wall     parapetWall      = Wall.Create(document, curve, wallType.Id, roofLevel.Id, UnitUtils.ConvertToInternalUnits(0.8, UnitTypeId.Meters), 0, false, false);

                Wall wall = hb.FindWall(curveMiddlePoint, baseLevel);
                if (wall != null)
                {
                    try { JoinGeometryUtils.JoinGeometry(document, wall, parapetWall); }
                    catch { continue; }
                }
            }
        }