View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000727||FreeCAD||Feature||public||2012-05-29 12:03||2012-06-04 19:04|
|Fixed in Version||0.13|
|Summary||0000727: Keep faces colors on boolean operations|
I know that when you do boolean operation resulting shape looses colors.
However, I usually do boolean operations on imported STEP files, and it takes quite a while to re-color resulting shape.
I also know that resulting shape has faces in random order, so I wanted to make a suggestion for simple algorythm:
1 - If a boolean operation was successful, then cycle through all faces of resulting shape. Let's call this face "Main Face"
2 - for each Main face create another iteration that goes through all faces of source shapes, and checks if it has the same shape as the Main face.
3 - if they are the same - then take the color of the first face and apply it to resulting one.
this algorythm would not work on faces that were modified in a boolean operation, but it is OK. This would IMO work nicely for most of my work. It would significantly decrease the coloring procedure I need to take on every STEP file modification.
|Additional Information||Win7 64bit|
|Tags||No tags attached.|
||There is an experimental branch here: http://free-cad.git.sourceforge.net/git/gitweb.cgi?p=free-cad/free-cad;a=shortlog;h=refs/heads/wmayer/keep_face_colors|
||Oh, I can see it is in the master now. will check.|
||git show f2b4f5c18e23b034c1d1cbb9322e7aa0852647c8|
This works great, even better than I have imagined, but I have one more small suggestion for this. Sorry for reopening this.
Can this work on refine shape too (Or, even better, implement refine shape executed before this on boolean operation made from GUI - boolean from python can be without this and without Refine shape, if Refine shape does not work good yet)?
also, minor suggestion which is not so important but I have seen it so I will mention it. I have made boolean from Box and cylinder. box was colored with lot of colors, but cylinder was not, and I have gotten really nice result. Then I decided to color cylinder, so I have shown cylinder and colored it, but resulting shape did not get color. This means that this color propagation is not parametric. This second part is not so important, but since I am reopening this I just thought to mention it.
||or maybe preferences checkbox - Refine Shape on Boolean operation|
> Can this work on refine shape too (Or, even better, implement refine shape executed before this on boolean operation made from GUI - boolean from python can be without this and without Refine shape, if Refine shape does not work good yet)?
That's currently totally impossible because the refine shape function builds a new model from scratch and we will loose all information about which face A in the old model become face B in the new model. So, we have no knowledge about the modifications. And because of that it doesn't make sense to include the refine function in the boolean operations.
> This means that this color propagation is not parametric. This second part is not so important, but since I am reopening this I just thought to mention it.
Of course not. Color is part of the GUI and not a parameter in the boolean operation feature. So, what you can do is changing a parameter of your cylinder after you have changed the colors and then you'll see the new color in the other object, too.
||ok. Thanks. if you want, you can re-close this :-)|
||Man, you can't belive what a lifesaver this is. Thanks again. Thanks very much.|
There is now an option in the preferences to run the refinement after boolean operations and I have added support on the refinement algorithm to log changes which faces were modified and deleted.
But note, in cases where joined faces had different colors the refined shape has only one color and it's random which face will "win".
git show f8f498a
sorry for reopening this all the time, but I can not place any comment other way.
Just wanted to report that it works great now - Just the way I wanted, but It looks to me that it is not working the way you describe in your final report:
you say:>>in cases where joined faces had different colors the refined shape has only one color and it's random which face will "win"<<
however, it looks to me that it is not "face" contest, but "shape" contest. It looks to me like when you have two faces that can be merged, he will place one face and apply one color to it, but the color of that face will not be one of the 2 faces that were joined, but shape color of one of the 2 shapes that were merged in boolean operation.
It is not a big deal IMO. It works very nice even now, but I wanted to report it since it is not hat you described - just info. It works sooo nice now, unbeliveable. Thanks so much for this.
||I have attached test file. Try to do boolean on the two boxes. Even though they have no gray faces, four gray faces appear after union because both boxes have gray global color.|
||The gray color comes from the input shape which shape color is still gray (even though you have given each face another color). But you're right, the joined faces shouldn't turn into gray but one of the two possible colors. I'll have a look at this...|
one more idea, not exactly on topic but...
since you added checkbox to refine shape on boolean, how about adding another one to refine shape on create shape from mesh.
> since you added checkbox to refine shape on boolean, how about adding another one to refine shape on create shape from mesh.
There are a few other cases where the refinement would be useful but these are used in modules other than Part or Part design module which currently don't have their own preference page. What I wanted to say is that we shouldn't put preferences of a module to the page of another module.
BTW, keeping the colors of refined shapes works too now
||git show 4f154d3|
|2012-05-29 12:03||pperisin||New Issue|
|2012-05-30 17:45||wmayer||Note Added: 0002102|
|2012-05-30 17:47||wmayer||Status||new => assigned|
|2012-05-30 17:47||wmayer||Assigned To||=> wmayer|
|2012-06-01 09:18||pperisin||Note Added: 0002106|
|2012-06-01 10:22||wmayer||Note Added: 0002107|
|2012-06-01 10:22||wmayer||Status||assigned => closed|
|2012-06-01 10:22||wmayer||Resolution||open => fixed|
|2012-06-01 10:22||wmayer||Fixed in Version||=> 0.13|
|2012-06-03 13:03||pperisin||Note Added: 0002114|
|2012-06-03 13:03||pperisin||Status||closed => feedback|
|2012-06-03 13:03||pperisin||Resolution||fixed => reopened|
|2012-06-03 13:20||pperisin||Note Added: 0002115|
|2012-06-03 13:46||wmayer||Note Added: 0002116|
|2012-06-03 13:57||pperisin||Note Added: 0002117|
|2012-06-03 18:16||pperisin||Note Added: 0002118|
|2012-06-04 07:46||wmayer||Note Added: 0002119|
|2012-06-04 07:46||wmayer||Status||feedback => closed|
|2012-06-04 07:46||wmayer||Resolution||reopened => fixed|
|2012-06-04 09:00||pperisin||Note Added: 0002120|
|2012-06-04 09:00||pperisin||Status||closed => feedback|
|2012-06-04 09:00||pperisin||Resolution||fixed => reopened|
|2012-06-04 09:15||pperisin||File Added: test.FCStd|
|2012-06-04 09:16||pperisin||Note Added: 0002121|
|2012-06-04 12:06||wmayer||Note Added: 0002122|
|2012-06-04 17:59||pperisin||Note Added: 0002123|
|2012-06-04 18:00||pperisin||Note Edited: 0002123|
|2012-06-04 19:04||wmayer||Note Added: 0002124|
|2012-06-04 19:04||wmayer||Note Added: 0002125|
|2012-06-04 19:04||wmayer||Status||feedback => closed|
|2012-06-04 19:04||wmayer||Resolution||reopened => fixed|