Skip to content

Commit

Permalink
Catenary transition for headstock
Browse files Browse the repository at this point in the history
  • Loading branch information
mnesarco committed Apr 13, 2020
1 parent 1d191b4 commit 4f77268
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/marz_neck_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from marz_utils import startTimeTrace
from marz_vxy import angleVxy, vxy
from marz_neck_profile import getNeckProfile
from marz_transitions import transitionDatabase
from marz_transitions import transitionDatabase, CatenaryTransition

#--------------------------------------------------------------------------
@PureFunctionCache
Expand Down Expand Up @@ -135,19 +135,16 @@ def headstockTransition(neckd, line,
startd = 0
trline = line.lerpLineTo(transitionLength).flipDirection().lerpLineTo(2*transitionLength)
length = trline.length
def fnw(x):
w = neckd.widthAt(x+startd) + length*math.cosh(x/transitionTension)-length
return min(w, headStockWidth*2)
def fnh(x):
h = -(neckd.thicknessAt(x+startd) + length*math.cosh(x/transitionTension)-length)
return max(h, -100)

transition = CatenaryTransition(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)

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=True)
tr = geom.makeTransition(wire.Edges[0], profile, transition.width, lambda x: -transition.height(x), steps=steps, limits=limit, ruled=True)

return tr

Expand Down
2 changes: 1 addition & 1 deletion src/marz_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from marz_threading import RunInUIThread
import marz_freecad as fc

MARZ_VERSION = "0.0.11-alpha"
MARZ_VERSION = "0.0.12-alpha"
MARZ_WINDOW_LABEL = f"FreeCAD :: Marz Workbench {MARZ_VERSION}"
MARZ_REPOSITORY = "https://github.com/mnesarco/MarzWorkbench/"

Expand Down

0 comments on commit 4f77268

Please sign in to comment.