Centerline between lines not working

Discussions about the development of the TechDraw workbench
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:

Centerline between lines not working

Post by uwestoehr »

I don't get a centerline between lines:

- take this example file, select the vier "Right001":
- select two lines and try to insert a centerline (as also done in the screencast below)

result: nothing happens and you get this warning:

Code: Select all

CenterLineBuilder - endpoints are equal:  (0.250,0.000,0.000) 
CenterLineBuilder - check V/H/A and/or Flip parameters
Also a centerlines between points is strange:
- select 2 points as in the screencast below

result: there will be a centerline, but is not in 90° to the 2 selected points. But then it is no centerline, or do I have a thinko here?
screencast
screencast
vbKIRxFTim.gif (145.44 KiB) Viewed 2842 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20110 (Git)
Build type: Release
Branch: master
Hash: 8401b563dadd68707b13ccff92f067b1469fbd2a
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Attachments
TD-Cube.FCStd
testfile
(52.14 KiB) Downloaded 67 times
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Centerline between lines not working

Post by chrisb »

Concerning lines: You did not show us the corresponding panel, but I bet you chose type Vertical - which is not possible for the selection. Centerline between lines works here if I choose type Horizontal or Aligned.

Centerline between points of type vertical is as shown indeed not vertical. Type Aligned works as expected.


Animated gifs are difficult to view. Could you use a screenscaster which includes the time so that it is possible to see where it starts?
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: Centerline between lines not working

Post by uwestoehr »

chrisb wrote: Tue Mar 17, 2020 7:12 pm Concerning lines: You did not show us the corresponding panel, but I bet you chose type Vertical - which is not possible for the selection. Centerline between lines works here if I choose type Horizontal or Aligned.
Sorry, see now a screenshot:
FreeCAD_VaHen5YFyN.png
FreeCAD_VaHen5YFyN.png (121.81 KiB) Viewed 2824 times

So I selected 2 horizontal lines but and the task dialog proposes vertical centerline.

There are 3 issues:
- the task dialog always proposes a vertical centerline, also when I select 2 horizontal lines -> then it must propose horizontal and grey-out the vertical option because vertical is impossible in this case
- the option "Flip ends" should be a checkbox not a radio button and this option is buggy -> not clear what it does
- the option Aligned does not work for faces. You get the error:

Code: Select all

CL::calcEndPoints - aligned is not applicable to Face center lines
Last edited by uwestoehr on Tue Mar 17, 2020 11:50 pm, edited 2 times in total.
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Centerline between lines not working

Post by chrisb »

uwestoehr wrote: Tue Mar 17, 2020 7:24 pm - the task dialog always proposes a vertical centerline, also when I select 2 horizontal lines -> then it must propose horizontal and grey-out the vertical option because vertical is impossible in this case
grey out is too restrictive for my taste. If the user decides so, he may have good reasons, consider the possibility of turning the view. Proposing horizontal is a good idea, if it is a "must" should be discussed.
- the option Aligned does nothing -> should be removed for FC 0.19 (can be added later)
The option "Aligned" works great here and should not be removed. Try using that option and turn the view.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20052 (Git)
Build type: Release
Branch: master
Hash: 6291921e9abe737e4440ff5814ca58547defadef
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
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: Centerline between lines not working

Post by uwestoehr »

chrisb wrote: Tue Mar 17, 2020 10:10 pm grey out is too restrictive for my taste. If the user decides so, he may have good reasons, consider the possibility of turning the view.
The point is that even if you want this, you cannot do this. You get no line, only an error message in the console. -> a good UI does not allow what is not allowed.
The option "Aligned" works great here and should not be removed. Try using that option and turn the view.
I see now. The issue is that its tooltip says it is not implemented.

I'll have a look to fix some UI issues.
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: Centerline between lines not working

Post by chrisb »

uwestoehr wrote: Tue Mar 17, 2020 10:50 pm The point is that even if you want this, you cannot do this. You get no line, only an error message in the console. -> a good UI does not allow what is not allowed.
So this should be fixed then?

BTW: I was not able to remove an existing centerline. Is this possible?
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: Centerline between lines not working

Post by uwestoehr »

chrisb wrote: Tue Mar 17, 2020 10:55 pm So this should be fixed then?
Sure.
BTW: I was not able to remove an existing centerline. Is this possible?
Yes:
- select the line
- the use the eraser toolbar icon to erase the line. See also the corresponding Wiki page.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Centerline between lines not working

Post by uwestoehr »

Here is a PR: https://github.com/FreeCAD/FreeCAD/pull/3202
that fixes some of the issues.

What is not addressed by the PR is:
- handling of option vertical if both selected lines are horizontal and vice versa
- fixing the Flip sides option -> I'll open a separate thread
run_the_race
Posts: 161
Joined: Mon Feb 01, 2021 7:22 pm

Re: Centerline between lines not working

Post by run_the_race »

To chime in with a newbs perspective, In order to use centerlines between lines, you have to understand how freeCAD implements its algorithm, and pushes things we naturally take for granted to the user.

I have used center lines in other programs without even thinking about it, but I could not get centerline between lines to work in freeCAD, until reading this thread and trying the `flip ends` option. Which does not stand out as an important option if you are just using the sw. Every centerline I have drawn so far appeared to brokenly do nothing (vert/horz/aligned did not matter), until I learnt to check flip edges.

In the following example, I think cause the diagonals intersect each other, the length of the center line seems to be 0. And for some reason this is just how it *always* is for me unless I select `flip ends`.
centerlinelines.png
centerlinelines.png (49.7 KiB) Viewed 2602 times
I recommend checking that if the centerline would be zero length, that it tries to flip ends automatically instead of just appearing to do nothing. Additionally it could determine the average gradient of both user selected lines, and the gradients of the two ways of drawing the center lines, and the default option is the one where the gradient is the closest. The `Flip ends` is then the less obvious rare case way (where gradient is furthest from the average gradients of the lines).
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Centerline between lines not working

Post by uwestoehr »

run_the_race wrote: Sat Apr 24, 2021 9:35 am In the following example, I think cause the diagonals intersect each other, the length of the center line seems to be 0. And for some reason this is just how it *always* is for me unless I select `flip ends`.
I don't understand what you mean.
The centerline feature misses a preview. This is on my ToDo list and annoys me too.
For now you select the two lines and then have to take care of the orientation. Then close the dialog with OK. First then you will see the centerline. This annoying because editing the existing centerline works different as it is no object in the model tree. However when editing the centerlines, you will then see the changes in the dialog immediately.

I recommend checking that if the centerline would be zero length, that it tries to flip ends automatically instead of just appearing to do nothing.
Good point. When I find time, I will implement this too.
Post Reply