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'}
Ejemplo n.º 2
0
    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'}
Ejemplo n.º 3
0
    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'}
Ejemplo n.º 4
0
    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)
        inversion_line_not_on(inv_line, A, B)

        return {'FINISHED'}
Ejemplo n.º 5
0
    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[-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'}
Ejemplo n.º 8
0
    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'}
Ejemplo n.º 9
0
    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'}
Ejemplo n.º 10
0
    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'}
Ejemplo n.º 11
0
    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'}