Recommended Posts

Update

I rewrote the script in C++ and built 2 binary versions of the tool - 1 for windows and 1 for Linux.

I have not been able to test them extensively and they do have bugs which I hope to fix soon.

I could not attach them to this post as the file size is too large.

Windows version tested on a fresh install of Windows 7 Professional (don't have anything more recent), Linux version tested on a fresh install of Ubuntu 16.04

technicAngles_Windows

technicAngles_Linux

 

Original post:

Hey all

Hope this is the right place to post this, if not, moderators please move to wherever it should go. Also, long post alert!

I was recently looking for a way the recreate an angle (within a certain range) using technic bricks and after some twiddling around by stacking lots of technic bricks and rotating another brick fixed to the stack with a pin in order to find where the holes would line up I realised a) that this was not very precise (I did find 1 illegal connection that seemed to work perfectly) and b) that it might take forever.

What to do? Automate!

I quickly hacked a small Python script together that would calculate all possible pythagorean triangles by stacking bricks - done. Or was I? Well, for my original purpose I was. But then I looked at the list of angles the script had returned and realised that I was having trouble imagining what a certain angle/triangle actually looked like. This is where ambition took over.

I started to add a graphical user interface which would draw the triangles calculated by my script - this took a lot longer than the mere calculation script. A LOT longer :laugh:

Anyway, it works nicely now.

Some screenshots (click on them to view a larger version)

img1_small.png

img2_small.png

Now, I don't know if this tool would be of any use to anyone (maybe everyone knows these angles by heart) but I thought I'd share it anyway.

The problem here is that it requires Python and Qt4 and anyone who'd like to use the script should have these installed and while I can and will give every bit of information and help concerning my script I simply do not have the time to help people to set up Python and Qt4 (and PyQt) on their computers.

Anyone who has these prerequisites fulfilled should be able to download the attached files and run it without a problem.

Alright then, some pointers on how to use it:

Checkbox "with half offsets": when checked the calculations will include technic brick 1 x 2 with 2 holes which basically means half a hole offset.

Checkbox "with multiples": when checked the same angle may appear multiple times as doubling the length and height of a triangle will result in the same angle.

Fields "Max. length" and "Max width": when left empty the script will use a maximum length of 15 holes (16 stud brick), use any other value you like - the larger, the more different angles you will get.

When you've made your choices click "Calculate" or press "ENTER". The script will generate a list of triangles and display it in the table.

Click on any entry in the table to see a graphical representation of the triangle on the right side of the window.

The currently displayed triangle can be saved as an image (.png) by clicking on, yes you guessed it, "Save Image". The image will be saved in the same location as the script resides.

That's about it.

I have tested this on Ubuntu Linux 14.04 using Python 2.7.6 and Qt4 and on Windows 7 using Python 2.7.5 and Qt4.

If you think you've found a bug please email me (address is in the source code or the about window) with a description and a way to reproduce it and I'll see what I can do.

The reason I chose Python/Qt is that it is platform independent and the script should run on any operating system which supports the 2 - also because I'm lazy and I have the 2 already installed. At the same time I realise that it is not for everyone because of the need to have them both installed.

Here's hoping that at least 1 person finds this useful :classic:

Feedback is always welcome of course.

Cheers

technic-angles.zip
 

Edited by usbdevice

Share this post


Link to post
Share on other sites

I looks like a nice tool. I would like to see it in 3D and studless coordinate system too :)

Share this post


Link to post
Share on other sites

At the start of this year I undertook my first project in python using Qt, so I know all about GUIs taking more time than the actual calculations!

