2
$\begingroup$

I'd like to be able to cut the faces belonging to a mesh, from a specific point, in a specific direction. For example, if I were trying to cut an icosphere from it's center at an angle 30 from the x-axis, like so:

enter image description here

How would I do this? More importantly, how would I create a script to automate this process? It seems that running bpy.ops.mesh.knife_tool() only creates an error that reads

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\modules\bpy\ops.py", line 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.mesh.knife_tool.poll() failed, context is incorrect

and I can't seem to find any more information about what I would need to do to use it in a script.

Currently, I only need to make vertical slices, from a specific point to the edge of the mesh.

Thanks for any help.

$\endgroup$
  • $\begingroup$ This question does not talk about scripting, but it shows how to cut any angle. $\endgroup$ – David Apr 5 '16 at 21:55
  • $\begingroup$ Alright, that's pretty helpful, and it'll at least get me started in the right direction. Thanks. $\endgroup$ – Kruglord Apr 5 '16 at 21:58
1
$\begingroup$

I'd would use a boolean modifier to go around this. It's a pretty easy way, not quite with the script though but works. Start by creating a very thin cube and rotating it by any angle you want, but make sure its cutting through all your mesh. Then give your icosphere a boolean modifier and set this new cube you have created as the mesh to use for boolean operation, don't forget to set the operation to difference.

p.s. It won't work with a plane as a boolean, only cube, just like that: enter image description here enter image description here

$\endgroup$
0
$\begingroup$

I found a great way to do this, though it doesn't use any scripting. I'm still trying to figure out how to re-create this process with python and the bmesh module, but this is how I've done it otherwise.

Lets say you want to cut a UV sphere at an angle of exactly 31 degrees cw from the x axis. enter image description here

First, hide the UV sphere with h. Then, create a new mesh -> plane. Give it a 90 degree turn about the X axis. enter image description here

Then, toggle it into edit mode. With everything selected, translate it 1 unit in the X direction. enter image description here

You'll notice that the origin of this plane is still the same, but the geometry of the plane is moved over. This is useful, since it means that the geometry of the plane can be used to cut our UV sphere is the exact spot and direction we want.

Now, exit edit mode, and rotate the object about the Z axis by the 31 degrees we mentioned earlier. Notice that one edge is still an the origin. enter image description here

At this point, you can reveal your original mesh with atl-h. Your cutting plane should extend beyond the limits of your other mesh, and you can achieve this using the scale operator. enter image description here

Now, make sure nothing is selected. Then, holding shift, select the cutting plane, followed by the UV sphere. Press tab to enter edit mode, and numpad 5 then numpad 7 to enter Top Ortho view. From here, you can use the Knife Project tool, making sure to check the cut-through option. enter image description here

Hiding the cutting plane at this point, you can see that a new set of edges has been created on the UV sphere at the intersection of the cutting plane. Since it was done in top ortho view, only one new edge is created per face, and with cut-through checked, it also cut the faces at the bottom of the UV sphere.

enter image description here

Now, if you want to cut the UV sphere at a location other than its origin, all you need to do in translate the cutting plane to that spot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.