Edit default primitive shape size

Hi guys,

I’m here to learn about Python and bpy. I’m already watching lots of youtube tutorials, but I’d like to learn a bit more about scripting add-ons through fiddling with Blender’s own code.

What i’m currently trying to do is edit Blender’s default torus (and other primitive shape) values.

I can’t seem to make it work by editing the source live.

What would be the best method for me to understand what’s going on and how to achieve the results I need.

Thanks in advance!
Kind regards,
Claus

see the template in Script window
might help to do it

also depends if you want to use the old or the new API

but for the new Bmesh API you need t go into edit mode then modify the verts or edges
then save it.

happy bl

Thanks for the reply!

As what do I need to save what exactly?

in Bmesh mode
you need to create a new Bmesh at beginning then do the modif and after save it

see template

bmesh_simple_editmode.py

as example



# This example assumes we have a mesh object in edit-mode
import bpy
import bmesh
# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)
bm.faces.active = None
# Modify the BMesh, can do anything here...
for v in bm.verts:
    v.co.x += 1.0

# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)



happy bl

Thanks for the pointers. I’m still getting started in Blender python and I keep finding more stuff to learn about, haha. Thanks again!