Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dimension lines didn't change layer when text alignment is horizontal, fixes #1396 #1409

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

melwyncarlo
Copy link
Contributor

BOTH the bugs mentioned in this issue have been resolved.

@jbergengh
Copy link

jbergengh commented Nov 22, 2021

The issue appears to be fixed for all dimension types except Aligned dimensions.
In this screenshot, the dimensions on the first row were created on the Green layer.
On the second row they were created on Green and moved to Red.
You can see all were moved but the dimension line on the Aligned dimension was not moved.

Also, if I go into Options - Current Drawing Preferences - and toggle Text Alignment back and forth between Aligned and Horizontal, most of the dimension lines are still green.

Almost there!
Thank you Melwyn.
Aligned

@jbergengh
Copy link

Regarding the other bug (Horizontal text not supported in angular dimensions).
The dimension lines should have a gap around the numerical value instead of overwriting the text.
Similar to the horizontal and vertical dimensions in this screenshot.
angular gap

@jbergengh
Copy link

Question: Please excuse my ignorance, I am a noob at github.
I noticed the version number of LibreCAD when testing this fix was 2.2.0-alpha.
Shouldn't it be 2.2.0-rc2 (the later version than alpha?)

@lordofbikes
Copy link
Member

@jbergengh the version number is created from git tags. I assume that -alpha is the default when no tags are found.
You have to add --tags to your git pull command to fetch tags.
When you use sources from a zip download, you have no tags, but this is no problem.
The feature is there, when you have the right sources.

@melwyncarlo
Copy link
Contributor Author

With regards to the first bug, it shouldn't happen if you ensure that the Use current layer checkbox is selected.

By default, I have a habit of keeping both the checkboxes selected while performing such an operation.

To solve it, I first have to understand the difference between the two options. I have a feeling that both the checkboxes are redundant, because if the entity is moved/copied within the same layer, it should inherit the current layer's attributes, and if it is moved to a new layer, then it should inherit that new layer's attributes.

@jbergengh
Copy link

jbergengh commented Nov 23, 2021

@melwyncarlo here is a video that I hope will help diagnose the bug.
https://youtu.be/KQD08u2uqwI
(For some reason clicking the link may not work but copy paste the url works)

@melwyncarlo
Copy link
Contributor Author

The issue appears to be fixed for all dimension types except Aligned dimensions. In this screenshot, the dimensions on the first row were created on the Green layer. On the second row they were created on Green and moved to Red. You can see all were moved but the dimension line on the Aligned dimension was not moved.

The issue was that the dimensions were not being updated post-transferring them onto a new layer.
It's sorted now! 😃

@melwyncarlo
Copy link
Contributor Author

melwyncarlo commented Nov 23, 2021

Regarding the other bug (Horizontal text not supported in angular dimensions). The dimension lines should have a gap around the numerical value instead of overwriting the text. Similar to the horizontal and vertical dimensions in this screenshot.

I've sorted out this as well, in #1427.

@jbergengh
Copy link

@melwyncarlo I tested #1409 and it is working perfectly now. Thank you very much. Excellent job.

@melwyncarlo
Copy link
Contributor Author

@jbergengh You're welcome, and thank you very much! 😃

@jbergengh
Copy link

jbergengh commented Nov 24, 2021

I found another case where dimension lines on dimensions with horizontal text are not getting updated.
Create some dimensions with horizontal text, then go to Options - Current Drawing Preferences - and change any of the dimension settings, such as Linear precision, Arrow size, text height, or anything else that would cause the dimension to be updated and re-drawn. Same condition as before - the dimension line does not update. Maybe this issue more widespread than we thought.

To reproduce:
Start LibreCAD (I am testing Task_4)
Set text alignment to Horizontal in Current drawing preferences
Create a layer with color=red
Create a layer with color=green
Confirm green layer is active
Draw some dimensions on the green layer
Make the Red layer the active layer
In Current drawing preferences, change any of the dimension settings listed above.
Dimension lines turn red while all else remains green
Expected behavior: dimension lines should not turn red. Dimension is on green layer. Nothing should turn red.
Make green layer active
Select dimension and drag to another spot on the screen.
The red dimension lines turn back to green. That's good as dimension should be on green layer.
Make red layer active.
Select dimension and drag to another spot on the screen
Dimension line turns red while remainder of dimension remains green.
Expected behavior: Entire Dimension should have remained green. Dragging dimension should not change it's layers or colors.

