View Issue Details

IDProjectCategoryView StatusLast Update
0003354DraftBugpublic2021-02-06 06:29
Reporterabdullah Assigned Toyorik  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version0.18 
Target Version0.20 
Summary0003354: Draft Clone does not maintain the colours of the original
DescriptionI am not sure how difficult is this to handle as it is in the Python realm, but it would be great if the original colors where maintained.
Steps To Reproduce1. Make a part of your choice.
2. Colour it using the "Shape Color" property.
3. Make a clone of it.

The result is with the default system color (grey).
Tagscolors
FreeCAD Information

Activities

gift

2018-06-10 08:47

reporter   ~0011392

Last edited: 2018-06-10 13:38

Hello @abdullah,

The provider copy the color. So it is not a Draft topic rather PartDesign. I don't know it good enough in the part design next source and I can't find the pdn provider. We must implement this Darft source code in PartDesign:

class _ViewProviderClone:
    "a view provider that displays a Clone icon instead of a Draft icon"

    def __init__(self,vobj):
        vobj.Proxy = self

    def getIcon(self):
        return ":/icons/Draft_Clone.svg"

    def __getstate__(self):
        return None

    def __setstate__(self, state):
        return None

    def getDisplayModes(self, vobj):
        modes=[]
        return modes

    def setDisplayMode(self, mode):
        return mode

    def resetColors(self, vobj):
        colors = []
        for o in getGroupContents(vobj.Object.Objects):
            if o.isDerivedFrom("Part::Feature"):
                if len(o.ViewObject.DiffuseColor) > 1:
                    colors.extend(o.ViewObject.DiffuseColor)
                else:
                    c = o.ViewObject.ShapeColor
                    c = (c[0],c[1],c[2],o.ViewObject.Transparency/100.0)
                    for f in o.Shape.Faces:
                        colors.append(c)
            elif o.hasExtension("App::GeoFeatureGroupExtension"):
                for so in vobj.Object.Group:
                    if so.isDerivedFrom("Part::Feature"):
                        if len(so.ViewObject.DiffuseColor) > 1:
                            colors.extend(so.ViewObject.DiffuseColor)
                        else:
                            c = so.ViewObject.ShapeColor
                            c = (c[0],c[1],c[2],so.ViewObject.Transparency/100.0)
                            for f in so.Shape.Faces:
                                colors.append(c)
        if colors:
            vobj.DiffuseColor = colors

gift

2018-06-11 18:56

reporter   ~0011403

Using grep I found that the clone is small solution in pdn(src/Mod/PartDesign/Gui/Command.cpp). Look on commit: 600b736 Please keep in mind that not included a update service of color analogy to the placement.

yorik

2019-02-15 00:00

administrator   ~0012644

Just add a look at this one, indeed by cloning an App::Part the clone doesn't take the individual face colors. But, it's not possible to set individual face colors to an App::Part. Only to its child objects. If you clone the child objects, it works correctly.

So the App::Part doesn't know of individual face colors. Should the clone go through the different children to make up the colors? Not realy sure that would be the proper way... Isn't the App::Part that should hold a colors list instead?

yorik

2022-03-03 13:55

administrator   ~0016600

This ticket has been migrated to GitHub as issue 5765.

Issue History

Date Modified Username Field Change
2018-02-25 09:10 abdullah New Issue
2018-02-26 01:14 Kunda1 Tag Attached: colors
2018-06-10 08:47 gift Note Added: 0011392
2018-06-10 13:38 Kunda1 Note Edited: 0011392
2018-06-10 13:39 Kunda1 Description Updated
2018-06-10 13:39 Kunda1 Steps to Reproduce Updated
2018-06-11 18:56 gift Note Added: 0011403
2019-02-15 00:00 yorik Note Added: 0012644
2019-02-15 00:00 yorik Assigned To => yorik
2019-02-15 00:00 yorik Status new => assigned
2019-02-15 00:01 yorik Target Version 0.18 => 0.19
2021-02-06 06:29 abdullah Target Version => 0.20