A couple of suggestions (noting that I haven't yet downloaded the source code):

  1. If the aim is to find how to make a specific angle, it might make more sense to sort your output by Angle, and have that as the first column.
  2. It's not explicit that your B side is in different units than your other two sides (it took me a while to figure out what was going on - "8 5 10? that's not a Pythagorean triple? Oh, that's 5 bricks making a length of 6 studs"). What if my upright was a beam rather than a stack of bricks? What if I wanted to make the hypotenuse out of a stack of 1x2 bricks? By not considering these options you're needlessly limiting yourself.
  3. Do you know why the 5-12-13 triangle is not displayed? (12 studs should equal 10 bricks, so that should be in your table as 5 10 13)
  4. Have you considered adding a tolerance? There are a bunch of combinations that aren't exact, but work well enough in real life. In the below image for example, I have a triangle that's A = 3-studs, B = 7-bricks, C = 9-studs. The pin doesn't quite line up in the hole on the render, but in actual bricks it's fine.

tri379.png

Owen.

Share this post


Link to post
Share on other sites

Hello Owen

You make good and valid points

If the aim is to find how to make a specific angle, it might make more sense to sort your output by Angle, and have that as the first column.

Very true. I am aware of this, I just never got around to implement the sorting. I'll look into this the next time I have a bit of spare time.

It's not explicit that your B side is in different units than your other two sides (it took me a while to figure out what was going on - "8 5 10? that's not a Pythagorean triple? Oh, that's 5 bricks making a length of 6 studs"). What if my upright was a beam rather than a stack of bricks? What if I wanted to make the hypotenuse out of a stack of 1x2 bricks? By not considering these options you're needlessly limiting yourself.

Also a good and important point. It took me a while to get to grips with the LDU-system of measurements and I probably should have used that for measurements in the list. I just figured that holes would be easier to understand, but yes, then you have the problem that the A and B units are not equal. As for the other options/possibilities of combining bricks, it's all doable but that would have gone beyond the original scope of my "hack" :classic:

It is limited, but at the moment that's just what it is.

Do you know why the 5-12-13 triangle is not displayed? (12 studs should equal 10 bricks, so that should be in your table as 5 10 13)

Yes, it would appear in the list if I had checked the "with multiples" checkbox, 5 10 13 is a multiple of 2.5 5 6.5. The script works in this way: when it has found a new triangle, it checks to see if the resulting angle is already in the list - depending on the checkbox it is then included or not.

It would also appear if I had unchecked the "half offsets" checkbox as then the 5 10 13 triangle would be the first with that angle.

Have you considered adding a tolerance? There are a bunch of combinations that aren't exact, but work well enough in real life. In the below image for example, I have a triangle that's A = 3-studs, B = 7-bricks, C = 9-studs. The pin doesn't quite line up in the hole on the render, but in actual bricks it's fine.

Yes I have. I wasn't sure whether this would be acceptable in terms of legal/illegal connections. I actually ended up using an angle which is not in the list either (the I mentioned in my original post, the one I found by trial & error). I even went as far as to calculate the relative "error" and looking up the coefficient of linear thermal expansion of ABS and molding tolerances for Lego bricks to see how many degrees of temperature change it would take for line up perfectly in best/worst case scenarios :laugh:

The question in the end would be: What is the acceptable tolerance in order to not stress the bricks too much?

This would probably not be too hard to implement but I'm still hesitant as I wouldn't want to upset the community by suggesting not entirely legal connections.

I'd like to point out, for anyone interested and with a knowledge of Python, the source code is there, feel free to add change and modify to suit your needs. I'm sure the code can be optimized. It is a hack and because of me not thinking it all through before starting there are a couple "ugly" patches to make it work.

I looks like a nice tool. I would like to see it in 3D and studless coordinate system too :)

Well, that would mean a whole other level of complexity and I would have no idea how to go about this but after thinking about it for a bit, it might be possible to export a particular triangle to maybe an MLCad/LDCad file format...

Lenny

Edited by usbdevice

Share this post


Link to post
Share on other sites

The most 'known' triplets that satisfy Pythagoras are 3/4/5 and 5/12/13, and their multiples. Now, how does the triplet 5/10/13 constitute a valid set?

5^2 + 10^2 = 25+100 = 125 is not equal to 13^2 = 169.

What am I missing?

Share this post


Link to post
Share on other sites

The most 'known' triplets that satisfy Pythagoras are 3/4/5 and 5/12/13, and their multiples. Now, how does the triplet 5/10/13 constitute a valid set?

5^2 + 10^2 = 25+100 = 125 is not equal to 13^2 = 169.

What am I missing?

5^2 + 12^2 = 13^2...

25 + 144 = 169...

so why 5/10/13?

Share this post


Link to post
Share on other sites

It looks like a nifty tool, but I would have some suggestions for improving it.

First of all, why is B is in another unit (brick-heights vs. studs)? As you can see this confuses people, and it's mathematically weird as well. So @darsedz: The 10 in column B means 10 brick-heights, which is exactly equal to 12 studs, which makes 5/10/13 actulaly 5/12/13, which is a known Pythagorean triple.

