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

Thank you for the code changes! I am working with the metric template but have to do the same conversion as you (my geometries are also scaled by factor 3.28…). The assignment of units and factor works well (although there was a spring nodes update that takes care of the bug in Revit 2022). However, using the last two lines of your code (those updating the SAT import parameters) results in the node simply not working without any error message. Any ideas how to solve this?

Alright, after trying to solve this problem for two hours, I found the solution 5 minutes after my post.
To those who use a metric template:
I had to set the custom scale to:

satOpt.CustomScale = 1 / (3.280839895)**2 * 1000 # factor 1000 because I use millimeters as project unit

1 Like

@Karam_Baki can you tell how to use your k-family import node in the metric project? While i am using that it is getting scaled. i tried to scale down before loading the geometry . that is not properly placing the family. Can you give me a solution . I am using this for creating a free-form family around a 5 point adaptive family.

Well it should scale well, it has multiple automatic scale handling functions, either for SAT files, or Dynamo generated geometry.

I can’t help without a sample to test on, would you send me the sample so I can check in my side ?
Thanks

1 Like

Hi,
please find the sample file in the link
https://www.dropbox.com/sh/p82qbx1gyxifdf2/AACM3il8gxtYwq8PR6AVIUTPa?dl=0

@Karam_Baki i have rectified the script and now it is working but when the adaptive point the input family increases , it takes 1 hr to process and create that family. Can we reduce that time?

@Karam_Baki And i have one more doubt, i have created a script that will take the geometry of model in place object and convert that to revit family and place that on top of model in place. I have used ur node but it is not taking multiple geometry and placing on a single family.