the first problem with this GUI
is the fact that each functions called by the menu
seems to be executed 3 times?
at least that’s what i see on the console
but there seems to be only one object in blender on outliner!
how can it be executed only ounce ?
2 - problem with the Mesh and object definition
i defined in the main part the mesh and ob for the new object
create mesh data block
ob = B.Object.New(‘Mesh’, ‘MeshOb’)
create ObData
me = B.Mesh.New(‘moldingMesh’)
then in the function i can add the vertices and edges then
link it to the scene
ob.link( me )
scene = B.Scene.GetCurrent()
scene.objects.link( ob )
Draw.Redraw()
now should i create a new mesh object each time i create a new shape
one per function
or is it possible to create one general mesh objet that can be used
or modified in each the functions?
but then how do you reset the mesh values ?
one of the problem is if i erase an added object then the script does not work anymore!
This way your function is only called when the menu changes, not everytime a redraw is issued.
I came up with a function called “fectchIfObject”
def fetchIfObject (passedObjectName):
# NOTE: Returns the object even if it is unlinked to the scene.
try:
tempObj = Blender.Object.Get(passedObjectName)
return tempObj
except:
return None
What this allows you to do is to fetch the object if it already exists.
You could wrap your create OB, near the begining like this…
ob = fetchIfObject("MeshOb")
if ob == None:
ob = B.Object.New('Mesh', 'MeshOb')
This way, if the object does not exist, a new one will be created, or an existing one in the scene will be fetched.
i got a PM with corrected file and now it’s not doing the multi call to each functions
but now the only problem left has to do with the fact that the functions is being called
i can see the print on the console
but i don’t see the mesh in blender
so that’s the last problem to solve before i can continu to code the differetn moldings
i need to do!
but also i like your idea bout checking for existing ob if not then create that ob
shoud i upload a new corrected file - might easier to check it out