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!
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
done
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.
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 »

Mario52,

1- I move the "Create Plane" button in Plane tab
2- In Objects tab I create 2 buttons to generate Cylinders "forages pour toi" and Cuboids


The new code is attached

If you feel it is ok could you upfate the Macro recipes for me?
Thank you so much for your help.
Merci d'avance pour ton aide.

Rentlau_64
Attachments
forage.jpeg
forage.jpeg (101.55 KiB) Viewed 3005 times
WF_2015_01_25.zip
(180.61 KiB) Downloaded 402 times
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
done
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.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: MACRO:Work Feature 2014_12

Post by NormandC »

Hello Rentlau_64,

I do not consider myself as a completely clueless person, but I struggled a lot to make your macro work.

The only way that it will work is if all the files are extracted in ~/.FreeCAD. But that's not where my macro folder is located.

Trying to execute WF_2015_01_25.FCMacro in a different folder, I get this error:

Code: Select all

Traceback (most recent call last):
  File "/home/normand/Dessins/Macros_FreeCAD/WF_2015_01_25.FCMacro", line 47, in <module>
    import WFGui_2015_01_25 as WFGui
<type 'exceptions.ImportError'>: No module named WFGui_2015_01_25
I could only fix this by changing my Macro path to ~/.FreeCAD, move the files there, execute it once, so it generated a "WFGui_2015_01_25.pyc" file; then I moved all files back to my Macro folder. Once I restart FreeCAD, the macro works properly.

Just a couple of things though:
  • Once the macro is executed, there is apparently no way to close the "Work Features" tab.
  • An empty tab is created along the "Work Features" tab.
I have a suggestion: to make it as a python module that you can drop in ~/.FreeCAD/Mod then have it available in the workbench switcher.
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
my home it works well
before I had my macros in C:\Program Files\FreeCAD 0.14
and now I have just moved to C:\Users\xx\AppData\Roaming\FreeCAD
test in C:\xxxxxxx\Macro Utiles\WF_2015_01_25
and I have no problem
launch the macro with WF_2015_01_25.FCMacro

ps:the whole must be in the same place and works well regardless of location
(tout l'ensemble doit être à la même place et fonctionne bien quelque soit l'endroit)

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.
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 »

Normandc,

As Mario said as soon the zip or tar file is extracting all the files into your MACRO directory it must works....
Stange behavior that you described ? Do you run FreeCAD under Windows (I never tested under Windows)?

Did you tested an old release to see If I made a mistake in the recent one? i.e. WF_2015_01_18.tar.gz ?
Once the macro is executed, there is apparently no way to close the "Work Features" tab.
No, not up to date but I will do it.. I have an example from Mario to do so.
An empty tab is created along the "Work Features" tab.
Yes because I discovered that if I open a FreeCAD file after opening my MACRO, after a while my "Work Feature" labelled tab become a "Projet" labelled tab...I fix it by letting the space to "Projet" tab with an empty tab... not very proud of that! :?
I have a suggestion: to make it as a python module that you can drop in ~/.FreeCAD/Mod then have it available in the workbench switcher.
I am developping more small tools and probaly I will do what you suggest but my concern is the fact that I will not have my
small tools still accessible if I switch to another workbench! Do you know how to by pass this behavior?

Have a nice day

Rentlau_64
User avatar
TT-RS
Posts: 70
Joined: Fri Oct 24, 2014 9:19 pm

Re: MACRO:Work Feature 2014_12

Post by TT-RS »

Hi,

I found this macro very useful, there are plenty of macros for FC, but this one is very productive / effective.

Thanks!
User avatar
ThierryM
Posts: 25
Joined: Tue Mar 04, 2014 2:51 am
Location: Les Corbières, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by ThierryM »

Hi,
Thanks for this new feature very usefull.
I have the same problem as NormandC with the same issue message (on line 47) for the WF_2015_01_25 :
Traceback (most recent call last):
File "/home/thierry/.FreeCAD/WF_2015_01_25/WF_2015_01_25.FCMacro", line 47, in <module>
import WFGui_2015_01_25 as WFGui
<type 'exceptions.ImportError'>: No module named WFGui_2015_01_25
If I extract the zip file directly in ./FreeCAD/ directory, I have the same problem.

I'm under Ubuntu :

Code: Select all

OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4544 (Git)
Branch: master
Hash: b67405e16ece8c705969a7095d0a152e49dacbe6
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
Thanks for your help,
Thierry
Linux Mint 21.2, 64 bits, Freecad 0.21
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by rockn »

Hi everyone and rentlau_64,

I made a little improvement to the macro. It's nothing but as I very don't like having all this file in my macro folders I have done this :
I have create a new folder called WorkFeature with all files needed inside.
I have rename WF_2015_01_25.FCMacro in __init__.py
Outside the new folder I have created a FCMacro called start_WF.FCMacro with this :

Code: Select all

import WorkFeature
WorkFeature.WorkFeatureTab()
Now in my FC macro folder I have start_WF.FCMacro file and WorkFeature folder.

It is very more clear to me, and it's let's you the ability to make update without the user having to change the name of the macro to start the tool. For example I have a button to start the macro and now even if you make update I don't have to edit this custum macro.

You can see and download this on my github repo : https://github.com/wood-galaxy/FC-WorkFeature
rentlau_64, pehaps it's time to make a github repo ;) Just fork my repo :D
Formations - Assistance - Développement : https://freecad-france.com
User avatar
ThierryM
Posts: 25
Joined: Tue Mar 04, 2014 2:51 am
Location: Les Corbières, France
Contact:

Re: MACRO:Work Feature 2014_12

Post by ThierryM »

Hi,
I have solved my problem : it was a problem on my distro with python and pyside on my computer (I added the missing packages). And so it's working now.
Rockn, I have installed your "fork" and it's working fine.
Thanks, regards,

Thierry

Edit : There's a problem with the display, an empty tab (see the picture)
Sélection_103.png
Sélection_103.png (113.91 KiB) Viewed 2795 times
Last edited by ThierryM on Fri Feb 13, 2015 12:27 pm, edited 1 time in total.
Linux Mint 21.2, 64 bits, Freecad 0.21
Post Reply