So I really think the UI should reflect this, and also, B should be available in studs. (Maybe have an option checkbox, or a second B column, and have the original B-in-brick-heighs column in another color to disitniguish it from all numbers measured in studs.

Adding B measured in studs would open up the program for the studless system (where a length of 6.5 for example could also be achieved using a 5.5 axle and two angle connectors). Then you can have a checkbox "work with multiples of 0.5 for B" (studless system) or "work with multiples of 0.4 for B" (studded system - a plate's height is 0.4 studs).

Also, I think, it would be very useful to add "near-misses" as well. For example I use the 4/7/8 triangle sometimes. It's not an exact Pythagorean triple, but 4x4 + 7x7 = 65 and 8x8 = 64 are so close together that this works and doesn't cause "strain". Same for 4/8/9. Sometimes I even use a 4/0.5/4 triangle, where a 5L beam is placed almost-vertically, because 4x4 + 0.5x0.5 = 16.25 is so close to 4x4 = 16. If you would do this, the actual offset (sqrt(65) - sqrt(64)) would be an interesting measurement, as that's the actual distance by which something in the structure has to stretch or compress. But if that's really small, it will fit with no problems.

I'm not sure I would use this personally (I prefer just trying in real bricks whether it fits, and in other situations I'm mathematically adept enough to use my own method. Also I sometimes want to do more complex stuff not possible with your program).

(And yes, building a user-friendly UI system is very often very time-consuming. So great job on that)

Share this post


Link to post
Share on other sites

I dealt with triangles too when I was building my propeller plane. I made simple excel table where I found these triangles with right angle that are useful for Technic beams. Lenghts are measured between centres of hole so if you want lenghts in holes (number of holes in beam) add 1 to each number. Triples with * are not 100% correct but still works with Technic beams.

3 / 4 / 5

5 / 12 / 13

6 / 8 / 10

6 / 17 / 18*

6 / 18 / 19*

7 / 11 / 13*

8 / 9 / 12*

8 / 15 / 17

9 / 12 / 15

10 / 15 / 18*

11 / 13 / 17*

12 / 12 / 17*

Edited by Tomik

Share this post


Link to post
Share on other sites

5^2 + 12^2 = 13^2...

25 + 144 = 169...

so why 5/10/13?

I agree that 5/12/13 is a valid triplet, as I clearly stated in my post. However, if you read the post prior to mine, there was a mention of 5/10/13 as a valid set, and that is why I asked my question. Incidentally, the triplet 3/4/5 is often called Egyptian triangle as it's often seen in Various old constructions by the Nile.

Also, one of the lego technic bent liftarms is based precisely on the 3/4/5 triplet. Can you guess which one?

Edited by DrJB

Share this post


Link to post
Share on other sites

Yes, it would appear in the list if I had checked the "with multiples" checkbox, 5 10 13 is a multiple of 2.5 5 6.5. The script works in this way: when it has found a new triangle, it checks to see if the resulting angle is already in the list - depending on the checkbox it is then included or not.

It would also appear if I had unchecked the "half offsets" checkbox as then the 5 10 13 triangle would be the first with that angle.

Ah yes, that makes sense - I should have looked at the other combinations more closely.

I agree that 5/12/13 is a valid triplet, as I clearly stated in my post. However, if you read the post prior to mine, there was a mention of 5/10/13 as a valid set, and that is why I asked my question. Incidentally, the triplet 3/4/5 is often called Egyptian triangle as it's often seen in Various old constructions by the Nile.

Also, one of the lego technic bent liftarms is based precisely on the 3/4/5 triplet. Can you guess which one?

That would be all of them? (well, the ones that don't go 90 degrees) - they're all bent at the same angle.

Are you happy now with why 5/10/13 is mentioned? Erik gives a pretty good explanation.

Share this post


Link to post
Share on other sites

That would be all of them? (well, the ones that don't go 90 degrees) - they're all bent at the same angle.

Almost, as the reason for the angle is exactly the Egyptian triangle. Of all three bent liftarms, the 1×9 (6-4) is the one I was referring to. The long side (6M) has a length of 5M (between holes) and that is the hypotenuse of the 3/4/5 triplet.

Are you happy now with why 5/10/13 is mentioned? Erik gives a pretty good explanation.

Yes I am, I was merely replying/clarifying to darsedz. In 5/10/13, 5 and 3 are in units of M (module) whereas 10 is in units of brick height. Once all elements are converted to M units, it becomes the familiar 5/12/13.

Edited by DrJB

Share this post


Link to post
Share on other sites

...

Also, one of the lego technic bent liftarms is based precisely on the 3/4/5 triplet. Can you guess which one?

..

6629 - Technic angular beam 4x6 (6 is this C triangle arm)

the same angle has 4x4 (32348) and 3x7 (33371)

Share this post


Link to post
Share on other sites

6629 - Technic angular beam 4x6 (6 is this C triangle arm)

the same angle has 4x4 (32348) and 3x7 (33371)

Already answered my own question. Read post #12 :wink:

Though, you're right! ALL bent liftarms have the same angle. But, the 4/6 liftarm (6629) has the correct hypotenuse length.

tan (alpha) = 3/4 ==> alpha = arctan(0.75) = 36.87 degrees.

Thus, angle of all liftarms is 180-36.87 = 143.13 degrees

Edited by DrJB

Share this post


Link to post
Share on other sites

Wow, thanks to everyone asking and contributing!

So yes, my UI is confusing, sorry about that :sad: I should have thought about this more before posting it here.

So to recap why at first glance those don't appear as valid pythagorean triangles:

The A and C sides use a different scaling than the B side.

Horizontally, A, and diagonally, C, the distance between 2 holes is 20 LDU, vertically, B, the distance between 2 holes (of 2 bricks stacked directly on top of each other) is 24 LDU (with each plate adding another 8 LDU).

If you multiply the numbers in the list with the corresponding LDU factor and THEN apply pythagoras you will find that it works out perfectly.

To take the 5/10/13 triangle mentioned above a couple of times: (5 * 20)² + (10 * 24)² = (13 * 20)²

The reason I used this "weird" scaling was that I needed my angle to be built in this way: vertically stacked and with a diagonally placed 1*X technic brick. Maybe I didn't search enough or in the wrong places, but I all information I could find using google referred to technic BEAMS and usually only listed very few possible angles (only one I can remember off the top of my head is brickgun.com)

Anyways, I'll try and work on it some more if I find some time this weekend.

Lenny

Edited by usbdevice

Share this post


Link to post
Share on other sites

could someone tell me whats going on without all the math?

usbdevice has built a tool to find out which beams to use to build a specified angle, or which beams to use to brace a construction with diagonals (to create triangles, which makes a construction stronger).

He has posted his tool here and people are giving suggestions as how to improve upon it. Interleaved with those suggestions is a discussion about how everyone works with angles and diagonal bracing.

People then mention that LEGO themselves have one of the main triangles built in their 4x6, 4x4 and 3x7 bent beams.

That's kind of what happens with all the math removed ;)

Share this post


Link to post
Share on other sites

That's kind of what happens with all the math removed ;)

Very eloquently stated :thumbup:

I can already guess what the next question will be: Can you explain how gearboxes work without using gears? ... j/k

Edited by DrJB

Share this post


Link to post
Share on other sites

Hi again

I have updated my original post as I recently decided I needed something to sink my teeth into. I rewrote the script in C++ and built binary versions (executables) for Windows and Linux.

Changes:

- I added the possibility to specify a tolerance for the more adventurous among us

- Option for studless - instead of a stack of bricks for the vertical, it'll draw you a 'regular' technic brick

- Scrolling with the mousewheel while on the image will zoom in/out

 

A word on the tolerance: It's specified in % of the distance between two holes of a technic brick, which is 20 LDU or 8mm. So for example a tolerance of 1% would equal 80um (micrometers)

The download links are in the first post of this thread.

Cheers

Edited by usbdevice

Share this post


Link to post
Share on other sites

Sounds like a potentially useful tool!  It is worth considering non-right angle triangles, which can also be very useful for producing specified angles.  For example, a 5-7-8 triangle has an exact 60 degree angle.  Such angles can be computed using the Cosine Rule.  I seem to remember I also wrote a python script to explore these a while back, and I may have posted some of the results here...

Share this post


Link to post
Share on other sites
11 hours ago, usbdevice said:

Hi again

I have updated my original post as I recently decided I needed something to sink my teeth into. I rewrote the script in C++ and built binary versions (executables) for Windows and Linux.

Is there version for Mac users?

 

Share this post


Link to post
Share on other sites
10 hours ago, Doug72 said:

Is there version for Mac users?

 

Sorry, not at the moment. The problem is not that I wouldn't want to, but that I don't have the means to test it at the moment.

I am looking into it though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.