View Issue Details

IDProjectCategoryView StatusLast Update
0003354DraftBugpublic2018-06-11 18:56
ReporterabdullahAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version0.18 
Target Version0.18Fixed in Version 
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

Activities

gift

2018-06-10 08:47

reporter   ~0011392

Last edited: 2018-06-10 13:38

View 2 revisions

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:

[code=pyhton]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
[/code]

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: [url=https://github.com/FreeCAD/FreeCAD/pull/1512/commits/600b736c01aff341f5430c54cb03df659e1ae1c7]600b736[/url] Please keep in mind that not included a update service of color analogy to the placement.

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 View Revisions
2018-06-10 13:39 Kunda1 Description Updated View Revisions
2018-06-10 13:39 Kunda1 Steps to Reproduce Updated View Revisions
2018-06-11 18:56 gift Note Added: 0011403