FamilyInstance.ByCoords - Op fails / object not valid?

See image: I’m trying to place a list of Families, passing the list to FamilyInstance.ByCoodinates

To keep things simple for this example, I’m ignoring my coordinates, and just using the default of 0,0,0

The families are definitely Point-type families, the list filtering you can partially see takes care of that.

The objects are correct - they are Revit.Element.FamilyType which is what the FamilyInstance.ByCoordinates expects as input.

However - there’s that error! Referenced Object is not valid.

I’m at a loss - the only thing I can think of is that I’m working at the Family (RFA) level - my open Document is a Family; and I’m trying to automatically place subfamilies from a predetermined list in predetermined locations. It’s all read from an Excel file, but as you can see, the Families are there and are being recognized as FamilyTypes.

I’ve tried all kinds of List Lacing, that has no effect (it shows Longest in image)

Does anyone have any idea what I’m doing wrong here?

EDIT:

It suddenly works, but I have NO IDEA what I did that suddenly made it work. I think I might have opened the Dynamo Script after the Family RFA file; would this make a difference? Even though Dynamo said it was connected to the currently open file and was reporting it correctly?

@Adrian_Esdaile, this makes sense if you’re switching between Project & Family editor environments. They are completely different. So be sure to open your graph after opening the Revit document.

@zhukoven, Thanks for the reply - yes I think that’s it.

I’m trying to build a system that can essentially ‘copy’ a family from a Revit Project into a Family file - something that cannot be done either in Revit, or the API.

I’m taking the location & rotation of a family, relative to a room; copying that info to an Excel file, then loading that data into a Family.

I’ve got the first part working - exporting tablular data, reading it, pre-loading the right subfamilies, but I’m having trouble with the placing in the Instances. It seems that the location / rotation data stored at the Project level doesn’t reflect the true location / rotation transformation of the family (annoyingly), so I’ll have to look at other ways to record the spatial relationship between objects

@Adrian_Esdaile, Family document has its own fixed orientation, that could be reached by the “FamilyInstance.FacingOrientation” node. Resulting vector is relative to Revit project in which the family is placed, so that it could be used to get the actual family rotation angle (“Vector.AngleAboutAxis”). Then the angle may be transferred to the “FamilyInstance.SetRotation” node inside the Family document via Excel.