models/parts/chris_desk.rb
#this connector is used when you need to remove a constant thickness from an edge
this connector is used when you need to remove a constant thickness from an edge
this connector is used when you need to remove a constant thickness from an edge
def draw!
    Sk.find_or_create_layer(name: self.class.name)
    Sk.make_layer_active_name(name: self.class.name)
    @top.draw!
    @top.move_by(x: 0,
                 y: 0,
                 z: length - thickness * tab_depth_percent).go!
    @front_cross_bar.draw!
    @front_cross_bar.rotate(vector: [0, 0, 1], rotation: 180.degrees).
        rotate(vector: [0, 1, 0], rotation: 90.degrees).
        move_to(point: origin).
        move_by(x: -1 * length,
                y: -1 * width + side_leg_offset + thickness * (1 - tab_depth_percent),
                z: -1 * front_cross_bar_offset - thickness).go!
    @back_cross_bar.draw!
    @back_cross_bar.rotate(vector: [0, 0, 1], rotation: 180.degrees).
        rotate(vector: [0, 1, 0], rotation: 90.degrees).
        move_to(point: origin).
        move_by(x: -1 * length,
                y: -1 * width + side_leg_offset + thickness * (1 - tab_depth_percent),
                z: -1 * depth + back_cross_bar_offset).go!
    @middle_left_cross_bar.draw!
    @middle_left_cross_bar.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        rotate(vector: [0, 0, 1], rotation: 90.degrees).
        move_to(point: origin).
        move_by(x: -1 * length,
                y:  depth - back_cross_bar_offset - @middle_left_cross_bar.length - (1 * (1.0 - tab_depth_percent) * thickness),
                z:  -1 * width + (middle_left_cross_bar_offset)).go!
    @middle_right_cross_bar.draw!
    @middle_right_cross_bar.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        rotate(vector: [0, 0, 1], rotation: 90.degrees).
        move_to(point: origin).
        move_by(x: -1 * length,
                y: depth - back_cross_bar_offset - @middle_right_cross_bar.length - (1 * (1.0 - tab_depth_percent) * thickness),
                z: -1 * width + (middle_right_cross_bar_offset)).go!
    rear_leg_offset = depth - @left_outer_leg.top_width - front_leg_offset
    @left_outer_leg.draw!
    @left_outer_leg.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        move_to(point: origin).
        move_by(x: -1 * (depth + @left_outer_leg.back_foot_width - rear_leg_offset),
                y: -1 * length,
                z: -1 * width + side_leg_offset).go!
    @left_inner_leg.draw!
    @left_inner_leg.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        move_to(point: origin).
        move_by(x: -1 * (depth + @left_inner_leg.back_foot_width - rear_leg_offset),
                y: -1 * length,
                z: -1 * width + side_leg_offset + thickness).go!
    @right_outer_leg.draw!
    @right_outer_leg.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        move_to(point: origin).
        move_by(x: -1 * (depth + @right_outer_leg.back_foot_width - rear_leg_offset),
                y: -1 * length,
                z: -1 * (thickness + side_leg_offset)).go!
    @right_inner_leg.draw!
    @right_inner_leg.rotate(vector: [1, 0, 0], rotation: -90.degrees).
        rotate(vector: [0, 1, 0], rotation: 180.degrees).
        move_to(point: origin).
        move_by(x: -1 * (depth + @right_inner_leg.back_foot_width - rear_leg_offset),
                y: -1 * length,
                z: -1 * (side_leg_offset + 2 * thickness)).go!
    groups = [@top.group, @front_cross_bar.group, @back_cross_bar.group,
              @left_outer_leg.group, @left_inner_leg.group, @right_outer_leg.group, @right_inner_leg.group, @middle_left_cross_bar.group, @middle_right_cross_bar.group]
    set_group(groups.compact)
  end
def draw! Sk . find_or_create_layer ( name : self . class . name ) Sk . make_layer_active_name ( name : self . class . name ) @top . draw! @top . move_by ( x : 0 , y : 0 , z : length - thickness * tab_depth_percent ) . go! @front_cross_bar . draw! @front_cross_bar . rotate ( vector : [ 0 , 0 , 1 ] , rotation : 180 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 90 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * length , y : - 1 * width + side_leg_offset + thickness * ( 1 - tab_depth_percent ) , z : - 1 * front_cross_bar_offset - thickness ) . go! @back_cross_bar . draw! @back_cross_bar . rotate ( vector : [ 0 , 0 , 1 ] , rotation : 180 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 90 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * length , y : - 1 * width + side_leg_offset + thickness * ( 1 - tab_depth_percent ) , z : - 1 * depth + back_cross_bar_offset ) . go! @middle_left_cross_bar . draw! @middle_left_cross_bar . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . rotate ( vector : [ 0 , 0 , 1 ] , rotation : 90 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * length , y : depth - back_cross_bar_offset - @middle_left_cross_bar . length - ( 1 * ( 1.0 - tab_depth_percent ) * thickness ) , z : - 1 * width + ( middle_left_cross_bar_offset ) ) . go! @middle_right_cross_bar . draw! @middle_right_cross_bar . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . rotate ( vector : [ 0 , 0 , 1 ] , rotation : 90 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * length , y : depth - back_cross_bar_offset - @middle_right_cross_bar . length - ( 1 * ( 1.0 - tab_depth_percent ) * thickness ) , z : - 1 * width + ( middle_right_cross_bar_offset ) ) . go! rear_leg_offset = depth - @left_outer_leg . top_width - front_leg_offset @left_outer_leg . draw! @left_outer_leg . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * ( depth + @left_outer_leg . back_foot_width - rear_leg_offset ) , y : - 1 * length , z : - 1 * width + side_leg_offset ) . go! @left_inner_leg . draw! @left_inner_leg . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * ( depth + @left_inner_leg . back_foot_width - rear_leg_offset ) , y : - 1 * length , z : - 1 * width + side_leg_offset + thickness ) . go! @right_outer_leg . draw! @right_outer_leg . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * ( depth + @right_outer_leg . back_foot_width - rear_leg_offset ) , y : - 1 * length , z : - 1 * ( thickness + side_leg_offset ) ) . go! @right_inner_leg . draw! @right_inner_leg . rotate ( vector : [ 1 , 0 , 0 ] , rotation : - 90 . degrees ) . rotate ( vector : [ 0 , 1 , 0 ] , rotation : 180 . degrees ) . move_to ( point : origin ) . move_by ( x : - 1 * ( depth + @right_inner_leg . back_foot_width - rear_leg_offset ) , y : - 1 * length , z : - 1 * ( side_leg_offset + 2 * thickness ) ) . go! groups = [ @top . group , @front_cross_bar . group , @back_cross_bar . group , @left_outer_leg . group , @left_inner_leg . group , @right_outer_leg . group , @right_inner_leg . group , @middle_left_cross_bar . group , @middle_right_cross_bar . group ] set_group ( groups . compact ) end
this connector is used when you need to remove a constant thickness from an edge
this connector is used when you need to remove a constant thickness from an edge
#  puts "Moving it to #{width} + #{side_leg_offset} + #{thickness * (1 - tab_depth_percent)}+ #{middle_left_cross_bar_offset} = #{-1 * width + side_leg_offset +  thickness * (1 - tab_depth_percent)  + middle_left_cross_bar_offset}"