def execute(self, context): A = context.active_object others = context.selected_objects others.remove(A) B = others[0] drive_rot = new_empty(hide=False) drive_rot.name = "Rotation driver (X loc)" drive_rot.location[0] = self.angle_rot e_rot = new_empty(hide=self.hide_extra) e_rot.name = "e_rotttttttttttttttttttttttt" e_loc = new_empty(hide=self.hide_extra) e_loc.name = "e_loc" e_center_X_track = new_empty(hide=self.hide_extra) e_center_X_track.name = "e_center_track" e_center_X_rotated = new_empty(hide=self.hide_extra) e_center_X_rotated.name = "e_center_rotated" e_rot.parent = A ###e_rot.rotation_euler[2] = math.radians(self.angle_rot) add_driver(e_rot, 'rotation_euler', 'Z', vars_def={ 'x': ('transform', drive_rot, 'location', 'X'), }, expr="x") copy_location(e_center_X_track, B) copy_rotation(e_center_X_track, B) locked_track(e_center_X_track, 'Z', 'X', A) e_center_X_rotated.parent = e_center_X_track ###e_center_X_rotated.rotation_euler[2] = math.radians(self.angle_rot) add_driver(e_center_X_rotated, 'rotation_euler', 'Z', vars_def={ 'x': ('transform', drive_rot, 'location', 'X'), }, expr="x") e_loc.parent = e_center_X_rotated add_driver_distance(e_loc, 'location', 'X', A, B) copy_rotation(e_loc, e_rot) dupli_A = duplicate(A) dupli_A.name = "Rotated object" copy_location(dupli_A, e_loc) copy_rotation(dupli_A, e_loc) copy_scale(dupli_A, A) # Option to change bevel if (isinstance(A.data, bpy.types.Curve)): add_abs_bevel(dupli_A, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] arc_neo = new_arc(angle=360, sides=64, hide=self.hide_arc) copy_location(arc_neo, A) copy_rotation(arc_neo, A) locked_track(arc_neo, 'Z', 'X', B) for i in range(3): arc_neo.scale[i] = self.radius add_abs_bevel(arc_neo, self.bevel_depth) if not self.other_angle: arc_neo.data.bevel_factor_start = 0 arc_neo.data.bevel_factor_end = self.arc_angle / 360 end1 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_endpoints) end1.name = "Arc endpoint" end2 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_endpoints) end2.name = "Arc endpoint" position_on_curve(end1, arc_neo, position=0) position_on_curve(end2, arc_neo, position=self.arc_angle / 360) if self.display_sides: side1 = new_line() add_abs_bevel(side1, self.bevel_depth) side2 = new_line() add_abs_bevel(side2, self.bevel_depth) ray(side1, A, end1) ray(side2, A, end2) else: arc_neo.data.bevel_factor_start = self.arc_angle / 360 arc_neo.data.bevel_factor_end = 1 end1 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_endpoints) end1.name = "Arc endpoint" end2 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_endpoints) end2.name = "Arc endpoint" position_on_curve(end1, arc_neo, position=self.arc_angle / 360) position_on_curve(end2, arc_neo, position=1) if self.display_sides: side1 = new_line() add_abs_bevel(side1, self.bevel_depth) side2 = new_line() add_abs_bevel(side2, self.bevel_depth) ray(side1, A, end1) ray(side2, A, end2) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) B, C = others arc_neo = new_right_angle(length=self.length) add_abs_bevel(arc_neo, self.bevel_depth) center = new_empty() copy_location(center, A) damped_track(center, axis='-X', target=B) locked_track(center, axis='-Y', lock='X', target=C) arc_neo.parent = center arc_neo.location[0] = -self.length arc_neo.location[1] = -self.length return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] C = duplicate(A) C.name = "Reflection" for constraint in C.constraints: C.constraints.remove(constraint) reflect_across_point(C, A, B) e_help_X = new_empty(hide=True) e_help_X.parent = A e_help_X.location[0] = 1 e_rot_X = new_empty(hide=True) reflect_across_point(e_rot_X, e_help_X, B) locked_track(C, 'Z', 'X', e_rot_X) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] e_new = new_empty(hide=True) e_new.location[0] = self.bevel_depth e_new.location[1] = self.cone_length e_new.location[2] = self.cone_radius line = new_line() segment(line, B, A) add_abs_bevel(line, self.bevel_depth) line.name = "Vector" add_driver( obj=line.data, prop='bevel_factor_end', vars_def={ 'd': ('distance', A, B), 'b1': ('transform', B, 'location', '-'), 'a1': ('transform', A, 'location', '-'), 'bev': ('transform', e_new, 'location', 'X'), 'dep': ('transform', e_new, 'location', 'Y'), 'r1': ('transform', e_new, 'location', 'Z'), }, expr="1 - dep/d" ) cone = new_cone(radius1=self.cone_radius, depth=self.cone_length) copy_location(cone, A) copy_rotation(cone, A) locked_track(obj=cone, lock='Z', axis='-X', target=B) A.hide_viewport = self.hide_endpoint return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B_test, arc_old_test) = others if 'Arc' in B_test.data.name: arc_old = B_test B = arc_old_test if 'Arc' in arc_old_test.data.name: arc_old = arc_old_test B = B_test empty1 = new_point(hide=True) empty1.parent = arc_old empty1.location[1] = -1 fl_arc_old = new_point(hide=True) copy_location(fl_arc_old, arc_old) locked_track(fl_arc_old, 'X', 'Y', empty1) arc_neo = new_arc(angle=360, sides=64, hide=self.hide_arc) uniform_scale(arc_neo, self.radius) add_abs_bevel(arc_neo, self.bevel_depth) copy_location(arc_neo, A) if self.other_side: copy_rotation(arc_neo, fl_arc_old) else: copy_rotation(arc_neo, arc_old) locked_track(arc_neo, 'Z', 'X', B) add_driver( obj=arc_neo.data, prop='bevel_factor_start', vars_def={ 'bev': ('datapath', arc_old, 'data.bevel_factor_start'), }, expr='bev' ) add_driver( obj=arc_neo.data, prop='bevel_factor_end', vars_def={ 'bev': ('datapath', arc_old, 'data.bevel_factor_end'), }, expr='bev' ) end1 = new_point(radius=self.sphere_radius, hide=self.hide_endpoints) end1.name = "Arc endpoint" end2 = new_point(radius=self.sphere_radius, hide=self.hide_endpoints) end2.name = "Arc endpoint" position_on_curve(end1, arc_neo, position=0) position_on_curve(end2, arc_neo, position=1) add_driver( obj=end1.constraints[-1], prop='offset_factor', vars_def={ 'bev': ("datapath", arc_neo, "data.bevel_factor_start"), }, expr="bev" ) add_driver( obj=end2.constraints[-1], prop='offset_factor', vars_def={ 'bev': ("datapath", arc_neo, "data.bevel_factor_end"), }, expr="bev" ) if self.display_sides: side1 = new_line() add_abs_bevel(side1, self.bevel_depth) side2 = new_line() add_abs_bevel(side2, self.bevel_depth) ray(side1, A, end1) ray(side2, A, end2) return {'FINISHED'}