Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete materials and subcategories not used in family

4 REPLIES 4
Reply
Message 1 of 5
convect
2836 Views, 4 Replies

Delete materials and subcategories not used in family

Hi all, I have a lot of families with material and subcategories not used and this increase file size. I was thinking to write a utility to remove all unused materials and subcategories in family editor, because Purge all doesn't work and all those entities remain in family.

Here are subcategories listed in Object Styles and some materials are mapped directly to them:

Sub1.jpg

 

Some of this subcategories are mapped to the solids in Materials and Finishes properties and should not be deleted:

 

Sub2.jpg

 

 

Remaining unused subcategories and materials could be removed:

Sub3.jpg

 

I realize that this is difficult task and was wondering if it's possible to clean up families via API. Thank you!

4 REPLIES 4
Message 2 of 5
jeremytammik
in reply to: convect

Here is an example how to purge unused materials:

 

http://thebuildingcoder.typepad.com/blog/2017/04/forgefader-ui-lookup-builds-purge-and-room-instance...

 

The Building Coder has discussed several approaches to other purge functionalities as well:

 

http://thebuildingcoder.typepad.com/blog/2017/11/purge-and-detecting-an-empty-view.html#2

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 5
convect
in reply to: jeremytammik

Thank you, Jeremmy!

I have seen Harry's solution, but it works only in project, not in family editor and not all unused materials are deleted. Also that solutions is not deleting unused subcategories.

Message 4 of 5

I want the same thing corvect

Message 5 of 5
TripleM-Dev.net
in reply to: convect

Hi,

 

Import the Families into a Empty project file (don't need to be placed), then export them again.

All unused user created subcategories will be gone.

 

If the project is clean, (no materials attached to any category/sybcategory) the export will be relative clean of materials, you even can purge/delete unused materials in the project and export the families after.

 

See if this helps.

- Michel

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report