MACRO:Work Feature 2014_12

Need help, or want to share a macro? Post here!
UR_
Posts: 1018
Joined: Tue Jan 03, 2017 8:42 pm

Re: MACRO:Work Feature 2014_12

Postby UR_ » Tue Jan 03, 2017 8:49 pm

Hello Rentlau_64,
i think same problem on my installation (win 10) too

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9459 (Git)
Build type: Release
Branch: master
Hash: f22f5c819e510c27debea285e6a7ee20363c30d9
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Postby rentlau_64 » Tue Jan 03, 2017 10:16 pm

@ nemesis,

You have this error :
ERROR:cannot load FreeCAD module...modify line 6 and 7 of this script !!
<unknown exception traceback><unknown exception type>: <unknown exception data>
Which file did you change first?
When you change :
if not sys.path.__contains__("/usr/lib/freecad/lib"):
sys.path.append("/usr/lib/freecad/lib")
to
if not sys.path.__contains__("/Applications/FreeCAD.app/Contents/lib"):
sys.path.append("/Applications/FreeCAD.app/Contents/lib")

To try to fix the bug :
Traceback (most recent call last):
File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Macro/start_WF.FCMacro", line 34, in <module>
import WorkFeature.WF_2015 as WF
File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/WF_2015.py", line 65, in <module>
from ParCurve.WF_ObjParCurve_2016 import *
File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/ParCurve/WF_ObjParCurve_2016.py", line 16, in <module>
import WF_ObjParCurveEdit_2016 as ParCurveEdit
File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/ParCurve/WF_ObjParCurveEdit_2016.py", line 11, in <module>
import Ui.WF_ObjParCurve2DEditGui_2016 as EDIT_2D
<type 'exceptions.ImportError'>: No module named WF_ObjParCurve2DEditGui_2016
Please check first that you have the following files:
__init__.py
WF_ObjParCurve2DEditGui_2016.py
WF_ObjParCurve3DEditGui_2016.py
WF_ObjSurfaceEditGui_2016.py
WF_ParCurveGui_2016.py
under your directory WorkFeature/WorkFeature/ParCurve/Ui

In the file WF_ObjParCurveEdit_2016.py under your directory WorkFeature/WorkFeature/ParCurve/:
try to replace line 9

Code: Select all

sys.path.append(os.path.dirname(__file__))
by

Code: Select all

# Get the path of the current python script    
m_current_path = os.path.realpath(__file__)
# Update your paths
if not sys.path.__contains__(m_current_path): 
    sys.path.append(m_current_path)
    
In file WF_ObjParCurve_2016.py under WorkFeature/WorkFeature/ParCurve/:
try to replace line 11

Code: Select all

m_current_path = "/home/laurent/Develop/Workspaces/Python/WF_test/WorkFeature/ParCurve/"
by

Code: Select all

# Get the path of the current python script    
m_current_path = os.path.realpath(__file__)
and let me know if it works i will commit the bug fix?

Rentlau_64
User avatar
nemesis
Posts: 347
Joined: Tue Mar 25, 2014 11:24 pm
Location: France, Lyon

Re: MACRO:Work Feature 2014_12

Postby nemesis » Tue Jan 03, 2017 10:33 pm

