mirror of
https://github.com/csirmaz/openscad-py.git
synced 2025-06-21 18:28:58 +02:00
Split code into separate class files
This commit is contained in:
parent
ffbee53da3
commit
9d24a2c85f
24 changed files with 1062 additions and 830 deletions
23
openscad_py/header.py
Normal file
23
openscad_py/header.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
from typing import Union as TUnion
|
||||
from typing import List
|
||||
|
||||
|
||||
class Header:
|
||||
"""Render a header (setting global values) of an OpensCAD file"""
|
||||
|
||||
|
||||
def __init__(self, quality: str = 'draft'):
|
||||
self.quality = quality
|
||||
|
||||
|
||||
def render(self):
|
||||
# See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Circle_resolution:_$fa,_$fs,_and_$fn
|
||||
if self.quality == 'draft':
|
||||
return ""
|
||||
if self.quality == 'mid':
|
||||
return "$fa=12;$fs=0.2;"
|
||||
if self.quality == 'best':
|
||||
return "$fa=6;$fs=0.1;"
|
||||
raise ValueError("Unknown quality")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue