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.
User avatar
bernd
Posts: 3868
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Part Workbench, set color

Postby bernd » Mon Feb 27, 2017 6:15 am

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
Site Admin
Posts: 11222
Joined: Thu Feb 19, 2009 10:32 am

Re: Part Workbench, set color

Postby wmayer » Tue Feb 28, 2017 6:44 pm

- 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
Posts: 3868
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Part Workbench, set color

Postby bernd » Wed Mar 01, 2017 8:17 am

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
DeepSOIC
Posts: 4443
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Part Workbench, set color

Postby DeepSOIC » Wed Mar 01, 2017 5:10 pm

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
Posts: 3868
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Part Workbench, set color

Postby bernd » Sat Mar 18, 2017 3:32 pm

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

Re: Part Workbench, set color

Postby bernd » Sun Mar 19, 2017 10:31 pm

@DeepSOIC:

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

bernd
DeepSOIC
Posts: 4443
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Part Workbench, set color

Postby DeepSOIC » Sun Mar 19, 2017 10:59 pm

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

Re: Part Workbench, set color

Postby bernd » Sun Mar 19, 2017 11:32 pm