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

Re: MACRO:Work Feature 2014_12

Post by mario52 »

hi
good tutorial !
Since version 0.15 there is a Global toolbar. If your toolbar is attached to this bar, it will always remain visible
see Customize_ToolsBar section (12)
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
felix
Posts: 26
Joined: Sat Nov 09, 2013 1:42 pm
Location: Madrid. Spain
Contact:

Re: MACRO:Work Feature 2014_12

Post by felix »

Ok, Thanks Mario.
Félix
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 »

Felix
felix wrote:I leave a small tutorial of the steps that I followed through if it helps someone.
Thank you felix for your small tutorial.

An easy way to install the Work Feature MACRO:
if you download the ZIP file from the Github and you unzip into let say /home/tmp/ you will end up with WorkFeature-master directory.
Just move every thing below the WorkFeature-master directory under your .FreeCAD directory in your home.
2.jpg
2.jpg (26.03 KiB) Viewed 3094 times
I will update the start_WFMacro file into Github for next release.
Meanwhile when your PYTHONPATH is not pointing at FreeCAD library just modify the file like as suggest in my last Post and as you did.

Any way thank you for your help and any comments concerning the MACRO and enhancement you would like are welcome.

Enjoy

A bientot

rentlau_64
mslonik
Posts: 40
Joined: Mon Jan 25, 2016 7:42 pm
Location: Poland
Contact:

Re: MACRO:Work Feature 2014_12

Post by mslonik »

Hi,

First of all thank you for your great work! I'm newbie to 3D modelling and FreeCAD is my first experience with this kind of tools. Your set of Work Feature macros helped me to understand approach to solving some issues especially on time of object assembly: what and where goes :-)

Unfortunately not everything is clear and / or working, so I decided to post my question here.

Work Feature version: 2015_12_16
My FreeCAD:
OS: Ubuntu 14.04.3 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6431 (Git)
Build type: None
Branch: master
Hash: 69c241ba8972b6b4b89d0a33e2e5eb4c3a7889f7
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

My problem: Please see attached file (
Exercise2.fcstd
(4.59 KiB) Downloaded 89 times
). There are two objects: Item4 and Item5. My goal is to move Item4 to desired position in XY plane:

1. Combo View: I select Item4 in Model tab, so the whole object turns green.
2. Work Features: Modif. vertical tab.
3. Work Features: Translate horizontal tab.
4. Translate: I click "Select Object(s)" button. As a result the string over button turns into "1 Object(s) selected".
5. Translate: Start tab, Starting Point: Origin.
6. Translate: End tab, Ending Point: To define: X: 50.0, Y: 150.0
7. Translate: I press Apply button.
8. Nothing happens...

Some results from Report view window in
ReportView.txt
(2.19 KiB) Downloaded 79 times
. By the way, it didn't help me to figure out what I'm making wrong.

Anyway I like very much the concept of "Translate" function. If I understand correctly, the following workflow should apply:
1. Select object(s) which is (are) to be translated.
2. Select point of the object which will be used to be translated. There are few predefined points: Origin, Base Obj., Center Obj.(s). There are also options to choose points out of predefined list: "To select" and "To define". If one would like to select one of the points in main view, "To select" option should be chosen. If one would like to define numerically starting point coordinates, "To define" option should be chosen.
3. Select end point of translation. Again there are few predefined points: Origin, Base Obj., Center Obj.(s). There are also options to choose points out of predefined list: "To select" and "To define". If one would like to select one of the points in main view, "To select" option should be chosen. If one would like to define numerically starting point coordinates, "To define" option should be chosen.
4. One should press Apply button in order to apply translation based on chosen points in point 2 and 3 or press Reset button in order to cancel selection.

This approach to translation is much more general to other translation functions available within FreeCAD, such as:
a. Combo View -> selected item -> Data tab -> Base: Placement, where only point of origin might be shifted.
b. WB: Draft -> Move, where to be successful at first "working plane" should be selected.

So my general question is: why nothing happens after following above list of events?


My second general question is about "Rotate" function. I can't understand a correct workflow for this function. My understanding:
1. Select object(s) which is (are) to be rotated.
2. Select axis of rotation. Another words: the selected line will be used to rotate the object(s) selected in point 1 around of it.
3. Select center point of rotation. Here I feel confused: should I select not only axis (point 2) but also point of rotation? Should it be alternative choice: axis of rotation or point of rotation, but not conjuction (Axis AND Center)? I don't get it. Example would definitely help me out to understand it.
4. Define angle of rotation.

The Rotate function is far away for me from other rotate function available within FreeCAD: WB: Draft -> Rotate, where:
a. it's good to specify at first "working plane",
b. one specifies point of rotation; if "working plane" was previously selected, then by default point of rotation belongs to this plane,
c. one specifies point of object to be rotated,
d. one specifies angle of rotation.
The presented workflow seems to be quite logic to newbie. To be honest I expected something similar in your macro, especially that it successfully uses concept of "working plane" and lets to select various planes.

