Example #1
0
        /// <summary>
        /// Tag the beam's start and end.
        /// </summary>
        /// <param name="tagMode">Mode of tag</param>
        /// <param name="tagSymbol">Tag symbol wrapper</param>
        /// <param name="leader">Whether the tag has leader</param>
        /// <param name="tagOrientation">Orientation of tag</param>
        public void CreateTag(TagMode tagMode,
                              FamilySymbolWrapper tagSymbol, bool leader,
                              TagOrientation tagOrientation)
        {
            foreach (FamilyInstance beam in m_beamList)
            {
                //Get the start point and end point of the selected beam.
                Autodesk.Revit.DB.LocationCurve location = beam.Location as Autodesk.Revit.DB.LocationCurve;
                Autodesk.Revit.DB.Curve         curve    = location.Curve;

                Transaction t = new Transaction(m_revitDoc.Document);
                t.Start("Create new tag");
                //Create tag on the beam's start and end.
                Reference      beamRef = new Reference(beam);
                IndependentTag tag1    = IndependentTag.Create(m_revitDoc.Document,
                                                               m_view.Id, beamRef, leader, tagMode, tagOrientation, curve.GetEndPoint(0));
                IndependentTag tag2 = IndependentTag.Create(m_revitDoc.Document,
                                                            m_view.Id, beamRef, leader, tagMode, tagOrientation, curve.GetEndPoint(1));

                //Change the tag's object Type.
                tag1.ChangeTypeId(tagSymbol.FamilySymbol.Id);
                tag2.ChangeTypeId(tagSymbol.FamilySymbol.Id);
                t.Commit();
            }
        }
Example #2
0
        /// <summary>
        /// Tag the beam's start and end.
        /// </summary>
        /// <param name="tagMode">Mode of tag</param>
        /// <param name="tagSymbol">Tag symbol wrapper</param>
        /// <param name="leader">Whether the tag has leader</param>
        /// <param name="tagOrientation">Orientation of tag</param>
        public void CreateTag(TagMode tagMode,
            FamilySymbolWrapper tagSymbol, bool leader,
            TagOrientation tagOrientation)
        {
            foreach(FamilyInstance beam in m_beamList)
            {
                //Get the start point and end point of the selected beam.
                Autodesk.Revit.DB.LocationCurve location = beam.Location as Autodesk.Revit.DB.LocationCurve;
                Autodesk.Revit.DB.Curve curve = location.Curve;

                Transaction t = new Transaction(m_revitDoc.Document);
                t.Start("Create new tag");
                //Create tag on the beam's start and end.
                IndependentTag tag1 = m_docCreator.NewTag(
                    m_view, beam, leader, tagMode, tagOrientation, curve.get_EndPoint(0));
                IndependentTag tag2 = m_docCreator.NewTag(
                    m_view, beam, leader, tagMode, tagOrientation, curve.get_EndPoint(1));

                //Change the tag's object Type.
                tag1.ChangeTypeId(tagSymbol.FamilySymbol.Id);
                tag2.ChangeTypeId(tagSymbol.FamilySymbol.Id);
                t.Commit();
            }
        }