Beispiel #1
0
def cut_curvelist_with_start(prev_p, curve_list, rapid_safety_space, current_start_depth, depth, clearance_height, start_point):
    start_x,start_y = start_point
    first = True
    for curve in curve_list:
        raise_cutter = True
        if first == True:
            direction = "on"
            radius = 0.0
            offset_extra = 0.0
            roll_radius = 0.0
            roll_on = 0.0
            roll_off = 0.0
            step_down = math.fabs(depth)
            extend_at_start = 0.0;
            extend_at_end = 0.0
            kurve_funcs.make_smaller(curve, start = area.Point(start_x,start_y))
            kurve_funcs.profile(curve, direction, radius, offset_extra, roll_radius, roll_on, roll_off, rapid_safety_space, clearance_height, current_start_depth, step_down, depth, extend_at_start, extend_at_end)
        else:
            s = curve.FirstVertex().p
            if (s.x == prev_p.x and s.y == prev_p.y) or feed_possible(prev_p, s):
                raise_cutter = False

        prev_p = cut_curve(curve, raise_cutter, first, prev_p, rapid_safety_space, current_start_depth, depth, clearance_height)
        first = False

    return prev_p
Beispiel #2
0
def cut_curvelist2(
    curve_list, rapid_safety_space, current_start_depth, depth, clearance_height, keep_tool_down_if_poss, start_point
):
    p = area.Point(0, 0)
    start_x, start_y = start_point
    first = True
    for curve in curve_list:
        need_rapid = True
        if first == True:
            direction = "on"
            radius = 0.0
            offset_extra = 0.0
            roll_radius = 0.0
            roll_on = 0.0
            roll_off = 0.0
            rapid_safety_space
            step_down = math.fabs(depth)
            extend_at_start = 0.0
            extend_at_end = 0.0
            kurve_funcs.make_smaller(curve, start=area.Point(start_x, start_y))
            kurve_funcs.profile(
                curve,
                direction,
                radius,
                offset_extra,
                roll_radius,
                roll_on,
                roll_off,
                rapid_safety_space,
                clearance_height,
                current_start_depth,
                step_down,
                depth,
                extend_at_start,
                extend_at_end,
            )
        else:
            s = curve.FirstVertex().p
            if keep_tool_down_if_poss == True:

                # see if we can feed across
                if feed_possible(p, s):
                    need_rapid = False
            elif s.x == p.x and s.y == p.y:
                need_rapid = False

        cut_curve(curve, need_rapid, p, rapid_safety_space, current_start_depth, depth)
        first = (
            False
        )  # change to True if you want to rapid back to start side before zigging again with unidirectional set
    rapid(z=clearance_height)
Beispiel #3
0
def profile(curve_name, profileparams,startparams):
    feedrate_hv(profileparams['verticalfeedrate'],profileparams['horizontalfeedrate'])
    side = profileparams['side']
    tool_diameter = profileparams['tooldiameter']
    offset_extra = profileparams['offset_extra']
    roll_radius = profileparams['roll_radius']
    roll_on = profileparams['roll_on']
    roll_off = profileparams['roll_off']
    rapid_safety_space = profileparams['rapid_safety_space']
    clearance = profileparams['clearance']
    start_depth = profileparams['start_depth']
    step_down = profileparams['step_down']
    final_depth = profileparams['final_depth']
    extend_at_start = profileparams['extend_at_start']
    extend_at_end = profileparams['extend_at_end']
    lead_in_line_len = profileparams['lead_in_line_len']
    lead_out_line_len = profileparams['lead_out_line_len']

    if startparams['startpt']:
        kurve_funcs.make_smaller( curve_name, start = area.Point(startparams['startptX'] ,startparams['startptY']))
    
    kurve_funcs.profile(curve_name, side, tool_diameter/2, offset_extra, roll_radius, roll_on, roll_off, rapid_safety_space, clearance, start_depth, step_down, final_depth,extend_at_start,extend_at_end,lead_in_line_len,lead_out_line_len )
Beispiel #4
0
def cut_curvelist2(curve_list, rapid_safety_space, current_start_depth, depth,
                   clearance_height, keep_tool_down_if_poss, start_point):
    p = geom.Point(0, 0)
    start_x, start_y = start_point
    first = True
    for curve in curve_list:
        need_rapid = True
        if first == True:
            direction = "on"
            radius = 0.0
            offset_extra = 0.0
            roll_radius = 0.0
            roll_on = 0.0
            roll_off = 0.0
            rapid_safety_space
            step_down = math.fabs(depth)
            extend_at_start = 0.0
            extend_at_end = 0.0
            kurve_funcs.make_smaller(curve, start=geom.Point(start_x, start_y))
            kurve_funcs.profile(curve, direction, radius, offset_extra,
                                roll_radius, roll_on, roll_off,
                                rapid_safety_space, clearance_height,
                                current_start_depth, step_down, depth,
                                extend_at_start, extend_at_end)
        else:
            s = curve.FirstVertex().p
            if keep_tool_down_if_poss == True:

                # see if we can feed across
                if feed_possible(p, s):
                    need_rapid = False
            elif s.x == p.x and s.y == p.y:
                need_rapid = False

        cut_curve(curve, need_rapid, p, rapid_safety_space,
                  current_start_depth, depth)
        first = False  #change to True if you want to rapid back to start side before zigging again with unidirectional set
    rapid(z=clearance_height)
