Page 2 of 2

Re: Shape color is not displayed correctly after change in tree

Posted: Tue Nov 10, 2020 10:52 am
by JohnThinger
This topic has been discussed in some other threads. If a sub-element of a combined part (union, cut, common or similar) is changed, the part color is going back to standard-grey and transparency to non-transparent. The original color and transparency values are still stored in the object data, but they are not visually applied.

It seems to be complex to fully resolve this, e.g. if different colors or materials are used on single faces. Nevertheless, the following approach works for single-color parts.

As written in the posts above, changing the color manually (to another color and then back to the desired color) resolves the problem. However, doing this manually after each change is annoying.

Hence, the following macro automates the process. Just select all (top-level) objects that have been modified and then run the macro. It will first invert the color and transparency values and then set the original values again.

Code: Select all

# -*- coding: utf-8 -*-
import FreeCAD

selection = FreeCADGui.Selection.getSelection()
for item in selection:
	tempColor = item.ViewObject.ShapeColor
	transparency = item.ViewObject.Transparency
	# Invert the color of all selected shapes.
	item.ViewObject.ShapeColor = (1 - tempColor[0], 1 - tempColor[1], 1 - tempColor[2])
	item.ViewObject.Transparency = 100 - item.ViewObject.Transparency
	# Reset the original color.
	item.ViewObject.ShapeColor = tempColor 
	item.ViewObject.Transparency = transparency

Re: Ticket #6069 - Shape color is not displayed correctly after change in tree

Posted: Fri Apr 01, 2022 11:20 pm
by Kunda1
Ticket migrated to issue #6069. Needs reviewing

Re: Ticket #6069 - Shape color is not displayed correctly after change in tree

Posted: Wed May 25, 2022 7:25 pm
by Kunda1
Bumping for activity (issue #6069)