diff --git a/README.md b/README.md index db81e95..419295a 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,11 @@ Initial Release: December 2014 ## Change Log +#### 0.9.6 +- Fixes part.fillet_lines method, all tests now pass + - Verified on Mac OS X + - Closes github Issue 32: '2/15 of the tests fail' + #### 0.9.5 (github + pypi) - Adds tests: sample tests at tests/test_samples.py - Adds tests: meshing tests at tests/test_meshing.py diff --git a/dist/documentation.zip b/dist/documentation.zip index 22f6d9f..e39bd84 100644 Binary files a/dist/documentation.zip and b/dist/documentation.zip differ diff --git a/dist/examples.zip b/dist/examples.zip index 356b7b3..09b7dd1 100644 Binary files a/dist/examples.zip and b/dist/examples.zip differ diff --git a/dist/pycalculix-0.9.5.zip b/dist/pycalculix-0.9.6.zip similarity index 76% rename from dist/pycalculix-0.9.5.zip rename to dist/pycalculix-0.9.6.zip index c4c30f3..a0b2f26 100644 Binary files a/dist/pycalculix-0.9.5.zip and b/dist/pycalculix-0.9.6.zip differ diff --git a/docs/conf.py b/docs/conf.py index 73b2ec8..bf8bbee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ author = 'Justin Black' # The short X.Y version -version = '0.9.5' +version = '' # The full version, including alpha/beta/rc tags -release = '0.9.5' +release = '' # -- General configuration --------------------------------------------------- @@ -184,7 +184,10 @@ # -- Options for todo extension ---------------------------------------------- # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True +todo_include_todos = True +from pycalculix.version import __version__ +version = __version__ +release = version extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.todo', diff --git a/examples/rounded-square-ccw.py b/examples/rounded-square-ccw.py index e969c99..04456b4 100644 --- a/examples/rounded-square-ccw.py +++ b/examples/rounded-square-ccw.py @@ -30,6 +30,7 @@ line_2 = part.draw_line_ax(-length)[0] part.draw_line_rad(-thickness*0.4) part.draw_line_to(radius_inner, axial) +model.plot_geometry(model_name + '_pre', display=show_gui) part.fillet_lines(line_1, line_2, radius) model.plot_geometry(model_name + '_geom', display=show_gui) diff --git a/examples/rounded-square-cw.py b/examples/rounded-square-cw.py index 5858962..10bf49d 100644 --- a/examples/rounded-square-cw.py +++ b/examples/rounded-square-cw.py @@ -30,6 +30,7 @@ line_2 = part.draw_line_rad(-thickness)[0] part.draw_line_ax(-length*0.5) part.draw_line_to(radius_inner, axial) +model.plot_geometry(model_name + '_pre', display=show_gui) part.fillet_lines(line_1, line_2, radius) model.plot_geometry(model_name + '_geom', display=show_gui) diff --git a/pycalculix/partmodule.py b/pycalculix/partmodule.py index c415462..ce41944 100644 --- a/pycalculix/partmodule.py +++ b/pycalculix/partmodule.py @@ -291,7 +291,7 @@ def draw_circle(self, center_x, center_y, radius, num_arcs=4): center_y (float): y-axis hole center radius (float): hole radius num_arcs (int): number of arcs to use, must be >= 3 - + Returns: loop (geometry.LineLoop): a LineLoop list of SignArc """ @@ -518,66 +518,76 @@ def fillet_lines(self, line1, line2, radius): Args: line1 (SignLine): line that the arc starts on, arc is tangent - line2 (SignLine): line that the ar ends on, arc is tangent + line2 (SignLine): line that the arc ends on, arc is tangent radius (float): arc radius size - + Returns: list: [arc, start_point, end_point] """ - # this function fillets lines in a part # check if the lines are touching - tmp = self.__cursor + if not line1.line.touches(line2.line): + print('ERROR: Cannot fillet! Lines must touch!') + return + + if line1.line.pt(1) == line2.line.pt(0): + first_line = line1 + second_line = line2 + elif line2.line.pt(1) == line1.line.pt(0): + first_line = line2 + second_line = line1 + else: + print('ERROR: Sign lines must both be going in CW or CCW ' + 'direction. The two passed lines are going in ' + 'different directions. Unable to fillet them.') + return - if line1.touches(line2): - # offset the lines, assuming area is being traced clockwise - # get the intersection point - magnitude = radius - l1_off = line1.offset(magnitude) - l2_off = line2.offset(magnitude) + tmp = self.__cursor + # offset the lines, assuming area is being traced clockwise + # get the intersection point + magnitude = radius + l1_off = first_line.offset(magnitude) + l2_off = second_line.offset(magnitude) + ctrpt = l1_off.intersects(l2_off) + if ctrpt == None: + # flip the offset direction if lines don't intersect + magnitude = -radius + l1_off = first_line.offset(magnitude) + l2_off = second_line.offset(magnitude) ctrpt = l1_off.intersects(l2_off) - if ctrpt == None: - # flip the offset direction if lines don't intersect - magnitude = -radius - l1_off = line1.offset(magnitude) - l2_off = line2.offset(magnitude) - ctrpt = l1_off.intersects(l2_off) - - # now we have an intersecting point - #print('Arc center pt is: ', ctrpt) - p1_new = line1.arc_tang_intersection(ctrpt, magnitude) - p2_new = line2.arc_tang_intersection(ctrpt, magnitude) - rempt = line1.pt(1) - - p1_new = self.__make_get_pt(p1_new.x, p1_new.y)[0] - ctrpt = self.__make_get_pt(ctrpt.x, ctrpt.y)[0] - p2_new = self.__make_get_pt(p2_new.x, p2_new.y)[0] - - # make the new arc - arc = self.__make_get_sline(geometry.Arc(p1_new, p2_new, ctrpt))[0] - - # put the arc in the right location in the area - area = line1.lineloop.parent - area.line_insert(line1, arc) - print('Arc inserted into area %i' % (area.id)) - - # edit the adjacent lines to replace the removed pt - line1.set_pt(1, arc.pt(0)) - line2.set_pt(0, arc.pt(1)) - # del old pt, store new points for the arc - self.fea.points.remove(rempt) - - return [arc, arc.pt(0), arc.pt(1)] - else: - print('Cannot fillet! Lines must touch!') + + # now we have an intersecting point + p1_new = first_line.arc_tang_intersection(ctrpt, magnitude) + p2_new = second_line.arc_tang_intersection(ctrpt, magnitude) + rempt = first_line.pt(1) + + p1_new = self.__make_get_pt(p1_new.x, p1_new.y)[0] + ctrpt = self.__make_get_pt(ctrpt.x, ctrpt.y)[0] + p2_new = self.__make_get_pt(p2_new.x, p2_new.y)[0] + + # make the new arc + arc = self.__make_get_sline(geometry.Arc(p1_new, p2_new, ctrpt))[0] + + # put the arc in the right location in the area + area = first_line.lineloop.parent + area.line_insert(first_line, arc) + print('Arc inserted into area %i' % (area.id)) + + # edit the adjacent lines to replace the removed pt + first_line.set_pt(1, arc.pt(0)) + second_line.set_pt(0, arc.pt(1)) + # del old pt, store new points for the arc + self.fea.points.remove(rempt) + # reset the cursor to where it should be self.__cursor = tmp + return [arc, arc.pt(0), arc.pt(1)] def fillet_all(self, radius): """Fillets all external lines not within 10 degrees of tangency - + Args: radius (float): the fillet radius to use - + Returns: arcs (list): list of SignArc """ @@ -630,7 +640,7 @@ def plot(self, axis, label=True, color='yellow'): # apply the label if label: self.label(axis) - + def __cut_line(self, point, line): """Cuts the passed line at the passed point. @@ -781,7 +791,7 @@ def __get_cut_line(self, cutline): def __cut_with_line(self, cutline, debug): """Cuts the part using the passed line. - + Args: cutline (Line): line to cut the area with debug (list): bool for printing, bool for plotting after every cut @@ -898,7 +908,7 @@ def __vect_to_line(self, point, cvect): Args: point (Point): the location we are cutting from cvect (Point): the vector direction of the cut from pt - + Returns: cutline (Line): cut line """ diff --git a/pycalculix/version.py b/pycalculix/version.py index f8c6ac7..50533e3 100644 --- a/pycalculix/version.py +++ b/pycalculix/version.py @@ -1 +1 @@ -__version__ = "0.9.5" +__version__ = "0.9.6"