Beispiel #5
0
    def DoGCodeCallsForSketch(self, object, data):
        cut_mode, depth_params, tool_diameter, roll_radius, offset_extra, cutting_edge_angle = data

        # decide if we need to reverse the kurve
        direction_reversed = False
        initially_ccw = False
        if self.tool_on_side != PROFILE_ON:
            if object.GetType() == cad.OBJECT_TYPE_CIRCLE:
                initially_ccw = True
            if object.GetType() == cad.OBJECT_TYPE_SKETCH:
                order = object.GetSketchOrder()
                if order == cad.SketchOrderType.SketchOrderTypeCloseCCW:
                    initially_ccw = True
            if self.spindle_speed < 0:
                direction_reversed = not direction_reversed
            if cut_mode == PROFILE_CONVENTIONAL:
                direction_reversed = not direction_reversed
            if self.tool_on_side == PROFILE_RIGHT_OR_INSIDE:
                direction_reversed = not direction_reversed

        curve = object.GetCurve()

        if self.start_given or self.end_given:
            start = None
            if self.start_given:
                start = geom.Point(self.start.x, self.start.y)
            end = None
            end_beyond = False
            if self.end_given:
                end = geom.Point(self.end.x, self.end.y)
                end_beyond = self.end_beyond_full_profile
            kurve_funcs.make_smaller(curve, start, end, end_beyond)

        if curve.NumVertices() <= 1:
            raise NameError("sketch has no spans! object = " +
                            object.GetTitle() + ' curve = ' + str(curve))

        if initially_ccw != direction_reversed:
            curve.Reverse()

        if (not self.start_given) and (not self.end_given):
            kurve_funcs.set_good_start_point(curve, direction_reversed)

        # start - assume we are at a suitable clearance height

        # get offset side string
        side_string = 'on'
        if self.tool_on_side == PROFILE_LEFT_OR_OUTSIDE:
            side_string = 'right' if direction_reversed else 'left'
        elif self.tool_on_side == PROFILE_RIGHT_OR_INSIDE:
            side_string = 'left' if direction_reversed else 'right'

        # roll on
        if self.tool_on_side == PROFILE_LEFT_OR_OUTSIDE or self.tool_on_side == PROFILE_RIGHT_OR_INSIDE:
            if self.auto_roll_on:
                roll_on = 'auto'
            else:
                roll_on = geom.Point(
                    self.roll_on_point.x / wx.GetApp().program.units,
                    self.roll_on_point.ywx.GetApp().program.units)
        else:
            roll_on = None

        # roll off
        if self.tool_on_side == PROFILE_LEFT_OR_OUTSIDE or self.tool_on_side == PROFILE_RIGHT_OR_INSIDE:
            if self.auto_roll_off:
                roll_off = 'auto'
            else:
                roll_off = geom.Point(
                    self.roll_off_point.x / wx.GetApp().program.units,
                    self.roll_off_point.ywx.GetApp().program.units)
        else:
            roll_off = None

        tags_cleared = False
        for tag in self.GetTags():
            if not tags_cleared:
                kurve_funcs.clear_tags()
            tags_cleared = True
            kurve_funcs.add_tag(
                geom.Point(tag.pos.x / wx.GetApp().program.units,
                           tag.pos.y / wx.GetApp().program.units),
                tag.width / wx.GetApp().program.units,
                tag.angle * math.pi / 180.0,
                tag.height / wx.GetApp().program.units)

        # extend_at_start, extend_at_end
        extend_at_start = self.extend_at_start / wx.GetApp().program.units
        extend_at_end = self.extend_at_end / wx.GetApp().program.units

        # lead in lead out line length
        lead_in_line_len = self.lead_in_line_len / wx.GetApp().program.units
        lead_out_line_len = self.lead_out_line_len / wx.GetApp().program.units

        # profile the kurve
        kurve_funcs.profile(curve, side_string, tool_diameter / 2,
                            offset_extra, roll_radius, roll_on, roll_off,
                            depth_params, extend_at_start, extend_at_end,
                            lead_in_line_len, lead_out_line_len)

        # do we need this here
        absolute()