Changes
6 changed files (+61/-71)
-
-
@@ -19,16 +19,14 @@ = Roundtype alias BuckleHole = -- Offset from the case side (lug side.) { offset : Length -- Distance between a base hole (center hole) and case-side strap end. { distance : Length -- Number of buckle holes, can be 0. , count : Int -- Adjustment level. The number of holes will be `1 + adjustments * 2`. , adjustments : Int -- Center-to-center. , interval : Length -- TODO: Support non circular holes. , diameter : Length }
-
@@ -169,8 +167,8 @@ , longPiece ={ length = mm 112 , tip = Round , buckleHole = { offset = mm 50 , count = 7 { distance = mm 70 , adjustments = 3 , interval = mm 6 , diameter = mm 2 }
-
@@ -209,9 +207,10 @@ , ( Key.toString ShortPieceLength, String.fromFloat (toMM params.shortPiece.length) ), ( Key.toString CanvasMargin, String.fromFloat (toMM params.rendering.margin) ) , ( Key.toString LineWidth, String.fromFloat (toMM params.rendering.lineWidth) ) , ( Key.toString ColorSchema, colorSchemaToString params.rendering.colorSchema ) , ( Key.toString BuckleHoleCount, String.fromInt params.longPiece.buckleHole.count ) , ( Key.toString BuckleHoleOffset, String.fromFloat (toMM params.longPiece.buckleHole.offset) ) , ( Key.toString BuckleHoleAdjustments, String.fromInt params.longPiece.buckleHole.adjustments ) , ( Key.toString BuckleHoleDistance, String.fromFloat (toMM params.longPiece.buckleHole.distance) ) , ( Key.toString BuckleHoleInterval, String.fromFloat (toMM params.longPiece.buckleHole.interval) ) , ( Key.toString BuckleHoleDiameter, String.fromFloat (toMM params.longPiece.buckleHole.diameter) ) , ( Key.toString Profile, profileKind params.profile ) ] |> (++)
-
@@ -223,14 +222,6 @@ Tapered to ->[ ( Key.toString TaperTo, String.fromFloat (toMM to) ) ] ) |> (++) (if params.longPiece.buckleHole.count > 0 then [ ( Key.toString BuckleHoleDiameter, String.fromFloat (toMM params.longPiece.buckleHole.diameter) ) ] else [] ) |> (++) (case params.shortPiece.loops.fixed of Just fixed -> [ ( Key.toString HasFixedLoop, "" )
-
@@ -274,7 +265,6 @@ , ( Key.toString FixedLoopLength, String.fromFloat (toMM defaultFixedLoop.length) ), ( Key.toString FreeLoopWidth, String.fromFloat (toMM defaultFreeLoop.width) ) , ( Key.toString FreeLoopLength, String.fromFloat (toMM defaultFreeLoop.length) ) , ( Key.toString FreeLoopOverlap, String.fromFloat (toMM defaultFreeLoop.overlap) ) , ( Key.toString BuckleHoleDiameter, String.fromFloat (toMM default.longPiece.buckleHole.diameter) ) ] |> Dict.fromList
-
-
-
@@ -587,32 +587,31 @@ , hr [] [], group { title = [ text "Buckle / Clasp" ], description = Nothing } [ numberField model { key = BuckleHoleCount , title = [ text "Hole Count" ] , description = [ text "Set 0 to disable buckle holes generation." ] { key = BuckleHoleDistance , title = [ text "Center Hole Distance" ] , description = [ text "Distance between case-side strap end and the center hole." ] , unit = Just "mm" , disabled = False , attrs = step "1.0" :: lengthFieldAttrs constraints.longPiece.buckleHole.distance } , numberField model { key = BuckleHoleAdjustments , title = [ text "Hole Adjustment Level" ] , description = [ text "Number of adjustment holes top and bottom of the center hole." ] , unit = Nothing , disabled = False , attrs = step "1" :: intFieldAttrs constraints.longPiece.buckleHole.count , attrs = step "1" :: intFieldAttrs constraints.longPiece.buckleHole.adjustments } , numberField model { key = BuckleHoleDiameter , title = [ text "Hole Diameter" ] , description = [ text "Diameter of buckle holes. You can leave the default value if you're going to use the center mark." ] , unit = Just "mm" , disabled = model.parameters.longPiece.buckleHole.count == 0 , attrs = step "1.0" :: lengthFieldAttrs constraints.longPiece.buckleHole.diameter } , numberField model { key = BuckleHoleOffset , title = [ text "Hole Offset" ] , description = [ text "Distance between strap end (lug-side) and first buckle hole." ] , description = [ text "Diameter of the buckle holes." ] , unit = Just "mm" , disabled = False , attrs = step "1.0" :: lengthFieldAttrs constraints.longPiece.buckleHole.offset step "1.0" :: lengthFieldAttrs constraints.longPiece.buckleHole.diameter } , numberField model { key = BuckleHoleInterval
-
-
-
@@ -45,10 +45,10 @@ }type alias BuckleHole = { count : NumberConstraints Int { adjustments : NumberConstraints Int , diameter : NumberConstraints Length , interval : NumberConstraints Length , offset : NumberConstraints Length , distance : NumberConstraints Length }
-
@@ -78,10 +78,10 @@ constraints ={ shoulderWidth = { min = Just (mm 10), max = Just (mm 30) } , longPiece = { buckleHole = { count = { min = Just 0, max = Just 10 } { adjustments = { min = Just 0, max = Just 4 } , diameter = { min = Just (mm 1), max = Just (mm 10) } , interval = { min = Just (mm 1), max = Just (mm 10) } , offset = { min = Just (mm 1), max = Just (mm 100) } , distance = { min = Just (mm 1), max = Just (mm 130) } } , length = { min = Just (mm 5), max = Just (mm 150) } }
-
-
-
@@ -14,8 +14,8 @@ type Key= ShoulderWidth | Profile | TaperTo | BuckleHoleOffset | BuckleHoleCount | BuckleHoleDistance | BuckleHoleAdjustments | BuckleHoleInterval | BuckleHoleDiameter | LongPieceLength
-
@@ -50,11 +50,11 @@ShoulderWidth -> "shoulder-width" BuckleHoleOffset -> "buckle-hole-offset" BuckleHoleDistance -> "buckle-hole-distance" BuckleHoleCount -> "buckle-hole-count" BuckleHoleAdjustments -> "buckle-hole-adjustments" BuckleHoleDiameter -> "buckle-hole-diameter"
-
-
-
@@ -272,30 +272,23 @@parseBuckleHole : ParametersDict -> Result Errors Parameters.BuckleHole parseBuckleHole fields = case ( ( parseField BuckleHoleCount (parseInt constraints.longPiece.buckleHole.count) fields ( ( parseField BuckleHoleAdjustments (parseInt constraints.longPiece.buckleHole.adjustments) fields , parseField BuckleHoleDiameter (parseLength constraints.longPiece.buckleHole.diameter) fields ) , ( parseField BuckleHoleOffset (parseLength constraints.longPiece.buckleHole.offset) fields , ( parseField BuckleHoleDistance (parseLength constraints.longPiece.buckleHole.distance) fields , parseField BuckleHoleInterval (parseLength constraints.longPiece.buckleHole.interval) fields ) ) of ( ( Ok 0, _ ), _ ) -> let default = Parameters.default.longPiece.buckleHole in Ok { default | count = 0 } ( ( Ok adjustments, Ok diameter ), ( Ok distance, Ok interval ) ) -> Ok { adjustments = adjustments, diameter = diameter, distance = distance, interval = interval } ( ( Ok count, Ok diameter ), ( Ok offset, Ok interval ) ) -> Ok { count = count, diameter = diameter, offset = offset, interval = interval } ( ( count, diameter ), ( offset, interval ) ) -> ( ( adjustments, diameter ), ( distance, interval ) ) -> Err (mkErrors [ ( BuckleHoleCount, getError count ) [ ( BuckleHoleAdjustments, getError adjustments ) , ( BuckleHoleDiameter, getError diameter ) , ( BuckleHoleOffset, getError offset ) , ( BuckleHoleDistance, getError distance ) , ( BuckleHoleInterval, getError interval ) ] )
-
-
-
@@ -97,7 +97,9 @@ toMM params.longPiece.lengthtaperUntil = Basics.min (toMM params.longPiece.buckleHole.offset - toMM params.longPiece.buckleHole.interval) (toMM params.longPiece.buckleHole.distance - (toMM params.longPiece.buckleHole.interval * toFloat (params.longPiece.buckleHole.adjustments + 1)) ) (length / 2) taper =
-
@@ -150,7 +152,7 @@ FalseTapered _ -> highlighting == Just BuckleHoleOffset == Just BuckleHoleDistance || highlighting == Just BuckleHoleInterval )
-
@@ -182,7 +184,11 @@ == Just ShoulderWidth|| highlighting == Just TaperTo || highlighting == Just BuckleHoleOffset == Just BuckleHoleDistance || highlighting == Just BuckleHoleAdjustments || highlighting == Just BuckleHoleInterval || highlighting == Just BuckleHoleDiameter )
-
@@ -211,15 +217,15 @@ ( p.x, p.y )params highlighting [ ClosePath ] :: (List.range 0 (params.longPiece.buckleHole.count - 1) :: (List.range 0 (params.longPiece.buckleHole.adjustments * 2) |> List.map (\index -> let { buckleHole } = params.longPiece offset = toMM buckleHole.offset distance = toMM buckleHole.distance interval = toMM buckleHole.interval
-
@@ -228,17 +234,17 @@ holeparams buckleHole.diameter ( p.x + shoulderWidth / 2 , p.y + offset + interval * toFloat index , p.y + distance + interval * toFloat (index - params.longPiece.buckleHole.adjustments) ) [ highlightStroke (highlighting == Just BuckleHoleDiameter || highlighting == Just BuckleHoleCount == Just BuckleHoleDistance || highlighting == Just BuckleHoleInterval || highlighting == Just BuckleHoleOffset == Just BuckleHoleAdjustments ) ] )
-
@@ -299,7 +305,9 @@ toMM params.shortPiece.lengthtaperUntil = Basics.min (toMM params.longPiece.buckleHole.offset - toMM params.longPiece.buckleHole.interval) (toMM params.longPiece.buckleHole.distance - (toMM params.longPiece.buckleHole.interval * toFloat (params.longPiece.buckleHole.adjustments + 1)) ) (length - 10) taper =
-
@@ -345,7 +353,7 @@ FalseTapered _ -> highlighting == Just BuckleHoleOffset == Just BuckleHoleDistance || highlighting == Just BuckleHoleInterval )
-