diff --git a/src/marz_neck_feature.py b/src/marz_neck_feature.py index 6357868..89092c0 100644 --- a/src/marz_neck_feature.py +++ b/src/marz_neck_feature.py @@ -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 @@ -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 diff --git a/src/marz_ui.py b/src/marz_ui.py index 8d744a8..eb83731 100644 --- a/src/marz_ui.py +++ b/src/marz_ui.py @@ -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/"