I want to use ifcopenshell to get specific elements and save it as a new file.
newfile = ifcopenshell.file(schema=ifcFile.schema)
elements = ifcFile.by_type(category)
for element in elements:
newfile.add(element)
newfile.write(filename)
The program works fine but when I open a 3D viewer to check it, it shows the error
"model is empty, there is no geometry to show".
Is there anything wrong or how can I get the element properly? many thanks
If you check the new file content, you would find not every info is transferred to the new file. So this makes it crash. The easier way is to remove the elements you don't want then keep the rest as a new file.
elements = ifcFile.by_type(category)
for element in elements:
ifcFile.remove(element)