@jbergengh
Copy link

jbergengh commented Nov 24, 2021

Also draw dimension on green layer, change active layer to red, delete the dimension and undo the delete.
Dimension line comes back as red.
This issue could be very widespread and maybe not worth the effort to track it all down.
What do you think? Would you like me to keep looking for more?

@melwyncarlo
Copy link
Contributor Author

This problem arose because the dimension lines created in the case of horizontal alignment were different from that of the aligned case. The aligned dimension line had an option to update its color, while the dimension lines in the horizontal alignment case did not; now, they do.

I've tested it all of your conditions, and because this fix was internal, it should fix all other conditions, too.

@jbergengh
Copy link

jbergengh commented Nov 28, 2021

@melwyncarlo could you please try the following steps to see if you get the same results I do? Using your latest "Task_4" fixes.

  1. Open LibreCAD
  2. Options - Application Preferences - Defaults - Modify layer... Checked On
  3. Open the attached file "Jam Cleats.dxf"
  4. Observe: Dimension lines are Red. They should be Magenta (color assigned to the Dimensions layer)
  5. Select all the dimensions in one of the views.
  6. Click the "Dimensions" layer (the same layer the dimensions are already on)
  7. Observe: The selected dimensions turn Magenta. That is good and as expected. The dimensions are "repaired".
  8. Create a new layer named "Green" with a default pen color of "Green"
  9. Verify the Green layer is the active layer
  10. Options - Current Drawing Preferences - Dimensions - Format units - Linear units: Change "Fractional" to "Decimal"
  11. OK
  12. Observe: All dimension lines revert back to Green, including the ones that were repaired in step 7. Should be Magenta.
  13. Select all dimensions on drawing.
  14. Click "Dimensions" layer to "repair" them again.
  15. Observe: All dimensions turn Magenta. Good. As expected.
  16. Save the drawing as a new file "test.dxf"
  17. Exit LibreCAD
  18. Restart LibreCAD
  19. Open "test.dxf" drawing
  20. Observe: All dimensions are back to red again, even though they were fixed in steps 15 & 16
    Jam Cleats.dxf.zip
    .

@melwyncarlo
Copy link
Contributor Author

Go to Options → Drawing Preferences → Dimensions.

Under Text size & position, Extension lines and Dimension lines, arrows & ticks (all three sections), change the Color from By Layer to By Block. That should fix it across saves.

Why does it do that? I've got no idea in the slightest. Using By Block sets the color to the currently active layer, and using By Layer sets it to the entity's layer. It's not how it's supposed to be, that's as far as I can tell. Also, none of my changes in Task_4 involve setting a color to an entity.

@jbergengh
Copy link

Changing all three sections from Color by Layer to Color by Block solved the issue when using Task_4.

I don't understand why it would work this way because selecting an entity and changing its Attributes to By Block strips that entity of its Color and/or Width and/or Line type information, and makes it ignore what its layer's settings are. Having to use Color by Block in drawing preferences to get Coloring by Layer is confusing to me. Maybe I'm not understanding something.

Nevertheless, your fixes work perfectly when I set drawing preferences to By Block. Excellent work as always, Melwyn

@melwyncarlo
Copy link
Contributor Author

Thank you very much @jbergengh! 😃

No, you have said it correctly, atleast as per the DXF documentation. It is definitely a bug, though I cannot find its source.

@lordofbikes lordofbikes added PR medium pull request, medium diff size PR bugfix pull request, fixing an issue PR next release pull request, to be considered for next release labels Apr 27, 2022
@lordofbikes lordofbikes changed the title Solved issue #1396 dimension lines didn't change layer when text alignment is horizontal, fixes #1396 Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR bugfix pull request, fixing an issue PR medium pull request, medium diff size PR next release pull request, to be considered for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants