IFC_FN_FLAGS = "generated_files/spf/" + IFC_FILE_BASE + "-".join(flags) IFC_PC_FN = IFC_FN_FLAGS + ".ifc" IFC_FACE_INFO = os.path.join(INTERMEDIATE_DIR, IFC_FILE_BASE, "face_information.json") IFC_PRODUCTS = os.path.join(INTERMEDIATE_DIR, IFC_FILE_BASE, "face_information.json") if GRID_SPACING > 1e-5: from utils import point_rasterizer, face_bounds rasterizer = point_rasterizer.rasterizer(face_bounds.get_mapping(IFC_FN)) if not os.path.exists(os.path.dirname(IFC_FN_FLAGS)): os.makedirs(os.path.dirname(IFC_FN_FLAGS)) decomp_relations = defaultdict(list) t0 = int(time.time()) # add range=[0] to speed things up datasets, global_ds = point_reader.read(ASSOC_FN, associate=not ALL_POINTS_AS_UNASSOCIATED) print "\nReading face parametrization data" shapes = dict((tuple(k),v) for k, v in json.load(open(IFC_FACE_INFO))) print "Reading original SPF file" f = ifcopenshell.open(IFC_FN) print "Creating new IFC representations" new_guid = lambda: ifcopenshell.guid.compress(uuid.uuid4().hex) tupelize = lambda np_array: tuple(map(lambda a: tuple(float(x) for x in a), np_array)) tupelize1d = lambda np_array: tuple(map(float, np_array)) tupelize2d = lambda np_array: tuple(map(tupelize1d, np_array))
] IFC_FN = ns.ifc_file IFC_FILE_BASE = os.path.splitext(os.path.basename(IFC_FN))[0] ASSOC_FN = "intermediate_files/%s/associated_points/points-subset-%%d.bin" % IFC_FILE_BASE IFC_FN_FLAGS = "generated_files/spf/" + IFC_FILE_BASE + "-".join(flags) IFC_PC_FN = IFC_FN_FLAGS + ".ifc" IFC_FACE_INFO = os.path.join(INTERMEDIATE_DIR, IFC_FILE_BASE, "face_information.json") IFC_PRODUCTS = os.path.join(INTERMEDIATE_DIR, IFC_FILE_BASE, "face_information.json") if not os.path.exists(os.path.dirname(IFC_FN_FLAGS)): os.makedirs(os.path.dirname(IFC_FN_FLAGS)) decomp_relations = defaultdict(list) t0 = int(time.time()) datasets, global_ds = point_reader.read(ASSOC_FN) print "\nReading face parametrization data" shapes = dict((tuple(k),v) for k, v in json.load(open(IFC_FACE_INFO))) print "Reading original SPF file" f = ifcopenshell.open(IFC_FN) print "Creating new IFC representations" new_guid = lambda: ifcopenshell.guid.compress(uuid.uuid4().hex) tupelize = lambda np_array: tuple(map(lambda a: tuple(float(x) for x in a), np_array)) tupelize1d = lambda np_array: tuple(map(float, np_array)) tupelize2d = lambda np_array: tuple(map(tupelize1d, np_array))