Problems with IFC

This forum section is only for IFC-related issues
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Fri Nov 15, 2019 2:37 pm

attached the file reduced to only a building and one object ...

Code: Select all

Exporting an IFC2X3 file...
No building found. Adding default building
writing  C:/Users/BHA/Desktop/test.ifc ...
Exporting an IFC2X3 file...
1    :  IfcBuilding  ( no shape ) :  Haus_Uebung2
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\Mod\Arch\exportIFC.py", line 484, in export
    pset, pname, ptype, pvalue = getPropertyData(key,value,preferences)
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\Mod\Arch\exportIFC.py", line 1415, in getPropertyData
    pvalue = int(pvalue)
<class 'ValueError'>: invalid literal for int() with base 10: ''

building_export_problem.FCStd
(17.64 KiB) Downloaded 4 times
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Fri Nov 15, 2019 2:48 pm

Code: Select all

mybuilding = App.ActiveDocument.BuildingPart
mybuilding.Label

for key, value in mybuilding.IfcProperties.items():
    print(key, " --> ", value)

Code: Select all

>>> 
>>> mybuilding = App.ActiveDocument.BuildingPart
>>> mybuilding.Label
'Haus_Uebung2'
>>> 
>>> for key, value in mybuilding.IfcProperties.items():
...     print(key, " --> ", value)
... 
BuildingID;;Pset_BuildingCommon  -->  IfcIdentifier;;
ConstructionMethod;;Pset_BuildingCommon  -->  IfcLabel;;new building
FireProtectionClass;;Pset_BuildingCommon  -->  IfcLabel;;
GrossPlannedArea;;Pset_BuildingCommon  -->  IfcAreaMeasure;;
IsLandmarked;;Pset_BuildingCommon  -->  IfcLogical;;False
IsPermanentID;;Pset_BuildingCommon  -->  IfcBoolean;;
NetPlannedArea;;Pset_BuildingCommon  -->  IfcAreaMeasure;;
NumberOfStoreys;;Pset_BuildingCommon  -->  IfcInteger;;
OccupancyType;;Pset_BuildingCommon  -->  IfcLabel;;residential building
Reference;;Pset_BuildingCommon  -->  IfcIdentifier;;
SprinklerProtection;;Pset_BuildingCommon  -->  IfcBoolean;;False
SprinklerProtectionAutomatic;;Pset_BuildingCommon  -->  IfcBoolean;;False
YearOfConstruction;;Pset_BuildingCommon  -->  IfcLabel;;2019
YearOfLastRefurbishment;;Pset_BuildingCommon  -->  IfcLabel;;2019
>>> 

Code: Select all

NumberOfStoreys;;Pset_BuildingCommon  -->  IfcInteger;;
there is no value at all ...
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Fri Nov 15, 2019 2:51 pm

it could be tried

Code: Select all

int("")

Code: Select all

>>> int("")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ValueError: invalid literal for int() with base 10: ''
>>> 
https://github.com/FreeCAD/FreeCAD/blob ... C.py#L1415
hlg
Posts: 18
Joined: Fri Jul 12, 2019 10:11 am

Re: Problems with IFC

Postby hlg » Fri Nov 15, 2019 3:18 pm

Ah, that's the reason. I was wondering how that could happen, because in IFC properties manager, you can not enter values of the wrong type, the UI restricts value entries to the right type. I was just about to search for IFC property sets with IfcIntegers (there are not that many) and test with these.

Now if we have empty properties, I see two options upon export:

1. export the default "null" value of that type, e.g. int() which would be 0 or
2. don't export the property in question at all.

I favour the 2nd option but am not 100% sure about the binding character of the standard property sets. Even after consulting the standard, I don't know: Do the common property sets only restrict properties to that certain set, such that implementers know that no other potentially unknown properties will appear, only those defined? Or do they prescribe that all these properties shall be set, such that implementers can expect all the values to be present (if they encounter the common property set).
Last edited by hlg on Fri Nov 15, 2019 3:23 pm, edited 1 time in total.
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Fri Nov 15, 2019 3:20 pm

git commit d0339c5

Properties with no values will not be exported.
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Fri Nov 15, 2019 3:21 pm

2 minutes for a fix :mrgreen: including testing etc ...

show me any software which could beat us :geek: If I would not have taken a cup of coffee the fix would have been in before the request. We would have been faster than calculated by Einstein ... SCNR
langk
Posts: 9
Joined: Sat Nov 09, 2019 11:39 am

Re: Problems with IFC

Postby langk » Fri Nov 15, 2019 3:52 pm

I'm afraid there is still an error. I updated the Pset for the building and I guess it's fine with it.

And I also used a project part. But when I select only this project it gives me an IFC file with 2kb, so nothing is in there.
So I tried to select just every Object and it tells me "index out of range". As before I tried to locate the problem by exporting single objects and there are two of walls I can't export because of this error. But I did export them before and everything was fine?
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Sat Nov 16, 2019 7:57 pm

if only the project is selected nothing is exported. This is a known issue. The project is new in 0.19. I have not had a look at its code. Since no other fixed it it is still around. But selecting the site should do the trick.

About the other problems: It should be looked into them. Would you post a file and explain step by step how to reproduce them?

bernd
langk
Posts: 9
Joined: Sat Nov 09, 2019 11:39 am

Re: Problems with IFC

Postby langk » Mon Nov 18, 2019 1:25 pm

Unfortunately the file is too big for the forum. Even if I reduce the model to just one floor with the objects that causes errors.

But I kind of solved the problem. I tried some stuff, deleted Psets, redraw the components which caused the errors etc. But there were always new errors so it was kinda like the never ending story. And then I just deleted this one structure that caused problems before and everything was fine. I was able to export the whole project. Of course deleting this structure is not really a solution but in FreeCAD there's always a workaround, so now I will model my columns one by one instead of making a sketch with four single circles and built a column out of it.

Again, thank you so much for your help!
User avatar
bernd
Posts: 8470
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Problems with IFC

Postby bernd » Mon Nov 18, 2019 4:11 pm

still ... If you work with latest 0.19 dev version and have problems with export keep going in describe the problem and send the file. Without knowing the problems we can not fix them.