def execute(self, context): if (len(context.selected_objects) == 3): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others line = new_line(hide=self.hide_extra) segment(line, B, C) obj = new_line(length=self.length) add_abs_bevel(obj, self.bevel_depth) parallel_line(obj, A, line, hide_extra=self.hide_extra) if (len(context.selected_objects) == 2): A = context.active_object others = context.selected_objects[-2:] others.remove(A) line = others[0] obj = new_line(length=self.length) add_abs_bevel(obj, self.bevel_depth) parallel_line(obj, A, line, hide_extra=self.hide_extra) return {'FINISHED'}
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 = new_arc(angle=360, sides=64) add_driver_distance( obj=arc, prop='scale', fields='XYZ', A=A, B=B, scale=1 ) add_abs_bevel(arc, self.bevel_depth) align_to_plane_of(arc, A, B, C) if self.other_angle: B, C = C, B add_driver( obj=arc.data, prop='bevel_factor_start', vars_def={ 'ax': ('transform', A, 'location', 'X'), 'ay': ('transform', A, 'location', 'Y'), 'az': ('transform', A, 'location', 'Z'), 'bx': ('transform', B, 'location', 'X'), 'by': ('transform', B, 'location', 'Y'), 'bz': ('transform', B, 'location', 'Z'), 'cx': ('transform', C, 'location', 'X'), 'cy': ('transform', C, 'location', 'Y'), 'cz': ('transform', C, 'location', 'Z'), }, expr='gb_drive_angle_bevel(True,ax,ay,az,bx,by,bz,cx,cy,cz)' ) add_driver( obj=arc.data, prop='bevel_factor_end', vars_def={ 'ax': ('transform', A, 'location', 'X'), 'ay': ('transform', A, 'location', 'Y'), 'az': ('transform', A, 'location', 'Z'), 'bx': ('transform', B, 'location', 'X'), 'by': ('transform', B, 'location', 'Y'), 'bz': ('transform', B, 'location', 'Z'), 'cx': ('transform', C, 'location', 'X'), 'cy': ('transform', C, 'location', 'Y'), 'cz': ('transform', C, 'location', 'Z'), }, expr='gb_drive_angle_bevel(False,ax,ay,az,bx,by,bz,cx,cy,cz)' ) return {'FINISHED'}
def execute(self, context): A = context.active_object circle = new_circle() circle_from_center_radius(circle, A, self.circle_radius) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): (A, B) = context.selected_objects[-2:] newline = new_line() line(newline, A, B, length=self.length) add_abs_bevel(newline, self.bevel_depth) newline.name = "Line" return {'FINISHED'}
def execute(self, context): (A, B) = context.selected_objects[-2:] line = new_line() segment(line, A, B) add_abs_bevel(line, self.bevel_depth) line.name = "Line Segment" return {'FINISHED'}
def execute(self, context): (A, B, C) = context.selected_objects[-3:] line1 = new_line(length=self.length) add_abs_bevel(line1, self.bevel_depth) euler_line(line1, A, B, C) return {'FINISHED'}
def execute(self, context): (A, B) = context.selected_objects[-2:] point_r = new_point(hide=True) radical_intercept(point_r, A, B) line1 = new_line(length=self.length) add_abs_bevel(line1, self.bevel_depth) radical_axis(line1, A, B) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others med = new_line(length=self.length) add_abs_bevel(med, self.bevel_depth) external_bisector(med, A, B, C) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] line1 = new_line(length=self.length) add_abs_bevel(line1, self.bevel_depth) polar_line(line1, A, B, hide_extra=self.hide_extra) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] circle = new_circle() circle_from_center_point(circle, A, B) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] line = new_line() ray(line, A, B, length=self.length) add_abs_bevel(line, self.bevel_depth) line.name = "Ray" return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] line1 = new_line(length=self.length) add_abs_bevel(line1, self.bevel_depth) circle_tangent_line(line1, B, A) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] inv_line = new_line(length=self.length) add_abs_bevel(inv_line, self.bevel_depth) inversion_on_cicle(inv_line, A, B) return {'FINISHED'}
def execute(self, context): (A, B, C) = context.selected_objects[-3:] center = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_center) circle = new_circle() incircle(circle, center, A, B, C) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): (A, B, C) = context.selected_objects[-3:] lines = [new_line(), new_line(), new_line()] segment(lines[0], A, B) segment(lines[1], B, C) segment(lines[2], C, A) for idx, line in enumerate(lines): line.name = f"Side {idx + 1}" add_abs_bevel(line, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (X, Y) = others circle = new_circle() circle_from_center_distance(circle, A, X, Y) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] inv_line = new_circle() add_abs_bevel(inv_line, self.bevel_depth) center = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_center) inversion_not_on_circle(inv_line, center, A, B) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others midp = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_foot) med = new_line() add_abs_bevel(med, self.bevel_depth) angle_bisector(med, midp, A, B, C) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others footp = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_foot) alt = new_line() add_abs_bevel(alt, self.bevel_depth) altitude(alt, footp, A, B, C) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others center = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius, hide=self.hide_center) circle = new_circle() excircle(circle, center, A, B, C) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): (A, B) = context.selected_objects[-2:] if 'Sphere' in A.data.name and 'Plane' in B.data.name: sphere, plane = A, B elif 'Plane' in A.data.name and 'Sphere' in B.data.name: sphere, plane = B, A else: self.report({'ERROR'}, 'Need to select a plane and a sphere') return {'CANCELLED'} # Shouldn't get here... circle = new_circle() plane_sphere_intersection(circle, plane, sphere, hide_extra=True) add_abs_bevel(circle, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] for i in range(self.copies_number): frame_num = (1 + i * self.frame_gap) B.constraints["Follow Path"].offset_factor = i / self.copies_number B.constraints["Follow Path"].keyframe_insert( data_path='offset_factor', frame=frame_num) copy = duplicate(A, remove_all=True) add_to_collection(copy, "Dynamic Family") # Option to change bevel if (isinstance(copy.data, bpy.types.Curve)): add_abs_bevel(copy, self.bevel_depth) copy.hide_render = True copy.keyframe_insert(data_path='hide_render', frame=0) copy.hide_render = False copy.keyframe_insert(data_path='hide_render', frame=frame_num) if self.for_test: mat = bpy.data.materials.new(name=f"Test Material {i}") mat.use_nodes = True mat.blend_method = 'BLEND' mat_alpha = mat.node_tree.nodes["Principled BSDF"].inputs[18] mat_alpha.default_value = 0 mat_alpha.keyframe_insert(data_path='default_value', frame=frame_num - 1) mat_alpha.default_value = 1 mat_alpha.keyframe_insert(data_path='default_value', frame=frame_num) # Assign it to object if copy.data.materials: # If material exists, replace copy.data.materials[0] = mat else: # Otherwise create new one copy.data.materials.append(mat) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] num_verts = self.resolution prev_offset = B.constraints["Follow Path"].offset_factor path = bpy.data.curves.new('path', 'CURVE') curve = bpy.data.objects.new('Locus Curve', path) context.collection.objects.link(curve) path.dimensions = '3D' spline = path.splines.new('BEZIER') spline.bezier_points.add(num_verts) handle_type = 'VECTOR' if self.vector_handles else 'AUTO' for i, o in enumerate(spline.bezier_points): B.constraints["Follow Path"].offset_factor = i / num_verts bpy.context.view_layer.update() o.co = A.matrix_world.to_translation() o.handle_right_type = handle_type o.handle_left_type = handle_type B.constraints["Follow Path"].offset_factor = prev_offset bpy.context.view_layer.update() add_abs_bevel(curve, self.bevel_depth) # Set keyframes for the start # --------------------------- curve.data.bevel_factor_end = 0 curve.data.keyframe_insert(data_path='bevel_factor_end', frame=self.frame_start) B.constraints["Follow Path"].offset_factor = 0 B.constraints["Follow Path"].keyframe_insert(data_path='offset_factor', frame=self.frame_start) curve.data.bevel_factor_end = 1 curve.data.keyframe_insert(data_path='bevel_factor_end', frame=self.frame_end) B.constraints["Follow Path"].offset_factor = 1 B.constraints["Follow Path"].keyframe_insert(data_path='offset_factor', frame=self.frame_end) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] for i in range(self.copies_number): B.constraints["Follow Path"].offset_factor = i / self.copies_number copy = duplicate(A, remove_all=True) add_to_collection(copy, "Static Family") # Option to change bevel if (isinstance(copy.data, bpy.types.Curve)): add_abs_bevel(copy, self.bevel_depth) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] point1 = new_point() point2 = new_point() circle_tangent_points(point1, point2, B, A) line1 = new_line() add_abs_bevel(line1, self.bevel_depth) line2 = new_line() add_abs_bevel(line2, self.bevel_depth) circle_tangent_lines(line1, line2, B, A, hide_extra=self.hide_extra) return {'FINISHED'}
def execute(self, context): if (len(context.selected_objects) == 2): (B, C) = context.selected_objects[-2:] obj = new_line(length=self.length) add_abs_bevel(obj, self.bevel_depth) bisecting_line_of_points(obj, B, C, hide_extra=self.hide_extra) if (len(context.selected_objects) == 1): A = context.active_object obj = new_line(length=self.length) add_abs_bevel(obj, self.bevel_depth) bisecting_line_of_line(obj, A, hide_extra=self.hide_extra) return {'FINISHED'}
def execute(self, context): line = context.active_object if isinstance(line.data, bpy.types.Curve): A = new_point(hide=self.hide_extra) B = new_point(hide=self.hide_extra) line_ends(A, B, line) circle = new_circle() circle_from_diameter(circle, A, B) add_abs_bevel(circle, self.bevel_depth) else: (A, B) = context.selected_objects[-2:] circle = new_circle() circle_from_diameter(circle, A, B) add_abs_bevel(circle, self.bevel_depth) 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'}