ShaftDesign not fully functional on v0.20

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
User avatar
Kuzma30
Posts: 139
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

ShaftDesign not fully functional on v0.20

Post by Kuzma30 »

Code: Select all

OS: Ubuntu Core 20 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.28968 (Git) Snap 47
Build type: Release
Branch: master
Hash: 03f38526172d8bc6274ddfb5cdd3ad6b691f5f56
Python 3.8.10, Qt 5.15.3, Coin 4.0.0, OCC 7.6.2
Locale: Ukrainian/Ukraine (uk_UA)
Installed mods: 
  * Plot 2022.4.17
There is some problems with ShaftDesign Wizard
1. Problem with translations. https://github.com/FreeCAD/FreeCAD-tran ... s/issues/4 We have translated string in crowdin and in .ts files but no on GUI.
2. Problem with Plot. It don't works
for some buttons it show errors, for example (Qz)

Code: Select all

12:30:01  Traceback (most recent call last):
12:30:01    File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/WizardShaft.py", line 117, in slotQz
12:30:01      self.showDiagram("Qz")
12:30:01    File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/WizardShaft.py", line 97, in showDiagram
12:30:01      self.shaft.showDiagram(diagram)
12:30:01    File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/Shaft.py", line 223, in showDiagram
12:30:01      self.diagrams[self.F[ax].name].close()
12:30:01    File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/ShaftDiagram.py", line 88, in close
12:30:01      self.win.parent().close()
12:30:01  AttributeError: 'Diagram' object has no attribute 'win'
for another (sigma[z]) it show pop-up dialog "Missing module". You may have to install the Plot add-on.
Detail show

Code: Select all

