How to create a simple flared cube from 4 sketches

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: How to create a simple flared cube from 4 sketches

Post by jmaustpc » Mon Nov 23, 2020 6:07 am

dapab wrote:
Sun Nov 22, 2020 3:46 pm
Thanks everyone
I'm posting my semi final project file as reference to anyone else who might find it useful. The base of the planter is optional!
The parameters are set in a spreadsheet and dynamically update the shape which is fantastic functionality!
I have had a quick look at your file. So notes:
1) your maths used to calculate the vertical height is wrong. You are using Pythagoras' theorem but you are only calculating allowing for a slope in one plane, you have to allow for a slope in two planes, so if viewed from above you have to use Pythagoras' theorem to find the hypotenuse of a right triangle coplanar with the top surface, then use that value as one side of the right triangle to calculate the vertical height from your angled edge length
2) I very much doubt that anyone would want to specify the planter box by the length of the angled edge, if it really is a planter box, they would want to specify the vertical height.
3) You now have a base and top that are rectangular rather than square, that is just an observation, but it will effect the maths for Pythagoras' theorem.
4) if you lined up a sketch vertical through the diagonal corners, you could use the sketch with construction geometry and constrains and a "driven constraint" to automatically calculate the correct vertical height, if really needed, if the difference between base and top lengths is the same as the difference between base and top lengths.
zardozer
Posts: 23
Joined: Sat Nov 07, 2020 2:35 am

Re: How to create a simple flared cube from 4 sketches

Post by zardozer » Mon Nov 23, 2020 6:56 am

I did a quick attempt at this, trying to do it in the simplest way I could think of. I do agree that usually you'd want to specify the height of it rather than the angled edge, but I went with what the OP was thinking. Basically what I think you need to do is calculate the height by using the diagonal lengths of both the top and bottom, as well as the length of the angled edge. You can see that I did this in the dynamic data table. Once you solve the height, you can use it to offset the top sketch.

Not only would it be more practical to specify the height, it would also be way simpler. Now, if you get to specify that angled edge, there are actually numbers that you can plug in there that would be impossible. You can't make that angled edge too short if the difference between the top and bottom lengths/widths are too large, for example. If you were specifying the height, the angled edge would just adjust accordingly.

I used dynamic data instead of the spreadsheet, but it's basically the same.
Attachments
Planter2.FCStd
(67.09 KiB) Downloaded 8 times
jmaustpc
Posts: 10524
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: How to create a simple flared cube from 4 sketches

Post by jmaustpc » Mon Nov 23, 2020 8:28 am

jmaustpc wrote:
Mon Nov 23, 2020 6:07 am
1) your maths used to calculate the vertical height is wrong. You are using Pythagoras' theorem but you are only calculating allowing for a slope in one plane, you have to allow for a slope in two planes, so if viewed from above you have to use Pythagoras' theorem to find the hypotenuse of a right triangle coplanar with the top surface, then use that value as one side of the right triangle to calculate the vertical height from your angled edge length
Of course that can be calculated with expressions, Python, spreadsheets etc. but just for fun or if you don't know what Pythagoras' theorem is, you can also do it with (construction) geometry and constraints. In this file you can see I have drawn the triangle on the left which is to calculate the offset of the top of the dual sloped line as viewed from above, then used that via an equals constraint to define another right triangle on the right hand side that would be what the dual sloped edge would look like when viewed from the normal of a plane going through the three points, (origin, bottom corner, top corner). The hypotenuse of the second triangle is read from the spreadsheet and is the length of the double sloped edge, the third edge that triangle is read via a vertical distant constraint in "driven mode". Note that the driven constraints (blue ones) are to read data out of a sketch rather than define anything unlike a normal constraint. All my geometry is in construction mode (is blue) so it does not show up in my model unless the sketch is in edit mode.
Screenshot_20201123_184535.png
Screenshot_20201123_184535.png (33.14 KiB) Viewed 111 times
The datum plane is attached to the datum points that are defined by the dimensions in the spreadsheet, this only works with square tops and bottoms or where the difference between the top and bottom dimensions is the same for both width and length.

Here is the file
planter model1(1)_calcwithsketch.FCStd
(137.87 KiB) Downloaded 6 times
dapab
Posts: 10
Joined: Sat Nov 21, 2020 9:26 pm

Re: How to create a simple flared cube from 4 sketches

Post by dapab » Mon Nov 23, 2020 11:45 pm

Thanks everyone again - 3D is tricky....
NB I've edited planter2 file to add dd.ddPlanter_height to the top sketch z attachment offset
And looks like you need to refresh to get dynamic data to update - spreadsheet in a new tab just updates
Why did I want to specify the diagonal length rather than vertical height? Well this is so that material lengths are specified rather than calculated.

Will need to think long and hard to get the geometry constraints example!
Attachments
planter v3.FCStd
(107.6 KiB) Downloaded 5 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot], jtm2020hyo, papyblaise and 15 guests