I'm after an adjustable pie chart. Think of a circular box of cheese triangles. Each triangle is a separate object from the others (and variable in the .pct of the circle, but together form a thick disk - like a hockey puck.
You can also do this with a curve by adding a bevel object and changing the Start/End values of the bevel:
Shift+A> Curve> Circle.
In edit mode of the new curve press Alt+C to 'Toggle Cyclic' so the curve doesn't join its ends together:
Select all the curve points and change their handle type to 'Free' in the side toolbar (T) under 'Handles' and move the curve points back into a circular shape (but the circle will now have a gap).
Extrude the last curve point with E and place it exactly on top of the other end of the curve (a bit more carefully than I have):
- Now add a new curve in object mode and flatten it so it is a straight line:
- In the curve properties for the curve that is a circle set the 'Bevel Object' to be the curve that is a straight line:
You can now adjust the 'Start' or 'End' values (shown in the first gif) to adjust the 'completeness' of the circle.
As one final step, you can give thickness to the curve by adding a 'Solidify' modifier and then an 'Edge split' modifier to correct the shading:
Duplicate this curve and adjust the 'Start' and 'End' values for each new segment of the pie.
One could use Sverchok - node based parametric geometry addon. (Full disclosure, I co-write this addon - but it is free and open-source)
All you then do is change the values in the List Input node..
And set the materials..
Here an alternative with some of the sliders labeled to help you out.
Pros and Cons to doing this:
- You have to install Sverchok Add-on
- Making it fully reusable requires a bit of coding or node noodling
- Sverchok doesn't have a functioning
List Running Sumoperator, the code exists but we never committed it. Questions like this reinforce why the extra operator should be added (thanks!)
- I've not written an example of how to dynamically pick n new colours when the amount of list items is updated.
- You get to experiment with Sverchok, and accidents lead to learning and the add-on has many more uses.
- You can easily develop parametric tools (node trees) that can be every bit as good as an addon, but with often less setup code.
Here's a version that does create new random colors for new list items, this might be handy during the construction phase to help you see the individual slices, simply disconnect the input to the node once you have enough slices
The script inside the "maker_material" node looks like this, and makes only one assumption; the base name of the object (here Alpha - a default name)
import random import bpy def sv_main(num_slices=0): dummy =  in_sockets = [ ['s', 'num_slices', num_slices] ] prefix_name = "Alpha" if num_slices and (num_slices > 0): for s in range(num_slices): obj = bpy.data.objects.get(prefix_name + "_" + str(s)) if obj: materials = obj.data.materials if None in materials[:] or len(materials) == 0: print('has no colours! - adding!') mat = bpy.data.materials.new('some_mat') mat.use_nodes = True nodes = mat.node_tree.nodes obj.active_material = mat diffuse = nodes.get("Diffuse BSDF") diffuse.inputs['Color'].default_value = random.random(), random.random(), random.random(), 1.0 else: print(obj.data.materials[:]) out_sockets = [ ['s', 'dummy_out', dummy] ] return in_sockets, out_sockets
Here is a very simple, purely material based solution.
Plug the Object coordinates in to a Gradient Texture node.
Set the Gradient Texture to Radial.
Drop in a ColorRamp node between the Gradient and the shader node.
Set that color ramp to Constant and add color stops for each part of the pie chart.
I did it this way: https://youtu.be/Fd6xU8tUlWc
I created a vertical plane width a screw modifier set to Z Axis, then I animated the Angle or the Itertions...
Use Array modifier with object angle offset.
Using a similar technique as in this answer
For example case,
- Add a default circle mesh to scene, choose "triangular fan" as fill type.
Add an empty at same location as circle. Rotate this empty
11.25degrees in z.
Add an array modifier to the wedge, and choose object offset and the select the empty.
Can now animate the array modifier count to open close the wedge.
PS. this was originally an answer for this question seems a more pertinent for this question.