47 lines
953 B
Python
Executable File
47 lines
953 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
toplevel file used for interactive modeling.
|
|
|
|
- `cq-editor ./cq_toplevel.py`
|
|
- then press green play button to render
|
|
- edit files externally, and press render again to refresh the view
|
|
"""
|
|
|
|
import cadquery as cq
|
|
import argparse
|
|
import logging
|
|
import os
|
|
import sys
|
|
|
|
sys.path.append(os.path.join(os.getcwd(), "src"))
|
|
|
|
import case
|
|
import pinephone
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def model():
|
|
phone = pinephone.PinePhone()
|
|
return case.case(phone)
|
|
|
|
def main():
|
|
logging.basicConfig()
|
|
logging.getLogger().setLevel(logging.INFO)
|
|
|
|
parser = argparse.ArgumentParser(description="toplevel cadquery interface")
|
|
parser.add_argument("--export-stl")
|
|
|
|
args = parser.parse_args()
|
|
|
|
model_ = model()
|
|
|
|
if args.export_stl:
|
|
logger.info("exporting stl to %s", args.export_stl)
|
|
cq.exporters.export(model_, args.export_stl)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
else:
|
|
result = model()
|