MACRO:Work Feature 2014_12
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 181
- Joined: Tue Oct 21, 2014 9:47 am
- Location: Pau (France)
MACRO:Work Feature 2014_12
Hi every body!
I am just a new comer to FreeCAD, I discovered few months ago.
I Just want to thank every people involved in FreeCAD for their work, it is really a very nice and useful tool !!!
Using already existing MACROS, I rewrite a set of Work Features to help me in my FreeCAD projects, and I would like to
share with all of you, hope it can be of some help to other users.
First I would like to Thank for original ideas and codes from :
* Javier Martinez Garcia 2014
* Gui ideas from by Jonathan Wiedemann 2014
* Mario52 for bounding box codes
With the Work_Feature_2014_12 Macro you can create points, lines, planes and bounding boxes using already existing objects...
Feel free to give me any advice/comment.
Here after a flavour of the tool, showing Point tab tools: The last release of this MACRO can be found in :
https://github.com/Rentlau/WorkFeature.git
To learn how to install a MACRO :
http://freecadweb.org/wiki/index.php?ti ... tall_HowTo
And here the icon I use in the part toolbar. Have a nice end of year.
Rentlau_64
I am just a new comer to FreeCAD, I discovered few months ago.
I Just want to thank every people involved in FreeCAD for their work, it is really a very nice and useful tool !!!
Using already existing MACROS, I rewrite a set of Work Features to help me in my FreeCAD projects, and I would like to
share with all of you, hope it can be of some help to other users.
First I would like to Thank for original ideas and codes from :
* Javier Martinez Garcia 2014
* Gui ideas from by Jonathan Wiedemann 2014
* Mario52 for bounding box codes
With the Work_Feature_2014_12 Macro you can create points, lines, planes and bounding boxes using already existing objects...
Feel free to give me any advice/comment.
Here after a flavour of the tool, showing Point tab tools: The last release of this MACRO can be found in :
https://github.com/Rentlau/WorkFeature.git
To learn how to install a MACRO :
http://freecadweb.org/wiki/index.php?ti ... tall_HowTo
And here the icon I use in the part toolbar. Have a nice end of year.
Rentlau_64
- Attachments
-
- WorkFeatures_2014_12.zip
- (140.8 KiB) Downloaded 367 times
Last edited by rentlau_64 on Mon Apr 20, 2015 6:56 am, edited 1 time in total.
Re: MACRO:Work Feature 2014_12
That's pretty cool work!
Here are some comments:
Point:
* The .py file you offer is created from a .ui form and is based on PyQt. In the recent past we moved from PyQt to PySide. So, could you also offer the original .ui file please so that this can be ported to PySide if needed?
* The command Object(s) Center doesn't do what I would expect. For example, when I create a circle in the sketcher, select it and press the button it creates a point outside the circle. I would have expected to get the circle's center point
Axis:
* The command Object(s) X,Y,Z axes creates only a single axis
* The command Cylinder(s) axis doesn't seem to do anything
* There is a typo in the tooltip of Axis=(Plane, Axis): "anoher"
* The command Axis=(Plane,Plane) gives me an error when I select two perpendicular faces of a cube that share a common edge. It tells me that the planes are parallel
* The axes created by Object(s) Base Axes are a bit too long because when doing a view fit all objects are almost invisible
Plane:
* When I select a line and one of its end points the command Plane=(Point,Axis) fails. It only seems to work when using a point and line from different objects
* This also happens for the command Plane=(Point, _| Axis)
* This also happens for the command Plane=(Point, Plane)
Boxes:
* Both commands create faces instead of a box and pop ups many warning messages
Here are some comments:
Point:
* The .py file you offer is created from a .ui form and is based on PyQt. In the recent past we moved from PyQt to PySide. So, could you also offer the original .ui file please so that this can be ported to PySide if needed?
* The command Object(s) Center doesn't do what I would expect. For example, when I create a circle in the sketcher, select it and press the button it creates a point outside the circle. I would have expected to get the circle's center point
Axis:
* The command Object(s) X,Y,Z axes creates only a single axis
* The command Cylinder(s) axis doesn't seem to do anything
* There is a typo in the tooltip of Axis=(Plane, Axis): "anoher"
* The command Axis=(Plane,Plane) gives me an error when I select two perpendicular faces of a cube that share a common edge. It tells me that the planes are parallel
* The axes created by Object(s) Base Axes are a bit too long because when doing a view fit all objects are almost invisible
Plane:
* When I select a line and one of its end points the command Plane=(Point,Axis) fails. It only seems to work when using a point and line from different objects
* This also happens for the command Plane=(Point, _| Axis)
* This also happens for the command Plane=(Point, Plane)
Boxes:
* Both commands create faces instead of a box and pop ups many warning messages
Re: MACRO:Work Feature 2014_12
Hi rentlau_64 and welcome !
Your work is awesome, the Gui is really nice. Well done !
I am just wondering if you can use pyside istead of pyqt, since FreeCAD use pyside, pyqt is not needed at the installation so I think it will be more compatible with pyside.
Your work is awesome, the Gui is really nice. Well done !
I am just wondering if you can use pyside istead of pyqt, since FreeCAD use pyside, pyqt is not needed at the installation so I think it will be more compatible with pyside.
Formations - Assistance - Développement : https://freecad-france.com
-
- Posts: 181
- Joined: Tue Oct 21, 2014 9:47 am
- Location: Pau (France)
Re: MACRO:Work Feature 2014_12
wmayer,
If you can give me a link to a simple example of Pyside vs PyQt, I guess I can translate the GUI file into PySide.
Merci.
I am also working on a "cutter tool" to separate one object into 2 objects along a cut line and a plane... if you are interrested I can post it very soon; I still just need to manage the object directory tree.
Bonne fetes de fin d'année a tous!
Have a nice end of year celebrations!
Rentlau_64
Here after the ui file as requested. rockn, wmayer,* The .py file you offer is created from a .ui form and is based on PyQt. In the recent past we moved from PyQt to PySide. So, could you also offer the original .ui file please so that this can be ported to PySide if needed?
If you can give me a link to a simple example of Pyside vs PyQt, I guess I can translate the GUI file into PySide.
Merci.
wmayer,Thank you very much for your comments/help, I will try mimic the behavior you describe and correct/improve all asap.* The command Object(s) Center doesn't do what I would expect. For example, when I create a circle in the sketcher, select it and press the button it creates a point outside the circle. I would have expected to get the circle's center point
Axis:
* The command Object(s) X,Y,Z axes creates only a single axis
* The command Cylinder(s) axis doesn't seem to do anything
* There is a typo in the tooltip of Axis=(Plane, Axis): "anoher"
* The command Axis=(Plane,Plane) gives me an error when I select two perpendicular faces of a cube that share a common edge. It tells me that the planes are parallel
* The axes created by Object(s) Base Axes are a bit too long because when doing a view fit all objects are almost invisible
Plane:
* When I select a line and one of its end points the command Plane=(Point,Axis) fails. It only seems to work when using a point and line from different objects
* This also happens for the command Plane=(Point, _| Axis)
* This also happens for the command Plane=(Point, Plane)
Boxes:
* Both commands create faces instead of a box and pop ups many warning messages
I am also working on a "cutter tool" to separate one object into 2 objects along a cut line and a plane... if you are interrested I can post it very soon; I still just need to manage the object directory tree.
Bonne fetes de fin d'année a tous!
Have a nice end of year celebrations!
Rentlau_64
Re: MACRO:Work Feature 2014_12
I can't provide a good tutorial for porting from PyQt to PySide but in general it's not that complicated. But what I can tell you is that the major differences is that QString doesn't exist in PySide. You simply use Python's own string classes.
So, in order to port it you first have to generate the .py file from the .ui resource. Use the tool pyside-uic therefore.
The .ui file you uploaded has some strange paths for the icons and when loading it into Qt designer no icons are displayed. I fixed all these paths manually. However, for the generated .py file I still don't get any icons at runtime. Maybe someone else can have a look?
The fix in FCMacro is pretty simple. Replace PyQt with PySide and replace "QtCore.QString.fromUtf8" with _fromUtf8.
Attached is are the sources.
So, in order to port it you first have to generate the .py file from the .ui resource. Use the tool pyside-uic therefore.
The .ui file you uploaded has some strange paths for the icons and when loading it into Qt designer no icons are displayed. I fixed all these paths manually. However, for the generated .py file I still don't get any icons at runtime. Maybe someone else can have a look?
The fix in FCMacro is pretty simple. Replace PyQt with PySide and replace "QtCore.QString.fromUtf8" with _fromUtf8.
Attached is are the sources.
- Attachments
-
- WFGui.zip
- (22.08 KiB) Downloaded 216 times
Re: MACRO:Work Feature 2014_12
The GUI work is gorgeous! Congrats
Re: MACRO:Work Feature 2014_12
About icon paths, they don't appear for me either, but I already noticed pyside seems to sometimes do strange things with relative paths...wmayer wrote:However, for the generated .py file I still don't get any icons at runtime. Maybe someone else can have a look?
I just found I could display the icons by adding this line:
Code: Select all
QtCore.QDir.setCurrent("/home/yorik/.FreeCAD")
Re: MACRO:Work Feature 2014_12
Ok, the problem is indeed with relative paths. PyQt does this much cleverer because it generates something like this in the header section:
and then for the icons it uses
So, this way the paths are always absolute but portable. With PySide I can't see a similar way to achieve this.
Code: Select all
import os.path
ICONS_PATH = os.path.dirname(__file__)
Code: Select all
icon.addPixmap(QtGui.QPixmap(_fromUtf8(str(ICONS_PATH) + "/Icons/WF_Axes.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
-
- Posts: 181
- Joined: Tue Oct 21, 2014 9:47 am
- Location: Pau (France)
Re: MACRO:Work Feature 2014_12
I use the following :
OS: Ubuntu 12.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4252 (Git)
Branch: master
Hash: c02590c666c6dd7d33bf3cb795497311b6badadb
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 6.7.1
Yorik,
Thank you very much for your comment and thank you very much for all the work you are doing to help people.
Wmayer,
You are right, In fact the relative path from QT4 designer is alway dirty so once I generated the WFGui_2014_12.py file from the WFGui_2014_12.ui file
I fixed the relative path as follow:
1 - First get the absolute path where are the 2 files (MACRO directory) and the Icons directory
./Icons
WF_2014_12.FCMacro
WFGui_2014_12.py
2 - so into WFGui_2014_12.py add the following :
3 - update all the icons path with :
Thank you for the advices for PySide I will look at them carefuly.
I tested some of the bug comments you gave me:
some first ideas/turn around:
- The Object(s) center do not work as expected (but was not designed for sketch)...I will continue to look after to fix for sketch.
- but the Circle(s) center works for a sketch circle.
- True for "Flat" sketch objects belonging to one of the XY, XZ or YZ plane ...(same "bug" as previous as I used the center point
and it was not designed for sketch)...I will continue to look after to fix for sketch.
and a point not aligned with the line.
Have a nice day
Rentlau_64
OS: Ubuntu 12.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4252 (Git)
Branch: master
Hash: c02590c666c6dd7d33bf3cb795497311b6badadb
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 6.7.1
Yorik,
Thank you very much for your comment and thank you very much for all the work you are doing to help people.
Wmayer,
You are right, In fact the relative path from QT4 designer is alway dirty so once I generated the WFGui_2014_12.py file from the WFGui_2014_12.ui file
I fixed the relative path as follow:
1 - First get the absolute path where are the 2 files (MACRO directory) and the Icons directory
./Icons
WF_2014_12.FCMacro
WFGui_2014_12.py
2 - so into WFGui_2014_12.py add the following :
Code: Select all
import os.path
ICONS_PATH = os.path.dirname(__file__)
Code: Select all
icon.addPixmap(QtGui.QPixmap(_fromUtf8(str(ICONS_PATH) + "/Icons/WF_Axes.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
I tested some of the bug comments you gave me:
some first ideas/turn around:
OK I mimic the behavior you got:Point:
* The command Object(s) Center doesn't do what I would expect. For example, when I create a circle in the sketcher,
select it and press the button it creates a point outside the circle. I would have expected to get the circle's center point
- The Object(s) center do not work as expected (but was not designed for sketch)...I will continue to look after to fix for sketch.
- but the Circle(s) center works for a sketch circle.
OK I mimic the behavior you got:Axis:
* The command Object(s) X,Y,Z axes creates only a single axis
- True for "Flat" sketch objects belonging to one of the XY, XZ or YZ plane ...(same "bug" as previous as I used the center point
and it was not designed for sketch)...I will continue to look after to fix for sketch.
Houps for me I get an axis as illustrated here after: Could you give me a FreeCAD file where it is not working or explain how to mimic your bug?Axis:
* The command Cylinder(s) axis doesn't seem to do anything
Again for me it is working as illustrated below: Could you give me a FreeCAD file where it is not working or explain how to mimic your bug?* The command Axis=(Plane,Plane) gives me an error when I select two perpendicular faces of a cube that share a common edge. It tells me that the planes are parallel
- Yes normal you need at least 3 none aligned points to generate a plane...I will change the error message to ask to select a linePlane:
* When I select a line and one of its end points the command Plane=(Point,Axis) fails. It only seems to work when using a point and line from different objects
and a point not aligned with the line.
- Yes I will try to add the box object (but I will keep the Faces too)Boxes:
* Both commands create faces instead of a box and pop ups many warning messages
Have a nice day
Rentlau_64
Re: MACRO:Work Feature 2014_12
Love it, Thanks to everyone involved to have bring it this far! But could someone help me understand what is this "macro" supposed to mean? Is it just the current implementation for testing or is it meant to stay like that? I would sure hope it could get in as a standard feature of FreeCAD