FamilyInstance.ByFace with ElementFaceReference

Hi all,
I’ve a problem with a little dynamo code: I’m trying to insert a Surface Based Familty onto a selected surface using attached code. It works good with Revit Elements (as walls, floors and roofs) but it doesn’t work with custom element (model in place or families).
I tried to convert the selected surface to Element.ElementFaceReference but it doesn’t work.

I tried with a Python script using face.Tags.LookupTag(“RevitFaceReference”), but it doesn’t work.

Could anyone of you figure out what the problem is and how can I solve it?

FamilyInstance.ByFace.dyn (11.9 KB)

I tried to upload even a rvt file as example but the website doesn’t allow me to upload it. In any case try the code with a normal roof and then with the same roof modeled using model in place technique. In first case it works good, in second case no.

Hi @Christian_Pallaria

Family.InstanceByFace face input needs surface but you where feeding Element.FaceReference to it try this it should solve your issue.


Thanks a lot Kulkul!

Hi, now the code works, but when I use it more times it delete all elements created and create others new elements depending on new parameters, but I would like to keep the old element and create others. How can I solve the problem?