File indexing completed on 2026-04-09 07:49:28
0001
0002
0003
0004
0005
0006 class CSG_(object):
0007 ZERO = 0
0008 OFFSET_LIST = 4
0009 OFFSET_LEAF = 7
0010 TREE = 1
0011 UNION = 1
0012 INTERSECTION = 2
0013 DIFFERENCE = 3
0014 NODE = 11
0015 LIST = 11
0016 CONTIGUOUS = 11
0017 DISCONTIGUOUS = 12
0018 OVERLAP = 13
0019 LEAF = 101
0020 SPHERE = 101
0021 BOX = 102
0022 ZSPHERE = 103
0023 TUBS = 104
0024 CYLINDER = 105
0025 SLAB = 106
0026 PLANE = 107
0027 CONE = 108
0028 EXBB = 109
0029 BOX3 = 110
0030 TRAPEZOID = 111
0031 CONVEXPOLYHEDRON = 112
0032 DISC = 113
0033 SEGMENT = 114
0034 ELLIPSOID = 115
0035 TORUS = 116
0036 HYPERBOLOID = 117
0037 CUBIC = 118
0038 INFCYLINDER = 119
0039 OLDCYLINDER = 120
0040 PHICUT = 121
0041 THETACUT = 122
0042 OLDCONE = 123
0043 UNDEFINED = 124
0044 OBSOLETE = 1000
0045 PARTLIST = 1001
0046 FLAGPARTLIST = 1002
0047 FLAGNODETREE = 1003
0048 FLAGINVISIBLE = 1004
0049 PMT = 1005
0050 ZLENS = 1006
0051 PRISM = 1007
0052 LAST = 1008
0053 D2V={'zero': 0, 'intersection': 2, 'union': 1, 'difference': 3, 'contiguous': 11, 'discontiguous': 12, 'overlap': 13, 'sphere': 101, 'box': 102, 'zsphere': 103, 'tubs': 104, 'cylinder': 105, 'slab': 106, 'plane': 107, 'cone': 108, 'oldcone': 123, 'box3': 110, 'trapezoid': 111, 'convexpolyhedron': 112, 'disc': 113, 'segment': 114, 'ellipsoid': 115, 'torus': 116, 'hyperboloid': 117, 'cubic': 118, 'infcylinder': 119, 'oldcylinder': 120, 'phicut': 121, 'thetacut': 122, 'undefined': 124, 'externalbb': 109, 'obsolete': 1000, 'partlist': 1001, 'flagpartlist': 1002, 'flagnodetree': 1003, 'flaginvisible': 1004, 'pmt': 1005, 'zlens': 1006, 'prism': 1007, 'last': 1008}
0054
0055
0056 @classmethod
0057 def raw_enum(cls):
0058 return list(filter(lambda kv:type(kv[1]) is int,cls.__dict__.items()))
0059
0060 @classmethod
0061 def enum(cls):
0062 return cls.D2V.items() if len(cls.D2V) > 0 else cls.raw_enum()
0063
0064 @classmethod
0065 def desc(cls, typ):
0066 kvs = list(filter(lambda kv:kv[1] == typ, cls.enum()))
0067 return kvs[0][0] if len(kvs) == 1 else "UNKNOWN"
0068
0069 @classmethod
0070 def descmask(cls, typ):
0071 kvs = list(filter(lambda kv:kv[1] & typ, cls.enum()))
0072 return ",".join(map(lambda kv:kv[0], kvs))
0073
0074 @classmethod
0075 def fromdesc(cls, label):
0076 kvs = list(filter(lambda kv:kv[0] == label, cls.enum()))
0077 return kvs[0][1] if len(kvs) == 1 else -1
0078
0079
0080