Page 3 of 3

Re: ShaftDesign not fully functional on v0.20

Posted: Wed Jun 01, 2022 2:18 pm
by uwestoehr
There is now for me only this bug left:

- in the PD workbench go to menu Part Design -> Shaft design wizard
- in the appearing dialog click on the button "w [z]"

result:

Code: Select all

16:16:35  Traceback (most recent call last):
16:16:35    File "D:\FreeCAD-build\Mod\PartDesign\WizardShaft\WizardShaft.py", line 131, in slotWz
16:16:35      self.showDiagram("wz")
16:16:35    File "D:\FreeCAD-build\Mod\PartDesign\WizardShaft\WizardShaft.py", line 97, in showDiagram
16:16:35      self.shaft.showDiagram(diagram)
16:16:35    File "D:\FreeCAD-build\Mod\PartDesign\WizardShaft\Shaft.py", line 249, in showDiagram
16:16:35      self.diagrams[self.w[ax].name].close()
16:16:35    File "D:\FreeCAD-build\Mod\PartDesign\WizardShaft\ShaftDiagram.py", line 88, in close
16:16:35      self.win.parent().close()
16:16:35  RuntimeError: Internal C++ object (Plot) already deleted.
@johnwang, do you have an idea? It seems the code tried to close a plot that is not existent.

Re: ShaftDesign not fully functional on v0.20

Posted: Wed Jun 01, 2022 3:06 pm
by Kuzma30
uwestoehr wrote: Wed Jun 01, 2022 2:15 pm
uwestoehr wrote: Wed Jun 01, 2022 11:57 am I removed it and restarted FC but the error persists.
Seems I had something cached somewhere. Now it works and I committed the fix:
https://github.com/FreeCAD/FreeCAD/commit/2de25dd04e

@Kuzma30 , please test if this works for you as well now.
Test on initial example. All works (Q[z], Mb[y], sigma[z] and sigmab[y]), except w[z]

Code: Select all

