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, B) = context.selected_objects[-2:] inter1 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) inter2 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) circle_circle_intersection(inter1, inter2, A, B, hide_extra=self.hide_extra) return {'FINISHED'}
def execute(self, context): A = context.active_object polygon = new_polygon(sides=self.sides_number, length=self.sides_length, hide=True) add_abs_bevel(polygon, self.bevel_depth) polygon.parent = A polygon.rotation_euler[2] = math.radians(self.polygon_rotate) vertices = [] for i in range(int(self.sides_number)): s = new_point(radius=self.sphere_radius) position_on_curve(s, polygon, position=i / self.sides_number) add_driver(obj=s, prop='location', fields='Z', expr="0") vertices.append(s) for i in range(int(self.sides_number) - 1): line = new_line() segment(line, vertices[i], vertices[i + 1]) add_abs_bevel(line, self.bevel_depth) line.name = "Side of polygon" line = new_line() segment(line, vertices[0], vertices[int(self.sides_number) - 1]) add_abs_bevel(line, self.bevel_depth) line.name = "Side of polygon" return {'FINISHED'}
def execute(self, context): line = context.active_object sphere = new_sphere(segments=self.segments) 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) sphere_from_diameter(sphere, A, B) else: (A, B) = context.selected_objects[-2:] sphere_from_diameter(sphere, A, B) return {'FINISHED'}
def execute(self, context): A = context.active_object obj = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) copy_transforms(obj, A, 'LR') 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): (A, B, C) = context.selected_objects[-3:] point = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) incenter(point, 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): 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): if (len(context.selected_objects) == 2): (A, B) = context.selected_objects[-2:] obj = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) midpoint(obj, A, B) if (len(context.selected_objects) == 1): A = context.active_object X = new_point(hide=self.hide_extra) Y = new_point(hide=self.hide_extra) line_ends(X, Y, A) obj = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) midpoint(obj, X, Y) return {'FINISHED'}
def execute(self, context): line = context.active_object A = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) A.name = 'Point' add_driver(obj=A, prop='location', fields='XYZ', expr="0") position_on_curve(A, line, position=self.position_c) copy_rotation(A, line) 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 = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] inv_point = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) inversion_point(inv_point, A, B) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others point = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) excenter(point, A, B, C) return {'FINISHED'}
def execute(self, context): (A, B) = context.selected_objects[-2:] if 'Circle' in A.data.name and 'Line' in B.data.name: circle, line = A, B elif 'Line' in A.data.name and 'Circle' in B.data.name: circle, line = B, A else: self.report({'ERROR'}, 'Need to select a line and a circle') return {'CANCELLED'} # Shouldn't get here... (A, B) = context.selected_objects[-2:] X = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) Y = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) line_circle_intersection(X, Y, line, circle, hide_extra=self.hide_extra) 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 = 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): if (len(context.selected_objects) == 3): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others obj = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) orthogonal_proj_to_points(obj, A, B, C) if (len(context.selected_objects) == 2): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] obj = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) orthogonal_proj_to_line(obj, A, B) 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[-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): plane = context.active_object created_point = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) created_point.name = 'Point' constraint_to_plane(created_point, plane) add_driver(obj=created_point, prop='scale', fields='XYZ', vars_def={ 'x': ('transform', plane, 'scale', 'X'), }, expr="1 / x") return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-3:] others.remove(A) (B, C) = others point1 = new_point(hide=True) angle_divider_foot(point1, A, B, C, influ=self.division_proportion) line1 = new_line() add_abs_bevel(line1, self.bevel_depth) if self.use_ray: ray(line1, A, point1) else: line(line1, A, point1) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] e_help = new_empty(hide=self.hide_extra) e_help.name = "Object defining drivers" e_help.location[0] = self.ratio if self.display_inside: new_inside = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) new_inside.name = "Segment divider inside" copy_rotation(new_inside, A) add_driver( obj=new_inside, prop='location', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 'b1': ('transform', B, 'location', '-'), 'a1': ('transform', A, 'location', '-'), }, expr="b1 + (x1 / (1+x1)) * (a1-b1)" ) if self.display_outside: if self.ratio > 1: new_outside = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) new_outside.name = "Segment divider outside" copy_rotation(new_outside, A) add_driver( obj=new_outside, prop='location', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 'b1': ('transform', B, 'location', '-'), 'a1': ('transform', A, 'location', '-'), }, expr="b1 + (x1/(x1-1))*(a1-b1)" ) if self.ratio < 1: new_outside = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) new_outside.name = "Segment divider outside" copy_rotation(new_outside, A) add_driver( obj=new_outside, prop='location', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 'b1': ('transform', B, 'location', '-'), 'a1': ('transform', A, 'location', '-'), }, expr="b1 - (x1/(1-x1))*(a1-b1)" ) return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] e_help = new_empty(hide=self.hide_extra) e_help.name = "Object defining drivers" e_help.location[0] = self.ratio if not (isinstance(A.data, bpy.types.Curve)): new = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) new.name = "Homothetic object" # Can try to duplicate instead and then clear all constraints if 'Line' in A.data.name: new = new_line() new.name = "Homothetic object" add_abs_bevel(new, self.bevel_depth) if 'Circle' in A.data.name: new = new_circle() new.name = "Homothetic object" add_abs_bevel(new, self.bevel_depth) copy_rotation(new, A) add_driver(obj=new, prop='location', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 'b1': ('transform', B, 'location', '-'), 'a1': ('transform', A, 'location', '-'), }, expr="b1 + x1*(a1-b1)") if 'Circle' in A.data.name: add_driver(obj=new, prop='scale', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 's1': ('transform', A, 'scale', 'X'), }, expr="x1*s1") if self.display_center: center = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) copy_location(center, new) copy_rotation(center, new) if 'Line' in A.data.name: add_driver(obj=new, prop='scale', fields='XYZ', vars_def={ 'x1': ('transform', e_help, 'location', 'X'), 's1': ('transform', A, 'scale', 'X'), }, expr="x1*s1") end1 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) end2 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) line_ends(end1, end2, new) return {'FINISHED'}
def execute(self, context): created_point = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) created_point.name = 'Point' 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'}
def execute(self, context): A = context.active_object others = context.selected_objects[-4:] others.remove(A) (O_test, L_test, R_test) = others if 'Sphere' in O_test.data.name: O = O_test if 'Sphere' in L_test.data.name: O = L_test if 'Sphere' in R_test.data.name: O = R_test others.remove(O) (L_test, R_test) = others if 'Line' in L_test.data.name: L = L_test R = R_test if 'Line' in R_test.data.name: L = R_test R = L_test # A: object to transform, O: origin, L: line, R: circle if not (isinstance(A.data, bpy.types.Curve)): new = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) new.name = "Homothetic object" if 'Line' in A.data.name: new = new_line() new.name = "Homothetic object" add_abs_bevel(new, self.bevel_depth) if 'Circle' in A.data.name: new = new_circle() new.name = "Homothetic object" add_abs_bevel(new, self.bevel_depth) copy_rotation(new, A) add_driver(obj=new, prop='location', fields='XYZ', vars_def={ 's': ('transform', L, 'scale', 'X'), 'r': ('transform', R, 'scale', 'X'), 'b1': ('transform', O, 'location', '-'), 'a1': ('transform', A, 'location', '-'), }, expr="b1 + (s/r)*(a1-b1)") if 'Circle' in A.data.name: add_driver(obj=new, prop='scale', fields='XYZ', vars_def={ 's': ('transform', L, 'scale', 'X'), 'r': ('transform', R, 'scale', 'X'), 's1': ('transform', A, 'scale', 'X'), }, expr="(s/r)*s1") if self.display_center: center = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) copy_location(center, new) copy_rotation(center, new) if 'Line' in A.data.name: add_driver(obj=new, prop='scale', fields='XYZ', vars_def={ 's': ('transform', L, 'scale', 'X'), 'r': ('transform', R, 'scale', 'X'), 's1': ('transform', A, 'scale', 'X'), }, expr="(s/r)*s1") end1 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) end2 = new_point(use_spheres=self.use_spheres, radius=self.sphere_radius) line_ends(end1, end2, new) 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, hide=self.hide_arc) 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, B) ray(side2, A, C) uniform_scale(arc, self.radius) 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)') 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, position=0) position_on_curve(end2, arc, position=1) add_driver(obj=end1.constraints[-1], prop='offset_factor', vars_def={ 'bev': ("datapath", arc, "data.bevel_factor_start"), }, expr="bev") add_driver(obj=end2.constraints[-1], prop='offset_factor', vars_def={ 'bev': ("datapath", arc, "data.bevel_factor_end"), }, expr="bev") return {'FINISHED'}
def execute(self, context): A = context.active_object others = context.selected_objects[-2:] others.remove(A) B = others[0] follow_constraint = B.constraints["Follow Path"] follow_constraint.offset_factor = 0 follow_constraint.keyframe_insert(data_path='offset_factor', frame=1) follow_constraint.offset_factor = 1 follow_constraint.keyframe_insert(data_path='offset_factor', frame=self.frame_end) # Make sure the interpolation is linear fcurve = B.animation_data.action.fcurves[0] for kf in fcurve.keyframe_points: kf.interpolation = 'LINEAR' # Create plane for particle system plane = new_plane(size=1, location=(0, 0, 0), hide=False) plane.show_instancer_for_render = False plane.show_instancer_for_viewport = False plane.parent = A # Create a point to be used as the instance object particle = new_point(radius=self.sphere_radius) particle.name = "Particle" particle.hide_render = True # Create and configure the particle system particle_system = add_particle_system( obj=plane, # The custom `add_particle_system` function takes in the settings name="Particles for locus", type='EMITTER', count=self.part_number, frame_start=1, frame_end=self.frame_end, lifetime=self.frame_end, lifetime_random=0, emit_from='FACE', distribution='JIT', use_emit_random=False, userjit=1, normal_factor=0, physics_type='NEWTON', render_type='OBJECT', particle_size=1, size_random=0, instance_object=particle ) # These nested values can't be passed in as kwargs, so set manually particle_system.effector_weights.gravity = 0 particle_system.effector_weights.all = 0 bpy.ops.ptcache.bake_all(bake=True) context.scene.frame_set(self.frame_end) context.scene.frame_end = self.frame_end return {'FINISHED'}