Rotation by vector not applying correctly

I’m trying to array an object along a model line and rotate it with the tangent to the line. It works ok with lines/arcs that run along x but the closer the line turns towards the y axis things start to break for some reason and I can’t figure out why. Any advice helpful. Thanks in advance.

Looks good:

Looks bad:

Paver Path Array.dyn (110.9 KB)

Hi,

That is hard in Revit, you ask him to rotatie by a vector, so when you have an other position in Revit your script does not what he has to do, I had the same with foundation brackets. You can’t work with x and y because you don’t know the position of the building for example.

What I did in my script is sorting the brackets by a spline and after that you can do your thing

1 Like

Hello…could it help with angleaboutvectoraxis instead of vectoranglewithvector…

PS Jan…is revit and dynamo a he/him ? if i call it that in DK i will very fast find myself in big trouble… .heheheheh

1 Like

Thank you @jw.vanasselt After some trial and error I was able to determine that it has to do with the direction in which the model line is drawn and this node here:

If I draw it up-down it works. But if I draw it down-up it breaks which tells me its the vector alignment and the z==1 if/true node.

@sovitek I will give that a shot

I’d like to make it work in all directions.

1 Like

This is so frustrating. All I want to do is array along a path in Revit. All these curves were drawn in the same direction but the vector transformation is not equal:

Hi, could you please share the Revit file as well?

Sure. Here is both Revit and Dynamo file.
Paver Path Array.dyn (133.1 KB)

Test Paver Path Array.rvt (560 KB)

I think the issue is somewhere with the vector.anglewithvector. It’s not returning the correct angle. I’m not sure if it has to do with angles bigger than 90

Like this?

Image2

Paver Path Array MOD.dyn (291.8 KB)

1 Like

oh my god yes! @EdsonMatt Could you pin point what was the issue? Was there a limit on the angle with vectorAngle? Also, is that Python in the codeblock? I can reverse engineer it if you tell me the language and you don’t want to walk me through it. Greatly appreciated!

I don’t have a compelling explanation for that yet. I just measured the dot product between your vectors and vector y and realize that those whose values were > 0 were the ones with the wrong direction. If nobody has an explanation for that and also if there isn’t an explanation in the forum about it (probably it does), I’ll search about it when I have time :slight_smile:.

It’s DesignScript, it’s basically the same thing when you use nodes, it’s just a written way (you can test yourself by right-clicking a node and choosing the option “node to code” or search “node to code” using the search tool here on the forum, you’ll find lots of information :wink:).

Ok thanks, last question. Can you translate this line?

dot_y > 0 ? angle_x*-1 : angle_x;

I think I’ve seen a similar syntax in PHP or JavaScript but I can’t break it down. Thanks.

I believe this syntax is similar to ternary operator in C language.

In C:
image

Amazing! Thanks!

Not to burst your bubble, but for some reason it stops half way along certain curves. Dynamo seems really unreliable…

I wonder if it’s a memory issue. It seems to work on/off…