4
$\begingroup$

I would like to ask whether there is a way of getting the radius of a sphere (mesh primitive) after it has been added. In other words, does Blender somehow distinguish between different shapes?

What I would like to do, is writing a python script to find all spheres in a scene and execute an action on them only. Then find all cylinders and execute another action on them. Is this sort of shape detection possible in Blender or do I have to specify a variable for each object by hand to make the distinction?

Thank you very much in advance!

$\endgroup$
3
  • 1
    $\begingroup$ Once a primitive has been added and you are past the settings stage Blender only thinks of it as a mesh, no distinction is made as to if it still is a primitive, or what type of primitive it started as. $\endgroup$
    – PGmath
    Jan 22, 2016 at 14:53
  • $\begingroup$ If you have control over the creation of such objects via Python, then you could add metadata to each created object (the metadata persists within the .blend file) and do your tests based on that. You could have ob['primitive_type'] = 'sphere' at creation time and then later test for ob in bpy.data.objects: if ob['primitive_type'] == 'sphere': do_action() $\endgroup$
    – nantille
    Jan 22, 2016 at 15:21
  • $\begingroup$ Of course if the annotated sphere mesh is edited in vertex mode and transformed into a tube-like thing (that must be cumbersome) then your annotation isn't valid anymore but the probability this happens is quite low :) $\endgroup$
    – nantille
    Jan 22, 2016 at 15:28

0

You must log in to answer this question.

Browse other questions tagged .