datum plane manual size

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!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

datum plane manual size

Post by Zolko »

Hello,

Datum Planes (PartDesign::Plane) can have either automatic dimensions, or manually set dimensions, for the 3D viewer. In this latter case, there are 2 properties that set this dimension: Length and Width. When setting the dimension manually, the plane's visual representation becomes a rectangle, with 1 corner always the 0,0 origin of the plane. Thus, when drawing a circle for example, the circle is outside the rectangle.

It is possible to manually set the datum plane's size and position by dragging its edges in other CAD programs. While I don't ask for such feature, it would be better that the datum plane is centered around it's origin, meaning that it should extend from -Length/2 to Length/2, and from -Width/2 to Width/2.

This is defined in ~/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp, line #134 setExtents(double l, double w):

Code: Select all

    pCoords->point.set1Value(0, l, w, 0);
    pCoords->point.set1Value(1, 0, w, 0);
    pCoords->point.set1Value(2, 0, 0, 0);
    pCoords->point.set1Value(3, l, 0, 0);
By changing this to :

Code: Select all

    pCoords->point.set1Value(0, l/2, w/2, 0);
    pCoords->point.set1Value(1, -l/2, w/2, 0);
    pCoords->point.set1Value(2, -l/2, -w/2, 0);
    pCoords->point.set1Value(3, l/2, -w/2, 0);

The Datum Plane should be centered. Can I make a PR for that ? Is there a very strong reason to have the current solution ?
try the Assembly4 workbench for FreCAD — tutorials here and here
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: datum plane manual size

Post by vocx »

Zolko wrote: Sun Dec 15, 2019 6:28 pm Hello,

Datum Planes (PartDesign::Plane) can have either automatic dimensions, or manually set dimensions, for the 3D viewer. ...


The Datum Plane should be centered. Can I make a PR for that ? Is there a very strong reason to have the current solution ?
I don't oppose the change that you propose, I just want to mention that the plane does center automatically around the origin when you attach it to a coordinate system, like the PartDesign Body's Origin. However, as I tested a few things, it seems that the automatic positioning doesn't work in all cases, like sometimes it is buggy and stays where it previously was. You need to change a value of a position to trigger the update.

I also noticed an unrelated issue, if I saved a plane with certain dimensions, after re-opening the file, the dimension would be lost. Say that I specified 40 mm and 40 mm in width and length, after re-opening the file it would be 40 mm and 60 mm. I'm not sure if this is entirely repeatable.

So, my advice before going through with this pull request would be to test different combinations:
* with attachment, automatic and manual dimensions, and changing the Base placement and Attachment offset.
* without attachment, automatic and manual dimension, and changing the Base placement.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Veteran
Posts: 54302
Joined: Tue Mar 17, 2015 9:14 am

Re: datum plane manual size

Post by chrisb »

In manual ResizeMode DatumPlanes behave here always as zolko described. Even if the DatumPlane is attached to e.g. XY-plane the DatumPlane is shown with a corner in (0,0,0).
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: datum plane manual size

Post by RatonLaveur »

Hello,

I agree with the suggestion, a more consistent datum plane behaviour is definitely a worthwhile endeavour.

here I take the liberty of adding this link https://forum.freecadweb.org/viewtopic. ... 0&start=90 from the Part Design Development forum. I think any kind and smart soul tinkering with Datum Planes would benefit from the context of all other Datum Plane "requests" (more like wishes/conversations).

I like to quote DeepSOIC on the matter who summed up very well the result of pages and pages of discussion.
DeepSOIC wrote: Fri Aug 30, 2019 4:52 pm So, for a potential developer (me, possibly), here's a list of things to do.
* add CS marker to datum planes, at least for the time it is being attached.
(that way, it will be easier to understand what roll,pitch and yaw do)
* (if possible) make datum plane's top and bottom look different.
* new attachment mode for sketches, to treat a plane as a plane.
* make the new attachment mode default for sketches made on datum planes.
* an option in preferences to change it back, for those who can't adapt to use LCS instead of a datum plane.
* make it easy to attach sketches to LCS object in PartDesign.
Does that sound good?
Of course, to that list we should now add "more consistent origin attachment behavior and extension of the representation of the plane".

