2
$\begingroup$

I'm making a unit cell of a face-centered-cubic crystal, and I want to cut a group of icospheres with a cube. I have grouped the spheres. Then I selected them by selecting one, and with the select menu, choose group -> siblings.

Once I do that, two things happen. 1st, other objects are selected at the same time (have to de-select them with shift-click) and now the cube no longer appears in the choice of objects as the second object for the modifier, only the icospheres in the selected group. See screenshot bottom right (below). (Ignore the un-applied wrench-icons in that screenshot)

UPDATE: Please let me know if what I'm trying to do is not possible!

Maybe I'm doing something silly, but I can't spot it. If there is a step-by-step out there that applies to groups, I haven't found it yet. Using 2.74.

Of course, later I'll do it with script, but I really should know how to do it by hand if I'm going to respect myself in the morning.

This is what I'm after:

enter image description here

import bpy
import numpy as np

icorners  = [(0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1)]
corners = np.array(icorners, dtype='float')

isides = [ (0.5, 0.5, 0.0), (0.5, 0.5, 1.0),  (0.5, 0.0, 0.5), (0.5, 1.0, 0.5),  (0.0, 0.5, 0.5), (1.0, 0.5, 0.5) ]
sides = np.array(isides, dtype='float')

scale, size = 3.0, 0.5
offset = np.array([-0.5*scale, -0.5*scale, +1.0*size])

for corner in corners:
    location = scale*corner + offset
    bpy.ops.mesh.primitive_ico_sphere_add(size=size, location=tuple(location))

for side in sides:
    location = scale*side + offset
    bpy.ops.mesh.primitive_ico_sphere_add(size=size, location=tuple(location))

radius = 0.5 * scale
location = offset + radius * np.ones(3)
bpy.ops.mesh.primitive_cube_add(radius=radius, location=tuple(location) )

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

When I run your Script in a fresh Blender pasted in a Text Editor, I get a couple of Icospheres and a cube. Now I select all the Icospheres and Join all of them (CtrlJ). This joined object now works pretty well (after being hidden) with your Cube and a Boolean Modifier set to Intersect with this object:

Example

You don't need any groups. So did I understand your question properly?

If you want to retain only that pieces separately you could Apply the Modifier and then in Edit Mode Separate (P) by loose parts.

$\endgroup$
1
  • $\begingroup$ Hey thanks for the help! It will take me a day to get back to my computer and try to recall exactly what I needed. So join makes a single mesh object, and then Separate by loose parts creates new mesh objects might not be good - I think I planned to keyframe corners, edges, and sides separately so I didn't want them to loose their individual identity, but the question isn't clear even to me now. I'll look into it and comment again $\endgroup$
    – uhoh
    Apr 13, 2016 at 15:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .