[PR #3888] extend pad direction feature

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[PR #3888] extend pad direction feature

Post by uwestoehr »

During the development of the feature to specify the pad direction, there were 2 wishes that I implement with this PR: https://github.com/FreeCAD/FreeCAD/pull/3888

1. have an option to measure the pad length not always along the sketch normal
Solution:
length along
length along
1qLlOFtwyS.gif (112.52 KiB) Viewed 2699 times

2. a possibility to select an edge from the model and use its direction as pad direction
Solution:
edge selection
edge selection
S831pDkrVc.gif (254.45 KiB) Viewed 2699 times
As you can see one can select an edge also from another part than the pad (in the example the box is in another part).

I implemented a third feature:
3. button to quickly reverse the direction
In the screencast for 2. you see after the selection of "Box:Edge12" that the pad direction is towards the inner of the hexagon and the pad is therefore inside it. Therefor a button is helpful to reverse the direction since when selecting an edge you cannot know in advance what of its two endpoints is its start point. The button helps in my opinion also if no edge is selected.
Last edited by uwestoehr on Wed Sep 23, 2020 12:46 am, edited 1 time in total.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR #3888] extend pad direction feature

Post by chrisb »

Is "Reverse Direction" different from the Reversed checkbox?

Edit: And another question: Is the direction following an edge parametric?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR #3888] extend pad direction feature

Post by uwestoehr »

chrisb wrote: Tue Sep 22, 2020 11:36 pm Is "Reverse Direction" different from the Reversed checkbox?
Yes, it updates the direction vector and is always visible, also for 2 dimensions. Moreover it does not change the "Reversed" property.

At first I thought I should extend the existing Reverse checkbox but I think the dialog shoudl always show the correct direction the pad is extruded at, not the opposite direction, in case one used the Reverse property.
I cannot get rid of the Reverse property because this would break existing documents but I could get rid of the Reverse checkbox in the dialog. Personally, I would do this.

Opinions?
Is the direction following an edge parametric?
No, it is for now exactly the same as when you select a face for the up to face feature. It could maybe made parametric in future, but not for this PR because I already changed a lot and prefer several steps to keep the overview.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR #3888] extend pad direction feature

Post by uwestoehr »

uwestoehr wrote: Tue Sep 22, 2020 11:58 pm I cannot get rid of the Reverse property because this would break existing documents but I could get rid of the Reverse checkbox in the dialog. Personally, I would do this.
This is now done. This fixes also the issue mentioned by users: when there are two dimensions, reversal should be allowed. This is now the case:

gyM1vKyh1F.gif
gyM1vKyh1F.gif (75.41 KiB) Viewed 2651 times

I only see one thing so far that could be improved: When it is up to face and the direction is orthogonal to the face's normal vector, maybe I should make the background color of the field name edit red and change its tooltip writing that the face is orthogonal to the direction.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR #3888] extend pad direction feature

Post by chrisb »

Thanks so far for the pad extension!
uwestoehr wrote: Tue Sep 22, 2020 11:58 pm
Is the direction following an edge parametric?
No, it is for now exactly the same as when you select a face for the up to face feature.
Up to face is parametric. So if following the direction is similar, maybe it's not too hard to implement.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR #3888] extend pad direction feature

Post by uwestoehr »

chrisb wrote: Wed Sep 23, 2020 6:05 am Up to face is parametric. So if following the direction is similar, maybe it's not too hard to implement.
But then the edge should be too already. Could you please attach a simple test case with a parametric face that I can proper test it?
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR #3888] extend pad direction feature

Post by chrisb »

Change in the attached file the 50mm constraint in Sketch to 100mm and see how the length of Pad001 is adapted.
Attachments
upToFaceParametric.FCStd
(12.99 KiB) Downloaded 63 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [PR #3888] extend pad direction feature

Post by uwestoehr »

chrisb wrote: Wed Sep 23, 2020 10:37 am Change in the attached file the 50mm constraint in Sketch to 100mm and see how the length of Pad001 is adapted.
Thanks. Now I understand what you mean.
So the answer is yes, the edge you select for the direction is as parametric as every other shape (like the face in your example).
The toponaming issue can of course affect the selection, but this applied for the existing face selection too.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [PR #3888] extend pad direction feature

Post by wmayer »

First of all this PR causes all travis builds to fail because it breaks the unit tests for pad.
1. have an option to measure the pad length not always along the sketch normal
I don't understand its purpose (and the property AlongCustomVector) and its tooltip doesn't enlighten me. We already have UseCustomVector so why is another property needed?
And each time I toggle the "Use custom direction" box it automatically sets the check mark of "Along sketch normal".
2. a possibility to select an edge from the model and use its direction as pad direction
Is having an additional link property to an edge to control the pad direction really what we want to have? Or wouldn't it be sufficient to get the direction of the edge and fill the custom direction fields by using an expression? With the current development version it's already possible to do exactly this but it's a bit difficult to do it manually. In the property editor you select the Direction property and set e.g. this expression:

Code: Select all

Sketch001.Shape.Edge1.Vertex1.Point - Sketch001.Shape.Edge1.Vertex2.Point
As you can see one can select an edge also from another part than the pad (in the example the box is in another part).
It must not even be allowed to select an edge of the pad, or otherwise you will break the model with a dependency to itself.
3. button to quickly reverse the direction
In the screencast for 2. you see after the selection of "Box:Edge12" that the pad direction is towards the inner of the hexagon and the pad is therefore inside it. Therefor a button is helpful to reverse the direction since when selecting an edge you cannot know in advance what of its two endpoints is its start point. The button helps in my opinion also if no edge is selected.
In the current PR the "Reverse direction" button has replaced the "Reversed" check box. This makes no sense to me because it's effectively not possible any more to toggle the Reversed property of the pad feature. And if an expression for Direction is set the "Reverse direction" button does not even work.

I played with the pad dialog a bit and by selecting an edge I got it working only once. After pressing several buttons it stopped working after re-selecting an edge. The pad direction is always normal to the sketch plane. I think by adding two more properties it easily happens that the pad is in an consistent state.
I cannot get rid of the Reverse property because this would break existing documents but I could get rid of the Reverse checkbox in the dialog.
The Reverse property is now even more useful since the Direction property has been added if e.g. an expression is set to the latter.
Up to face is parametric. So if following the direction is similar, maybe it's not too hard to implement.
By using an expression it is parametric.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [PR #3888] extend pad direction feature

Post by DeepSOIC »

wmayer wrote: Wed Sep 23, 2020 10:59 am Is having an additional link property to an edge to control the pad direction really what we want to have?
In anticipation of proper topological naming, i think yes, we need a link.
Link property is going to be properly supported, while the expression might not be.
Post Reply