Skip to content

Commit 78c89ce

Browse files
authored
Add global scale factors (#29)
Add three new command line arguments "--xscale", "--yscale", and "--zscale" that can be used independently, all defaulting to 1.0, making them optional.
1 parent 69fd66d commit 78c89ce

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ The full command parameter usage (as generate by `gflabel --help`):
123123
usage: gflabel [-h] [--vscode] [-w WIDTH] [--height HEIGHT] [--depth DEPTH_MM] [--no-overheight] [-d DIVISIONS] [--font FONT]
124124
[--font-size-maximum FONT_SIZE_MAXIMUM | --font-size FONT_SIZE] [--font-style {regular,bold,italic}] [--font-path FONT_PATH]
125125
[--margin MARGIN] [-o OUTPUT] [--style {embossed,debossed,embedded}] [--list-fragments] [--list-symbols] [--label-gap LABEL_GAP]
126-
[--column-gap COLUMN_GAP] [-v] [--version VERSION]
126+
[--column-gap COLUMN_GAP] [--xscale XSCALE] [--yscale YSCALE] [--zscale ZSCALE] [-v] [--version VERSION]
127127
BASE LABEL [LABEL ...]
128128
129129
Generate gridfinity bin labels
@@ -166,6 +166,9 @@ options:
166166
Vertical gap (in mm) between physical labels. Default: 2 mm
167167
--column-gap COLUMN_GAP
168168
Gap (in mm) between columns
169+
--xscale,--yscale,--zscale
170+
Scale factor for entire label along the corresponding axis. Useful when you need slight adjustments for proper fit.
171+
[All default to 1.0]
169172
-v, --verbose Verbose output
170173
--version VERSION The version of geometry to use for a given label system (if a system has versions). [Default: latest]
171174
```

src/gflabel/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
add,
3535
export_step,
3636
extrude,
37+
scale,
3738
)
3839

3940
from . import fragments
@@ -284,6 +285,15 @@ def run(argv: list[str] | None = None):
284285
parser.add_argument(
285286
"--column-gap", help="Gap (in mm) between columns", default=0.4, type=float
286287
)
288+
parser.add_argument(
289+
"--xscale", help="Scale factor for entire label on the X axis", default=1.0, type=float
290+
)
291+
parser.add_argument(
292+
"--yscale", help="Scale factor for entire label on the Y axis", default=1.0, type=float
293+
)
294+
parser.add_argument(
295+
"--zscale", help="Scale factor for entire label on the Z axis", default=1.0, type=float
296+
)
287297
parser.add_argument("--box", action="store_true", help=argparse.SUPPRESS)
288298
parser.add_argument("-v", "--verbose", help="Verbose output", action="store_true")
289299
parser.add_argument(
@@ -424,6 +434,8 @@ def run(argv: list[str] | None = None):
424434
else:
425435
assembly = Compound(part.part)
426436

437+
assembly = scale(assembly, (args.xscale, args.yscale, args.zscale))
438+
427439
for output in args.output:
428440
if output.endswith(".stl"):
429441
logger.info(f"Writing STL {output}")

0 commit comments

Comments
 (0)