Пример #1
0
        /// <summary>
        /// Auto tag rooms with specified RoomTagType in a level
        /// </summary>
        /// <param name="level">The level where rooms will be auto tagged</param>
        /// <param name="tagType">The room tag type</param>
        public void AutoTagRooms(Level level, RoomTagType tagType)
        {
            PlanTopology planTopology = m_revit.ActiveUIDocument.Document.get_PlanTopology(level);

            SubTransaction subTransaction = new SubTransaction(m_revit.ActiveUIDocument.Document);

            subTransaction.Start();
            foreach (ElementId eid in planTopology.GetRoomIds())
            {
                Room tmpRoom = m_revit.ActiveUIDocument.Document.GetElement(eid) as Room;

                if (m_revit.ActiveUIDocument.Document.GetElement(tmpRoom.LevelId) != null && tmpRoom.Location != null)
                {
                    // Create a specified type RoomTag to tag a room
                    LocationPoint        locationPoint = tmpRoom.Location as LocationPoint;
                    Autodesk.Revit.DB.UV point         = new Autodesk.Revit.DB.UV(locationPoint.Point.X, locationPoint.Point.Y);
                    RoomTag newTag = m_revit.ActiveUIDocument.Document.Create.NewRoomTag(new LinkElementId(tmpRoom.Id), point, null);
                    newTag.RoomTagType = tagType;

                    List <RoomTag> tagListInTheRoom = m_roomWithTags[newTag.Room.Id];
                    tagListInTheRoom.Add(newTag);
                }
            }
            subTransaction.Commit();
        }
        /// <summary>
        /// When clicked the autoTag button, then tag all rooms in the specified level.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void autoTagButton_Click(object sender, EventArgs e)
        {
            Level       level   = this.levelsComboBox.SelectedItem as Level;
            RoomTagType tagType = this.tagTypesComboBox.SelectedItem as RoomTagType;

            if (level != null && tagType != null)
            {
                m_roomsData.AutoTagRooms(level, tagType);
            }

            UpdateRoomsList();
        }
Пример #3
0
        /// <summary>
        /// Get the amount of room tags in a room with the specified RoomTagType
        /// </summary>
        /// <param name="room">A specified room</param>
        /// <param name="tagType">A specified tag type</param>
        /// <returns></returns>
        public int GetTagNumber(Room room, RoomTagType tagType)
        {
            int            count            = 0;
            List <RoomTag> tagListInTheRoom = m_roomWithTags[room.Id];

            foreach (RoomTag roomTag in tagListInTheRoom)
            {
                if (roomTag.RoomTagType.Id == tagType.Id)
                {
                    count++;
                }
            }
            return(count);
        }
Пример #4
0
        /// <summary>
        /// Auto tag rooms with specified RoomTagType in a level
        /// </summary>
        /// <param name="level">The level where rooms will be auto tagged</param>
        /// <param name="tagType">The room tag type</param>
        public void AutoTagRooms(Level level, RoomTagType tagType)
        {
            PlanTopology planTopology = m_revit.ActiveUIDocument.Document.get_PlanTopology(level);

            SubTransaction subTransaction = new SubTransaction(m_revit.ActiveUIDocument.Document);

            subTransaction.Start();
            foreach (Room tmpRoom in planTopology.Rooms)
            {
                if (tmpRoom.Level != null && tmpRoom.Location != null)
                {
                    // Create a specified type RoomTag to tag a room
                    LocationPoint        locationPoint = tmpRoom.Location as LocationPoint;
                    Autodesk.Revit.DB.UV point         = new Autodesk.Revit.DB.UV(locationPoint.Point.X, locationPoint.Point.Y);
                    RoomTag newTag = m_revit.ActiveUIDocument.Document.Create.NewRoomTag(tmpRoom, point, null);
                    newTag.RoomTagType = tagType;

                    List <RoomTag> tagListInTheRoom = m_roomWithTags[newTag.Room.Id.IntegerValue];
                    tagListInTheRoom.Add(newTag);
                }
            }
            subTransaction.Commit();
        }