Traceback (most recent call last):
  File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/WizardShaft.py", line 97, in showDiagram
    self.shaft.showDiagram(diagram)
  File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/Shaft.py", line 266, in showDiagram
    self.diagrams[self.sigmaN[ax].name].create(text[0], self.sigmaN[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0E-6, 10)
  File "/snap/freecad/47/usr/Mod/PartDesign/WizardShaft/ShaftDiagram.py", line 30, in create
    from freecad.plot import Plot
ImportError: cannot import name 'Plot' from 'freecad.plot' (/home/alexandr/snap/freecad/common/Mod/Plot/./freecad/plot/__init__.py)
As write in wiki "From FreeCAD 0.20 on plot module is already packaged within the program, so you don't need to install any add-on, but just type " (https://wiki.freecadweb.org/Plot_Workbench) But designshaft don't work without and with Plot WB installed.
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
johnwang
Veteran
Posts: 1100
Joined: Sun Jan 27, 2019 12:41 am

Re: ShaftDesign not fully functional on v0.20

Post by johnwang »

I tried to use matplotlib which is included in FC.

In \Mod\PartDesign\WizardShaft\ShaftDiagram.py, Find 'class Diagram' and change to:

Code: Select all

class Diagram:
    def create(self, title, function, xlength, xname, xunit, xscale, yname, yunit, yscale, numxpoints):
        # Initialize
        #from freecad.plot import Plot
        import matplotlib.pyplot as Plot
and at the end of this 'def create', change to:

Code: Select all

        # Create plot
        #self.plot()
        Plot.plot(self.xpoints,self.ypoints)
        Plot.show()
shear.jpg
shear.jpg (41.34 KiB) Viewed 999 times
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
Kuzma30
Posts: 139
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: ShaftDesign not fully functional on v0.20

Post by Kuzma30 »

johnwang wrote: Tue May 31, 2022 10:55 am I tried to use matplotlib which is included in FC.
Thanks. I make your changes and comment self.thePlot = Plot.getPlot() line
I have error with it

Code: Select all

Traceback (most recent call last):
  File "/home/alexandr/Kuzma30/FreeCAD-build-master/Mod/PartDesign/WizardShaft/WizardShaft.py", line 117, in slotQz
    self.showDiagram("Qz")
  File "/home/alexandr/Kuzma30/FreeCAD-build-master/Mod/PartDesign/WizardShaft/WizardShaft.py", line 97, in showDiagram
    self.shaft.showDiagram(diagram)
  File "/home/alexandr/Kuzma30/FreeCAD-build-master/Mod/PartDesign/WizardShaft/Shaft.py", line 227, in showDiagram
    self.diagrams[self.F[ax].name].create(text[0], self.F[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0, 10)
  File "/home/alexandr/Kuzma30/FreeCAD-build-master/Mod/PartDesign/WizardShaft/ShaftDiagram.py", line 46, in create
    self.thePlot = Plot.getPlot()
AttributeError: module 'matplotlib.pyplot' has no attribute 'getPlot'
^CTraceback (most recent call last):
  File "/home/alexandr/Kuzma30/FreeCAD-build-master/Mod/PartDesign/WizardShaft/WizardShaft.py", line 166, in isAllowedAlterDocument
    def isAllowedAlterDocument(self):
Can you make PR to upstream?
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
johnwang
Veteran
Posts: 1100
Joined: Sun Jan 27, 2019 12:41 am

Re: ShaftDesign not fully functional on v0.20

Post by johnwang »

Kuzma30 wrote: Tue May 31, 2022 11:28 am
Thanks. I make your changes and comment self.thePlot = Plot.getPlot() line
I have error with it

Can you make PR to upstream?
Yes. It need to be commented out.

Code: Select all

        # Get the plot object from the window
        #self.thePlot = Plot.getPlot()
This is just a quick test. Haven't consider other part of the code. Don't know if it worth a PR.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
Kuzma30
Posts: 139
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: ShaftDesign not fully functional on v0.20

Post by Kuzma30 »

johnwang wrote: Tue May 31, 2022 11:41 am
Kuzma30 wrote: Tue May 31, 2022 11:28 am
Thanks. I make your changes and comment self.thePlot = Plot.getPlot() line
I have error with it

Can you make PR to upstream?
Yes. It need to be commented out.

Code: Select all

        # Get the plot object from the window
        #self.thePlot = Plot.getPlot()
This is just a quick test. Haven't consider other part of the code. Don't know if it worth a PR.
Of course it worth. Without this changes it doesn`t work on 0.20
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
user1234
Veteran
Posts: 1714
Joined: Mon Jul 11, 2016 5:08 pm

Re: ShaftDesign not fully functional on v0.20

Post by user1234 »

See, https://forum.freecadweb.org/viewtopic.php?f=10&t=59688.

Also i do not like the shaft wizard, because it is not the way as it work in real life. I allow me to quote myself:
user1234 wrote: Fri Jun 25, 2021 10:01 pm So i would wipe the Shaft Wizard it from PartDesign also. Also the Shaft Wizard uses FEM constraints without a FEM Analysis Container, which is useless. And a analysis tool has nothing to do in PartDesign. This things should always be separated.

And also one generally technical thing: I never used the Shaft Wizard, so i can only guess, if the things below are included.

I guess the plot only makes a F(x), M(x), ..... means forces and so on from a running x. I you do that on discontinuous (and also relative discontinuous) elements, then you must include factors for notch effects, roughness of surfaces, size, application, ....... . If this is not included the calculation is invalid (often extremely). And If you do not know that and see, ahhh that result is OK (sigma is OK), then it could be dangerous! So my conclusion is that if you want do make a shaft, you should do it with normal FreeCAD workbenches and if you want to analyze it, you should do it yourself or with FEM. And if anyone is familiar with FreeCAD, you can use later the Wizard with the addon anyway (if it works).

Greetings
user1234

edit: typo
User avatar
Kuzma30
Posts: 139
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: ShaftDesign not fully functional on v0.20

Post by Kuzma30 »

user1234 wrote: Tue May 31, 2022 1:24 pm See, https://forum.freecadweb.org/viewtopic.php?f=10&t=59688.

Also i do not like the shaft wizard, because it is not the way as it work in real life. I allow me to quote myself:
user1234 wrote: Fri Jun 25, 2021 10:01 pm So i would wipe the Shaft Wizard it from PartDesign also. Also the Shaft Wizard uses FEM constraints without a FEM Analysis Container, which is useless. And a analysis tool has nothing to do in PartDesign. This things should always be separated.

And also one generally technical thing: I never used the Shaft Wizard, so i can only guess, if the things below are included.

I guess the plot only makes a F(x), M(x), ..... means forces and so on from a running x. I you do that on discontinuous (and also relative discontinuous) elements, then you must include factors for notch effects, roughness of surfaces, size, application, ....... . If this is not included the calculation is invalid (often extremely). And If you do not know that and see, ahhh that result is OK (sigma is OK), then it could be dangerous! So my conclusion is that if you want do make a shaft, you should do it with normal FreeCAD workbenches and if you want to analyze it, you should do it yourself or with FEM. And if anyone is familiar with FreeCAD, you can use later the Wizard with the addon anyway (if it works).

Greetings
user1234

edit: typo
I am not real user of ShaftDesign. I test it while trying to resolve translations problem.
If it provide incorrect results it must be deleted :)
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
adrianinsaval
Veteran
Posts: 3168
Joined: Thu Apr 05, 2018 5:15 pm

Re: ShaftDesign not fully functional on v0.20

Post by adrianinsaval »

@uwestoehr thoughts? seems it doesn't work out of the box and might be a bad idea to use it anyways, should we remove the shaft design wizard?
User avatar
uwestoehr
Veteran
Posts: 4302
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: ShaftDesign not fully functional on v0.20

Post by uwestoehr »

adrianinsaval wrote: Tue May 31, 2022 9:36 pm @uwestoehr thoughts? seems it doesn't work out of the box and might be a bad idea to use it anyways, should we remove the shaft design wizard?
Not for 0.20, it will stay for now.
User avatar
Kuzma30
Posts: 139
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: ShaftDesign not fully functional on v0.20

Post by Kuzma30 »

uwestoehr wrote: Wed Jun 01, 2022 2:07 am
adrianinsaval wrote: Tue May 31, 2022 9:36 pm @uwestoehr thoughts? seems it doesn't work out of the box and might be a bad idea to use it anyways, should we remove the shaft design wizard?
Not for 0.20, it will stay for now.
Than make it plot diagram.
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
Post Reply