def number_solids(self, shape): count = 0 e = TopExp_Explorer(shape, TopAbs_SOLID) while e.More(): count += 1 e.Next() return count
def _get_topo(shape, topo): explorer = TopExp_Explorer(shape, topo) hashes = {} while explorer.More(): item = explorer.Current() hash_value = item.HashCode(MAX_HASH_KEY) if hashes.get(hash_value) is None: hashes[hash_value] = True yield downcast(item) explorer.Next()
def _get_topo(shape, topo): explorer = TopExp_Explorer(shape, topo) hashes = {} while explorer.More(): item = explorer.Current() hash = item.HashCode(HASH_CODE_MAX) if hashes.get(hash) is None: hashes[hash] = True yield downcast(item) explorer.Next()
def _objects(shape, shape_type): HASH_CODE_MAX = 2147483647 out = {} # using dict to prevent duplicates explorer = TopExp_Explorer(shape, shape_type) while explorer.More(): item = explorer.Current() out[item.HashCode(HASH_CODE_MAX)] = downcast(item) explorer.Next() return list(out.values())