18:03:55  Traceback (most recent call last):
18:03:55    File "/home/aleksandr/test_crowdin/FreeCAD-build-master/Mod/PartDesign/WizardShaft/WizardShaft.py", line 131, in slotWz
18:03:55      self.showDiagram("wz")
18:03:55    File "/home/aleksandr/test_crowdin/FreeCAD-build-master/Mod/PartDesign/WizardShaft/WizardShaft.py", line 97, in showDiagram
18:03:55      self.shaft.showDiagram(diagram)
18:03:55    File "/home/aleksandr/test_crowdin/FreeCAD-build-master/Mod/PartDesign/WizardShaft/Shaft.py", line 253, in showDiagram
18:03:55      self.diagrams[self.w[ax].name].create(text[0], self.w[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1000.0, 30)
18:03:55    File "/home/aleksandr/test_crowdin/FreeCAD-build-master/Mod/PartDesign/WizardShaft/ShaftDiagram.py", line 54, in create
18:03:55      self.plot()
18:03:55    File "/home/aleksandr/test_crowdin/FreeCAD-build-master/Mod/PartDesign/WizardShaft/ShaftDiagram.py", line 82, in plot
18:03:55      axes.set_xlim(right = max(self.xpoints) * 1.05)
18:03:55  ValueError: max() arg is an empty sequence

Re: ShaftDesign not fully functional on v0.20

Posted: Wed Jun 01, 2022 10:23 pm
by chennes
I get the same error as @Kuzma30 -- it seems to stem from the following comment in SegmentFunction.py:

Code: Select all

        # Coverity has reported a problem that I_i, C_i0 or C_i1:
        # Bad use of null-like value (CIDs are 192609, 192611, 192616)
        # Since this code doesn't seem to be used anywhere the problematic
        # part will be commented out
        #for xval in sorted(xvals):
        #    if xval in divs:
        #        i = self.intfunc.index(xval)
        #        (begin,  length) = self.intfunc.interval(xval)
        #        I_i = self.intfunc.value(xval)
        #        C_i0 = self.boundaries[2 * i]
        #        C_i1 = self.boundaries[2 * i + 1]
        #        FreeCAD.Console.PrintMessage("Interval %u: %f to %f, I_i: %f, C_i0: %f, C_i1: %f\n" % (i,  begin, length,  I_i,  C_i0,  C_i1))
        #
        #    xresult.append(xval)
        #    # w(xval) = (transfunc(xval) + C_i0 * xval + C_i1) / (E * I_i)
        #    value = (self.transfunc.value(xval)  + C_i0 * xval + C_i1) / (E * I_i)
        #    yresult.append(value)
            
        return (xresult, yresult)
So the code that actually creates xresult and yresult has been commented out to appease the static analyzer. I've submitted a PR that reverts this change -- I don't know if Coverity is concerned about a case in which those array indices are out of bounds, but at any rate it seems to be it's better to have working code that might have a bug, than non-functional code that certainly has a bug!

https://github.com/FreeCAD/FreeCAD/pull/6954

Re: ShaftDesign not fully functional on v0.20

Posted: Wed Jun 01, 2022 11:56 pm
by Kunda1
Merged in git commit d860c4b
Thanks @chennes!

Re: ShaftDesign not fully functional on v0.20

Posted: Thu Jun 02, 2022 9:07 am
by johnwang
uwestoehr wrote: Wed Jun 01, 2022 2:15 pm I committed the fix:
Thx.

Re: ShaftDesign not fully functional on v0.20

Posted: Thu Jun 02, 2022 9:10 am
by johnwang
user1234 wrote: Wed Jun 01, 2022 2:14 pm I would say that. Maybe a very dirty solution, remove the menu entry?
It is hard to get in, so if it is there for a long time, better keep it.
It is really a good example to do some design tools. Hope it will inspire others to get started

Re: ShaftDesign not fully functional on v0.20

Posted: Thu Jun 02, 2022 12:53 pm
by user1234
johnwang wrote: Thu Jun 02, 2022 9:10 am It is really a good example to do some design tools. Hope it will inspire others to get started
I do not agree. Only plotting along an axis through a know section, gives never valid result (no factors of notches, surfaces, section areas, load variation ..... which are some each other braced). Even a simple stepped shaft will not be valid. I think this functions really dangerous, if some does not know more about constructing and looks only on the sigma (tension) or tau (shear).

Greetings
user1234

edit: blue

Re: ShaftDesign not fully functional on v0.20

Posted: Thu Jun 02, 2022 1:12 pm
by uwestoehr
user1234 wrote: Thu Jun 02, 2022 12:53 pm Only plotting along an axis through a know section, gives never valid result (no factors of notches, surfaces, section areas, load variation
I agree. It is really dangerous when people would take these results. I mean the feature does not even allow you to set the material parameters. Now it is too late but for the next FreeCAD version, the feature should be moved to the FEM workbench so that one can set the material parameters and also use it for shafts in a custom design (e.g. D-shape tip like for many electric motors, holes etc.)

Re: ShaftDesign not fully functional on v0.20

Posted: Thu Jun 02, 2022 1:17 pm
by user1234
uwestoehr wrote: Thu Jun 02, 2022 1:12 pm Now it is too late
I know, and agree with you. If it is now in it, it is no bonebreaker. I just wanted to point it out, why it is no good function.


Greetings
user1234

Re: ShaftDesign not fully functional on v0.20

Posted: Mon Jan 02, 2023 10:59 am
by david69
checking some issue with translations on Crowdin, https://github.com/FreeCAD/FreeCAD-tran ... s/issues/4, I don't understand the meaning of edge. can you enlight me pls?
Capture d’écran du 2023-01-02 11-57-41.png
Capture d’écran du 2023-01-02 11-57-41.png (26.34 KiB) Viewed 1089 times
@kaktus it may interest you too.

adding: the wording corresponding to Constrain type are not proposed for translation: Force, Fixed, Bearing...