LDraw.org Discussion Forums

Full Version: Rotation & angle of universal joint?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(2019-10-06, 17:51)Roland Melkert Wrote: [ -> ]You don't need an angle, just apply the same orientation the script applied to the second universal end (or the axle snapped to it).

This is what the ctrl+home combined with the relative grid does in my above sequence.
Part of the problem is that I'm not sure what part/end we are speaking of...
Orange parts are the chassis, grey parts are properly placed (I am supposed to be after step "90 deg to align with the axle again."), but blue and white parts are not properly connected.
Maybe I'm dumb... Wink
(2019-10-06, 18:18)Philippe Hurbain Wrote: [ -> ]Orange parts are the chassis, grey parts are properly placed (I am supposed to be after step "90 deg to align with the axle again."), but blue and white parts are not properly connected.
Assuming the red axle is correctly snapped to the all grey universal joint:

Select red axle
Set rel grid
(single) Select the grey uni end (the one with the blue center)
ctrl+home (reset only ori to grid)
rotate it 90 deg as the axle is X oriented and the uni halves are Z oriented.
add the blue, white end and white axle to the selection
apply script
re snap the white axle to the white end.
(2019-10-06, 18:32)Roland Melkert Wrote: [ -> ]Assuming the red axle is correctly snapped to the all grey universal joint:

Select red axle
Set rel grid
(single) Select the grey uni end (the one with the blue center)
ctrl+home (reset only ori to grid)
rotate it 90 deg as the axle is X oriented and the uni halves are Z oriented.
add the blue, white end and white axle to the selection
apply script
re snap the white axle to the white end.
OK, it works Wink Problem iI had s that selection needed for the script reapply  is not similar to what we did before. Need to think a bit to really understand...
(2019-10-06, 19:02)Philippe Hurbain Wrote: [ -> ]OK, it works Wink Problem iI had s that selection needed for the script reapply  is not similar to what we did before. Need to think a bit to really understand...
The fist time you applied the script to: white end, blue center, grey end, grey center
That gave the correct positional information
The second time corrects the rotational parts of the center en white end based upon the red axle instead of the 'randomly' rolled white one.
(2019-10-06, 19:15)Roland Melkert Wrote: [ -> ]The fist time you applied the script to: white end, blue center, grey end, grey center
That gave the correct positional information
The second time corrects the rotational parts of the center en white end based upon the red axle instead of the 'randomly' rolled white one.
OK, get it. Phew Wink
Ah, time for using bold font on this forum...
Roland, thanks a lot for this script! Although it has some bugs (and it's UI is... eh... minimalistic? Wink ), it is a big help I had been waiting for, for a looong time. It motivates me to study the function source code and trying to create a similar function for two rotated beams connection. I hope I can save some time for it.

The above-mentioned bug report:
I followed all step of your "usage howto" in this thread and the script rotated not only the desired halves of uni-joint but the other ones as well, fortunately it was easy to fix (rotate them by 180°). See attached picture.
[attachment=4109]

About UI:

1. in fact, the script/function is completely useless without this forum thread knowledge. For "production version", can you add a help message?
2. we can see here why I requested a feature of >1 selection(s) (i.e. different colors of selection highlight or a script asking interactively for each selection) - if impossible with LDCAD 1.6, may you think about it for 2.0, please?
(2019-10-22, 9:01)Milan Vančura Wrote: [ -> ]Roland, thanks a lot for this script! Although it has some bugs (and it's UI is... eh... minimalistic? Wink ), it is a big help I had been waiting for, for a looong time. It motivates me to study the function source code and trying to create a similar function for two rotated beams connection. I hope I can save some time for it.
It's not a quick and dirty version for nothing Smile

The core math comes from the 8860 animation and it only works with joint parts that are oriented in the Z direction.

(2019-10-22, 9:01)Milan Vančura Wrote: [ -> ]I followed all step of your "usage howto" in this thread and the script rotated not only the desired halves of uni-joint but the other ones as well, fortunately it was easy to fix (rotate them by 180°). See attached picture.
Don't know what goes wrong, I tried the same setup and it works for me. Just be sure a selection is the 3 joint parts and a destination point (usually the next joint's first part).

A script that does both in one go would be much better for these constructions otherwise you'll have to do one of the joints twice to correct for the roll difference (like discussed above).

Such a script would need a selection of all 6 joint parts and the destination axle.

You could also let it automatically add an axle with the correct length in the middle of the two joints.


(2019-10-22, 9:01)Milan Vančura Wrote: [ -> ]1. in fact, the script/function is completely useless without this forum thread knowledge. For "production version", can you add a help message?
2. we can see here why I requested a feature of >1 selection(s) (i.e. different colors of selection highlight or a script asking interactively for each selection) - if impossible with LDCAD 1.6, may you think about it for 2.0, please?
1. I could add a message before execution, but that would be annoying once you know how it works.

2. 2.0 will indeed be much more integrated with the scripting engine.
EDIT: Never mind. Big Grin While reading through the script to figure out the necessary math, I noticed this line:
Code:
endCPosOri:mulRotateBA(90, 0, 0, 90) --optional

Commenting out that optional line made it unnecessary to rotate the end piece in the first place, so my question, while still of interest, now becomes purely academic.

(But why is the vector argument here 0, 0, 90 instead of 0, 0, 1 for the z-axis?) Huh


Follow-up question: Let's say I've applied the script (the improved one that now comes with LDCad, naturally) as above, and now I want to rotate one of the U-joints 90 degrees longitudinally—for example, so that the slots align on the center link?

It's easy enough to rotate the ends, just by changing signs and moving 1's around in the matrix. But how about for the center piece? That seems like it should be just as easy, but I can't work out the right process.

Theoretically, you could rotate the ends and then re-apply the script to just that one joint, but this seems to introduce slight misalignments that weren't present when applying the script to both joints at once. I'd like to retain the calculations done by the script the first time and just manually type in the 90 degree rotation.
(2021-08-22, 17:09)N. W. Perry Wrote: [ -> ](But why is the vector argument here 0, 0, 90 instead of 0, 0, 1 for the z-axis?) Huh
Typo, the function will normalize it anyway Smile
Pages: 1 2 3