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

[PD] improve blind hole depth handling #4134

Merged
merged 2 commits into from
Jan 30, 2021

Conversation

donovaly
Copy link
Member

@donovaly donovaly commented Dec 13, 2020

as reported in https://tracker.freecadweb.org/view.php?id=3818
we treat the blind hole depth not according to the conventions. The size of the drill point due to the angle is normally not taken into account but FC does this in every case.

There are of course cases where the total depth, including the drill point size matters.

This PR adds therefore an option, that is by default off, to take the drill point size into account.
Without the option, (the new default) the depth is nor calculated according to the conventions.

I purposely made the new option by default off, because all literature about technical drawings don't take the drill point size into account and the hole dialog should by default offer the normed / conventioned behavior.

As side effect that means that existing blind holes change, but the same applied for my last hole dialog fixed (diameters of existing holes changed). So I think it is OK. If you disagree, please tell. However, I don't see how this can be avoided.

Forum thread: https://forum.freecadweb.org/viewtopic.php?t=51491&view=unread#p457068

@chennes
Copy link
Member

chennes commented Dec 14, 2020

When I tried to test this I got a crash due to a debug assertion failure in OCC. The steps I followed were:

  1. Create a rectangle in a sketch
  2. Pad the rectangle 50mm
  3. Sketch a circle on that pad's upper surface
  4. Activate the hole task
  5. Check the new option to "Take into account for depth" (without changing anything else).

Error message is:
"Error: a duplicated modification of a shape. (Condition: "!aModifications->Contains(theModified)")"

Backtrace:

 	TKBRepd.dll!00007ffbbe5fa660()	Unknown
 	TKBOd.dll!00007ffbbf98f2a1()	Unknown
 	TKBOd.dll!00007ffbbf965374()	Unknown
 	TKBOd.dll!00007ffbbf9723b3()	Unknown
 	TKBOd.dll!00007ffbbf970751()	Unknown
 	TKBOd.dll!00007ffbbf910d42()	Unknown
 	TKBOd.dll!00007ffbbf90cc1e()	Unknown
 	TKBOd.dll!00007ffbbf914edc()	Unknown
>	_PartDesign_d.pyd!PartDesign::Hole::execute() Line 1518	C++
 	FreeCADApp_d.dll!App::DocumentObject::recompute() Line 111	C++
 	Part_d.pyd!Part::Feature::recompute() Line 101	C++
 	FreeCADApp_d.dll!App::Document::_recomputeFeature(App::DocumentObject * Feat) Line 3744	C++
 	FreeCADApp_d.dll!App::Document::recomputeFeature(App::DocumentObject * Feat, bool recursive) Line 3804	C++
 	PartDesignGui_d.pyd!PartDesignGui::TaskFeatureParameters::recomputeFeature() Line 74	C++
 	PartDesignGui_d.pyd!PartDesignGui::TaskHoleParameters::drillForDepthChanged() Line 387	C++
 	PartDesignGui_d.pyd!PartDesignGui::TaskHoleParameters::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 176	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::GUIApplication::notify(QObject * receiver, QEvent * event) Line 92	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::GUIApplication::notify(QObject * receiver, QEvent * event) Line 92	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::Application::runApplication() Line 2278	C++
 	FreeCAD_d.exe!main(int argc, char * * argv) Line 302	C++
 	FreeCAD_d.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 97	C++
 	[External Code]	

@wwmayer
Copy link
Contributor

wwmayer commented Dec 14, 2020

I cannot confirm the behaviour you observed but I realized that there are several locations where the doubles x and z are declared and used for further calculations but they are never correctly initialized so behaviour is undefined.

These are the lines 1269, 1298 and 1349.

@donovaly
Copy link
Member Author

there are several locations where the doubles x and z are declared and used for further calculations but they are never correctly initialized so behaviour is undefined.

Yes, and since their meaningless name it is even hard to follow what the code does. I now renamed the variables and initialized them.

I also improved the code a little bit here. But the whole hole code could benefit from some love. However, not for now.

@donovaly
Copy link
Member Author

When I tried to test this I got a crash due to a debug assertion failure in OCC. The steps I followed were:

I could not reproduce this with a debug build. But maybe it was because of the uninitialized variables. Can you please check again?

@chennes
Copy link
Member

chennes commented Dec 15, 2020

When I tried to test this I got a crash due to a debug assertion failure in OCC. The steps I followed were:

I could not reproduce this with a debug build. But maybe it was because of the uninitialized variables. Can you please check again?

It seems that it was being caused by the weird geometry that was generated when the tip doubled back on itself (due to those duplicated lines 1389 through 1398) -- a3bcf88 should do the trick, but I will re-test shortly.

@donovaly
Copy link
Member Author

donovaly commented Jan 2, 2021

Can this PR go in? I fixed the 2 issues spotted by @chennes . I see that the PR is necessary since it popped up again in the forum: https://forum.freecadweb.org/viewtopic.php?t=51491&view=unread#p462138

@donovaly donovaly force-pushed the PD-Hole-DrillPoint branch 3 times, most recently from 20e67ee to 1ffc7f5 Compare January 2, 2021 21:39
Copy link
Member

@chennes chennes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just re-tested and the bug I reported is resolved. It works well and is a good addition, thanks!

@donovaly
Copy link
Member Author

Can this PR go in?

Ping.

@chennes tested it and we have another PR (#4274) that waits for it. (Waits for this PR because it will change the Hole dialog further.)

Copy link
Contributor

@davidosterberg davidosterberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested it, but the code looks good. I request that the UI file is sorted, and the PR rebased. Otherwise this looks ready (considering @chennes approval).

as reported in https://tracker.freecadweb.org/view.php?id=3818
we treat the blind hole depth not according to the conventions. The size of the drill point due to the angle is normally not taken into account but FC does this in any case.

This PR adds therefore an option, that is by default off, to take the drill point size into account.
Without the option, (the new default) the depth is calculated according to the conventions.

The PR also removes unused widgets and restored the tab order in the .ui file. The thread parameters were never used. In case we made in future the decision to carve into holes real (modeled) threads, we need a special UI for that solution anyway so having the dead code in is not helpful at all.
@donovaly
Copy link
Member Author

I request that the UI file is sorted, and the PR rebased. Otherwise this looks ready (considering @chennes approval).

Done, thanks for having a look.

Copy link
Contributor

@davidosterberg davidosterberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@kkremitzki kkremitzki merged commit 497ecbe into FreeCAD:master Jan 30, 2021
@donovaly
Copy link
Member Author

Many thanks for merging. We can now proceed to finish the other 2 pending hole PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants