--- a/linetypes.py Wed Dec 20 17:25:09 2017 +0200 +++ b/linetypes.py Thu Dec 21 10:46:41 2017 +0200 @@ -13,6 +13,8 @@ return 'linetypes.EmptyLine()' def textual_representation(self): return '' + def typename(self): + return 'empty line' class Comment: def __init__(self, text, style = 'old'): @@ -32,6 +34,8 @@ return '0 ' + self.text else: return '0 // ' + self.text + def typename(self): + return 'comment' class SubfileReference: def __init__(self, *, colour, subfile_path, anchor, matrix): @@ -52,6 +56,8 @@ self.subfile_path, ] return ' '.join(ldraw_str(arg) for arg in args) + def typename(self): + return 'subfile reference' class BasePolygon: def __init__(self, *, colour, geometry): @@ -73,14 +79,20 @@ class LineSegment(BasePolygon): def textual_representation(self): return '2 ' + self.base_textual_representation() + def typename(self): + return 'line segment' class Triangle(BasePolygon): def textual_representation(self): return '3 ' + self.base_textual_representation() + def typename(self): + return 'triangle' class Quadrilateral(BasePolygon): def textual_representation(self): return '4 ' + self.base_textual_representation() + def typename(self): + return 'quadrilateral' class Contour(LineSegment): def __init__(self, *, colour, geometry, control_points): @@ -99,3 +111,5 @@ result += ' ' result += ' '.join(strings) return result + def typename(self): + return 'contour line segment'