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: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi rentlau welcome
rentlau_64 wrote:First I would like to Thank for original ideas and codes from :
* Javier Marti­nez Garci­a 2014
* Gui ideas from by Jonathan Wiedemann 2014
* Mario52 for bounding box codes
First thanks for your thanks

nice work
few transition code between PyQt and PySide met in my macros and operating in PySide Extra_python_modules
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.
wmayer
Founder
Posts: 20306
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MACRO:Work Feature 2014_12

Post by wmayer »

I have found a way to load the icons with the generated py file without creating a Python resource file. The trick is to write the pixmap path inside the .ui file like this.

Code: Select all

icons:WF_box.svg
Inside the macro you have to set a search path so that Qt can find the icon files on disk.

Code: Select all

ICONS_PATH = os.path.dirname(__file__) + "/Icons"
QtCore.QDir.setSearchPaths("icons", [ICONS_PATH])  # use "icons" as prefix which we used in the .ui file
That's the whole trick. However, the little downside is that when loading the .ui file into Qt designer you can't see the icons.
Attachments
WFGui.zip
(21.99 KiB) Downloaded 83 times
wmayer
Founder
Posts: 20306
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MACRO:Work Feature 2014_12

Post by wmayer »

1 - First get the absolute path where are the 2 files (MACRO directory) and the Icons directory
Then you did this manually? That might become cumbersome because your changes are lost whenever re-creating te .py file from the .ui file.
Houps for me I get an axis as illustrated here after:
Now it worked for me too.
Could you give me a FreeCAD file where it is not working or explain how to mimic your bug?
Axis=(Plane,Plane): For a directly created cube it works but when you create a rectangle sketch and pad it then it doesn't work.
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 »

Wmayer,
Axis=(Plane,Plane): For a directly created cube it works but when you create a rectangle sketch and pad it then it doesn't work.
You are rigth I have some problem with sketch and objects generated from sketch as a pad rectangle done by "part design" workbench but no issue with pad done by "part" workbench. I need to work to fix that. If you have any idea of the differences between a pad from "part design" and a pad from "part" it may help me to chase the issue. (I already localised an issue with skecths in the minMaxObjectsLimits() function)

Concerning :
That's the whole trick. However, the little downside is that when loading the .ui file into Qt designer you can't see the icons.
and
Then you did this manually? That might become cumbersome because your changes are lost whenever re-creating te .py file from the .ui file.
In order to see the icons into QT4 designer, I assume your ui file is in the same directory than Icons directory,
so I fixed the ui file to have the icons available into QT4 with:

Code: Select all

<normaloff>Icons/WF_Axes.svg</normaloff>Icons/WF_Axes.svg</iconset>
Then to transfrom the ui file in py file (handling also PySide) just use the small shell script I wrote :

Code: Select all

sh_ui2pySide WFGui_2014_12_23.ui
It will fix the path for icons like :

Code: Select all

_fromUtf8("icons:WF_Axes.svg")
Here following the new zip file:
WorkFeatures_2014_12_23.zip
(149.37 KiB) Downloaded 130 times
Have a nice day.
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
it would be interesting to put your macro in order not to lose it in the vastness of the week Macros_recipes
it will create a link to the file in the forum because it is more than 64Ko
if you are interested you can read here How to get wiki editing permissions or ask someone to do it for you

ce serait intéressant de mettre votre macro dans Macros_recipes pour ne pas le perdre dans l'immensité du forum
il faudra créer un lien sur le fichier dans le forum car il fait plus de 64ko
si vous êtes intéressé vous pouvez lire ici How to get wiki editing permissions ou demandez à quelqu’un pour le faire pour vous


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,
it would be interesting to put your macro in order not to lose it in the vastness of the week Macros_recipes
it will create a link to the file in the forum because it is more than 64Ko
if you are interested you can read here How to get wiki editing permissions or ask someone to do it for you
Thank you , yes It may be usefull for others.
Could you do it for me ?

Merci d'avance pour votre aide.
Thank you very much for your help.

"Bon Noel a tous!"

PS : Are you French (or perhaps Canadian)?
Rentlau_64
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
rentlau_64 wrote:Thank you , yes It may be usefull for others.
Could you do it for me ?
ok
rentlau_64 wrote:PS : Are you French (or perhaps Canadian)?
non pas Canadien

EDIT : your macro is it completely finished ?
votre macro est-elle complètement terminée ?
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,

My Macro is fully usable with objects but not yet with sketchs (bugs pointed by Wmayer).But I guess you can publish it now and I will update it soon with sketchs fix (I am currently working on it).
Let me know how I can update in MACRO recipes the link to the zip file and I will update it after if you want.

Thank you and Bon Noel.

Rentlau_64
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
simply place your mouse on the link, right-click and copy the link address
WorkFeature00.png
WorkFeature00.png (22.9 KiB) Viewed 2957 times
create the link to the wiki for this model

Code: Select all

[http://forum.freecadweb.org/download/file.php?id=10245 WorkFeatures_2014_12_23.zip]
[ AddressComplete space your text ]

you must request permission in writing wiki

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

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
your page Macro_WorkFeatures

and bon noël à tous Image
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.
Post Reply