Draft Layers

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
nic
Posts: 17
Joined: Thu Apr 18, 2019 1:14 pm
Location: France

Re: Draft Layers

Postby nic » Tue Jun 11, 2019 7:23 am

Probably not, and it wouldn't help with the problem: "collect all {obj} and put them in a layer", {obj} being one of {sketches, walls, part, whatever}.
User avatar
bitacovir
Posts: 648
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Draft Layers

Postby bitacovir » Tue Jun 11, 2019 2:53 pm

In my case, the layer's icon doesn't show any color.
FreeCAD_2019-06-11_10-51-30.png
FreeCAD_2019-06-11_10-51-30.png (26.79 KiB) Viewed 415 times
Also, one question. How do you create a new layer in the Layers group?
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16945 (Git)
Build type: Release
Branch: master
Hash: d818a9638424a934bd9da74d187a1af4cb773f05
Python version: 3.6.8
Qt version: 5.12.1
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)

My Blog
Mini Airflow Tunnel Project
User avatar
yorik
Site Admin
Posts: 11371
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Draft Layers

Postby yorik » Tue Jun 11, 2019 8:07 pm

Layers go automatically into the layer group.
I found that the tree doesn't request new icons all the time. Only at certain moments, for ex. when hiding/showing layers. Not sure yet how to attack that issue...
User avatar
Chris_G
Posts: 1058
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Draft Layers

Postby Chris_G » Sat Jun 15, 2019 9:31 pm

Hi Yorik,
I am glad to see Layers implemented.
I made an experiment about this.
I have not been able to solve the "update icon" issue.
It would be really great to be able to force icon update.
This little icon is a very "UX friendly" way to communicate some information to the user.
I suppose it means something like adding a "updateIcon" method to the viewprovider ???
I have never been much outside PartWB code, so I don't know all the mechanics up there :D .
User avatar
yorik
Site Admin
Posts: 11371
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Draft Layers

Postby yorik » Sun Jun 16, 2019 3:02 am

Oh wow, I hadn't seen you had done something similar...
Will have a better look, there might be stuff to merge between the two.

For the icons, basically, the getIcon() method accepts two possibilities: a file path to an image, or XPM data. So I made another function that produces an XPM icon, simply by "drawing" it with Qt painting tools: https://github.com/FreeCAD/FreeCAD/blob ... er.py#L211
and then caching the XPM data so the getIcon() can serve it when needed without the need to recalculate it.

But indeed I haven't been able to force an icon recompute...
wandererfan
Posts: 2770
Joined: Tue Nov 06, 2012 5:42 pm

Re: Draft Layers

Postby wandererfan » Mon Jun 17, 2019 12:25 pm

yorik wrote:
Sun Jun 16, 2019 3:02 am
But indeed I haven't been able to force an icon recompute...
Don't have a Python example, but here is how I change the icon for the various dimension types. Might spark something for you.

Code: Select all

void ViewProviderDimension::updateData(const App::Property* p)
{
    if (p == &(getViewObject()->Type)) {
        if (getViewObject()->Type.isValue("DistanceX")) {
            sPixmap = "TechDraw_Dimension_Horizontal";
        } else if (getViewObject()->Type.isValue("DistanceY")) {
            sPixmap = "TechDraw_Dimension_Vertical";
        } else if (getViewObject()->Type.isValue("Radius")) {
            sPixmap = "TechDraw_Dimension_Radius";
        } else if (getViewObject()->Type.isValue("Diameter")) {
            sPixmap = "TechDraw_Dimension_Diameter";
        } else if (getViewObject()->Type.isValue("Angle")) {
            sPixmap = "TechDraw_Dimension_Angle";
        } else if (getViewObject()->Type.isValue("Angle3Pt")) {
            sPixmap = "TechDraw_Dimension_Angle3Pt";
        }
    }
    ViewProviderDrawingView::updateData(p);
}
RatonLaveur
Posts: 158
Joined: Wed Mar 27, 2019 10:45 am

Re: Draft Layers

Postby RatonLaveur » Thu Jul 11, 2019 6:30 am

Hello gents,

the implementation of layers seems really cool. Coming from the laser cutting point of view, this is exactly the method needed to have control over more complex .dxf cutting files.

in a more CAD oriented aspect, my experience with other CAD packages such as Siemens NX, shows that using layers is also very useful within a single part design, where layers can be used to separate or suppress the skeleton and master sketches. I'm sure down the line this will enable a part design workflow that will not phase new people coming from this background, which definitely propels FreeCAD front and center.

Just a positive thought on your work and tribulations.