Hey,
I have an IFC file that all the elements are classified
as IfcBuildingElementProxy.
They do however have some string in the layers name and elements name that
can provide me enough info to determine their type alone.
I want to create a script that will traverse all the elements in the IFC
file and change the types of the element while preserving all other data to
later import it to Revit and hopefully it will recognize all the types as
well.
I tried looking for some solution for that and found this: https://stackoverflow.com/questions/57771326/how-can-i-change-an-objects-ifcclassification-with-python-ifcopenshell-f-ex-ifc
.
I tried just changing the text file itself from IFCBUILDINGELEMENTPROXY to
IFCSLAB and the IFCBUILDINGELEMENTPROXYTYPE to IFCSLABTYPE and some
software like Solibri do open it and parse it correctly by Revit just
ignores that element completely and I can't find it.
Do you have any other way to do what I'm trying to do?
Yes, as @hlg said on that SO post, the entities do not have the same number of attributes. So any text-based mechanisms will likely fail depending on the validity checks of the importer. My colleague is working on an optimizer tutorial that selectively copies over instances to a new file. I have attached a working draft for reference. The idea is that instead of filtering on attribute equality (in the tutorial that's inst.get_info) you can filter on is_a() and then create_entity() based on the type you do want in the file.
They issue is I had with the SO solution with creating the entity is that non of the related objects were created as well and so I lost all the psets and so on.
Will the script you attach handles that in some smart way?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey,
I have an IFC file that all the elements are classified
as IfcBuildingElementProxy.
They do however have some string in the layers name and elements name that
can provide me enough info to determine their type alone.
I want to create a script that will traverse all the elements in the IFC
file and change the types of the element while preserving all other data to
later import it to Revit and hopefully it will recognize all the types as
well.
I tried looking for some solution for that and found this:
https://stackoverflow.com/questions/57771326/how-can-i-change-an-objects-ifcclassification-with-python-ifcopenshell-f-ex-ifc
.
I tried just changing the text file itself from IFCBUILDINGELEMENTPROXY to
IFCSLAB and the IFCBUILDINGELEMENTPROXYTYPE to IFCSLABTYPE and some
software like Solibri do open it and parse it correctly by Revit just
ignores that element completely and I can't find it.
Do you have any other way to do what I'm trying to do?
Yes, as @hlg said on that SO post, the entities do not have the same number of attributes. So any text-based mechanisms will likely fail depending on the validity checks of the importer. My colleague is working on an optimizer tutorial that selectively copies over instances to a new file. I have attached a working draft for reference. The idea is that instead of filtering on attribute equality (in the tutorial that's
inst.get_info
) you can filter onis_a()
and thencreate_entity()
based on the type you do want in the file.They issue is I had with the SO solution with creating the entity is that non of the related objects were created as well and so I lost all the psets and so on.
Will the script you attach handles that in some smart way?
yes the script I attached considers every instance in the file.