The whole idea if summed up by me is:
- Make the X Y Z LCS of the DatumPlane visible during creation/attachment to make the user aware of the plane orientation.
- Make Top and Bottom of the plane visible somehow to better know where a sketch will appear (this would allow the user to not have to play constantly with "reverse mappings" which do have their own problems.

I believe these points link quite nicely to Zolko's original request above, since they all boil down to an easier and more consistent attachment of planes.

Cheers Gents,
User avatar
adrianinsaval
Veteran
Posts: 5553
Joined: Thu Apr 05, 2018 5:15 pm

Re: datum plane manual size

Post by adrianinsaval »

RatonLaveur wrote: Mon Dec 16, 2019 11:42 am
DeepSOIC wrote: Fri Aug 30, 2019 4:52 pm * (if possible) make datum plane's top and bottom look different.
- Make Top and Bottom of the plane visible somehow to better know where a sketch will appear (this would allow the user to not have to play constantly with "reverse mappings" which do have their own problems.
My understanding is that if the LCS is displayed then the normal vector (Z axis) would give you the orientation, so there's no real need for different colors or anything like that. I agree with everything else, it would be more intuitive.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: datum plane manual size

Post by Zolko »

DeepSOIC wrote: Fri Aug 30, 2019 4:52 pm So, for a potential developer (me, possibly), here's a list of things to do.
* add CS marker to datum planes, at least for the time it is being attached.
* (if possible) make datum plane's top and bottom look different.
* new attachment mode for sketches, to treat a plane as a plane.
* make the new attachment mode default for sketches made on datum planes.
* an option in preferences to change it back, for those who can't adapt to use LCS instead of a datum plane.
* make it easy to attach sketches to LCS object in PartDesign.
RatonLaveur wrote: Mon Dec 16, 2019 11:42 am I believe these points link quite nicely to Zolko's original request above, since they all boil down to an easier and more consistent attachment of planes.
these things don't have not the same level of complexity: my proposal is a trivial minor change in the visual representation of a datum plane, it doesn't need any new tricks, and it shouldn't make any core difference in FreeCAD. In other words, it could be accepted without any risks of regressions, it's a purely visual artefact.

The other proposals, while more elegant, are also much more intrusive, and would need much more time to code and test.
try the Assembly4 workbench for FreCAD — tutorials here and here
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: datum plane manual size

Post by RatonLaveur »

Oh Zolko, we agree on this one. Except the visualization thing.
I simply felt like trying to keep similar concepts together so that whoever is tackling your request also has this in mind. Perhaps it is misguided however, to give too much information. Maybe I'm being counterproductive.

One thing is for sure if you want your datum plane to be precentered and easily scalable visually, I feel like adding the positive Z axis visualization doesn't hurt either ;) either way your request sounds great.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: datum plane manual size

Post by Zolko »

Zolko wrote: Sun Dec 15, 2019 6:28 pm This is defined in ~/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp, line #134 setExtents(double l, double w):

Code: Select all

    pCoords->point.set1Value(0, l, w, 0);
    pCoords->point.set1Value(1, 0, w, 0);
    pCoords->point.set1Value(2, 0, 0, 0);
    pCoords->point.set1Value(3, l, 0, 0);
By changing this to :

Code: Select all

    pCoords->point.set1Value(0, l/2, w/2, 0);
    pCoords->point.set1Value(1, -l/2, w/2, 0);
    pCoords->point.set1Value(2, -l/2, -w/2, 0);
    pCoords->point.set1Value(3, l/2, -w/2, 0);
can I make this PR ?

Also: wouldn't it be nice if datum axes could also have a manual size ? Uodate would be needed for PartDesign::DatumLine.h, DatumLine.cpp and ViewProviderDatumLine.cpp. Thus, an axis could have a finite length. I think this would make the use of datum objects more widespread.
try the Assembly4 workbench for FreCAD — tutorials here and here
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: datum plane manual size

Post by vocx »

Zolko wrote: Fri Dec 20, 2019 7:40 am can I make this PR ?
You don't have to ask. You can just do it. If it's rejected then maybe you'll get feedback on why it wasn't accepted.

Linking to this discussion in the pull request is essential so that the admins know that it's been discussed, and agreed upon by the community.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Veteran
Posts: 54302
Joined: Tue Mar 17, 2015 9:14 am

Re: datum plane manual size

Post by chrisb »

vocx wrote: Sat Dec 21, 2019 12:24 am
Zolko wrote: Fri Dec 20, 2019 7:40 am can I make this PR ?
You don't have to ask. You can just do it.
Formally you are right, but I think it is good habit to ask first in the community before making a pull request.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply