FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
19.27k stars 3.99k forks source link

DRAFT: Crash on import DXF #16736

Open gianlucafiore opened 5 days ago

gianlucafiore commented 5 days ago

Is there an existing issue for this?

Problem description

Good afternoon colleagues, I would like to know if there is a possibility of making Freecad work with complex line models in DRAFT, as Autocad, Librecad or Qcad can do, the minimum comparison I am going to make is, how when importing a DXF in Freecad (as a block first and then ungrouped with the inverted arrow) and in Autocad opened normally. Freecad collapses the RAM (reaching 6 GB), while Autocad remains stable at approximately 400 MB. I really do not understand much how the memory optimization is built in Freecad, but here there is a huge open door to constant crash.

In this first image, the memory consumed by freecad began to rise more and more when pressing the button

image

almost reaching 7gb of ram, i forced close it

image

image

Full version info

OS: Windows 11 build 22631
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38728 (Git)
Build type: Release
Branch: main
Hash: 9de78e27f4148e8032594788a9804486e769388b
Python 3.11.9, Qt 5.15.13, Coin 4.0.2, Vtk 9.2.6, OCC 7.7.2
Locale: Spanish/Argentina (es_AR)
Stylesheet/Theme/QtStyle: FreeCAD Light.qss/FreeCAD Light/Qt default
Installed mods: 
  * Dracula 0.0.5
  * OpenDark 2024.3.13
  * OpenTheme 2024.9.1
  * SearchBar 1.0.2

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

luzpaz commented 5 days ago

cc @yorikvanhavre

furgo16 commented 5 days ago

Possibly related PRs: https://github.com/FreeCAD/FreeCAD/pull/16611, https://github.com/FreeCAD/FreeCAD/pull/16596

yorikvanhavre commented 4 days ago

The issue here is a classical one. FreeCAD. like all parametric modelers, is a very different kind of application than traditional 2D CAD like AutoCAD or QCAD.

Each object, in FreeCAD (the same is valid for any other kind of parametric modeler like Revit, SoldiWorks, etc.. even Blender suffers from this) is a complex feature that has several connection slots and processes a lot of information, even the simple ones. In traditional CAD apps, on the contrary, individual objects are very simple structure that live in a database and have no parametric capabilities. Furthermore, users of these apps know there is little impact in having billions of objects, and tend to "dirty" the files a lot, so one often meets very big files.

The result is this basic rule, parametric modelers can handle way less objects than traditional CAD apps.

When passing from one to the other, you need to change a bit your way of working, to limit the number of individual objects. Try to split complex DXF files into smaller ones, use Arch References, use a lot of compounds, etc. The viewport of FreeCAD is able to handle millions of faces/lines easily, the key is to have few objects.

It is totally possible to work with complex 2D drawings, but you'll need to adapt a bit and find strategies.

Roy-043 commented 4 days ago

Looking at the images I get the idea that the texts have been exploded in the DXF. In other words, each letter consists of multiple lines. If that is indeed the case, then that would be a contributing factor.

The file from #16485 (which seems to be from the same project) shows hatches and even dashes lines that have been exploded.

Are we not dealing with a very bad DXF here?

Roy-043 commented 2 days ago

@gianlucafiore Can you attach the DXF file?