### Author Topic: something simple to start with - a bit of a blog...  (Read 692 times)

#### raymw

• Newbie
• Posts: 32
##### something simple to start with - a bit of a blog...
« on: 2020-08-27, 16:34:14 »
Being a fairly new user of AngelCad, I've been looking for suitable objects to model, and also 3d print, or machine. One such item is a standard steel oil-drum. The history of steel oil-drums is quite interesting, and the design soon became a world wide 'standard' The basic dimensions are 34 inches high and 23 inches in diameter, and capacity is 55 gallons (USA), 48 gallons (Imperial). They have a couple of ridges around the circumference, to add strength, and make them easy to roll.

see https://bizfluent.com/info-tip-8098511-dimensions-55gallon-oil-drum.html

The goal, is to make a model of a drum, in either 7mm to the foot scale, or 4mm to the foot.

Always, in cad, model in full size dimensions, and apply a scale factor at the end to get to the size of the object needed. Most cad programs, cnc (g-code) are unit-less, although obviously the machine will be set to convert the numbers into standard units of measurement.

So, this is how I've gone about the modelling of the oil drum. I'm putting in a fair bit of detail of my method, so that if you are a raw beginner, you can understand the process. Of course, there are dozens of ways of doing this, I'm not pretending this is 'the best', but it works for me.

We start with the main cylinder, 34 inches high by 23 inches diameter

so we can write

Code: [Select]
`solid@ cyl1(){   return cylinder (34,11.5);}`
that is followed, as always by

Code: [Select]
`void main(){   shape@ obj = cyl(1);   obj.write_xcsg(GetInputFullPath(),secant_tolerance:.05);}`
which will generate an stl file, and show the representation on screen, in the xcsg viewer.

So far, so good. What else is needed? Well there is a recess at the ends of the drum, where the top is folded into the sides in manufacturing. In reality, the steel is about 0.125 inches thick, but as we are trying to model this at a small scale, and 3d printing the results, then it will pay initially to allow that lip to be thicker. (Generally in modelling, details have to be exaggerated, for various reasons) (OK, I maybe breaking the rule about always model in full size dimensions ...   )

So we can subtract a cylinder from each end of the main drum, giving us

Code: [Select]
`solid@ cyl1(){    return cylinder(34,11.5)- translate(0,0,33)*cylinder(1,11) - cylinder(1,11);}`
the translate (0,0,33) puts the recess at top of cylinder.

Now, in the top of the drum, there are usually two caps, a filler and a vent, so that the drum does not collapse when the contents are sucked out, or an air lock does not form when being poured. A couple of small cylinders will suffice for that.

so, we can add the script for these caps as

Code: [Select]
`solid@ caps(){   solid@ cap = cylinder (1,1.7);   solid@ cap2 =cylinder(1,1.2);   return translate(9,0,33)*cap + translate(-9,0,33)*cap2;}`As the drum is centred on the origin, it is easy to get the caps evenly spaced on a diameter line, 9 inches either side of the centre.

Now, we want a couple of the reinforcement ridges, which are equally spaced on the circumference of the drum. Now, these are sort of smooth in profile, but at the small scale we are ultimately dealing with, we can represent them by a triangular profile. Thinking of a cone as being a circular triangle, and thinking of the top of one of these ridges, then the sort of shape we need is given by cone(1.1,12.2,11.3) which is saying that it is 1.1 high, and the bottom radius is 12.2, (0.7 bigger than the drum) and the inner radius is  11.3, 0.2 smaller than drum. This gives the sort of angle we are looking for, and since this shape will be added to the drum, the over lap in the diameters will not matter. We need a bottom edge of the ridge, so simply rotate the top edge around the x axis (or y) and add the top and bottom together

Code: [Select]
`solid@ ridge(){   solid@ top= cone(1.1,12.2,11.3);   solid@ bot= rotate_x(180)*top;    return top + bot ;}`

You can now add together what we have so far, and view the result.

So, we now have to position the two ridges, but if If you look at an image of an oil drum, you can see there is also a lip at the top and bottom, so we may as well show that, too

so, we can make the lips 0.2inches wide, and position the ridges at 11 and 22 inches from the bottom of the drum

Code: [Select]
`solid@ ridges(){   solid@ lip = cylinder(1,11.7)-cylinder (1,11.5);   solid@ toplip = translate(0,0,33)*lip;   return translate(0,0,11)*ridge()+ translate(0,0,22)*ridge() + lip + toplip;}`

That is the drum components completed, so add it all together

Code: [Select]
`solid@ drum(){   return cyl1() + caps()+ridges();}`

remember, that if you have gone through this procedure outlined above, and viewed the results at each stage, you will need to modify the name of the object you are creating in main(). Also, secant_tolerance, adjusts the smoothness of the surface for curved objects, see https://github.com/arnholm/xcsg/wiki/secant_tolerance

Now, part of the design features of standard oil drums, is that four of them sit quite nicely on a standard pallet, with one inch spacing between them (It is not clear if that is one inch between each drum body, or one inch between ridges).

So, we can position four of them, (The rotates make sure that the fillers are not lined up, I do not think they would be in reality, unless perhaps new empty drums from the manufacturer)

