Placement dialog -- axial motion along axis

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!
Post Reply
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Placement dialog -- axial motion along axis

Post by TheMarkster »

In the other thread on some previous work I did with the Placement dialog mario52 suggested applying the same principles to movement along the axis. I decided to open a new topic since this is a slightly different subject.

Here is what I have come up with. I added a new quantity spin box, labeled "Axial" and a new button labeled "Apply axial" these are located in the same group box ("Translation") as already containing the x, y, and z position spin boxes. (This space was actually just being wasted anyway due to the Center of Mass checkbox and Selected points button forcing this box to stretch. And if nothing else, this at least brings back some symmetry to this dialog.)

When the Apply axial button is clicked the object is moved the distance in the Axial spin box along the Axial direction. (Shift+click Apply axial to go in the opposite direction.) The Axial direction is determined by the value in the Axis box. If you are using Euler angles you will not see this Axis box, but the value in it still gets used anyway. By default the Axis direction is Z, but X, Y, Z, or a custom value may be chosen. The Selected points button can be used as a convenient means of configuring a custom axis.

In this example video I have 2 primitive cylinders some distance from one another, lined up with one another, but they have been rotated by 30 degrees about a common central point. It would be challenging to move these back together without this new feature since they are no longer aligned with the Z axis, but with the new feature it's fairly simple to do. We just need to select the 2 endpoints along the seam of the cylinder we want to move, click Selected points to create a new custom axis, then move it along that custom axis.

phpBB [video]


You might have noticed I selected the 2 points, then cleared and reselected them. This is because the order of selection defines the direction and I had inadvertently selected them in the wrong order at first. The second point selected becomes the direction of motion (relative to the first point selected). But this is not particularly important since you can always Shift+Click the Apply axial button to move in the opposite direction if you get it wrong on the first try (or you can put a negative value in the Axial spin box).

Behind the scenes, the only thing Apply axial does is update the X, Y, and Z Translation values, then call onPlacementChanged() to signal the placement has changed.

https://github.com/FreeCAD/FreeCAD/pull/1693
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Placement dialog -- axial motion along axis

Post by chrisb »

Looks useful!
Is it possible to add a mouse-over short help on the button telling about the shift key? Something like "Hold Shift key while clicking to move to opposite direction". Without that newbies or others users might never find this.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: Placement dialog -- axial motion along axis

Post by mario52 »

hi

many thanks i think now the placement dialog is totally complete

thanks
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.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Placement dialog -- axial motion along axis

Post by TheMarkster »

chrisb wrote: Thu Sep 27, 2018 5:24 am Looks useful!
Is it possible to add a mouse-over short help on the button telling about the shift key? Something like "Hold Shift key while clicking to move to opposite direction". Without that newbies or others users might never find this.
This can be done very easily. Should be short as possible, I think. Long tool tips can be annoying. How about:

"Shift click for opposite direction"?
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Placement dialog -- axial motion along axis

Post by TheMarkster »

I've done a bit more work with the placement dialog, adding the capability to select 3 points instead of just 1 or 2. This gives us some really neat aligning possibilities. When 3 points are selected and the Selected points button clicked the first point selected becomes the center of rotation and the other 2 points are used to determine the plane defined by the 3 points and the normal vector at the center point. Some additional information is provided in the report view when either 2 or 3 points are selected. If 2 points were selected the distance between them is given (in addition to the custom axis created along that vector). When 3 points are selected the angle between the 2 (non-central) points is given, along with the distance between them. This information can be used to align the objects.

In the video below I demonstrate using these new features to align 2 bodies and a Part cube.

phpBB [video]
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Placement dialog -- axial motion along axis

Post by chrisb »

I liked the previous improvements very much, they are straight forward. However, I have to confess the new functions shown in the video are a too much for my taste. Without further explanations it is difficult to follow what's going on.
There is no doubt, that the functions are useful, but I would expect them rather in a workbench - e.g. Manipulator WB - than in the Placement dialog.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Placement dialog -- axial motion along axis

Post by TheMarkster »

chrisb wrote: Mon Oct 01, 2018 10:34 pm I liked the previous improvements very much, they are straight forward. However, I have to confess the new functions shown in the video are a too much for my taste. Without further explanations it is difficult to follow what's going on.
There is no doubt, that the functions are useful, but I would expect them rather in a workbench - e.g. Manipulator WB - than in the Placement dialog.
I'll need to update the wiki for sure. I was looking at it today, and I saw the Use center of mass checkbox was also not yet documented.

It's really not all that complex. The Apply axial button moves the object in the direction of the current Axis by the amount in the Axial spinbox. A custom axis can be created by selecting either 2 or 3 points in the 3d view and clicking the Selected points button. If 2 points are selected the axis is the direction from one point to the other. If 3 points are selected the axis is the direction that is normal to the plane defined by those 3 points. The center of rotation is the first selected point in the case of 3 points selected, the midpoint in the case of 2 points selected, and of course the point selected in the case of 1 point selected.

With 2 points we calculate the distance between them and provide that information in the report view. With 3 points we calculate and show the distance from the 2nd point to the 3rd point and the angle between them.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Placement dialog -- axial motion along axis

Post by chrisb »

Thanks for the explanation.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply