Hello,
I encountered an issue while trying to set a low int as creation date. In some date system 30.12.1899 is 0 for example in LibreOffice/Excel sheets. See Epoch (computing). If you convert it to an ifc compatible date you get -2209165200 which apparently currently produce an overflow. So a date left to default 0 produce an error.
Error message
Exception has occurred: OverflowError
in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'
File "/home/cyril/git/IfcOpenShell/src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py", line 3695, in setArgumentAsInt
return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v)
File "/home/cyril/git/IfcOpenShell/src/ifcopenshell-python/ifcopenshell/entity_instance.py", line 267, in __setitem__
self.method_list[idx](
File "/home/cyril/git/IfcOpenShell/src/ifcopenshell-python/ifcopenshell/file.py", line 286, in create_entity
e[idx] = arg
File "/home/cyril/git/IfcOpenShell/src/ifcopenshell-python/scripts/issue_lowtimestamp.py", line 52, in <module>
owner_history = file.createIfcOwnerHistory(
OverflowError: in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'
Code to reproduce
import uuid
import ifcopenshell
import datetime
file = ifcopenshell.file(schema='IFC4')
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcaddress.htm
address = file.createIfcAddress(
Purpose="OFFICE",
Description="Anton Philipslaan 199\n5616TW Eindhoven\nThe Netherlands",
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcorganization.htm
organisation = file.createIfcOrganization(
Name="AECGeeks",
Description="""Software development and consultancy for the
Architecture Engineering and Construction industry""",
Addresses=[address],
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcapplication.htm
application = file.createIfcApplication(
ApplicationDeveloper=organisation,
Version=ifcopenshell.version,
ApplicationFullName="IfcOpenShell",
ApplicationIdentifier="ifcopenshell",
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcroleenum.htm
role = file.createIfcActorRole("MANUFACTURER")
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcperson.htm
person = file.createIfcPerson(
Identification=str(uuid.uuid4()),
FamilyName="Unknown",
GivenName="Unknown",
Roles=[role],
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcorganization.htm
organisation = file.createIfcOrganization(
Identification="companyid", Name="company", Roles=[role]
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcpersonandorganization.htm
person_and_organisation = file.createIfcPersonAndOrganization(
person, organisation, Roles=[role]
)
# https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/link/ifcownerhistory.htm
owner_history = file.createIfcOwnerHistory(
OwningUser=person_and_organisation,
OwningApplication=application,
CreationDate=int(datetime.datetime(1899, 12, 30).timestamp()),
)
Hello,
I encountered an issue while trying to set a low int as creation date. In some date system 30.12.1899 is 0 for example in LibreOffice/Excel sheets. See Epoch (computing). If you convert it to an ifc compatible date you get
-2209165200which apparently currently produce an overflow. So a date left to default 0 produce an error.Error message
Code to reproduce