Rotate elements in the good coordinates references


I really don’t know how to explain it well in English but i’ll try… I have 1000 piles in my revit file. I collected x,y,z coordinates from each piles and then created cuboids (same size as the piles heads (maybe not the good word?)) but as you can see, the cuboids have not the good coordinates references… Do you have any ideas to help me ?

Thank you and sorry for this bad explication.

Your origin point is based off of the global coordinate system. Try using the Cuboid.ByLengths node that takes a coordinate system instead of an origin point and create a coordinate system that aligns with the pile caps.

Thank you it seems to work but i have problems with some of the piles…

Some need a rotation of 45° :

What are you trying to do exactly? Are you trying to rotate the piles or are they already rotated in the model? What is the cuboid needed for?

I want to evaluate the volume of levelling works needed for each pile. When I will have the cuboids I want, I will increase their volume.

I hope it is more clear…

Because it seems to work for some piles and not all of them, I’m thinking there is something specific to those elements that is causing the problem. They may have been rotated using a different method that is not being recognized or they were rotated in the opposite direction - this seems likely since the cuboids are exactly 45 degrees off regardless of rotation.

Try placing a new element and rotating it to match to see if it works correctly for the new pile.

You are right, but I don’t know how to solve this issue… I didn’t make the piles myself, I am just using the model.

For the right ones :

For the others :

There is a small difference in the name, but this is the only thing different I can see.

Actually the difference is not in the family but in an other paramater (created by the user) called “Sous Zone” which divide the whole project in differents areas. Is it a way to get all elements from a parameter ? Like there is for these parameters :



You can do something like that to collect elements with this parameter :

If you want to collect elements with different values from the parameter Sous zone, you can use an other FilterbyBoolMask.

Thank you Alban !

But finally even in the same “Sous zone” there are the rotations issues… I really don’t understand how it has been done.

Did you open the family and look at the reference planes ? Is there a rotation inside the family ?

For only 1 pile (1 family) the reference plane is :

And for the others (almost 1000 piles and 6 families) :

Is it what you asked ?

I was wondering if the way the family is designed affects the instance in the project.

That’s what I was wondering as well. There are many ways to change the orientation of an element in Revit, but the Rotation parameter is only tracked one way. You could try getting an internal reference plane or face of the element (something that will determine its orientation) and use that instead.

I am sorry but can you explain a bit more how I get an internal reference plane or face and how to use it ?

Thank you

I believe there are a few posts that cover getting an internal reference, but getting a face would be much easier since your object is completely orthogonal. Use the node Element.Faces to get all the faces making up the geometry of the family instance. You’ll have to do a little filtering to get one of the side faces, but the normal direction of any of those faces should tell you the global rotation of the family.

Thank you !
I still have problems… How can I filter my list to keep only the good surface ?

All elements don’t have the same number of faces and I don’t know which one is one of a side faces. I should keep only 1 of the 10 faces in each Sublist (I don’t know how to do it…) but how can I be certain that this will be the good one for all the sublists ?

Just a hint here


Thank you but it still doesn’t work… Is it the good method to use it ?