Revit Duplicating 1000s of Line Styles

python
dynamo
revit

#22

Well this is one messed up model. I think Dynamo can’t delete the subcategories because they all have the same name. When I run the script it finds 12 instances of the subcategories that start with ‘PTE’, deletes those 12 instances and that’s it.
I tried opening the object styles in Revit, but that’s taking more than an hour now…
No drinks this weekend :frowning2:


#23

@T_Pover Thanks for looking! I really do appreciate the kindness of people on here.

I’m a total newbie with accessing the API (currently struggling with navigating the API file in the SDK)

If I can find a way to point towards this specific list then I imagine it might be possible to use Python to create a list of all the line subcategories then use a for loop to delete each one? I’m thinking I’d approach this using RevitPythonShell or PyRevit.

Does that sound sensible?


#24

That sounds very sensible and it is exactly what I tried :slight_smile: Attached is the script in which I tried to retrieve every subcategory of every category in the project and then filter for “PTE” but it just doesn’t list all subcategories. Wouldn’t know how to proceed from here to be honest.test.dyn (9.9 KB)


#25

Late reply,
I got the same problem to deal with a few months back.
with bits and pieces I got that macro together

it ran 4s and deleted more than 114 000 substyles :stuck_out_tongue:

DeleteExtraObjectStyles.txt (3.1 KB)


#26

Another way to try is with these Plissken nodes:


#27

@Jean-Marc_Couffin awesome! I’ll take a look later today :slight_smile: thanks for your thoughts - in the end I installed AutoHotKeys and set up a simple script to delete the linestyles one-by-one. Ran it Friday evening and it finished halfway through Sunday.

…but that was definitely not as smart a solution!

@truevis oh I’ve not some across these nodes before; will check them out! Thanks

Ollie


#28

no pb, I went through the same process :smile: before finding that code solution _ I even did delete all line style by hand at one point…


#29

unfortunately the Plissken nodes only show the line styles that are used, not the hidden thousands of line styles that need to be removed similar to SW Parking, SW Street, SW Point Wipeout. At least those are some of the ones I am coming up against. will have to review the code presented above and if that will work for our case.

Edit: My Appologies! Searching further thru the GraphicsStyles node I can find the types I am looking for. Thank you for the Direction! @truevis

Edit: Added a simple quick graph/definition to delete.
Delete_GraphicStyles-unusedLineStyles.dyn (8.7 KB)


#30

Great nodes, will definitely be using these :slight_smile: Thanks for the recommendation!