IfcOpenShell access IFC-SPF header data
Is it possible to get the Header FILE_DESCRIPTION and FILE_NAME by Python?
HEADER;FILE_DESCRIPTION(('no view'),'2;1');
FILE_NAME('C:\\Users\\BHA\\Desktop\\exporter_new.ifc',
'2020-10-29T15:57:39',('Bernd Hahnebach'),('My Office AG',
'My Street 32, 9999 My Town'),
'EDMsix Version 2.0100.09 Sep 7 2016',
'Allplan 2020.1 09.09.2020 - 17:35:19','');
FILE_SCHEMA(('IFC2X3'));
ENDSEC;
The schema is possible with ifcos_ifc_class.schema. This is what I know and use.
Comments
BTW: Found this in the regard of the header, but it is quite old ... https://standards.buildingsmart.org/documents/Implementation/ImplementationGuide_IFCHeaderData_Version_1.0.2.pdf
@bernd yes, using
ifc_file.wrapped_data.header
. See:https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcblenderexport/blenderbim/bim/export_ifc.py#L1411
but this is set_header, for export. I would like to read the data out of a ifc file like get_header ...
@bernd no,
set_header
is simply a function in the BlenderBIM Add-on during the export process. Look at the lines after it.got it ... :-)
...
How about the comments Revit does write before it even starts the ifc file contents. I assume reading comments is not possible?!
@bernd good point, I haven't seen a way to access comments. It's a relatively simple string parse, though...
How would once acces the timestamp in FILE_NAME using IfcOpenShell?
As I understand it is not possible with IfcOpenShell yet... :-)?
What about something like this?
Is the FILE_NAME always on line 4? seems a bit risky method, string parsing...
It will work for this specific file but I'm sure it's not that hard to make it fail ^^ What if your file name has a
,
in it ? I think it would be a bit more robust to check all lines and see if they begin withFILE_NAME
and then parse the string with a regular expression to see if something matches a date formating.I'm very late to the party, just found this thread looking for similar issues, but it's just
ifc_file.wrapped_data.header.file_name.time_stamp
, in similar way as accessing any other header entities.