Message 1 of 5
Place a door tag at the centre of the door opening leaf

Not applicable
07-30-2017
11:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Yall,
I am currently working on a problem. It seems simple enough but it is driving me up the wall.
Revit as it stands, places Door tags over the centre line of the door threshold (2d), and I have to manually modify the door tags to fit within the opening space of the door leaf (the curvy part) opposite the hosting wall.
does anyone know a simple way of finding the centre point of a door opening and then applying a door tag to that point or if there is already a door tag there, moving it to that location?
My Code as stand is the following.
using System; using System.Collections.Generic; using System.Linq; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; namespace DoorTags { [TransactionAttribute(TransactionMode.Manual)] [RegenerationAttribute(RegenerationOption.Manual)] public class doorTags : IExternalCommand { public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { //Get application and document objects UIApplication uiApp = commandData.Application; Document doc = uiApp.ActiveUIDocument.Document; // Set cursor as hour glass Cursor.Current = Cursors.WaitCursor; Dim collector As Dictionary(Of String, List(Of DB.FamilyInstance)) = _ New DB.FilteredElementCollector(doc).OfClass(GetType(DB.FamilyInstance)).OfCategory(DB.BuiltInCategory.OST_Doors).Cast(Of DB.FamilyInstance).GroupBy(Function(fi) fi.Symbol.Family.Name).ToDictionary(Of String, List(Of DB.FamilyInstance)) (Function(f) f.Key, Function(f) f.ToList); // test if the family name string contains "single" Dim searchString as String = "Single"; for Each key as String in collector.Keys if key.Contains(searchString, StringComparison.CurrentCultureIgnoreCase) { //Get door current location LocationPoint DoorLocation = OST.Doors.Location as LocationPoint; XYZ oldPlace = DoorLocation.Point; //Get door swing direction // calculate new door tag location if (condition) // tag already exists { XYZ DoorTagPlace = new XYZ(); ElementTransformUtils.MoveElement(document, column.Id, newPlace); (condition) } else { then(condition)// no door tag exisiting } //find the direction of the door opening which will help us work out where to place the door tag bool condition = true; // the door swings inward, place the door tag on the inside of the door relative to the centre of the hosting door. if (condition) { // move door tag to the inside of the wall to the centre of the opening door leaf } else { // move the door tag to the outside of the wall to the centre of the opening door leaf } } // Set cursor as default arrow Cursor.Current = Cursors.Default; } } }
I am also placing a timer for the operation, so the more efficient my method, the better. any help would be greatly appreciated.