Batch loading families creates large files

cons
Explorer
Explorer

Batch loading families creates large files

cons
Explorer
Explorer

Hi everyone

I'm new to this forum, and to programming in general (I'm and architect, not a programmer)

So I've built this python script (run through PyRevit), where essentially I create 2 lists of files (target files and source files) , and load all of the source files into all of the target files (skipping of course in case the source and target are

identical) using doc.LoadFamily(string,IloadFamiliyOptions).

It works fine, but when testing it on the same files in both lists, the size of the files grow with each iteration, even though all of the files contain the same amount of families in the end.

e.g: 4 files in each list, all of the files were just a plain generic model family file with no other families loaded (I just copy/pasted the files in he folder and renamed them)

So the result should be 4 files, each containing the other 3 files (which is what happens). I would expect all the files to be of the same size, but what happens is each file is larger than the previous one (some kind of exponential growth)

any thoughts?

 

I've attached some screenshots of the files' sizes before and after I run the script, and a screenshot of the script itself, and the relevant part of the script.

 

Thanks everyone!

 

 

0 Likes
Reply
395 Views
3 Replies
Replies (3)

TripleM-Dev.net
Advisor
Advisor

Hi,

 

It's hard to follow, I think the family1 (in which family2-3-4 is loaded correct..) is actually used in the next iteration.

If families are loaded in is the family saved AND CLOSED! else beause the same names the wrong Family1 will be used. In the code I see a CLOSE and SAVE, but after the save no CLOSE is issued, check that one (line 99 and 105).

 

Check, family4, it will have multiple nested families in families (assume that families are not shared types)

So for each iteration the Loadinto version is used as LoadFrom (uhm think so) and would grow each time.

 

Besides the Code, why are you loading families with identical names into eachother?

 

- Michel.

0 Likes

matthew_taylor
Advisor
Advisor

Hi @cons ,
Two things:

  1. Look into SaveOptions, specifically the 'Compact' property: https://www.revitapidocs.com/2020/e567811b-4502-e938-c956-dce0e5cc17c2.htmhttps://www.revitapidocs.com/2020/9a19b5d0-fb06-969b-a17b-fa3ad45aa7d6.htm
  2. Which version of Revit are you using? I have noticed similar behaviour when using LoadFamily in Revit 2021. I have a couple of hunches as to what it could be. I'll report back if I isolate the issue.

 


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes

matthew_taylor
Advisor
Advisor

Oh, and I didn't check your whole script, but probably best to have differing test files to load files. Maybe you've got multiple layers of nesting going on, and the layers are incrementing each time.


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes