cq_toplevel: add an --export-tjs option

This commit is contained in:
2024-02-03 04:19:54 +00:00
parent 27a4cf5626
commit ddc87b8ec7

View File

@@ -58,6 +58,7 @@ def main():
parser.add_argument("--render-phone", action="store_true", help="include the phone model itself in the stl; useful to confirm fit visually before printing")
parser.add_argument("--export-stl")
parser.add_argument("--export-svg")
parser.add_argument("--export-tjs")
parser.add_argument("--editor", action="store_true", help="view in cq-editor")
args = parser.parse_args()
@@ -71,6 +72,7 @@ def main():
if args.export_stl:
logger.info("exporting stl to %s", args.export_stl)
cq.exporters.export(model_, args.export_stl)
if args.export_svg:
view = None
if "front" in args.export_svg:
@@ -81,6 +83,17 @@ def main():
view = "right"
logger.info("exporting svg to %s (view: %s)", args.export_svg, str(view))
cq.exporters.export(model_, args.export_svg, opt=svg_export_options(view))
if args.export_tjs:
logger.info("exporting three.js to %s", args.export_tjs)
cq.exporters.export(
model_,
args.export_tjs,
tolerance=0.01,
angularTolerance=0.1,
exportType=cq.exporters.ExportTypes.TJS,
)
if args.editor:
logger.info("launching cq-editor")
subprocess.check_call(["cq-editor", __file__])