feature req: placement - rotate part around its midpoint

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
herrdeh
Posts: 351
Joined: Wed Sep 03, 2014 12:15 pm

feature req: placement - rotate part around its midpoint

Postby herrdeh » Sat Feb 25, 2017 7:27 am

When I put my parts into their position, often they have to be rotated by a certain degree. But when I'm using placement, it will by default rotate around the origin of the whole project. When the project is a little bigger, this is not a good thing as the part will completely be moved out of its position.

To make life easier (that, what we're using CAD, true?), I'd like two features:

* a context menu entry (RMB) "copy coordinates of mouse pointer to clipboard" - which can be pasted to the placement dialogue in the next step, and
* a "rotate selected item around its midpoint" button in the placement dialogue, which will automatically calculate the midpoint and insert it into the placement dialogue. This button can be deactivated in cases where the midpoint calculation is too complicated, but there is no problem with cylinders, cubes, balls etc.

Cheers,
Wolf
chrisb
Posts: 30740
Joined: Tue Mar 17, 2015 9:14 am

Re: reature req: placement - rotate part around its midpont

Postby chrisb » Sat Feb 25, 2017 10:20 am

If the part is not symmetric, do you want the center of mass as midpoint? (And do you mind correcting the typo in the title? It makes it easier to find).
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herrdeh
Posts: 351
Joined: Wed Sep 03, 2014 12:15 pm

Re: feature req: placement - rotate part around its midpoint

Postby herrdeh » Sat Feb 25, 2017 11:05 pm

If the part is not symmetric, do you want the center of mass as midpoint?
Of course, this is a good idea. But I suppose, this needs more code lines than just finding the midpoint, and is less helpful at the same time.
Therefore, this feature could go to prio #2 for my taste,
chrisb
Posts: 30740
Joined: Tue Mar 17, 2015 9:14 am

Re: feature req: placement - rotate part around its midpoint

Postby chrisb » Sun Feb 26, 2017 5:59 am

herrdeh wrote:
If the part is not symmetric, do you want the center of mass as midpoint?
Of course, this is a good idea. But I suppose, this needs more code lines than just finding the midpoint, and is less helpful at the same time.
Therefore, this feature could go to prio #2 for my taste,
Which midpoint do you mean then, that is easy to find? I have seen, that there is a CenterOfMass function, although I couldn't get it working due to some type error.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herrdeh
Posts: 351
Joined: Wed Sep 03, 2014 12:15 pm

Re: feature req: placement - rotate part around its midpoint

Postby herrdeh » Sun Feb 26, 2017 9:23 am

I think, at this point "finding the midpoint of an irregular object", it's a bit of guessing what the particular user means in that situation. Therefore, it might not be worth to but too much effort into it..

The mass midpoint is a good idea, another approach could be to take the mass midpoints of the 3 projected surfaces in x-, y- and z-direction. Meaning: create a plane of constant thickness of each projection and take that mass midpoint.

But I think, the user will not expect the machine to guess his thoughts...

Thanks for refelcting on this issue!
W
chrisb
Posts: 30740
Joined: Tue Mar 17, 2015 9:14 am

Re: feature req: placement - rotate part around its midpoint

Postby chrisb » Sun Feb 26, 2017 10:48 am

What you suggest seems to be sensible as well and I think it is not too hard to accomplish: In each dimension X, Y, Z it is the midpoint of the enclosing rectangle, but of course it is more to do than nothing.
I am afraid there is some effort necessary anyway, albeit to decide if a solid has a regular shape or not.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
easyw-fc
Posts: 2928
Joined: Thu Jul 09, 2015 9:34 am

Re: feature req: placement - rotate part around its midpoint

Postby easyw-fc » Sun Feb 26, 2017 3:02 pm

chrisb wrote: Which midpoint do you mean then, that is easy to find? I have seen, that there is a CenterOfMass function, although I couldn't get it working due to some type error.
it is possible to use centerofmass or bounding box
I use both on my macro for aligning parts
Macro_Center_Align_Objects_with_Faces_or_Edges on Macro recipes
Image
chrisb
Posts: 30740
Joined: Tue Mar 17, 2015 9:14 am

Re: feature req: placement - rotate part around its midpoint

Postby chrisb » Sun Feb 26, 2017 5:22 pm

Thanks for sharing the code. It was now easy to find my error: I had called the non existent function CenterOfMass() and didn't use the attribute.
You need at least FreeCAD 0.19.23300 to edit my current sketches.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mario52
Posts: 3308
Joined: Wed May 16, 2012 2:13 pm

Re: feature req: placement - rotate part around its midpoint

Postby mario52 » Fri Mar 03, 2017 3:19 pm

hi
not totally finished
Macro_Rotate_To_Point00.gif
Macro_Rotate_To_Point00.gif (917.94 KiB) Viewed 1922 times
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
easyw-fc
Posts: 2928
Joined: Thu Jul 09, 2015 9:34 am

Re: feature req: placement - rotate part around its midpoint

Postby easyw-fc » Fri Mar 03, 2017 5:56 pm

mario52 wrote:hi
not totally finished
Macro_Rotate_To_Point00.gif
mario
Hi Mario, very nice!
Would it nice/possible to add also rotate on Edge? :D
Maurice