Top constraint in family to snap to level in revit

I have created a family with a ‘Top constraint’ and would like said family to snap to this constraint.

You can see what I have been trying to do in the top right with no luck after searching around for a while.

Also I was wondering as to whether this script could be more optomised as once I added in elements to project points down from a drawn line onto the topo surface it starts eating up massive amounts of ram.

To give you an idea of what I have tried to accomplish with the overall script I have added a picture from Revit. It is a wall made from fins with varying angles (so you can see in at specific points). the script allows for changing said angles and line selection (hence the sliders for varying parameters). The base is undulating along the toposurface, however I want the top of the family to be aligned with a specific level as previously stated.


Can you post your revit file and dyn file, as well as the error occurring in the Element.SetParameterByName? This will help us understand the the family in question and provide a more detailed response.

Thanks for the reply. I have sorted out the error

This allows me to change the top constraint to a level in the model.
However it is just taking the height of the level and applying it each family instance so the top level is not constant.

I want it to have a uniform top height. I dont know if the is a way to change the parameter of each istance individually by deducting the base offset of each instance from the level height. This would output a sum that would allow the top of each instance to be constant.

If you take the level elevation and subtract the z value of the element’s location point from the transpose node that should give you the required total height of the element. See the example below.

image

Thanks for the help but this didn’t work. I think it has something to do with where the ‘Element.SetParameterByName’ is being plugged into. I think because it is being directly linked to ‘Family Types’ it is not changing each point but a single instance that effects every single one.

Is there a way to ‘plug’ it into ‘FamilyInstance.ByPoint’ as this is where the individual rotations are changed so that each point is being changed individually and obviously this is working to separately control each instance of the family.

To reiterate plugging into ‘Family Types’ is not allowing for individual modification of each point instance of the family.

‘Plugging’ into ‘FamilyInstance.ByPoint’ may resolve this but I am unsure how.

Ah, I see. The issue lies in the construction of the family. The height parameter in your family needs to be an instance parameter, not a type parameter. If you change that in the family, you can then set a different value for each instance of that family. If you post the Revit family, I can take a look at the change required there. Your script would look similar to below.

Fin_wall.rfa (380 KB)

Thanks, that is a great help.

I have changed the ‘type parameter’ to ‘instance parameter’ within the family. The ‘Element.SetParameterByName’ is now not recognising the parameter name giving the error, “No parameter found by that name”.

I have double checked using ‘Get Family Parameter’ and ‘Top contraint’ is not coming up in the list anymore.

I have set up everything as you have shown.

What is the next step from here? What am I missing?