Beispiel #1
0
            public static void UpdateToPGs()
            {
                if (_addiInfo.requiredComp[(byte)PGComponents.Ceiling])
                {
                    while (true)
                    {
                        string FGCode = "C3032.";
                        if (_addiInfo.defaultSet[(byte)DefaultSet.Ceiling_LateralSupport] == 0)     //w/o lat support
                        {
                            if (_addiInfo.sdc == SDC.A || _addiInfo.sdc == SDC.B)
                            {
                                FGCode += "001";
                            }
                            else if (_addiInfo.sdc == SDC.C)
                            {
                                FGCode += "002";
                            }
                            else
                            {
                                _abandonWriter.WriteAbandonment(_ceiling, AbandonmentTable.Ceiling_SDCConflictLatSupport);
                                break;
                            }
                        }
                        else
                        {
                            if (_addiInfo.sdc == SDC.A || _addiInfo.sdc == SDC.B || _addiInfo.sdc == SDC.C)
                            {
                                _abandonWriter.WriteAbandonment(_ceiling, AbandonmentTable.Ceiling_SDCConflictLatSupport);
                                break;
                            }
                            if (_addiInfo.defaultSet[(byte)DefaultSet.Ceiling_Ip] == 0)             //Ip = 1.0
                            {
                                if (_addiInfo.sdc == SDC.F)
                                {
                                    _abandonWriter.WriteAbandonment(_ceiling, AbandonmentTable.Ceiling_SDCConflictIp);
                                    break;
                                }
                                else
                                {
                                    FGCode += "003";
                                }
                            }
                            else
                            {
                                FGCode += "004";
                            }
                        }

                        if (_area < 250)
                        {
                            FGCode   += "a";
                            _areaBase = 250;
                        }
                        else if (250 < _area && _area < 1000)
                        {
                            FGCode   += "b";
                            _areaBase = 600;
                        }
                        else if (1000 < _area && _area < 2500)
                        {
                            FGCode   += "c";
                            _areaBase = 1800;
                        }
                        else
                        {
                            FGCode   += "d";
                            _areaBase = 2500;
                        }

                        int index;
                        if (_dictionary.TryGetValue(FGCode, out index))
                        {
                            _PGItems.ElementAt(index).Num[_floor] += _area / _areaBase;
                        }
                        else
                        {
                            PGItem pgItem = new PGItem();
                            pgItem.PGName       = "天花板";
                            pgItem.PinYinSuffix = "TianHuaBan";
                            pgItem.Code         = FGCode;
                            pgItem.direction    = Direction.Undefined;
                            pgItem.Num[_floor] += _area / _areaBase;
                            pgItem.Price        = _addiInfo.prices[(byte)PGComponents.Ceiling];
                            if (pgItem.Price == 0.0)
                            {
                                pgItem.IfDefinePrice = false;
                            }
                            else
                            {
                                pgItem.IfDefinePrice = true;
                            }
                            _PGItems.Add(pgItem);
                            _dictionary.Add(FGCode, _PGItems.Count - 1);
                        }
                        break;
                    }
                }

                if (_addiInfo.requiredComp[(byte)PGComponents.CeilingLighting])
                {
                    FilteredElementCollector lightingCollector = new FilteredElementCollector(_doc);
                    BoundingBoxXYZ           bbCeiling         = _ceiling.get_BoundingBox(_doc.ActiveView);
                    Outline ceilingOutline = new Outline(bbCeiling.Min, bbCeiling.Max);
                    BoundingBoxIntersectsFilter bbFilter       = new BoundingBoxIntersectsFilter(ceilingOutline);
                    ElementCategoryFilter       lightingFilter = new ElementCategoryFilter(BuiltInCategory.OST_LightingFixtures);
                    lightingCollector.WherePasses(bbFilter).WherePasses(lightingFilter);
                    int num_Rece = 0;
                    int num_Pend = 0;
                    foreach (Element lighting in lightingCollector)
                    {
                        BoundingBoxXYZ bbLighting = lighting.get_BoundingBox(_doc.ActiveView);
                        if (bbLighting.Max.Z - bbLighting.Min.Z < ErrorCtrl_Lighting)
                        {
                            ++num_Rece;
                            isFoundLighting[0] = true;
                        }
                        else
                        {
                            ++num_Pend;
                            isFoundLighting[1] = true;
                        }
                    }

                    _rece.Num[_floor] += num_Rece;
                    _pend.Num[_floor] += num_Pend;
                }
            }