Code: [Select]
`solid@ four(){   solid@ first = drum();   solid@ second = translate(0,24.5,0)*rotate_z(25)* first;   solid@ third = translate(24.5,0,0)*rotate_z(50)* first;   solid@ fourth = translate(24.5,24.5,0)*rotate_z(150)*first;   return first+second+third+fourth;}`
You may as well print four of these pallet-fulls. As an exercise, use translate and rotate so that none of the fillers line up. (In my example, I've not done the rotates.)

so, at 7mm to the foot, and most 3d printers expect mm dimensions, then the scale is 7/12 mm to the inch a scale of 58.3%, near enough.

Applying the AngelCad scaling transform we can have something like - scale(0.583)*four() in the  main function.

I've attached the complete script (barrel.as). (attached as barrel.txt - you can rename it)

In practice, I may take care of the scaling in the slicing program, if wanting different scaled models.

I hope this has helped you, if you realise the power of Angel Cad, but can't make much sense of github, and the rest of the help system.

A few additional print related comments. The lips need to be far larger than the scaled full size, since the detail is too fine for a slicer, such as Cura to slice properly. The two fillers need to be bigger, too, they just look wrong. There are certain aspects in models, that need to be exaggerated, in order for them to 'look right'. In the same way that colours generally need to be more subdued, and matt finish paint, not gloss, etc, is preferred. Equally, there are some things that can not be readily modeled to scale, working tolerances, for example, sound too.

---
Edit (by Carsten Arnholm): I put your code snippets in code tags to make the post easier to read. Please use the # button for this purpose.
« Last Edit: 2020-08-29, 21:57:04 by raymw »

#### raymw

• Newbie
• Posts: 32
##### Re: something simple to start with - a bit of a blog...
« Reply #1 on: 2020-08-27, 17:01:48 »
Having made our four drums, that will fit on a pallet, we'd better make the pallet, to stand them on.

The standard drum pallet is 48 inches square. I found an image, and made some calculations, as best as I could. I've never seen such a pallet, so I've made some guesses, and decided that each plank is 0.75 inches thick, and 4 inches wide. There are 7 on the top, and 4 on the bottom, parallel to each other. They are separated by spacers, say 5 inches high by 1.5 inches wide, one at each edge, and two towards the middle, about 4 inches each side of centre line.

so, we may as well build it from the bottom up, but let's first design the parts needed.

There are only two construction parts,  a plank, 4 inches by 0.75 inches, 48 inches long, and the supports, 5 inches by 1.5 inches by 48 inches long. We  may as well use the correct orientation.

Code: [Select]
`solid@ plank(){ return  cuboid(4,48,0.75);} // create supportsolid@ support(){    return cuboid(48,1.5,5);}  `

Now we can lay down the four slats for the base (remembering to allow for the width of slats - they are more or less equally spaced over the 48 inch width),

Code: [Select]
`// create four planks on the ground solid@ base(){   solid@ b2 = translate(17-2,0,0)*plank();   solid@ b3 = translate(31-2,0,0)*plank();   solid@ b4 = translate(48-4,0,0)*plank();    return plank() + b2 +b3 +b4;}`
Now the supports, they must be raised 0.75 inches, the thickness of the slats (They are already at right angles)

Code: [Select]
`// create  the four supportssolid@ supports(){   solid@ s1 = translate(0,0,0.75)*support();   solid@ s4 = translate(0,46.25,0.75)*support();   solid@ s2 = translate(0,19,0.75)*support();   solid@ s3 = translate(0,48-19-1.5,0.75)*support();   return s1 + s2 + s3 + s4; } `

Finally the top layer of 7 slats.  I'll make 2 groups of 3 slats, and one in the middle - remember the z offset.

Code: [Select]
`// create the  top planks  solid@ top(){    solid@ mid = translate(24-2,0,5.75)*plank();   solid@ l1 = translate(0,0,5.75)*plank();   solid@ l2 = translate(4+(11/3),0,5.75)*plank();   solid@ l3 = translate(8+(22/3),0,5.75)*plank();    solid@ left = l1+l2 +l3;   solid@ right = translate(26+(10/3),0,0)*left;    return left + mid +right; }`

Then nail all the parts together.

Code: [Select]
`shape@ main_shape(){  //add the three layers   return base() + supports()+ top();}void main(){   shape@ obj = main_shape();   obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);}`Don't forget to scale it.

These print quite nicely, with no supports or rafts, and the oil drums fit, too.

Now, hopefully, if you were new to all this, you've followed along, and at least produced and viewed the stl files. If you have access to a 3d printer, have a go at printing them and make adjustments as necessary. To follow on from this, maybe you can write the script for producing a 7mm scale fork lift truck, to handle the pallets.

---
Edit (by Carsten Arnholm): I put your code snippets in code tags to make the post easier to read. Please use the # button for this purpose.
« Last Edit: 2020-08-28, 14:45:48 by Carsten Arnholm »

#### raymw

• Newbie
• Posts: 32
##### Re: something simple to start with - a bit of a blog...
« Reply #2 on: 2020-08-28, 19:07:06 »
Thanks - by default, I have scripting turned off in Firefox, I didn't see the tags. I'll try and remember in future.