Example #1
0
    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]

        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

        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[-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'}
Example #5
0
    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'}