diff --git a/api/s12_curves.py b/api/s12_curves.py index e2af652..89235cd 100644 --- a/api/s12_curves.py +++ b/api/s12_curves.py @@ -134,7 +134,7 @@ def inp_in_curve(section: list[str]) -> ChangeSet: count = len(section) for i in range(0, count): if section[i].startswith(';'): - # this is description + # ;type: desc type_plus_desc = section[i].removeprefix(';') type_plus_desc_tokens = type_plus_desc.split(':') next = i + 1 @@ -182,21 +182,11 @@ def inp_out_curve(name: str) -> list[str]: #-------------------------------------------------------------- def inp_in_curve_v3(section: list[str]) -> ChangeSet: types = {} - descs = {} curves: dict[str, list[dict[str, float]]] = {} count = len(section) for i in range(0, count): if section[i].startswith(';'): - # this is description - type_plus_desc = section[i].removeprefix(';') - type_plus_desc_tokens = type_plus_desc.split(':') - next = i + 1 - if next < count and section[next].startswith(';') == False: - next_tokens = section[next].split() - types[next_tokens[0]] = type_plus_desc_tokens[0].strip().upper() - if len(type_plus_desc_tokens) > 1: - descs[next_tokens[0]] = type_plus_desc_tokens[1].strip() continue tokens = section[i].split() @@ -220,4 +210,16 @@ def inp_in_curve_v3(section: list[str]) -> ChangeSet: def inp_out_curve_v3(name: str) -> list[str]: - return [] + lines = [] + types = read_all(name, f"select * from _curve") + for type in types: + id = type['id'] + # id type + lines.append(f"{id} {type['type']}") + objs = read_all(name, f"select * from curves where id = '{id}' order by _order") + for obj in objs: + id = obj['id'] + x = obj['x'] + y = obj['y'] + lines.append(f'{id} {x} {y}') + return lines