I have partially "automated" the creation of generic model tags by applying a view template which only shows what I want to tag, tagging all not tagged, applying a view template which shows everything I want visible again.
However, I often want to move the tags around to make it a bit more visually pleasing. I can do this manually, but I was wondering if it's possible to select only tags that start with "ST " for example and move all of those without manually selecting every one.
Is this possible out of the box? Would it be possible to program something like this or is the text in the tag not available to get?

hi @mat_hijs
Yes!!! you can achieve using API, Try to implement the below code...
{
//Accesing Revit
UIApplication RevitApp = commandData.Application;
UIDocument RevitUI = RevitApp.ActiveUIDocument;
Document RevitDoc = RevitUI.Document;
//Filter Tag Element in Active View
List<IndependentTag> tagList = new FilteredElementCollector(RevitDoc, RevitDoc.ActiveView.Id).
OfClass(typeof(IndependentTag)).Cast<IndependentTag>().Where(x => x.TagText.StartsWith("ST")).ToList();
//Move Element
using (Transaction moveElement=new Transaction(RevitDoc,"Move Tag"))
{
moveElement.Start();
//Value to Move(Comvert to Revit Internal Unit)
double x = UnitUtils.ConvertToInternalUnits(1000, DisplayUnitType.DUT_MILLIMETERS);
foreach (IndependentTag tag in tagList)
{
tag.Location.Move(new XYZ(x, 0, 0));
}
moveElement.Commit();
}Hope This Helps!!!
FYI...
Please Post in Revit API Forum for Programming-related Queries....
Accecpt this as a Solution, If your Get Soltion From this Message ![]()
I understand that questions about programming should be asked in the API forum, I regularly post on the Inventor API forum. I was actually hoping you wouldn't need to program to do this.
I'm guessing the code you sent me is written in C#. I'm not familiar with that and I'm struggling with where to put this code. I created a module and a macro, my guess was to copy and paste this code between the brackets under public void MoveTags() but that gives me some errors. Now that we're here anyway could you please enlighten me on where to go with this code?
Or ideally if you're familiar with VB.NET could you send me the same code but written in VB.NET and tell me where to go with that code? I'm a bit familiar with VBA and VB.NET since that's what I'm using in Inventor but in Inventor you start with a blank sheet and go from there, not needing to import the application and things like that, they are readily available.
I hope I'm not asking too much.

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.