Create Adaptive Component Hosted on Line in Family Instance

See image and attached files. I am trying to write a Python Script that will place a 2 point adaptive at the 0 & 1 parameters of a line that is inside of a loaded Revit Family instance.

Here’s the issue - the code seems to work from the aspect of the Adaptive Component is placed in the project and the placement points know they are hosted to the family and to the appropriate parameter, but the Adaptive is Not placed in the correct position, nor does it move along with the host family - in other words - if you snoop the adaptive - it thinks it is hosted, but it does not behave as if it is hosted at all since it is not in the correct position nor does it update its position when the host is moved.

Anyone got any ideas or experience with this?
HostingForAdaptive.rvt (1.4 MB)
AdaptiveHostOnFamilyLine.dyn (6.1 KB)

Have a look at the “Springs.AdaptiveFamily.ByFacetedGeometry” node. It shares similar code.

1 Like

I looked at your code and I see the similarities, but isn’t your node operating in the family environment and not in the project environment? It looks like i’m using the same “SetPointReference” and “NewPointOnEdge” methods, but for some reason in the project environment the code doesn’t behave as expected.

That’s correct, it’s for a family environment. The other difference is that it targets reference points, and not adaptive points. I expect the two would behave quite differently too.

When I tab-select the adaptive point of an adaptive component placed on a line, I can see and tweak the “Normalized Curve Parameter”. Question is does the hosting method even work for adaptive points?

Update:
It seems the method used (NewPointOnEdge) requires actually having a solid. Even though an adaptive can host on a model line that is part of a family within the project environment, the API method only works for edges (meaning you need to have a solid first to get edges from). If using just lines in a loaded family - the adaptive will place itself within the project at the global coordinates that correspond to the local coordinates within the family of the points along the line you are trying to host on. If you model a solid within the family such that one edge falls exactly along the line you wanted to use, then modify the code to find the edge rather than the line - everything works as expected. Bottom line - I think this is a case of that which works in Revit UI does not always work in Revit API.

2 Likes

Also (for anyone searching this later) - note that in order to get the Revit API to correctly place the adaptive in the global coordinates, there is a very good chance that your loaded family needs to be “Joined” to another family during the adaptive hosting process. There is some spooky stuff going on in the background that people smarter than me seem to think is a bug with the API. See this link for more info:
https://forums.autodesk.com/t5/revit-api-forum/edge-reference-of-a-family-instance/td-p/7088651

1 Like