FreeCAD BIM weekly update 7

Hi all!

Here is the seventh weekly update showing what I am doing this week with FreeCAD, specifically on the BIM and NativeIFC fronts. Sorry about the missing update last week, school holidays and kids got the priority

  • NativeIFC: Edit placements: This has been a bit of a headache, because of several aspects: 1) Placements in IFC are notoriously a complex affair, 2) Placement matrixes are different in FreeCAD and IfcOpenShell, and 3) Placement properties are triggered pretty often in FreeCAD, and there was a whole question of sorting out when the IFC placement of the object needed to be updated. This is now all (hopefully) sorted out, and you can now edit placements of IFC objects in FreeCAD, which will correctly reflect on the stored IFC placement. This means changing the placement of an object manually works, but also all other commands that work on placements, such as the Move command. As this is using the IfcOpenShell API, all needed internal complexity of dealing with local and relative placements is taken care of magically! commit
  • FreeCAD: Draft memory leak: The Draft workbench has had a nasty memory leak for a very long time, which means the memory usage is increasing during use. Usually this is normal when running a program, as structures (data, variables, etc...) are created during the execution, that take space in memory. However, there are usually destruction mechanisms in place, for example all variables or objects created inside a function are automatically destroyed when the function ends, or there are garbage collection systems that automatically clean up unused variables and data structures. A memory leak occurs when something escapes these mechanisms and is not automatically destroyed, and is recursively being created, which makes the memory consumption raise over time. The Draft workbench has had one of these for a long time. To see the effect by yourself, you just need to start a Draft command such as Line, click a point and simply hover your mouse around instead of clicking the second point. If you watch the memory consumption (for example running top -p $(pidof freecad) in a terminal), you will see a small memory increase. This used to be huge, and is now mostly solved, as the garbage collection manages to keep it under control and in the long run, memory usage does not increase anymore. There is however still some minor leak happening, that I couldn't pinpoint yet. There are so many things happening in Draft, with so many different parts of FreeCAD involved (Qt interface, widgets on the Coin3D view,...) that it turns debugging very difficult. issue - PR
  • NativeIFC: Allow to delete objects: Deleting an object in FreeCAD now correctly deletes the corresponding object in the IFC file. As usual when using the IfcOpenShell API, everything is taken care of automatically, and all needed subobjects and dependencies are deleted automatically too. As always, when you perform an operation that affects internal IFC objects, the project object is marked as modified, and by right-clicking it in the tree view you can select "Show Diff..." to see the modifications that have been made to the IFC file. This is a great way to make sure the right operation was done. commit
  • NativeIFC: Allow to collapse children: You can now perform the reverse operation to "Expand children": When an object has its children expanded, you can now reverse the operation by right-clicking the object and choosing "Collapse children". The child objects (and all their descendents too) will be removed from the FreeCAD document, causing the base object to gather and show the shapes of them all. This allows you to keep your FreeCAD document fast and light, even when working on large IFC files, by shrinking the structures you don't need to edit. commit

That's it for this week I guess! As always, thanks to everybody who sponsors me on Patreon, LiberaPay or GitHub! As a side note, the OpenToolChain Foundation grant I have received to help funding this project has officially ended, but I am a bit late on schedule and have not finished the entirety of what I had promised them (What is missing is basically be able to create NativeIFC elements with the BIM workbench tools) We are very close to it anyway, all the internal structure is in place, we just need to tie that up to the BIM commands. This will be done in the next weeks (I still want to work on drag & dropping first to make it really perfect).

I am really liking posting these weekly updates, first because it motivates me a lot to produce stuff every week, and also it syncs nicely with the weekly updates on the FreeCAD blog. So although this had started as a form of reporting related to the OTCF grant, I'm going to continue this for a while. Thanks to all of you who show support for this!