What I actually try to gain is solution to this problem: viewtopic.php?f=3&t=13998&hilit=mslonik ... 10#p113943. Without luck so far.

Kind regards, mslonik
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 »

Mslonik,
Thank you for your comments.
I am fortunatly aways from my computers for one week vacation. :D
But i promise i will review and answer yours questions when i will be back.

Best regards

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 »

Mslonik,
1. Combo View: I select Item4 in Model tab, so the whole object turns green.
2. Work Features: Modif. vertical tab.
3. Work Features: Translate horizontal tab.
4. Translate: I click "Select Object(s)" button. As a result the string over button turns into "1 Object(s) selected".
5. Translate: Start tab, Starting Point: Origin.
6. Translate: End tab, Ending Point: To define: X: 50.0, Y: 150.0
7. Translate: I press Apply button.
8. Nothing happens...
Instead of select the object in "combo view" could you test the selection of object via the graph view?
Let me know, but anyway except the manner to select your worklow is the same i used...and it was woriking.
l will retest it.

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 »

Some results from Report view window in

 ReportView.txt(2.19 KiB) Downloaded 2 times

. By the way, it didn't help me to figure out what I'm making wrong.
The vectors and the rotations are zero ...you must have not null coordinates, means nothing really selected i presume

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 »

Anyway I like very much the concept of "Translate" function. If I understand correctly, the following workflow should apply:
1. Select object(s) which is (are) to be translated.
2. Select point of the object which will be used to be translated. There are few predefined points: Origin, Base Obj., Center Obj.(s). There are also options to choose points out of predefined list: "To select" and "To define". If one would like to select one of the points in main view, "To select" option should be chosen. If one would like to define numerically starting point coordinates, "To define" option should be chosen.
3. Select end point of translation. Again there are few predefined points: Origin, Base Obj., Center Obj.(s). There are also options to choose points out of predefined list: "To select" and "To define". If one would like to select one of the points in main view, "To select" option should be chosen. If one would like to define numerically starting point coordinates, "To define" option should be chosen.
4. One should press Apply button in order to apply translation based on chosen points in point 2 and 3 or press Reset button in order to cancel selection.

This approach to translation is much more general to other translation functions available within FreeCAD, such as:
a. Combo View -> selected item -> Data tab -> Base: Placement, where only point of origin might be shifted.
b. WB: Draft -> Move, where to be successful at first "working plane" should be selected.

So my general question is: why nothing happens after following above list of events?
This is really the way it works (and in addition you can also duplicate or multiply yours objects and translation)
and once the end points are selected you must have in addition a preview of the results. The process is only achieved when "apply" is pressed.

Make all selection in main graph view instead on combo view...
Rentlau_64
mslonik
Posts: 40
Joined: Mon Jan 25, 2016 7:42 pm
Location: Poland
Contact:

Re: MACRO:Work Feature 2014_12

Post by mslonik »

Hi Rentlau 64,

This time I was one week off... Thank you very much for your reply. I retested it and... I still can't get it running. I've recorded a screencast to be more specific what I'm doing: https://youtu.be/eZHii7h1I28

Could you please have a look into it?

Kind regards, mslonik
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 »

mslonik,
1. Combo View: I select Item4 in Model tab, so the whole object turns green.
2. Work Features: Modif. vertical tab.
3. Work Features: Translate horizontal tab.
4. Translate: I click "Select Object(s)" button. As a result the string over button turns into "1 Object(s) selected".
5. Translate: Start tab, Starting Point: Origin.
6. Translate: End tab, Ending Point: To define: X: 50.0, Y: 150.0
7. Translate: I press Apply button.
8. Nothing happens...
Just type RETURN into the "End tab, Ending Point: To define: X" Edit Line and "End tab, Ending Point: To define: Y" Edit Line in order to validate your changes and it will works;

I will try to change the behavior to be more user friendly in next commit (and will add tooltips).

Concerning:
My second general question is about "Rotate" function. I can't understand a correct workflow for this function. My understanding:
1. Select object(s) which is (are) to be rotated.
2. Select axis of rotation. Another words: the selected line will be used to rotate the object(s) selected in point 1 around of it.
3. Select center point of rotation. Here I feel confused: should I select not only axis (point 2) but also point of rotation? Should it be alternative choice: axis of rotation or point of rotation, but not conjuction (Axis AND Center)? I don't get it. Example would definitely help me out to understand it.
4. Define angle of rotation.
You always need an axis and a rotation center to define any rotation...but most of the time the rotation center belongs to the rotation axis.

Kind regards

Rentlau_62
Post Reply