def coRegPointsTrans(doc, elems=[], point1=[0, 0, 0], point2=[0, 0, 0]): """Apply a translation to all the elements in "elems" such that point1 is moved to the location of point2 (all points in elems are shifted by point2-point1)""" objl = [doc.getInstance(p) for p in elems] pt = array(point2) - array(point1) conv = {"Trans_x": pt[0], "Trans_y": pt[1], "Trans_z": pt[2]} for obj in objl: print obj, conv alignObject(obj, conv)
def ptDist(doc, point1=[0, 0, 0], point2=[0, 0, 0]): """print and return the euclidian distance between point1 and point2""" d = eucd(array(point1), array(point2)) print "Distance: %.4f" % (d,) return d