I have a problem with a project where it takes a very long time to open Visibility/Graphics or Object Styles (over an hour of spinning interminably). The problem seems to be caused by a subcategory of Curtain Panels called Panel which appears thousands (?) of times:
None of the curtain panels in the project appear to have this subcategory. I have tried deleting Panel from Object Styles but there are so many it was hard to tell whether they were being deleted and then I made the mistake of selecting too many and it went into spinning mode again.
It seems similar to duplicating linetypes problem reported before on this forum but I am unable to programmatically access the subcategory in order to delete it, either through Dynamo or a macro. Here is the output of all of the subcategories for Curtain Panels reported through the API, no Panel to be seen.
Thanks,
Thomas
16.0.1144.0
20160525_1230(x64)
Update 5 for R2
Gelöst! Gehe zur Lösung
Gelöst von thomascorrie. Gehe zur Lösung
Still not made much progress but on a heavily purged and de-linked model I managed to get beyond the spinning wheel to a point of deleting the subcategories which numbered 34021. Upon deletion there was no discernible improvement in performance.
In the end I was able to access the additional subcategories through the API by filtering for all elements on the workset 'Object Styles' and deleting elements that matched the exact name of the subcategory. The process took about fifteen minutes to run.
In the course of doing this I realised there was also exactly the same number 34021 of duplicates of the following subcategories which also needed purging:
Doors: Detailing
Doors: Detailing Dotted
Windows: Vent Line Detail
The V/G dialogue now opens as usual.
Thank you, @thomascorrie for sharing information about this weird problem and how you solved it. The cause is still not clear. You said the problem was always in some specific subcategories related to Doors. Did you find the specific family that was causing all this trouble? I wonder if it was some kind of .dwg content imported inside the family that caused some corruption. This is a very strange problem. I had never seen this before.
Hello @Alfredo_Medina, the problem occurred in three categories: Curtain Panels; Doors and Windows. I wasn't able to track down any families where the subcategories occurred but once I worked out how to get rid of the duplicates I didn't look spend much time looking any further. Your suggestion of dwg data within a family is plausible as some of our families do incorporate imported CAD information.
Looking back at archived copies of the model the problem seems to have started around the time we switched from non-subscription Revit 2016 to R2 but I don't know if that has anything to do with it.
It's been over a week since we deleted the duplicates and there has been no reoccurrence of the problem so hopefully it was a one-off.
@thomascorrie I don't suppose you'd like to share the code you used to accomplish this?
Matt Wunch
Revit Subject Matter Expert/sUAS Pilot
Twitter | LinkedIn
AU2017 - Code Blue Dr Revit - How to Resuscitate Corrupt Revit Models
Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDO button.
Hi @Matt__W
Here's the macro I used. Because I was looking for very specific subcategories which I knew in advance I hardcoded in their names. Ideally I would have made it more flexible.
Thomas
public void ProblematicSubCategoryDeletion()
{
//To identify and delete problematic subcategories that have repeated many times in a model
//Setup uidoc and doc for accessing the Revit UI (uidoc) and the Model (doc)
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
//Collect worksets to determine workset id of Object Styles workset
FilteredWorksetCollector coll = new FilteredWorksetCollector(doc);
StringBuilder worksetNames = new StringBuilder();
foreach( Workset workset in coll )
{
worksetNames.AppendFormat( "{0}: {1} - {2}\n", workset.Name, workset.Kind, workset.Id );
}
//Show task dialog of all worksets - 'Object Styles' appears to be 6 in all files I have tried
TaskDialog td = new TaskDialog("Worksets");
td.MainInstruction = worksetNames.ToString();
td.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel;
td.DefaultButton = TaskDialogResult.Cancel;
TaskDialogResult tdRes = td.Show();
if (tdRes == TaskDialogResult.Cancel) {return;} //Ability to cancel
//Grab the workset "Object Styles"
WorksetId id = new WorksetId(6); //<------ Hardcoded Workset id here
FilteredElementCollector elementCollector = new FilteredElementCollector(doc);
ElementWorksetFilter elementWorksetFilter = new ElementWorksetFilter(id, false);
ICollection<Element> worksetElemsfounds = elementCollector.WherePasses(elementWorksetFilter).ToElements();
List<ElementId> deleteIds = new List<ElementId>();
var report = new StringBuilder();
int elementsCount = worksetElemsfounds.Count; //Elements found in 'Object Styles'
report.AppendLine("Element count for Object Styles Workset: " + elementsCount);
//Hardcoded counts for problematic subcategories
int countDetailingDotted = 0;
int countDetailing = 0;
int countVentLineDetail = 0;
int countPanel = 0;
//Loop through all elements looking for specific (hardcoded) problematic subcategories
foreach (Element ele in worksetElemsfounds)
{
if (ele.Name.Equals("Detailing Dotted") || ele.Name.Equals("Detailing") || ele.Name.Equals("Vent Line Detail") || ele.Name.Equals("Panel"))
{
if (ele.Name.Equals("Detailing Dotted") && countDetailingDotted == 0)
{
countDetailingDotted++;
continue;
} else if (ele.Name.Equals("Detailing") && countDetailing == 0)
{
countDetailing++;
continue;
} else if (ele.Name.Equals("Vent Line Detail") && countVentLineDetail == 0)
{
countVentLineDetail++;
continue;
} else if (ele.Name.Equals("Panel") && countPanel == 0)
{
countPanel++;
continue;
}
report.AppendFormat("\n{0}: {1}", ele.Id, ele.Name);
deleteIds.Add(ele.Id);
}
}
if (deleteIds.Count == 0)
{
report.AppendFormat("Nothing to delete - process will exit");
}
//Show task dialog of all elements to be deleted
TaskDialog tdr = new TaskDialog("Report");
tdr.MainInstruction = report.ToString();
tdr.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel;
tdr.DefaultButton = TaskDialogResult.Ok;
TaskDialogResult tdResr = tdr.Show();
if (tdResr == TaskDialogResult.Cancel) {return;} //Ability to cancel
if (deleteIds.Count == 0) { return; } //Exit if there is nothing to delete
//Delete Elements
StringBuilder elementError = new StringBuilder();
using (Transaction mt = new Transaction(doc,"Delete Elements"))
{
mt.Start(); //Starts transaction
foreach (ElementId e in deleteIds)
{
try {
if (null != e)
{
doc.Delete(e);
}
} catch (Exception ex) {
elementError.AppendLine(ex.GetType().Name + " " + ex.Message);
}
}
mt.Commit();
}
TaskDialog.Show( "Complete", "Complete:\n" + elementError.ToString());
}
Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.