I’m an egress of 3dsmax and I’ve just adapted a maxscript tool I used a lot back there to Blender/python.
It works. Basically, right now, it picks a 4-object selection and put the active one in the center of the circle defined by the other three ones.
I’m figuring, though, that it’s not trivial to make things like outputting to the python console and creating global variables, things I consider valuable to explore what methods and properties give me back according to selection and etc. Could you guys point me to some direction?
Also, it’s now quite obvious that, while it was easy (and lazy) for me to just define it as a global function in 3dsmax and use it this way whenever I needed, it’s become quite obvious that in Blender this thing should make use of the 3D cursor and make it to the 3D cursor panel in the 3D view Properties shelf.
Any tips on how to create a button below the X,Y and Z boxes? The Templates offered in the Text Editor are quite confusing for beginners and it’s still a bit hard to figure what operators are, for instance.
Finally, in case you guys are wondering about the code I’ve written, here it is. Feel free to criticize, use, modify and whatever.
import bpy from mathutils import *; from math import * import mathutils C = bpy.context def circumcenter(): def baricenter (p0, p1, p2, u, v, w): return (u*p0 + v*p1 + w*p2) / (u + v + w) if (len(C.selected_objects) >= 4): p=; for obj in C.selected_objects: if (obj != C.object): p.append(obj.location) a = p - p b = p - p c = p - p u = a.dot(a) * c.dot(b) v = b.dot(b) * c.dot(a) w = c.dot(c) * b.dot(a) circumcenter_cache = baricenter(p, p, p, u, v, w); C.object.location = circumcenter_cache else: circumcenter_cache = mathutils.Vector((0.0, 0.0, 0.0)) return circumcenter_cache print(circumcenter())