Welcome! Log In Create A New Profile

Advanced

Any way to get the angle between layers?

Posted by Thedudeabides 
Any way to get the angle between layers?
February 25, 2015 10:46AM
Hello. I am a uni student that has limited expierience in coding (basic course in C, really basic course in C++).

I, and my group, have been tasked with improving a concrete 3d printer. To achieve this we need the angles between the layers in the z axis. I tried writing a different program that modifies the g-code that slic3r spits out, and this works decently, however it seems that the points slic3r gives me is in the middle of the layer (as opposed to lower limit of the layer eg. z= 0 and upper limit of the layer eg. z = 10mm, it gives me the midlle of the layer z= 5mm).
This means that the calculated angles between points don't really correspond to the real angles unless the angle is constant. There is also the problem that with this setup, the final layer will have no angle (as there is no referen point on the next layer, that does not exist).

So my question is the following: Is there any way that slic3r can give me the angles between the bottom point, and top point of a layer, or alternatively, the top and bottom points on a layer (x&y values, the z values seem to already be found in the g-code).

If this is not possible, could I have a couple of pointers to how I could achieve this if I modify the code by myself (my c++ skills are limited...).

PS. I might have misunderstood the g-code and it actually gives me the bottom layer (eg. z= 0). This does still leave the problem that the last layer will have no angle as there is no reference point.

//uni dude
Re: Any way to get the angle between layers?
February 25, 2015 12:21PM
I don't really understand what you are asking, but surely you will achieve what you need by simply subtracting half the layer height from all the Z distances? The model that Slic3r will be using is of an extrusion profile that is symmetric, so a point at the centre of an extrusion will be directly above a point at the midpoint of bottom of that extrusion and directly below a point at the top, so the angles between layers will be the same no matter what reference height is used within each layer. Quite right that there is no reference point above the top layer - there cannot be and it makes no sense to have one because with no layer above there can be no slope. You are in effect fitting a curved line to a set of points just as you would in a plotted graph (and need to use the same method for doing so) - the line cannot accurately be continued past the final point - you could only extrapolate based upon the change of slope over the final few points.

Dave
Re: Any way to get the angle between layers?
February 26, 2015 09:32AM
I see what you mean about the angles, thanks. But I still think that I don't have enough points for an angle of the final layer.

Lets take a simple example with 2 layers. The printer then prints at 2 different z-values. To get the angle for the first layer, I take the angle between a point (x2,y2,z2) in the second layer and a point in the first layer (x1,y1,z1). To then get the angle for the second layer, I would need a reference point (x3,y3,z3) to go with the point (x2,y2,z2) to get the angle? or was the extrapolation meant for this problem?

Thanks.

//uni dude
Re: Any way to get the angle between layers?
February 26, 2015 12:43PM
Quote
Thedudeabides
I see what you mean about the angles, thanks. But I still think that I don't have enough points for an angle of the final layer.

Lets take a simple example with 2 layers. The printer then prints at 2 different z-values. To get the angle for the first layer, I take the angle between a point (x2,y2,z2) in the second layer and a point in the first layer (x1,y1,z1). To then get the angle for the second layer, I would need a reference point (x3,y3,z3) to go with the point (x2,y2,z2) to get the angle? or was the extrapolation meant for this problem?

Thanks.

//uni dude

I assume that you are tilting the extruder to deposit the concrete at a non-vertical angle (you have not really explained what you need to achieve, so I can only guess).

Yes, there is no final angle information and none is possible with the way you are doing this. Consider that I am printing a vertical wall that is tilted. If I set the height of the wall to a single layer height, then the G-Code will consist of just a single line and there will be no way whatsoever of determining the angle of the original model because the G-code will be the same no matter what the angle (you have only 1 point of reference). Now consider that the wall is curved (in Z) rather than just tilted. If I print just two layers the result will be the same as if the original model was a tilted wall - the fact that if there had been a 3rd layer it would be at a different angle cannot be known. You have only 2 reference points and so can only draw a single straight line. With three layers I will know that the angle is changing, but I cannot know whether it is a 1-off change or if the change continues to make a curve.

There are three solutions.

1) Use the original STL file to work out the angles, and use the Gcode only for the paths (adjusting the XY coordinates of the paths depending on the current angle of your extruder).
2) Use Slic3r to slice at half the layer height. Use every other layer for the position information, but calculate angles using the points between that layer and the one above. So if the object is 6 layers high (at half layer thickness), you use the paths of layers 2,4 and 6 for XY position and the angles between layers 1-2, 3-4 and 5-6 for tilt information. Or slice at 1/3rd the height and use the paths of every 3 layers and angles between 1st and 3rd (paths 3,6,9 angles 1-3, 4-6, 7-9, ignoring layers 2, 6 and 8 completely) - if you slice thinly enough the path of each Nth layer will be close enough to what you want your concrete extruder to follow that you probably won't need to adjust the XY coordinate to compensate for the angle, you just need the layer height to be less than the XY positional tolerance that the concrete can be deposited and the maths will all done by Slic3r (albeit taking a much longer time to slice).
3) Extrapolate for the final layer, just as you have to do if you are drawing a graph that extends beyond the final point. As said, the usual way is to look at the change in angle over the past three layers (or the change in change of angle over more than the past 3 points) and apply that same change (or change of change etc.) to extrapolate the next angle - classic curve-fitting. A cruder method is to assume that the structure is not curved in Z and simply apply the same angles to the final layer as you did to the penultimate layer.

Method (2) is probably your easiest route.

Dave
Sorry, only registered users may post in this forum.

Click here to login