How to resolve this with Revit API?

How to resolve this with Revit API?

takumi.yoshioka
Autodesk Autodesk
646 Views
3 Replies
Message 1 of 4

How to resolve this with Revit API?

takumi.yoshioka
Autodesk
Autodesk

Problem:

Adding the following 2 instance parameters onto the family and overwrote.

「配置基準(Placement Criteria)」and 「配置高さ(Placement height)」

 

After the overwrote them, one of the family sizes got so big and others are not. The weird phenomenon has happened. 

 

Here are the families and size changed.

  1. Family name : 1091000010_1001_SVC4_PE_SA_260.rfa
  • Size of the original family : 660KB
  • Size of the revised family: 1,188KB   (180% increased)

 

  1. Family Name: 1011600010_1001_N_C_7_200.rfa
  • Size of the original family : 336 KB
  • Size of the revised family: 336 KB   (0% increased)

 

Question:

How to avoid this with API?

 

Note:

Although We set the compact property (Compact=True) at SaveAsOption Class, the result of file size was the same as above mentioned.

 

Attachments: 

  • Families 
  • Source Code
  • Comparison sheet (Excel)

Thank you for your advice in advance! 

0 Likes
647 Views
3 Replies
Replies (3)
Message 2 of 4

stever66
Advisor
Advisor

Did you try re-opening the family with the "Audit" button checked? 

 

If that works, I do see audit is an option for opening a file by the API. 

 

So you close the family file after adding the parameters, and then reopen the family with an audit, and resave it.

 

But I would try using an audit first without the API and see if it reduces the file size before writing all the code to do this.

https://www.revitapidocs.com/2015/61fd9502-777d-a946-aead-24974c8ac3f2.htm

 

Message 3 of 4

takumi.yoshioka
Autodesk
Autodesk

Thank you for your message! @stever66

We have already tested and confirmed that with the way you mentioned. 

Yes, it worked and we consider it is the workaround. 

 

But we still want to find the way to optimize the file size without audit or re-saving.

File size optimization by API is the way we are looking for and we believe it should be. 

 

Thanks anyway. 

0 Likes
Message 4 of 4

stever66
Advisor
Advisor

You might try auditing the family and saving before adding the parameters through the API.  You might also try purging the family to get rid of any unnecessary items, and then doing an audit.  (It's probably a good idea to make a backup first!)

 

If you have a clean family to start with, I don't know why adding a parameter would double the file size of the family.  My guess is that there is something not quite right with the family.  Maybe its from doing multiple upgrades from previous versions of Revit?

 

I'm not sure how complex your family is, but hopefully, the worst case is that you might have to recreate the family from scratch in one of the more recent versions of Revit.

 

0 Likes