MACRO:Work Feature 2014_12

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

Hello. The macro can not be installed in Ubuntu 14.04 Features Work, I tried to git and downloading the file but nothing. I read the installation link, either works for me. Can someone help? Thank you. I installed Drawing_dimensioning and some other but this is nothing impossible.

OS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5919 (Git)
Build type: None
Branch: master
Hash: 081bc6b10708c244577dd1baf73070be47eb3109
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17


Félix Fernández
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: MACRO:Work Feature 2014_12

Post by sgrogan »

WorkFeature is a super macro, like Bolts, so the installation is a little different.
What I do;
From home I clone Rentlau's git repository

Code: Select all

https://github.com/Rentlau/WorkFeature.git
then from the created WorkFeature directory in home I copy the WorkFeature sub-directory and the start_WF.FCMacro file to my "home/.FreeCAD" directory.
To update, open a terminal from "home/WorkFeature" directory and

Code: Select all

git pull
and then copy and replace the above.
If this doesn't work post back.
OS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5924 (Git)
Build type: Unknown
Branch: master
Hash: 629a89218d72d035fde6161eb6247b4bc0f0651d
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
"fight the good fight"
mario52
Veteran
Posts: 4696
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
felix wrote:I read the installation link, either works for me. Can someone help?
you must copy alls files in your macro directory ( /home/your_user_name/.FreeCAD ) see Location_and_destination_of_macros
and run start_WF.FCMacro or start_WF.py
see her for create one button on the toolbar Customize_ToolsBar
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: MACRO:Work Feature 2014_12

Post by renatorivo »

note that is visible by clicking on new entry in Combo View
Attachments
WorkFeatures.png
WorkFeatures.png (17.62 KiB) Viewed 2622 times
User avatar
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

Sorry I must be stupid.

I have cloned https://github.com/Rentlau/WorkFeature.git in my home directory.

I copied the folder WorkFeature .FreeCAD and start_WF.FCMacro file inside the folder I have also copied .FreeCAD.

Start_WF.FCMacro run and I get this error:

felix felix-sdb @: ~ / .FreeCAD $ python start_WF.FCMacro
Traceback (most recent call last):
File "start_WF.FCMacro", line 16, in <module>
WorkFeature.WF_2015 import as WF
File "/home/felix/.FreeCAD/WorkFeature/WF_2015.py", line 56, in <module>
WorkFeature import from WF_ObjParCurve_2015
File "/home/felix/.FreeCAD/WorkFeature/WorkFeature/WF_ObjParCurve_2015.py", line 5, in <module>
WorkFeature.WF_ObjParCurveEdit_2015 import as ParCurveEdit
File "/home/felix/.FreeCAD/WorkFeature/WF_ObjParCurveEdit_2015.py", line 16, in <module>
as import FreeCAD App
ImportError: No module named FreeCAD
felix felix-sdb @: ~ / $ .FreeCAD

FreeCAD open, try customizing and Macros only see start_WF.FCMacro, which is the file that was copied outside the WokFeature folder.

Sorry Mario, but I do not want to bother appreciate your detailed help.

Felix
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: MACRO:Work Feature 2014_12

Post by renatorivo »

it's strange, my installation is equal to yours, no errors:

OS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5924 (Git)
Build type: None
Branch: master
Hash: 629a89218d72d035fde6161eb6247b4bc0f0651d
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
with the version 2015_10_05 everything works, have you given permission?
Attachments
workfeatureslinux1.png
workfeatureslinux1.png (48.77 KiB) Viewed 2601 times
User avatar
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

No, I have not given any permission, I tried to allow a program to run executable file without result.

I'll keep trying. Thank you very much.

Félix
Attachments
workfeature.png
workfeature.png (40.74 KiB) Viewed 2598 times
rentlau_64
Posts: 181
Joined: Tue Oct 21, 2014 9:47 am
Location: Pau (France)

Re: MACRO:Work Feature 2014_12

Post by rentlau_64 »

Hello,

The current release from Github is :"2015_11_08"
felix felix-sdb @: ~ / .FreeCAD $ python start_WF.FCMacro
Traceback (most recent call last):
File "start_WF.FCMacro", line 16, in <module>
WorkFeature.WF_2015 import as WF
File "/home/felix/.FreeCAD/WorkFeature/WF_2015.py", line 56, in <module>
WorkFeature import from WF_ObjParCurve_2015
File "/home/felix/.FreeCAD/WorkFeature/WorkFeature/WF_ObjParCurve_2015.py", line 5, in <module>
WorkFeature.WF_ObjParCurveEdit_2015 import as ParCurveEdit
File "/home/felix/.FreeCAD/WorkFeature/WF_ObjParCurveEdit_2015.py", line 16, in <module>
as import FreeCAD App
ImportError: No module named FreeCAD
It seems to me that you do not have in your PYTHONPATH variable the FreeCAD library path:

Insert the following into your "start_WF.FCMacro" python file just after line 3 :

Code: Select all

if not sys.path.__contains__("/usr/lib/freecad/lib"): 
    sys.path.append("/usr/lib/freecad/lib")
You must change "/usr/lib/freecad/lib" by your own FreeCAD lib path to import FreeCAD.

To find this path launch "freecad" into an Xterm.
You must see the following line inside the information printed:
'icon': '/usr/lib/freecad/Mod/plugins/icons/master.png',

means that your path should be "/usr/lib/freecad/lib".

Your "start_WF.FCMacro" file must looks like :

Code: Select all

# -*- coding: utf-8 -*-
import sys
import os.path

if not sys.path.__contains__("/usr/lib/freecad/lib"): 
    sys.path.append("/usr/lib/freecad/lib")
    
try:
    # try import
    import WorkFeature.WF_2015 as WF
except:
    # get the path of the current python script    
    m_current_path = os.path.realpath(__file__)
    m_current_path = os.path.dirname(m_current_path)
    # check if this path belongs to the PYTHONPATH variable and if not add it
    if not sys.path.__contains__(str(m_current_path)):
        sys.path.append(str(m_current_path))
    # retry import now
    import WorkFeature.WF_2015 as WF
  
WF.myDialog = WF.WorkFeatureTab()

My system:

OS: Ubuntu 14.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

Please let me know if it solved your issue...?

Rentlau_64
User avatar
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

Perfect Rentlau_64.

True, I lacked the PYTHONPATH library.

But there is a small error in the GIT. When cloned creates a folder called WorkFeature and in another with the same name.

You have to remove one, ie there must be a single folder called WorkFeature in .FreeCAD. If not it fails.

We must change the GIT to create a single folder.

Thank you very very much.
Attachments
workfeature-freecad.png
workfeature-freecad.png (35.32 KiB) Viewed 2525 times
User avatar
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

I leave a small tutorial of the steps that I followed through if it helps someone.

How to Install on Ubuntu 14.04.

On the Terminal: (Ctrl+Alt+T)

Install Python dependency grapher:


sudo apt-get install snakefood

cd .FreeCAD

Clone Git:

git clone https://github.com/Rentlau/WorkFeature.git

Close Terminal.

Open your Home directory:

Move on folder .FreeCAD (Ctrl+H) to see hidden.

Open the folder WorkFeature

Copy the file start_WFMacro into folder .FreeCAD

Copy on the desk the folder WorkFeature (has the same name, it is within the above).

Back to the folder .FreeCAD

Delete the main folder WorkFeature

Move the folder we copied to your desktop (WorkFeature) into .FreeCAD directory

With the text editor open the file start_WFMacro (right open with gedit)

Copy and paste the following, overwriting all and save the file:
# -*- coding: utf-8 -*-
import sys
import os.path

if not sys.path.__contains__("/usr/lib/freecad/lib"):
sys.path.append("/usr/lib/freecad/lib")

try:
# try import
import WorkFeature.WF_2015 as WF
except:
# get the path of the current python script
m_current_path = os.path.realpath(__file__)
m_current_path = os.path.dirname(m_current_path)
# check if this path belongs to the PYTHONPATH variable and if not add it
if not sys.path.__contains__(str(m_current_path)):
sys.path.append(str(m_current_path))
# retry import now
import WorkFeature.WF_2015 as WF

WF.myDialog = WF.WorkFeatureTab()


In short:

.FreeCAD Folder has to have a single folder called WorkFeature containing all the original files.

And besides start_WFMacro we modified file.
02.png
02.png (128.25 KiB) Viewed 2509 times
.FreeCAD Inside the folder create a new folder called icons

Copy and paste the icon WF_wf.svg into folder icons

Open FreeCAD

Open menu Tools --> Customize


Press Into menu Macros (1)

Press (2) select start_WF.FCMacro

Type a name (3)

Added icon (4)

Select the folder (5 and 6)

Ok (7)

Select the icon (8)

Ok Button
04.png
04.png (90.01 KiB) Viewed 2509 times
Press Add
05.png
05.png (27.76 KiB) Viewed 2509 times
Select Toolbars (1)

Select Macros (2)

Select Workbench (3)

Press New (4)

Type a name (5)

Select your macro (6)

copy it to your macros (7)

Close.
06.png
06.png (43.43 KiB) Viewed 2499 times
07.png
07.png (39.4 KiB) Viewed 2499 times

Félix Fernández

Tanks Rentlau_64
Last edited by felix on Wed Nov 18, 2015 9:31 pm, edited 1 time in total.
Post Reply