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!
Post Reply
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 »

ThierryM wrote:Rockn, I have installed your "fork" and it's working fine.
Thanks for testing.
Formations - Assistance - Développement : https://freecad-france.com
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 »

Thank to every body who find this macro useful. I am working to add extra tools (Normal to an object point ,intersection of 2 lines, point mean of a set of points, Tangent plane, circle, ellipse)...all of this are ready but need a bit of more tests from my side

Thierry,

Cool that you fix your installation problem; Could you say to Normandc what "missing" package you installed, I guess he faced the same issue than you. Merci
Edit : There's a problem with the display, an empty tab (see the picture)
I already answer to Normandc concerning thie issue:
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! :?

If some one know how to solve this little issue , I will be very happy to implement.

Rockn,

Thank you very much for your help by creating a "fork" on Github.
I am learning how to use Github so I will be able to put next release in it.
For your info I recreate also a tool to rotate and translate objects in a more "intuitive" manner...i tried to use the standard tool for rotation but did not find it very simple. My plan is to incorporate also 2 tools for adapting (by rotation and translation) on object on another, using a edge or a plane. I guess you asked some tools like that a while ago?

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

rentlau_64 wrote:Rockn,

Thank you very much for your help by creating a "fork" on Github.
I am learning how to use Github so I will be able to put next release in it.
You're welcome, As I said I did it mainly to keep my macro folder as clear as possible. Having all these files and folder icon in my macro folder becomes unmanageable. I hope you noticed that.
rentlau_64 wrote: For your info I recreate also a tool to rotate and translate objects in a more "intuitive" manner...i tried to use the standard tool for rotation but did not find it very simple. My plan is to incorporate also 2 tools for adapting (by rotation and translation) on object on another, using a edge or a plane. I guess you asked some tools like that a while ago?
Me ? I don't remember :oops: Since it is possible to project a point on the workplane with snaps tools I have no problem during rotations.
But I'm looking forward to your tools. ;)
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,
rentlau_64 wrote: Cool that you fix your installation problem; Could you say to Normandc what "missing" package you installed, I guess he faced the same issue than you. Merci
I'm not proud :lol: but in Synaptics I've found all the packages related with python-pyside and as I've Python 2 and 3, I installed them... So I don't know exactly the necessary package(s). But it's work :oops: . I tought it was the python's fault because I had the same issue messages when I tried to launch the others macros.
The packages that I've installed :

Code: Select all

libpyside-py3-1.2 (1.2.1-4build1)
libshiboken-py3-1.2 (1.2.1-3build1)
python-pyface (4.1.0-1ubuntu3)
python-traits (4.1.0-1ubuntu4)
python3-pyside (1.2.1-4build1)
python3-pyside.phonon (1.2.1-4build1)
python3-pyside.qtcore (1.2.1-4build1)
python3-pyside.qtdeclarative (1.2.1-4build1)
python3-pyside.qtgui (1.2.1-4build1)
python3-pyside.qthelp (1.2.1-4build1)
python3-pyside.qtnetwork (1.2.1-4build1)
python3-pyside.qtopengl (1.2.1-4build1)
python3-pyside.qtscript (1.2.1-4build1)
python3-pyside.qtsql (1.2.1-4build1)
python3-pyside.qtsvg (1.2.1-4build1)
python3-pyside.qttest (1.2.1-4build1)
python3-pyside.qtuitools (1.2.1-4build1)
python3-pyside.qtwebkit (1.2.1-4build1)
python3-pyside.qtxml (1.2.1-4build1)
Regards,
Thierry
Linux Mint 21.2, 64 bits, Freecad 0.21
CkwA
Posts: 59
Joined: Fri Sep 12, 2014 6:37 pm

Re: MACRO:Work Feature 2014_12

Post by CkwA »

rentlau_64 wrote: 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! :?

If some one know how to solve this little issue , I will be very happy to implement.
In fact this happen when you use a Draft command in your macro. But it will happen too if you switch language or load some workbenches. After looking at the source, i think the problem is here in gui/CombiView.cpp :