Пример #5
0
        Stream(ArrayList data, ElementType sym)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(ElementType)));

            // no data at this level yet

            AnnotationSymbolType annoType = sym as AnnotationSymbolType;

            if (annoType != null)
            {
                Stream(data, annoType);
                return;
            }

            AreaReinforcementType areaReinforcementType = sym as AreaReinforcementType;

            if (areaReinforcementType != null)
            {
                Stream(data, areaReinforcementType);
                return;
            }

            AreaTagType areaTagType = sym as AreaTagType;

            if (areaTagType != null)
            {
                Stream(data, areaTagType);
                return;
            }

            BeamSystemType beamSystemType = sym as BeamSystemType;

            if (beamSystemType != null)
            {
                Stream(data, beamSystemType);
                return;
            }

            DimensionType dimType = sym as DimensionType;

            if (dimType != null)
            {
                Stream(data, dimType);
                return;
            }

            //TF
            FabricSheetType fabricST = sym as FabricSheetType;

            if (fabricST != null)
            {
                Stream(data, fabricST);
                return;
            }

            FabricWireType fabricWT = sym as FabricWireType;

            if (fabricWT != null)
            {
                Stream(data, fabricWT);
                return;
            }
            //TFEND

            GroupType groupType = sym as GroupType;

            if (groupType != null)
            {
                Stream(data, groupType);
                return;
            }

            HostObjAttributes hostAtt = sym as HostObjAttributes;

            if (hostAtt != null)
            {
                Stream(data, hostAtt);
                return;
            }

            InsertableObject insObj = sym as InsertableObject;

            if (insObj != null)
            {
                Stream(data, insObj);
                return;
            }

            LevelType levelType = sym as LevelType;

            if (levelType != null)
            {
                Stream(data, levelType);
                return;
            }

            LineAndTextAttrSymbol lineAndTextAttr = sym as LineAndTextAttrSymbol;

            if (lineAndTextAttr != null)
            {
                Stream(data, lineAndTextAttr);
                return;
            }

            LoadTypeBase loadTypeBase = sym as LoadTypeBase;

            if (loadTypeBase != null)
            {
                Stream(data, loadTypeBase);
                return;
            }

            MEPBuildingConstruction mepBldConst = sym as MEPBuildingConstruction;

            if (mepBldConst != null)
            {
                Stream(data, mepBldConst);
                return;
            }

            PathReinforcementType pathReinforcementType = sym as PathReinforcementType;

            if (pathReinforcementType != null)
            {
                Stream(data, pathReinforcementType);
                return;
            }

            RebarBarType rebarBarType = sym as RebarBarType;

            if (rebarBarType != null)
            {
                Stream(data, rebarBarType);
                return;
            }

            RebarCoverType rebarCoverType = sym as RebarCoverType;

            if (rebarCoverType != null)
            {
                Stream(data, rebarCoverType);
                return;
            }

            RebarHookType rebarHookType = sym as RebarHookType;

            if (rebarHookType != null)
            {
                Stream(data, rebarHookType);
                return;
            }

            RebarShape rebarShape = sym as RebarShape;

            if (rebarShape != null)
            {
                Stream(data, rebarShape);
                return;
            }

            RoomTagType roomTagType = sym as RoomTagType;

            if (roomTagType != null)
            {
                Stream(data, roomTagType);
                return;
            }

            SpaceTagType spaceTagType = sym as SpaceTagType;

            if (spaceTagType != null)
            {
                Stream(data, spaceTagType);
                return;
            }

            TrussType trussType = sym as TrussType;

            if (trussType != null)
            {
                Stream(data, trussType);
                return;
            }

            DistributionSysType distSysType = sym as DistributionSysType;

            if (distSysType != null)
            {
                Stream(data, distSysType);
                return;
            }

            MEPCurveType mepCurType = sym as MEPCurveType;

            if (mepCurType != null)
            {
                Stream(data, mepCurType);
                return;
            }

            FluidType fluidType = sym as FluidType;

            if (fluidType != null)
            {
                Stream(data, fluidType);
                return;
            }

            PipeScheduleType pipeSchedType = sym as PipeScheduleType;

            if (pipeSchedType != null)
            {
                Stream(data, pipeSchedType);
                return;
            }

            VoltageType voltType = sym as VoltageType;

            if (voltType != null)
            {
                Stream(data, voltType);
                return;
            }

            WireType wireType = sym as WireType;

            if (wireType != null)
            {
                Stream(data, wireType);
                return;
            }

            ModelTextType modelTxtType = sym as ModelTextType;

            if (modelTxtType != null)
            {
                Stream(data, modelTxtType);
                return;
            }
        }
Пример #6
0
 /// <summary>
 /// Get the amount of room tags in a room with the specified RoomTagType
 /// </summary>
 /// <param name="room">A specified room</param>
 /// <param name="tagType">A specified tag type</param>
 /// <returns></returns>
 public int GetTagNumber(Room room, RoomTagType tagType)
 {
     int count = 0;
     List<RoomTag> tagListInTheRoom = m_roomWithTags[room.Id.IntegerValue];
     foreach (RoomTag roomTag in tagListInTheRoom)
     {
         if (roomTag.RoomTagType.Id.IntegerValue == tagType.Id.IntegerValue)
         {
             count++;
         }
     }
     return count;
 }
Пример #7
0
        /// <summary>
        /// Auto tag rooms with specified RoomTagType in a level
        /// </summary>
        /// <param name="level">The level where rooms will be auto tagged</param>
        /// <param name="tagType">The room tag type</param>
        public void AutoTagRooms(Level level, RoomTagType tagType)
        {
            PlanTopology planTopology = m_revit.ActiveUIDocument.Document.get_PlanTopology(level);

            SubTransaction subTransaction = new SubTransaction(m_revit.ActiveUIDocument.Document);
            subTransaction.Start();
            foreach (Room tmpRoom in planTopology.Rooms)
            {
                if (tmpRoom.Level != null && tmpRoom.Location != null)
                {
                    // Create a specified type RoomTag to tag a room
                    LocationPoint locationPoint = tmpRoom.Location as LocationPoint;
                    Autodesk.Revit.DB.UV point = new Autodesk.Revit.DB.UV (locationPoint.Point.X, locationPoint.Point.Y);
                    RoomTag newTag = m_revit.ActiveUIDocument.Document.Create.NewRoomTag(tmpRoom, point, null);
                    newTag.RoomTagType = tagType;

                    List<RoomTag> tagListInTheRoom = m_roomWithTags[newTag.Room.Id.IntegerValue];
                    tagListInTheRoom.Add(newTag);
                }

            }
            subTransaction.Commit();
        }