Part Workbench, set color

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Part Workbench, set color

Post by bernd »

The context menue set color does not work for all Part objects. It does not work either for Boolean Fragments nor for CompoundFilter.

- Start FreeCAD
- make a cube and a cylinder
- make a boolean union of them
- select the union --> Part --> compound --> CompoundFilter
- select the CompoundFilter --> right click --> set color --> nothing happens

OS: Debian GNU/Linux 8.7 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10283 (Git)
Build type: Unknown
Branch: master
Hash: dd7b65a585fe0fe2a8ceb37be55e1f721de24190
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.0.0
wmayer
Founder
Posts: 20308
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Part Workbench, set color

Post by wmayer »

- select the union --> Part --> compound --> CompoundFilter
- select the CompoundFilter --> right click --> set color --> nothing happens
Looks like setEdit is not implemented to handle edit modes of sub-classes: https://github.com/FreeCAD/FreeCAD/blob ... er.py#L185

For me it's not clear why _ViewProviderCompoundFilter suppresses all kind of edit modes. On the other hand the class doesn't know just from the "mode" number what the mode is supposed to do.

It's best to ask DeepSOIC what's the purpose of setEdit doing it this way.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part Workbench, set color

Post by bernd »

Thanks for the informations werner. If I comment the setEdit and unsetEdit it works flawlessly ...
wmayer wrote:For me it's not clear why _ViewProviderCompoundFilter suppresses all kind of edit modes.
I copied it from DeepSoics code. May be he did it for the same reason than I did not change it. He did not know the insides ... In FEM I need setEdit and unsetEdit for my objects to open the taskpanel, means I have them over there in all objects. I did not know they are not mandatory. Does it mean I only would need setEdit and unsetEdit if I need to overwrite the standard behavior (same like double clicked) ?

If so I would go for a PR which deletes the setEdit and unsetEdit, but before I get in contact with DeepSOIC.

wmayer wrote: On the other hand the class doesn't know just from the "mode" number what the mode is supposed to do.
How about the modes? Where do I get more informations about them. I never really understood what are they used for in setEdit and unsetEdit
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part Workbench, set color

Post by DeepSOIC »

wmayer wrote:It's best to ask DeepSOIC what's the purpose of setEdit doing it this way.
At some point, I read the code to see what return value of setEdit() does. To find out that if I return False, Part::Feature's setEdit is invoked. This has changed recently.

There was no specific purpose in doing it :oops:

PS: thanks bernd for pm, otherwise I would likely have missed this topic.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part Workbench, set color

Post by bernd »

User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part Workbench, set color

Post by bernd »

@DeepSOIC:

How about removing all setEdit and unsetEdit to get the C++ setEdit modes working again ? https://github.com/berndhahnebach/FreeC ... 83c9efd457

bernd
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part Workbench, set color

Post by DeepSOIC »

Yes of course, delete them. I thought it was done already.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Part Workbench, set color

Post by bernd »

Post Reply