1
$\begingroup$

Firstly, I am new to Blender. I am actually working on to create a hemispherical model with cell fractured property.

  1. I have done this work manually and now I want to automate using python. I have written the code for the hemisphere and filling up the hemisphere using bpy.ops.mesh.fill().

  2. My problem is when I created a hemisphere using circle and bisecting it, I have extruded one edge to another with proper dimension. But there is another edge that is occurring based on code. I am unable to overcome it. I have posted the code and the image below for reference. Please check and help me out with how to delete that extra edge.

  3. I want to create cell fracture using python. I have created particles using python. But I want cell fracture also in python, but since its add-on in blender, I am unable to do in Python.

Here is the code:

#Imports.
import bpy
import numpy as np
import math
from array import *
from mathutils import Vector
from math import degrees

# Draw hemisphere of 1m radius
bpy.ops.mesh.primitive_circle_add(radius=1, enter_editmode=True, align='WORLD', location=(0, 0, 0))
bpy.ops.mesh.bisect(plane_co=(0, 0, 0), plane_no=(0, -1, 0), clear_inner=True, clear_outer=False, xstart=0, xend=0, ystart=1, yend=1)

# Extrude vertices after hemisphere
bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"use_normal_flip":False, "mirror":False}, TRANSFORM_OT_translate={"value":(2, 0, 0), "orient_type":'GLOBAL', "orient_matrix":((1, 0, 0), (0, 1, 0), (0, 0, 1)), "orient_matrix_type":'GLOBAL', "constraint_axis":(True, False, False), "mirror":False, "use_proportional_edit":False, "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "use_proportional_connected":False, "use_proportional_projected":False, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "cursor_transform":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})

# Fill
bpy.ops.mesh.select_linked(delimit=set())
bpy.ops.mesh.fill()

Hemisphere with extra edge image:

Hemisphere image with extra edge

Hemisphere with particles image:

Hemisphere image with particles

$\endgroup$
2
  • $\begingroup$ Hi. Please only ask one question at a time. You are welcome to ask multiple questions but as separate posts. I suggest editing your question down to just one question (by using the edit link below it) and asking the other one separately. Thanks. $\endgroup$ Jul 29, 2020 at 13:06
  • $\begingroup$ Are you looking for a Hemisphere or filled semi circle? $\endgroup$
    – batFINGER
    Jul 29, 2020 at 16:23

1 Answer 1

2
$\begingroup$

Fill the circle primitive.

Going by the demonstration it appears you wish to have a flat filled semi circle.

In which case recommend filling the circle when created, then ditching the extrude and fill operators.

Test script, have chosen a triangular fan fill for the circle, for an ngon, choose 'NGON'

enter image description here

import bpy


# Draw hemisphere of 1m radius
bpy.ops.mesh.primitive_circle_add(
    radius=1, 
    enter_editmode=True, 
    align='WORLD', 
    location=(0, 0, 0), 
    fill_type='TRIFAN',  # NOTHING  or NGON
    )
    
bpy.ops.mesh.bisect(
    plane_co=(0, 0, 0), 
    plane_no=(0, -1, 0), 
    clear_inner=True,
    )

In question code after the bisect operator the verts on bisect line are selected. The extrude move operator creates an edge for each from original vert to 2 units in x direction.

$\endgroup$
1
  • $\begingroup$ Thank you so much for the solution. This has helped me a lot. 1. Coming back to second part of the question, could you help me with cell fracture method in Python? 2. My process after hemisphere is creating particles and using cell Fracture add-on. With info, I am able to create particles using python but not cell fracture. Thanks and Regards, Sunag R A $\endgroup$
    – rasunag27
    Jul 30, 2020 at 4:31

You must log in to answer this question.

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