Exemplo n.º 1
0
        void EncodeEquipment()
        {
            ElementClassFilter       instanceFilter = new ElementClassFilter(typeof(FamilyInstance));
            ElementClassFilter       hostFilter     = new ElementClassFilter(typeof(HostObject));
            LogicalOrFilter          andFilter      = new LogicalOrFilter(instanceFilter, hostFilter);
            FilteredElementCollector collector      = new FilteredElementCollector(m_uIDocument.Document);

            collector.WherePasses(andFilter);

            foreach (var ele in collector)
            {
                var catogary   = ele.Category.Name;
                var familyName = MtCommon.GetElementFamilyName(m_uIDocument.Document, ele);
                if (familyName.Contains("风盘") || familyName.Contains("风机盘管"))
                {
                    continue;
                }
                if (catogary.Equals(MtGlobals.EquipmentCategory) || catogary.Equals(MtGlobals.ElecticCategory))
                {
                    //temp
                    var length = familyName.Length;
                    MtCommon.SetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.EquipmentCode),
                                             length <= 5 ? familyName.Substring(0, length - 1) : familyName.Substring(0, 5));
                }
            }
        }
Exemplo n.º 2
0
        void ClearEquipmentCode()
        {
            ElementClassFilter       instanceFilter = new ElementClassFilter(typeof(FamilyInstance));
            ElementClassFilter       hostFilter     = new ElementClassFilter(typeof(HostObject));
            LogicalOrFilter          andFilter      = new LogicalOrFilter(instanceFilter, hostFilter);
            FilteredElementCollector collector      = new FilteredElementCollector(m_uIDocument.Document);

            collector.WherePasses(andFilter);

            foreach (var ele in collector)
            {
                MtCommon.SetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.EquipmentCode), string.Empty);
            }
        }
Exemplo n.º 3
0
        public void MarkLongVerticalPipeOrDust(Element ele, string levelName, string startoffset, string endoffset)
        {
            if (ValideParams(ele, levelName, startoffset, endoffset))
            {
                double LevelOffset  = m_dicLevelOffset[levelName];
                double startoffsetV = double.Parse(startoffset);
                double endoffsetV   = double.Parse(endoffset);

                if (Math.Abs(startoffsetV - endoffsetV) > LevelOffset)   //只有跨楼层的竖管才标记
                {
                    MtCommon.SetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.VerticalPipe), "1-1");
                }
                else
                {
                    MtCommon.SetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.VerticalPipe), "1");
                }
            }
        }
Exemplo n.º 4
0
        public void MarkVerticalPipe()
        {
            GetALLLevelOffset();

            ElementClassFilter instanceFilter = new ElementClassFilter(typeof(FamilyInstance));
            ElementClassFilter hostFilter     = new ElementClassFilter(typeof(HostObject));
            LogicalOrFilter    andFilter      = new LogicalOrFilter(instanceFilter, hostFilter);

            FilteredElementCollector collector = new FilteredElementCollector(m_uIDocument.Document);

            collector.WherePasses(andFilter);

            foreach (var ele in collector)
            {
                string levelName = GetPipeLevel(ele);
                string offset    = GetPipeOffset(ele);
                string category  = ele.Category.Name;

                if (category.Equals(MtGlobals.PipeCategory) || category.Equals(MtGlobals.DustCategory))
                {
                    //if (ele.LookupParameter(MtCommon.GetStringValue(MtGlobals.Parameters.VerticalPipe)) == null) continue;

                    string startoffset    = GetPipeStartOffset(ele);
                    string endoffset      = GetPipeEndOffset(ele);
                    bool   isVerticalPipe = CheckIsVerticalPipe(ele, startoffset, endoffset);
                    if (isVerticalPipe)
                    {
                        MarkLongVerticalPipeOrDust(ele, levelName, startoffset, endoffset);
                    }
                    else
                    {
                        MtCommon.SetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.VerticalPipe), "0");
                    }
                }
            }
        }