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: 436
Joined: Wed Sep 03, 2014 12:15 pm

feature req: placement - rotate part around its midpoint

Post by herrdeh »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

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).
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herrdeh
Posts: 436
Joined: Wed Sep 03, 2014 12:15 pm

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

Post by herrdeh »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
herrdeh
Posts: 436
Joined: Wed Sep 03, 2014 12:15 pm

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

Post by herrdeh »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

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

Post by easyw-fc »

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
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb »

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.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mario52
Veteran
Posts: 4692
Joined: Wed May 16, 2012 2:13 pm

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

Post by mario52 »

hi
not totally finished
Macro_Rotate_To_Point00.gif
Macro_Rotate_To_Point00.gif (917.94 KiB) Viewed 2889 times
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
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

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

Post by easyw-fc »

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