Code: Select all

void CombiView::changeEvent(QEvent *e)
{
    if (e->type() == QEvent::LanguageChange) {
        tabs->setTabText(0, trUtf8("Model"));
        tabs->setTabText(1, trUtf8("Tasks"));
        tabs->setTabText(2, trUtf8("Project")); << Remove or comment this line
    }

    DockWindow::changeEvent(e);
}
Before in this file there is :

Code: Select all

    // task panel
    //projectView = new Gui::ProjectWidget(this);
    //tabs->addTab(projectView, trUtf8("Project"));
So I assume this tab will never be created by FreeCAD "core".

I compiled the latest source with this change and it seems solve this issue. I hope someone will read this and could apply it because i don't know where and how commit something.

Sorry if i am wrong and if my english is not good ...
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 »

rentlau_64 wrote: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)?
No, I run Ubuntu 14.04 LTS. Sorry, should have included my FreeCAD info. :oops:
rentlau_64 wrote: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 ?
It didn't cross my mind.

But rockn's fork worked straight away when I placed the files in my Macros folder and launched the start_WF.FCMacro script.
rockn wrote: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
Thanks rockn! I also prefer this solution.

OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4556 (Git)
Branch: master
Hash: cd5783ac2e3fdd3e0ec8f5a03aa4df1e98364e13
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
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 »

ThierryM wrote:I've found all the packages related with python-pyside and as I've Python 2 and 3, I installed them
FreeCAD relies on Python2, not Python3, so all those python3-pyside packages were unnecessary. Unless you have another program which relies on them.

I have the first two packages installed (libpyside-py3-1.2 and libshiboken-py3-1.2) even though they are Python3 related thus not used by FreeCAD (they are hard dependencies of packages which are required by FreeCAD).

After testing I found that my problem was two-fold:
  • python-pyface and python-traits seem to be required (the first depends on the second)
  • The macro won't launch if the Macro folder contains any non-ASCII characters. My folder is named Macros_FreeCAD. I tried a space, a dash, accented letters: the original macro won't start with those.
Also, it looks like rockn's version does not work all the time.

One time out of two, I'm getting this error:

Code: Select all

Traceback (most recent call last):
  File "/home/normand/Dessins/Macros_FreeCAD/start_WF.FCMacro", line 1, in <module>
    import WorkFeature
<type 'exceptions.ImportError'>: No module named WorkFeature
I should mention that after each attempted launch, I delete the "WFGui_2015_01_25.pyc" that gets created after successful launch, I close FreeCAD then launch it again.

It is quite late here and I can't think straight, I will have to continue testing in the morning.
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

it is an error path that is why it can not find the macro
I tried "C:\tmp\home\normand\Dessins\Macros_FreeCAD" and it Works ??
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,
Also, it looks like rockn's version does not work all the time.

One time out of two, I'm getting this error:

Code: Select all
Traceback (most recent call last):
File "/home/normand/Dessins/Macros_FreeCAD/start_WF.FCMacro", line 1, in <module>
import WorkFeature
<type 'exceptions.ImportError'>: No module named WorkFeature


I should mention that after each attempted launch, I delete the "WFGui_2015_01_25.pyc" that gets created after successful launch, I close FreeCAD then launch it again.
as Mario said it looks like an error of PYTHONPATH variable
I do not have the same issue but you could try to replace the 2 lines into start_WF.FCMacro by:

Code: Select all

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

try:
    # try import
    import WorkFeature
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
    
WorkFeature.WorkFeatureTab()
Let us know if it solve the issue in order I add this into GitHub

Merci
Rentlau_64
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 »

Guys,

Find a new release of WORK FEATURE MACRO at
https://github.com/Rentlau/WorkFeature.git

i include a new tool to cut objects in two pieces.
CuttingSettings.jpg
CuttingSettings.jpg (122.46 KiB) Viewed 3366 times
CuttingResult.jpg
CuttingResult.jpg (117.15 KiB) Viewed 3366 times
Please keep me inform of issues and comments
Thank you
Rentlau_64
Post Reply