Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Techdraw performance issues #12362

Closed
2 tasks done
blinking-led opened this issue Feb 13, 2024 · 20 comments
Closed
2 tasks done

Techdraw performance issues #12362

blinking-led opened this issue Feb 13, 2024 · 20 comments
Labels
WB TechDraw Related to the TechDraw Workbench

Comments

@blinking-led
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

HI, everyone!

When I try to work with the Techdraw WB, it hangs with a high-load CPU. Techdraw works with two frames per minute. You can see it in the screenshot. When I delete Techdraw FreeCAD works well. Any suggestion?
Intel core i5 1035G / 16 Gb / SSD

freecad-1
freecad-2
freecad-3

Full version info

[code]
OS: Windows 11 build 22621
Word size of FreeCAD: 64-bit
Version: 0.21.1.33668 +26 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: Russian/Russia (ru_RU)
[/code]

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added WB TechDraw Related to the TechDraw Workbench Missing: tested on dev version labels Feb 13, 2024
@maxwxyz
Copy link
Collaborator

maxwxyz commented Feb 13, 2024

@blinking-led can you try out the performance of the dev builds: https://github.com/FreeCAD/FreeCAD-Bundle/releases/tag/weekly-builds

@xtemp09
Copy link
Contributor

xtemp09 commented Feb 13, 2024

I have compiled FreeCAD with gprof and pressed some buttons in PartDesign, Sketcher and more buttons in TechDraw. The output says that FreeCAD spends time dealing with std::string.

Perhaps, this is the right time to make use of std::string_view.

output.txt


OS: Ubuntu 22.04.3 LTS (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.35936 (Git)
Build type: Debug
Branch: main
Hash: b39d246c27ccbec0a503cd2d5e6dc08762951300
Python 3.10.12, Qt 5.15.12, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.1
Locale: English/United States (en_US)

@maxwxyz
Copy link
Collaborator

maxwxyz commented Feb 13, 2024

@WandererFan can you help out here?

@WandererFan
Copy link
Contributor

Whenever I've run TechDraw under valgrind, the majority of time is spent deep in the bowels of occ calculating intersections.

Off hand, I can't think of anywhere TechDraw does enough string comparisons to compete with that. Maybe the same comparison a ridiculous number of times?

The picture looks like a circuit board. Those are often slow to build due to the large number of faces to be checked.

You can use CoarseMode, set the Page to not update or turn off face finding to speed things up until you are ready to produce a finished drawing.

@xtemp09
Copy link
Contributor

xtemp09 commented Feb 14, 2024

Fine, I'll try Google's Orbit or tweak some options to get more useful information about the performance. But I'm right that the power of std::string_view (QStringView, std::span and other) must come to the abode of the source code of FreeCAD. At the moment, FreeCAD uses it only in a handful of cases.

@blinking-led
Copy link
Author

Thank you for answering!
Except for night builds, I attempt to follow all advice. That was ineffective. I saw a similar freeze in today's test, which is simpler and involves about 20 objects in the drawing.
I'm using standard models from official websites, like https://www.dkceurope.com/en/prodotto/ramblock/cqe-modular-cabinets-with-blank-door-and-front-mounting-plate-2000x800x500-r5cqe2085t
file from the website R5CQE2085.zip

WandererFan About "large number of faces" I made a "Simple copy" of DSK cabinets in the Part WB, and it changed the situation in the right way, but not enough. There might be a problem, while using TechDraw WB exclude calculation faces that are placed behind the front face?

@blinking-led
Copy link
Author

Today, I tried night build, but without any changes.
In the log panel, I see:

15:38:57 Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
15:56:30 Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
15:59:31 Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation

@maxwxyz maxwxyz added Bug This issue or PR is related to a bug and removed Missing: tested on dev version Bug This issue or PR is related to a bug labels Feb 15, 2024
@blinking-led
Copy link
Author

Today, I'm trying to nightly build:

OS: Windows 11 build 22621
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.35994 (Git)
Build type: Release
Branch: main
Hash: 69097667df47b2cc86d8688d2dbb545319e33e68
Python 3.10.13, Qt 5.15.8, Coin 4.0.2, Vtk 9.2.6, OCC 7.6.3
Locale: Russian/Russia (ru_RU)

Wonderful! I make techdraw, but the UI shows only blank templates. After about 1–2 minutes, drawings appear.
Along with it, I see on the console:

09:06:14 Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
09:07:21 Unhandled std::exception caught in GUIApplication::notify.
The error message is: invalid vector subscript
09:07:24 DrawProjectSplit::scrubEdges - OCC fuse raised warning(s):
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertAcquiredSelfIntersection
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge
BOPAlgo_AlertTooSmallEdge

@WandererFan
Copy link
Contributor

I can't be sure without a test file, but those BOPAlgo_Alert messages look like something you'd get if the input shape has problems.

@pavltom - might need your help here.

@pavltom
Copy link
Contributor

pavltom commented Feb 19, 2024

Hello, I have tried to import the R5CQE2085.step file. The model is pretty detailed and I am running a debug build of FreeCAD, nevertheless for me it loaded in about 30s. I have inserted few views from different angles into an A4 page, but although the rendering consumed about 2 minutes, it always produced an usable part view. I have scaled the view to fit the page, but again, so far no issues. The UI is not much responsive (sluggish at least), but there is really a lot of faces/edges to process.

@blinking-led maybe could You provide a saved document, which is causing You the troubles? Or some step-by-step scenario with the R5CQE2085.step file to reproduce the issue? I know this is rather a cliche, but on my machine everything works correctly ;-)

@blinking-led

This comment was marked as off-topic.

@blinking-led
Copy link
Author

@pavltom Thank you! File attached.
FOR_DEBUG.zip

Found one more bug in techdraw WB? Look at screenshoot
freecad-4

@blinking-led
Copy link
Author

blinking-led commented Feb 21, 2024

"Scale to page" in TechDraw works uncorrect with the file

R5CQE2085.zip

If I add some views and after that change in scale, the projection views become too far from each other.

@blinking-led
Copy link
Author

One more bug. After reopening my file with dimensions, some of them became "zero", some of them lost their place.

freecad-5

14:34:41 Dimension Reference has null geometry
14:44:16 DVP::getGeomByIndex(2997) - invalid index - size: 2992
14:44:16 DVD::getDimValue - Dimension027 - 2D references are corrupt (5)
14:44:30 Dimension Reference has null geometry
14:44:30 DVP::getGeomByIndex(2997) - invalid index - size: 2992
14:44:30 DVD::getDimValue - Dimension027 - 2D references are corrupt (5)
14:44:31 DVP::getGeomByIndex(5797) - invalid index - size: 5443
14:44:31 DVD::getDimValue - Dimension030 - 2D references are corrupt (5)
14:44:34 DVP::getGeomByIndex(5798) - invalid index - size: 5443
14:44:34 DVD::getDimValue - Dimension029 - 2D references are corrupt (5)
14:44:38 DVP::getGeomByIndex(5796) - invalid index - size: 5443
14:44:38 DVD::getDimValue - Dimension028 - 2D references are corrupt (5)
14:44:40 DVP::getGeomByIndex(5563) - invalid index - size: 5443
14:44:40 DVD::getDimValue - Dimension026 - 2D references are corrupt (5)
14:46:51 DrawProjectSplit::scrubEdges - OCC fuse raised warning(s):
14:47:15 Dimension Reference has null geometry
14:47:15 Dimension Reference has null geometry
14:47:15 Dimension Reference has null geometry
14:47:15 Dimension Reference has null geometry
14:47:35 DrawProjectSplit::scrubEdges - OCC fuse raised warning(s):
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertSelfInterferingShape

P.S.
@maxwxyz I think that night build working well with TechDraw WB. Should I close this post and open a new issue for describing bug?

@blinking-led
Copy link
Author

blinking-led commented Feb 26, 2024

Periodically, I see a huge frame over the main window. It hides when I click on it.

freecad-6

@maxwxyz
Copy link
Collaborator

maxwxyz commented Feb 26, 2024

@blinking-led Yes please close this if irrelevant and make another with the bug.

@frank-trampe
Copy link

@blinking-led, did you file a new bug? I am having a similar problem with periodic hanging accompanied by log output as follows.

18:50:18  DrawProjectSplit::scrubEdges - OCC fuse raised warning(s):
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertSelfInterferingShape
BOPAlgo_AlertBadPositioning
BOPAlgo_AlertSelfInterferingShape

@WandererFan
Copy link
Contributor

The bad positioning and self interfering shape messages indicate that there are problems with the geometry of the source objects.

OCC really does not like problems with geometry.

@pavltom
Copy link
Contributor

pavltom commented Apr 1, 2024

I was thinking about dumping these OCC warnings on the Log level, instead of Warning level. I guess it can be quite confusing for a common user and as we can see above, it is unnecessarily flooding the log. What's your opinion?

@frank-trampe
Copy link

Is there any way to determine which element is triggering those warnings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WB TechDraw Related to the TechDraw Workbench
Projects
Development

No branches or pull requests

6 participants