Skip to content

Commit

Permalink
Made transition surfaces ruled and more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
mnesarco committed Apr 13, 2020
1 parent e0ea38e commit 1d191b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions docs/examples/example_custom_headstock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/marz_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def wire(i):
p = fnProfile(w,h)
p.Placement = Placement(points[i], rot)
return p
loft = Part.makeLoft([ wire(i) for i in range(steps+1) ], solid, ruled)
wires = [ wire(i) for i in range(steps+1) ]

loft = Part.makeLoft(wires, solid, ruled)
if limits:
loft = loft.common(limits)
return loft
8 changes: 4 additions & 4 deletions src/marz_neck_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def heelTransition(neckd, line, startd, h, transitionLength, transitionTension):
transition = Transition(neckd.widthAt, neckd.thicknessAt, transitionTension, transitionTension, startd, length)
profile = getNeckProfile(neckd.profileName)
wire = Part.Wire( Part.LineSegment(geom.vec(trline.start), geom.vec(trline.end)).toShape() )
steps = int(trline.length/5)
steps = int(trline.length)

limit = geom.extrusion(neckd.fbd.neckFrame.polygon, 0, Vector(0,0,-h))
tr = geom.makeTransition(wire.Edges[0], profile, transition.width, transition.height, steps=steps, limits=limit, ruled=False)
tr = geom.makeTransition(wire.Edges[0], profile, transition.width, transition.height, steps=steps, limits=limit, ruled=True)

return tr

Expand Down Expand Up @@ -143,11 +143,11 @@ def fnh(x):
return max(h, -100)
profile = getNeckProfile(neckd.profileName)
wire = Part.Wire( Part.LineSegment(geom.vec(trline.start), geom.vec(trline.end)).toShape() )
steps = int(trline.length/3)
steps = int(trline.length)

limitp = trline.lerpLineTo(transitionLength+transitionLength).rectSym(headStockWidth)
limit = geom.extrusion(limitp, 0, Vector(0,0,-h - (0 if cut else 30)))
tr = geom.makeTransition(wire.Edges[0], profile, fnw, fnh, steps=steps, limits=limit, ruled=False)
tr = geom.makeTransition(wire.Edges[0], profile, fnw, fnh, steps=steps, limits=limit, ruled=True)

return tr

Expand Down
4 changes: 2 additions & 2 deletions src/marz_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class CatenaryTransition:
def __init__(self, wBase, hBase, wParam, hParam, start, length, wMax = 500, hMax = 500):

def fnw(x):
w = wBase(x + start) + length * math.cosh(x/wParam) - length
w = wBase(x + start) + (length * math.cosh(x/wParam) - length)/4
return w

def fnh(x):
h = hBase(x + start) + length * math.cosh(x/hParam) - length
h = hBase(x + start) + (length * math.cosh(x/hParam) - length)/4
return h

self.width = fnw
Expand Down

0 comments on commit 1d191b4

Please sign in to comment.