Cosmetics v2

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Cosmetics v2

Post by wandererfan »

There are some new Cosmetic tools available in the latest master branch. Three new tools have been added:
TechDraw_2LineCenterLine
TechDraw_2PointCenterLine
TechDraw_DecorateLine

An editor for CenterLines has also been added TechDraw_FaceCenterLine#Editing_Center_Lines.

The Cosmetic Vertex, Cosmetic Edge and CenterLine tools have been significantly changed internally to conform with standard FreeCAD Save/Restore techniques. Unfortunately, this breaks compatibility with v1. The new code will not restore cosmetic vertices or edges stored using the alpha version.

Work on Python functionality has also begun. Four 'make' methods have been added to DrawViewPart:

Code: Select all

dvp = App.ActiveDocument.View

dvp.makeCosmeticVertex(center);
dvp.makeCosmeticLine(start,end,style, weight, blue)
dvp.makeCosmeticCircle(center, radius, style, weight, red)
dvp.makeCosmeticCircleArc(arcCenter, radius, arcStart, arcEnd, style, weight, gray)
Please report any issues you encounter with this new code.

Thanks,
wf
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Cosmetics v2

Post by bitacovir »

wow!!. Well done! I will try this.
Thxs
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
aapo
Posts: 619
Joined: Mon Oct 29, 2018 6:41 pm

Re: Cosmetics v2

Post by aapo »

Very useful, thanks! Centerlines work nicely, and I could edit and use them as I'd expect. I tested quite a few things and any weird corner cases I could think of, but everything just worked. Well done! :D

However, I noticed some things with the DecorateLine functionality:
  • There are two ways to make a line invisible: select the Visible property as "False", OR select the Style property as "NoLine"
  • Even though it's possible to set linestyle to "NoLine", these lines do not become visible with the "Restore Invisible Lines" tool, so making them visible again is difficult (but possible, by clicking the invisible line just in the right position, and pressing the DecorateLine button).
  • When editing normal geometry lines in the drawing, the edit box has default line thickness 0.50 and default line style "Dashed", which causes the 0.70 thick geometry lines to go thinner and dashed. This happens just by selecting LineDecoration button and immediately pressing OK in the edit box (without actually changing any of the values).
I guess the Restore Invisible Lines tool is at least temporarily necessary, as the decorations and centerlines are not Document Objects, and won't be visible in the document tree. Therefore the lines can't be edited, if they are not visible/selectable in the drawing, and this is a bit of a problem, no? One solution could be a on/off button for "highlight" mode to temporarily highlight and make selectable all lines and decorations, regardless if they are set to be visible or not in the "normal" mode. A bit similar to the "Turn View Frames On/Off" button that hides or shows the selection points and frames.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Cosmetics v2

Post by wandererfan »

aapo wrote: Tue Jul 16, 2019 10:13 pm
This is great feedback. Thanks for testing.
[*]There are two ways to make a line invisible: select the Visible property as "False", OR select the Style property as "NoLine"
[*]Even though it's possible to set linestyle to "NoLine", these lines do not become visible with the "Restore Invisible Lines" tool, so making them visible again is difficult (but possible, by clicking the invisible line just in the right position, and pressing the DecorateLine button).
Never noticed this. :oops: I will either remove the "NoLine" choice or modify the "Restore Invisible Lines" to pick up the "NoLine" edges.
[*]When editing normal geometry lines in the drawing, the edit box has default line thickness 0.50 and default line style "Dashed", which causes the 0.70 thick geometry lines to go thinner and dashed. This happens just by selecting LineDecoration button and immediately pressing OK in the edit box (without actually changing any of the values).
It looks at the first edge in the selection for style info, but if that line hasn't been "styled" it uses defaults. It should be looking at the overall settings of the View instead.
I guess the Restore Invisible Lines tool is at least temporarily necessary, as the decorations and centerlines are not Document Objects, and won't be visible in the document tree. Therefore the lines can't be edited, if they are not visible/selectable in the drawing, and this is a bit of a problem, no? One solution could be a on/off button for "highlight" mode to temporarily highlight and make selectable all lines and decorations, regardless if they are set to be visible or not in the "normal" mode. A bit similar to the "Turn View Frames On/Off" button that hides or shows the selection points and frames.
If we fix your first point, does this problem go away? I really don't want to make each line an entry in the tree. A "ShowAll" button might be a good idea though.

Thanks again.
wf
aapo
Posts: 619
Joined: Mon Oct 29, 2018 6:41 pm

Re: Cosmetics v2

Post by aapo »

wandererfan wrote: Wed Jul 17, 2019 12:26 am It looks at the first edge in the selection for style info, but if that line hasn't been "styled" it uses defaults. It should be looking at the overall settings of the View instead.
This should work great, if it'd indeed use the "real" info of the first edge of the selection, be it individually styled or descended from the overall settings. Sounds good. This would enable a fast workflow, where you can copy the line settings by first selecting an edge with the linetype you want (if already available), and then selecting the edges you want to change, and just pressing ok in the edit box. Btw, I didn't first realise you'd be able to select and edit several edges at once, which is quite convenient and seems to work.

If we fix your first point, does this problem go away? I really don't want to make each line an entry in the tree. A "ShowAll" button might be a good idea though.
Yes, I think it'd make the problem go away. I believe a "ShowAll" button would be useful for situations, where you have e.g. 432 hidden lines of the same edgetype, and want to make 3 of them permanently visible again. With "ShowAll/HideInvisibles" button you'd need to click just three hidden edges, and change their linestyles to visible. With the "Restore Invisible Lines" tool you'd need to make all the edges visible, and then click all the remaining 429 edges with mouse to make them rehidden.
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Cosmetics v2

Post by wandererfan »

aapo wrote: Wed Jul 17, 2019 8:27 am
git commit e406b2f3e6 should fix "Remove NoLine option from dialogs" + "wrong default for unformatted first edge"

git commit 3104854826 should fix "Add Show/Hide invisible lines tool". No wiki entry yet.

These commits should also close issue #3573 and issue #3574.
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Cosmetics v2

Post by bitacovir »

2 Line CenterLine does not work with selected edges of a Draft Rectangle.
- Create a Rectangle with DraftWB
- Create a page in TechDrawWB
- Create a View of the Rectangle (I set the scale of the view to 0.03)
- Select the two opposite vertical edges of the Rectangle
- Click on 2 Line CenterLine and OK. It gives an error:
App::Document::_RecomputeFeature(): Unknown exception in Feature "View" thrown
App::Document::_RecomputeFeature(): Unknown exception in Feature "View" thrown

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17433 (Git)
Build type: Release
Branch: master
Hash: 125380ddd9a1fdeb45ffc736040dad1f6343daa4
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Australia (en_AU)
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Cosmetics v2

Post by wandererfan »

bitacovir wrote: Thu Jul 18, 2019 2:43 pm 2 Line CenterLine does not work with selected edges of a Draft Rectangle.
git commit 517b11ee3b should fix this.

It was actually broken for any pair of edges that were "reversed" - ie 1 top to bottom and the other bottom to top.

Thanks for catching this.
aapo
Posts: 619
Joined: Mon Oct 29, 2018 6:41 pm

Re: Cosmetics v2

Post by aapo »

wandererfan wrote: Thu Jul 18, 2019 2:06 pm git commit 3104854826 should fix "Add Show/Hide invisible lines tool". No wiki entry yet.
Well that was fast! Seems to work well, and fits perfectly my use case. Thanks a thousand! One thing might be difficult for a beginner; namely there is no visual cue if the viewall button is active or not. I think usually one would go for a select/deselect button that is highlighted when active. The same goes for the older but similar hide frames and points button. At least for beginners it would probably be much easier to understand what's going on with visual clues on the toolbar, too.

I hope that also a similar new tool for adding a cosmetic line between two points could be added for v0.19, as well as a new cosmetic bolt circle tool. If I remember correctly, some people have asked for a bolt circle tool in TechDraw. I guess in some cases there will be a problem to find the center point for the bolt circle in techDraw. Luckily utilizing cosmetic points it'd be possible, albeit somewhat clumsy, to simply add a point to the exactly right coordinates. Difficult but possible would be much better than impossible! :D

EDIT: Now that I think about it, an obvious way to make a bolt circle tool would be to demand the user selects either one point (center, with editable radius), two points (center and radius) or three points (all three on the circumference, as this exactly defines a circle, and should be the most useful choice for a bolt circle). Making the tool accept three edges, or one point and an edge, or even an existing circular arc, would add some extra choices, but might probably be an overkill.

OS: Debian GNU/Linux bullseye/sid (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17439 (Git)
Build type: Release
Branch: master
Hash: 82dd7f0344edc4977d492201ae56c26277008b8d
Python version: 2.7.16
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
User avatar
wandererfan
Veteran
Posts: 6309
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Cosmetics v2

Post by wandererfan »

aapo wrote: Sat Jul 20, 2019 10:33 am One thing might be difficult for a beginner; namely there is no visual cue if the viewall button is active or not. I think usually one would go for a select/deselect button that is highlighted when active. The same goes for the older but similar hide frames and points button. At least for beginners it would probably be much easier to understand what's going on with visual clues on the toolbar, too.
You're right, of course. I did think about this, but the viewAll only applies to one View ('n' Views? have to check.) at a time so you can't just highlight/unhighlight each time it is pressed. I was thinking about an icon on the view itself like the 'lockposition' icon in the label area.

Hide frames applies on the whole page, so changing the icon might work there.
I hope that also a similar new tool for adding a cosmetic line between two points could be added for v0.19, as well as a new cosmetic bolt circle tool. If I remember correctly, some people have asked for a bolt circle tool in TechDraw. I guess in some cases there will be a problem to find the center point for the bolt circle in techDraw. Luckily utilizing cosmetic points it'd be possible, albeit somewhat clumsy, to simply add a point to the exactly right coordinates. Difficult but possible would be much better than impossible! :D
There are initial versions of python routines to draw cosmetic lines(2 points), circles(center, radius) and arcs of circles (center, radius, startAngle, endAngle), but I haven't done the docs for them yet. I was hoping that macros could add a bunch of features like bolt circles. Need to add a py routine that projects a 3D point onto a View and returns the 2D equivalent, too.
Post Reply