Ejemplo n.º 1
0
            public static bool Recognization(MEPCurve duct)
            {
                try
                {
                    _area = Math.PI * duct.Diameter * duct.Diameter / 4;
                }
                catch
                {
                    try
                    {
                        _area = Math.PI * duct.Width * duct.Height;
                    }
                    catch
                    {
                        _abandonWriter.WriteAbandonment(duct, AbandonmentTable.Duct_CrossSectionOOR);
                        return(false);
                    }
                }
                _length = duct.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble();
                _level  = _doc.GetElement(duct.get_Parameter(BuiltInParameter.RBS_START_LEVEL_PARAM).AsElementId()) as Level;
                _offset = duct.get_Parameter(BuiltInParameter.RBS_START_OFFSET_PARAM).AsDouble();
                bool isFound;

                _floor = _myLevel.GetFloor(out isFound, _level, _offset) - 1;
                if (_floor == MyLevel.GetLevelNum())
                {
                    _abandonWriter.WriteAbandonment(duct, AbandonmentTable.LevelNotFound);
                    return(false);
                }
                return(true);
            }
Ejemplo n.º 2
0
            public static bool Recognization(Ceiling ceiling)
            {
                _ceiling = ceiling;
                _area    = ceiling.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
                _level   = _doc.GetElement(ceiling.get_Parameter(BuiltInParameter.LEVEL_PARAM).AsElementId()) as Level;
                _offset  = ceiling.get_Parameter(BuiltInParameter.CEILING_HEIGHTABOVELEVEL_PARAM).AsDouble();
                bool isFound;

                _floor = _myLevel.GetFloor(out isFound, _level, _offset) - 1;
                if (_floor == MyLevel.GetLevelNum() || _floor == -1)
                {
                    _abandonWriter.WriteAbandonment(ceiling, AbandonmentTable.LevelNotFound);
                    return(false);
                }
                return(true);
            }
Ejemplo n.º 3
0
        protected bool TryGetFIFloor(Document doc)
        {
            Level  level  = doc.GetElement(_fi.LevelId) as Level;
            double offset = _fi.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).AsDouble();
            bool   isFound;

            _floor = MyLevel.GetMyLevel().GetFloor(out isFound, level, offset);
            if (MyLevel.GetLevelNum() <= _floor)
            {
                AbandonmentWriter.GetWriter().WriteAbandonment(_fi, AbandonmentTable.LevelOutOfRoof);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 4
0
            public static void UpdateToPGs()
            {
                bool isFound;

                _floor_bottom =
                    _myLevel.GetFloor(out isFound, _level_bottom, _offset_bottom);
                _floor_top =
                    _myLevel.GetWallTopFloor(out isFound, _level_bottom, _offset_bottom, _noConsHeight);

                if (!(MyLevel.isLegalFloorIndex(_floor_bottom) && MyLevel.isLegalFloorIndex(_floor_top)))
                {
                    _abandonWriter.WriteAbandonment(_wall as Element, AbandonmentTable.LevelNotFound);
                    return;
                }

                if (_floor_top <= _floor_bottom)
                {
                    _abandonWriter.WriteAbandonment(_wall, AbandonmentTable.Wall_WallTooShort);
                    return;
                }
                if (!isFound)
                {
                    --_floor_top;
                    if (_floor_top == MyLevel.GetLevelNum())
                    {
                        _abandonWriter.WriteAbandonment(_wall, AbandonmentTable.LevelOutOfRoof);
                        return;
                    }
                }
                if (_num_glass == 1)
                {
                    _isSetPGItem[(byte)_direction] = true;
                    while (_floor_bottom < _floor_top)
                    {
                        _PGItems[(byte)_direction].Num[_floor_bottom++] += 1.0;
                    }
                }
                else
                {
                    _isSetPGItem[(byte)_direction + 2] = true;
                    while (_floor_bottom < _floor_top)
                    {
                        _PGItems[(byte)_direction + 2].Num[_floor_bottom++] += 1.0;
                    }
                }
            }
Ejemplo n.º 5
0
            public static bool Recognization(RoofBase roof)
            {
                Level  level  = (Level)_doc.GetElement(roof.get_Parameter(BuiltInParameter.ROOF_BASE_LEVEL_PARAM).AsElementId());
                double offset = roof.get_Parameter(BuiltInParameter.ROOF_LEVEL_OFFSET_PARAM).AsDouble();
                bool   isFound;

                _floor = _myLevel.GetFloor(out isFound, level, offset);
                --_floor;
                if (MyLevel.GetLevelNum() - 2 < _floor || _floor < 0)
                {
                    _abandonWriter.WriteAbandonment(roof, AbandonmentTable.LevelNotFound);
                    return(false);
                }

                CompoundStructure cs = roof.RoofType.GetCompoundStructure();

                try
                {
                    IList <CompoundStructureLayer> layers = cs.GetLayers();
                    Material matl = (Material)_doc.GetElement(layers.First().MaterialId);
                    if (matl.MaterialCategory == _addiInfo.materialTypes[(byte)PGMaterialType.ConcreteTile])
                    {
                        _matlIndex = 1;
                    }
                    else if (matl.MaterialCategory == _addiInfo.materialTypes[(byte)PGMaterialType.ClayTile])
                    {
                        _matlIndex = 2;
                    }
                    else
                    {
                        _abandonWriter.WriteAbandonment(roof, AbandonmentTable.Roof_MatlOOR);
                        return(false);
                    }
                }
                catch
                {
                    _abandonWriter.WriteAbandonment(roof, AbandonmentTable.Roof_MatlOOR);
                    return(false);
                }
                _area = roof.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
                return(true);
            }
Ejemplo n.º 6
0
            public static void UpdateToPGs()
            {
                bool isFound;

                _floor_bottom =
                    _myLevel.GetFloor(out isFound, _level_bottom, _offset_bottom);
                _floor_top =
                    _myLevel.GetWallTopFloor(out isFound, _level_bottom, _offset_bottom, _noConsHeight);

                if (!(MyLevel.isLegalFloorIndex(_floor_bottom) && MyLevel.isLegalFloorIndex(_floor_top)))
                {
                    _abandonWriter.WriteAbandonment(_wall as Element, AbandonmentTable.LevelNotFound);
                    return;
                }

                if (_floor_top <= _floor_bottom)
                {
                    _abandonWriter.WriteAbandonment(_wall, AbandonmentTable.Wall_WallTooShort);
                    return;
                }
                if (!isFound)
                {
                    --_floor_top;
                    if (_floor_top == MyLevel.GetLevelNum())
                    {
                        _abandonWriter.WriteAbandonment(_wall, AbandonmentTable.LevelOutOfRoof);
                    }
                    else                                                //partial height
                    {
                        _area = _length * (_level_top.Elevation + _offset_top - _myLevel.GetElevation(_floor_top));
                        Update(WallHightMode.Partial);
                    }
                }
                while (_floor_bottom < _floor_top)                      //full height
                {
                    _area = _length * (_myLevel.GetElevation(_floor_top) - _myLevel.GetElevation(_floor_bottom));
                    Update(WallHightMode.Full);
                    ++_floor_bottom;
                }
            }
Ejemplo n.º 7
0
            public static bool Recognization(Pipe pipe)
            {
                _pipe = pipe;
                try
                {
                    _diameter = pipe.Diameter * 12;
                }
                catch
                {
                    _abandonWriter.WriteAbandonment(pipe, AbandonmentTable.Pipe_NonCircular);
                    return(false);
                }
                _length = pipe.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble();
                _level  = _doc.GetElement(pipe.get_Parameter(BuiltInParameter.RBS_START_LEVEL_PARAM).AsElementId()) as Level;
                _offset = pipe.get_Parameter(BuiltInParameter.RBS_START_OFFSET_PARAM).AsDouble();
                bool isFound;

                _floor = _myLevel.GetFloor(out isFound, _level, _offset) - 1;
                if (_floor == MyLevel.GetLevelNum() || _floor < 0)
                {
                    _abandonWriter.WriteAbandonment(pipe, AbandonmentTable.LevelOutOfRoof);
                    return(false);
                }
                SDC sdc = _addiInfo.sdc;

                _material = ((Material)_doc.GetElement(pipe.get_Parameter(BuiltInParameter.RBS_PIPE_MATERIAL_PARAM).AsElementId())).MaterialCategory;
                _pipeType = PipeType.Unknown;
                try
                {
                    PipingSystem     pipingSys     = pipe.MEPSystem as PipingSystem;
                    PipingSystemType pipingSysType = _doc.GetElement(pipingSys.GetTypeId()) as PipingSystemType;
                    FluidType        fluidType     = _doc.GetElement(pipingSysType.FluidType) as FluidType;
                    String           pstName       = pipingSysType.Name;

                    if (pstName.Contains("冷水"))
                    {
                        _pipeType = PipeType.ColdWater;
                    }
                    if (pstName.Contains("热水"))
                    {
                        _pipeType = PipeType.HotWater;
                    }
                    if (pstName.Contains("卫生"))
                    {
                        _pipeType = PipeType.SanitaryWater;
                    }
                    if (pstName.Contains("冷却"))
                    {
                        _pipeType = PipeType.ChilledWater;
                    }
                    if (pstName.Contains("蒸汽"))
                    {
                        _pipeType = PipeType.Steam;
                    }
                    if (pstName.Contains("消防"))
                    {
                        _pipeType = PipeType.FireSprinkler;
                    }

                    if (_pipeType == PipeType.Unknown)
                    {
                        double temperature = pipingSysType.FluidTemperature - 273.15;
                        if (5 < temperature && temperature < 15)
                        {
                            _pipeType = PipeType.ColdWater;
                        }
                        else if (30 < temperature && temperature < 100)
                        {
                            _pipeType = PipeType.HotWater;
                        }
                        else if (temperature <= 5)
                        {
                            _pipeType = PipeType.ChilledWater;
                        }
                        else if (100 <= temperature)
                        {
                            _pipeType = PipeType.Steam;
                        }
                        else
                        {
                            _abandonWriter.WriteAbandonment(pipe, AbandonmentTable.Pipe_TypeUnknown);
                            return(false);
                        }
                    }
                }
                catch
                {
                    _abandonWriter.WriteAbandonment(pipe, AbandonmentTable.Pipe_TypeUnknown);
                    return(false);
                }
                if (_pipeType != PipeType.ColdWater && !IsValidMaterial(_material))
                {
                    _abandonWriter.WriteAbandonment(_pipe, AbandonmentTable.Pipe_MatlOOR);
                    return(false);
                }

                return(true);
            }
Ejemplo n.º 8
0
        private static void Process()
        {
            if (_StruColumns.Count() * _StruBeams.Count() == 0)
            {
                return;
            }
            string FGCode;

            if (!TryGetFGCode(out FGCode))
            {
                return;
            }
            int floorNum = MyLevel.GetLevelNum() - 1;

            int[] num      = new int[floorNum];
            int   totalNum = 0;

            for (int i = 0; i < floorNum; ++i)
            {
                int    n, m, k;
                double lowerLevel   = _myLevel.GetElevation(i);
                double upperLevel   = _myLevel.GetElevation(i + 1);
                double deltaHi      = upperLevel - lowerLevel;
                double columnLL     = lowerLevel + deltaHi * 0.3;
                double columnUL     = upperLevel - deltaHi * 0.3;
                XYZ    columnBottom = new XYZ(_maxBB.Min.X, _maxBB.Min.Y, columnLL);
                XYZ    columnTop    = new XYZ(_maxBB.Max.X, _maxBB.Max.Y, columnUL);
                BoundingBoxIntersectsFilter columnBBFilter = new BoundingBoxIntersectsFilter(new Outline(columnBottom, columnTop));
                FilteredElementCollector    columnFec      = new FilteredElementCollector(_doc, _StruColumns);
                columnFec.WherePasses(columnBBFilter);
                double beamLL     = lowerLevel + deltaHi * 0.7;
                double beamUL     = upperLevel + deltaHi * 0.3;
                XYZ    beamBottom = new XYZ(_maxBB.Min.X, _maxBB.Min.Y, beamLL);
                XYZ    beamTop    = new XYZ(_maxBB.Max.X, _maxBB.Max.Y, beamUL);
                BoundingBoxIntersectsFilter beamBBFilter = new BoundingBoxIntersectsFilter(new Outline(beamBottom, beamTop));
                FilteredElementCollector    beamFec      = new FilteredElementCollector(_doc, _StruBeams);
                beamFec.WherePasses(beamBBFilter);
                if (columnFec.Count() * beamFec.Count() == 0)
                {
                    continue;
                }
                GetNMK(columnFec.ToElementIds().ToList(), beamFec.ToElementIds().ToList(), out n, out m, out k);
                num[i]    = m - n + k;
                totalNum += num[i];
            }
            if (totalNum != 0)
            {
                PGItem pgItem = new PGItem();
                pgItem.Code         = FGCode;
                pgItem.direction    = Direction.Undefined;
                pgItem.PGName       = "支撑刚架";
                pgItem.PinYinSuffix = "ZhiChengGangJia";
                pgItem.Price        = _addiInfo.prices[(byte)PGComponents.BracedFrame];
                if (pgItem.Price == 0.0)
                {
                    pgItem.IfDefinePrice = false;
                }
                else
                {
                    pgItem.IfDefinePrice = true;
                }
                for (int i = 0; i < floorNum; ++i)
                {
                    pgItem.Num[i] = num[i];
                }
                _PGItems.Add(pgItem);
            }
        }