i’m trying to create a script where i can drawn in blender
different type of moldings qty= 30 types
in many of the function i have to draw a circle segment and add this to a a mesh object
in each function with a different mesh name - one name per type of molding
here is one example of a function i did for an OVOLO molding
now the mesh in the function is given a name for the mesh throught the variable molding_name before calling it
the ob is created outside at the level of the main
def create_ovolo(molding_name):
global edgeId,medges, mn_type_act, mesh_name
mn_type_act = 2
edgeId=0
genr=5.0
XC=0
YC=0
delt=5.0
medges=[]
#create the mesh - using the mesh_name argument
me = Blender.Mesh.New(molding_name)
# N = ANGLE IN DEGREES
for n in range(0,90+delt/2,delt):
ANGTR=n*pi/180
XC=genr*cos(ANGTR)
YC=genr*sin(ANGTR)
p1=[XC,YC,0]
verts=[p1]
# add vertices
me.verts.extend( verts )
# make edges
# print 'before edgeid= ',edgeId
if edgeId > 0:
medges.append([edgeId-1, edgeId])
me.edges.extend(medges)
edgeId+= 1
# do the bottom part
h1= -genr*0.2 # Left
p1=[XC+h1,YC,0]
verts=[p1]
me.verts.extend( verts )
# medges.append([edgeId-1, edgeId])
# me.edges.extend(medges)
#get the current scene
scn = Blender.Scene.GetCurrent()
#create/link the object to the scene
ob = scn.objects.new(me, molding_name + "Ob")
mesh_name = me.name
but i have this type of circle segment making in a lot of functions
so i’m wondering if i can transfert theses segment circle portion into another function
so that it saves space
but as i indicated the problem seems to be with the fact that the me mesh is defined and created inside one function
but i think i’m beginning to see that may be this can be done hopefully!
the major problem right now is the space used by the script
i have done something like 24 functions
and i’m already at 3000 lines of codes!
i would like to save some spaces and make the lenght of the script shorter if this can be done
if necessary i can open another therad for a more complete script with example let say with 5 type of moldings
to show where the codes is being repeated
Thanks guys