Sooooo… I played around a bit, and it winds up that this is doable in a somewhat hacky manor, without too much effort or going too far off the rails. It’s pretty well buried under the idiosyncrasies of Revit though. Basically, a Revit Family File and a Revit Family Template have the same content and format under the hood, with a modified extension so Revit handles them differently when opening. This means that you can change the extension of a Revit Family File from .rfa to .rft and get a Revit Family Template file.
Overall, the workflow looks like this:
Steps are basically this:
- Before starting in Revit, create a family with no geometry, and all the parameters your office typically wants, and at least one type parameter for material information.
- Get the material you want to use from the project.
- Load that family into the project, get the original type from the family (remember you’re in the project environment now), set the name, and assign the material parameter to the material which was selected in step 1.
- Get the family element from the family type, and save the family out using the File.Save family node in the orchid package. Use a wait for method to ensure the family finishes saving out before you pass along the directory path you saved it to. By adding the material to a parameter value in the project environment before saving we ensure the material is preserved.
- Generate two file paths from the family name and the directory path - one for the family file (.rfa) which would have just been saved, and one for a matching family template file (.rft).
- Copy the family file to the family template path, and then pass the family template path. We now have a path to a family template which we can use for the Springs.FamilyInstance.ByGeometry node.
- Pass whatever geometry, family name, category, and the name of the material from step 1 into the Springs.FamilyInstance.ByGeometry node.
- If you don’t want the family instance, use a Springs.Doc.DeleteElements node. If you do want it, skip the node or toggle the Boolean to false so it doesn’t execute.
Thanks to the package authors (@erfajo, @Andreas_Dieckmann and @Dimitar_Venkov) who’s work make this possible.
Push Materials from Project into Family Geometry.dyn (76.2 KB)