cq_toplevel: implement --render-phone-only CLI option to render just the phone without any case
This commit is contained in:
@@ -46,7 +46,13 @@ def svg_export_options(view: str):
|
||||
|
||||
def model():
|
||||
render_phone = os.environ.get("CASE_RENDER_PHONE", "") not in ("", "0")
|
||||
render_phone_only = os.environ.get("CASE_RENDER_PHONE_ONLY", "") not in ("", "0")
|
||||
|
||||
phone = pinephone.PinePhone()
|
||||
|
||||
if render_phone_only:
|
||||
return case.orient_for_printing(phone)
|
||||
|
||||
battery = ldtek_battery.LdtekBattery()
|
||||
return case.case(phone, battery=battery, render_phone=render_phone)
|
||||
|
||||
@@ -55,7 +61,8 @@ def main():
|
||||
logging.getLogger().setLevel(logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser(description="toplevel cadquery interface")
|
||||
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("--render-phone", action="store_true", help="render the case and also the phone within it; useful to confirm fit visually before printing")
|
||||
parser.add_argument("--render-phone-only", action="store_true", help="render *only* the phone, not even the case")
|
||||
parser.add_argument("--export-stl")
|
||||
parser.add_argument("--export-svg")
|
||||
parser.add_argument("--export-vtk")
|
||||
@@ -66,6 +73,9 @@ def main():
|
||||
if args.render_phone:
|
||||
os.environ["CASE_RENDER_PHONE"] = "1"
|
||||
|
||||
if args.render_phone_only:
|
||||
os.environ["CASE_RENDER_PHONE_ONLY"] = "1"
|
||||
|
||||
logger.info("computing model ...")
|
||||
model_ = model()
|
||||
|
||||
|
Reference in New Issue
Block a user