Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Adds fix for issue 32
Browse files Browse the repository at this point in the history
  • Loading branch information
spacether committed Jul 22, 2018
1 parent a6c98da commit 860f7f4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 24 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified dist/documentation.zip
Binary file not shown.
Binary file modified dist/examples.zip
Binary file not shown.
Binary file not shown.
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand Down Expand Up @@ -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',
Expand Down
4 changes: 0 additions & 4 deletions examples/rounded-square-ccw.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@
line_1 = part.draw_line_rad(thickness)[0]
line_2 = part.draw_line_ax(-length)[0]
part.draw_line_rad(-thickness*0.4)
print(line_2)
part.draw_line_to(radius_inner, axial)
print(line_2)
# change the closure to flip the signline, not the line
model.plot_geometry(model_name + '_pre', display=show_gui)
part.fillet_lines(line_1, line_2, radius)
# this fails for ccw geometry, but works for cw geometry

model.plot_geometry(model_name + '_geom', display=show_gui)
part.chunk()
Expand Down
41 changes: 25 additions & 16 deletions pycalculix/partmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,38 +518,47 @@ 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]
"""
# check if the lines are touching
if not line1.touches(line2):
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

tmp = self.__cursor
# 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)
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
print('Ofsetting in the other direction')
magnitude = -radius
l1_off = line1.offset(magnitude)
l2_off = line2.offset(magnitude)
l1_off = first_line.offset(magnitude)
l2_off = second_line.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)
print('Point to remove is: %s' % rempt)
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]
Expand All @@ -559,13 +568,13 @@ def fillet_lines(self, line1, line2, radius):
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)
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
line1.set_pt(1, arc.pt(0))
line2.set_pt(0, arc.pt(1))
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)

Expand Down
2 changes: 1 addition & 1 deletion pycalculix/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.5"
__version__ = "0.9.6"

0 comments on commit 860f7f4

Please sign in to comment.