FamilyInstance.ByGeometry not working in Revit 2022

Thank you for your further explanation :+1:
It worked pretty well :slight_smile:

A support for handling a list of materials would be really cool and handy :slight_smile:

Great! I’m happy it helped.
I’ll add that feature gladly

Best,

2 Likes

I am struggling to follow-along discussion, as it is so long. I am using Revit 2022, and would like to use the FamilyInstance.ByGeometry node. I do not have the option of rolling back to Revit 2020 nor can I use Revit 2023.

The node does not work unless I change the code to the following:

#units = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits
#factor = UnitUtils.ConvertToInternalUnits(1,units)
units = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
factor = UnitUtils.ConvertToInternalUnits(1,units)

#satOpt.Unit = ImportUnit.Foot
#satOpt.Unit = ImportUnit.Default
satOpt.Unit = ImportUnit.Custom
satOpt.CustomScale = 1/3.280839895

as per an earlier post.

But then I get the following output in Revit.

The problem, is that I am not getting any errors, but I can’t figure out the scale of the families instances.

Okay, I was able to resolve the problem by scaling my geometry before applying the FamilyInstance.ByGeometry. Once I clean up my dynamo script, I’ll upload a workflow for converting spaces to conceptual masses using the FamilyInstance.ByGeometry node. I’ll also copy-paste the couple small changes I made to the internal python code to get all of this to run.

2 Likes

Hey did you ever get to clean ur script or any solution here. how are we to scale to geometry before applying the familyinstance.bygeometry

I replaced the code in the python script inside the FamilyInstance.ByGeometry node with the following code:

#units = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits
#factor = UnitUtils.ConvertToInternalUnits(1,units)
units = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
factor = UnitUtils.ConvertToInternalUnits(1,units)
#satOpt.Unit = ImportUnit.Foot
#satOpt.Unit = ImportUnit.Default
satOpt.Unit = ImportUnit.Custom
satOpt.CustomScale = 1/3.280839895

In addition I am attaching a picture of my specific application of the FamilyInstance.ByGeometry node, where you can see that I have to scale the geometry using the Geometry.Scale function.

04_CreateMassesWithSpaces.dyn (37.3 KB)

1 Like