rentlau_64 wrote: Which file did you change first?
I changed it in "start_WF.py"
rentlau_64 wrote: Please check first that you have the following files:
check.png
check.png (125.46 KiB) Viewed 1184 times
check! (that's a clone from github)

I did all the changes and:

Code: Select all

Traceback (most recent call last):
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Macro/start_WF.FCMacro", line 34, in <module>
    import WorkFeature.WF_2015 as WF
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/WF_2015.py", line 65, in <module>
    from ParCurve.WF_ObjParCurve_2016 import *
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/ParCurve/WF_ObjParCurve_2016.py", line 18, in <module>
    import WF_ObjParCurveEdit_2016    as ParCurveEdit 
  File "/Volumes/doc/Thierry/Library/Preferences/FreeCAD/Mod/WorkFeature/WorkFeature/ParCurve/WF_ObjParCurveEdit_2016.py", line 16, in <module>
    import Ui.WF_ObjParCurve2DEditGui_2016 as EDIT_2D
<type 'exceptions.ImportError'>: No module named WF_ObjParCurve2DEditGui_2016
User avatar
sgrogan
Posts: 5473
Joined: Wed Oct 22, 2014 5:02 pm

Re: MACRO:Work Feature 2014_12

Postby sgrogan » Wed Jan 04, 2017 1:24 am

Hello rentlau_64, thanks for the update!
What is the expected path?
It seems that the directory structure is more complicated in this version.
Can you post a screenshot of your directory structure starting with the .FreeCAD folder?
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Postby rentlau_64 » Wed Jan 04, 2017 6:18 am

Yes the directory structure is a bit more complex.
I did that to try to handle more sub function of the big big macro.
The directory tree is :
.
├── README.md
├── start_WF.FCMacro
├── start_WF.py
└── WorkFeature
├── Beam
│   ├── beam.py
│   └── __init__.py
├── COPYING
├── COPYING.LESSER
├── Doc
│   ├── WF_documentation.pdf
│   └── WF_releasesDocumentation.pdf
├── Icons
│   ├── License
│   └── WF_centerObjectsPlanes.png
├── __init__.py
├── __init__.pyc
├── ParCurve
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── Ressources
│   │   ├── 2DPoints.txt
│   │   ├── __init__.py
│   │   ├── Parametric2D.dat
│   │   ├── Parametric3D.dat
│   │   └── ParametricSurf.dat
│   ├── Ui
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── sh_ui2pySide
│   │   ├── WF_ObjParCurve2DEditGui_2016.py
│   │   ├── WF_ObjParCurve2DEditGui_2016.pyc
│   │   ├── WF_ObjParCurve2DEditGui_2016.ui
│   │   ├── WF_ObjParCurve3DEditGui_2016.py
│   │   ├── WF_ObjParCurve3DEditGui_2016.pyc
│   │   ├── WF_ObjParCurve3DEditGui_2016.ui
│   │   ├── WF_ObjSurfaceEditGui_2016.py
│   │   ├── WF_ObjSurfaceEditGui_2016.pyc
│   │   ├── WF_ObjSurfaceEditGui_2016.ui
│   │   ├── WF_ParCurveGui_2016.py
│   │   ├── WF_ParCurveGui_2016.pyc
│   │   └── WF_ParCurveGui_2016.ui
│   ├── Utils
│   │   ├── Coordonnees.py
│   │   ├── Gui.py
│   │   ├── Gui.pyc
│   │   ├── __init__.py
│   │   ├── __init__.pyc
│   │   ├── Text.py
│   │   └── Text.pyc
│   ├── WF_ObjParCurve_2016.py
│   ├── WF_ObjParCurve_2016.pyc
│   ├── WF_ObjParCurveEdit_2016.py
│   └── WF_ObjParCurveEdit_2016.pyc
├── Ressources
│   ├── Parametric2D.dat
│   └── Parametric3D.dat
├── Sweep
│   └── sweep.py
├── Ui
│   ├── __init__.py
│   ├── sh_ui2pySide
│   ├── WFGui_2015.py
│   ├── WFGui_2015.ui
│   ├── WF_ObjParCurve2DEditGui_2016.py
│   ├── WF_ObjParCurve2DEditGui_2016.ui
│   ├── WF_ObjParCurve3DEditGui_2016.py
│   ├── WF_ObjParCurve3DEditGui_2016.ui
│   ├── WF_ObjSurfaceEditGui_2016.py
│   └── WF_ObjSurfaceEditGui_2016.ui
├── Utils
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── WF_curve.py
│   ├── WF_line.py
│   ├── WF_plane.py
│   ├── WF_points_set.py
│   ├── WF_points_set.pyc
│   └── WF_Utils.py
├── WF_2015.py
├── WF_2015.pyc
├── WFGui_2015.py
├── WFGui_2015.pyc
├── WF_ObjParCurve_2015.py
├── WF_ObjParCurve2DEditGui_2016.py
├── WF_ObjParCurve3DEditGui_2016.py
├── WF_ObjParCurveEdit_2015.py
├── WF_ObjRot_2015.py
├── WF_ObjRot_2015.pyc
├── WF_ObjSurfaceEditGui_2016.py
├── WF_Utils_2015.py
├── WF_Utils_2015.pyc
└── WF_wf.png
I added the ParCurve directory and its structure
you can test if starting from file WF_ObjParCurve_2016.py directly into FreeCad works or not?
On my Linux system it is working OK.
Let me try to fix that issue
Rentlau_64
User avatar
sgrogan
Posts: 5473
Joined: Wed Oct 22, 2014 5:02 pm

Re: MACRO:Work Feature 2014_12

Postby sgrogan » Wed Jan 04, 2017 12:54 pm

rentlau_64 wrote:The directory tree is :
Thanks, this helps.
There are missing files on github.
The Workfeature/ParCurve/Ui sub directory is missing the .py files (only the .ui files are there) I found 3 of the 4 .py files in Workfeature/Ui directory, copied them over and got past nemesis's error. I couldn't find WF_ParCurveGui_2016.py. Also the Workfeature/ParCurve/Utils sub directory is totally missing.
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Postby rentlau_64 » Wed Jan 04, 2017 4:31 pm

Sgrogan,
thank you for your help,
l will commit all the missing files in a few minutes.
meanwhile you can generate py files into Ui directory with:
sh sh_ui2pySide anyfile.ui
Rentlau_64
UR_
Posts: 1018
Joined: Tue Jan 03, 2017 8:42 pm

Re: MACRO:Work Feature 2014_12

Postby UR_ » Wed Jan 04, 2017 6:05 pm

Hello Rentlau_64,

that was it!
Starting fine now.
Thank you.

UR_
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Postby rentlau_64 » Wed Jan 04, 2017 7:29 pm

cool!
have fun
User avatar
sgrogan
Posts: 5473
Joined: Wed Oct 22, 2014 5:02 pm

Re: MACRO:Work Feature 2014_12

Postby sgrogan » Thu Jan 05, 2017 12:20 am

Thanks rentlau_64, everything loads now.
If I select the "Wire" tab and then then the "Curves and Surfaces" tab, when launching the Curves and Surfaces menu I get

Code: Select all

Traceback (most recent call last):
  File "C:/Users/Chris/AppData/Roaming/FreeCAD/Macro\WorkFeature\WF_2015.py", line 13441, in launch_curvesAndSurfaces
    self.reg_events2D = RegressionCurve2DEvents(myObject.gui)
  File "C:/Users/Chris/AppData/Roaming/FreeCAD/Macro\WorkFeature\ParCurve\WF_ObjParCurve_2016.py", line 1968, in __init__
    self.regcurv2D = RegressionCurve2D(self.ui)
  File "C:/Users/Chris/AppData/Roaming/FreeCAD/Macro\WorkFeature\ParCurve\WF_ObjParCurve_2016.py", line 503, in __init__
    Parametric.__init__(self, gui)
  File "C:/Users/Chris/AppData/Roaming/FreeCAD/Macro\WorkFeature\ParCurve\WF_ObjParCurve_2016.py", line 244, in __init__
    self.setGuiStuff()
  File "C:/Users/Chris/AppData/Roaming/FreeCAD/Macro\WorkFeature\ParCurve\WF_ObjParCurve_2016.py", line 255, in setGuiStuff
    self.pbar    = self.gui.progressBar
AttributeError: 'module' object has no attribute 'progressBar'
The "Parametric Curve" tab is created though.
The "Close" button doesn't close. If I hit the x in the upper right corner the tab closes. If I then re-launch the "Curves and Surfaces" tab it opens as a new panel pinned to the right side of my screen.
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6706 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17