[solved] Face.Orientation bug?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

[solved] Face.Orientation bug?

Post by dprojects »

Hi, I am not sure if this is what I think. The Face.Orientation should return info about the sink in object? For Cube is works correctly for each face but for Pad the opposite faces return the same value? is it bug or the Face.Orientation means something different?

Image
Last edited by dprojects on Thu Aug 04, 2022 7:51 am, edited 1 time in total.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Face.Orientation bug?

Post by onekk »

dprojects wrote: Wed Aug 03, 2022 7:52 pm is it bug or the Face.Orientation means something different?
Usually orientation mean normals so Normal and Reverse are referring to the outside and inside of the solid, or this I've been told some time ago, if you make a fusion if faces are "reversed" they became "holes".

What is the explanation of:

Code: Select all

help(Part.Face.Orientation)
if there is any?

Sorry I could not check now as I'm on mobile.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
Roy_043
Veteran
Posts: 8455
Joined: Thu Dec 27, 2018 12:28 pm

Re: Face.Orientation bug?

Post by Roy_043 »

It is related to the parameterization.

Code: Select all

            if shape.Orientation == "Reversed":
                self.u, self.v = self.v, self.u
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Face.Orientation bug?

Post by wandererfan »

dprojects wrote: Wed Aug 03, 2022 7:52 pm Hi, I am not sure if this is what I think. The Face.Orientation should return info about the sink in object? For Cube is works correctly for each face but for Pad the opposite faces return the same value? is it bug or the Face.Orientation means something different?
Explanation of Face orientation is about half way down this: https://opencascade.blogspot.com/2009/02/continued.html
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Face.Orientation bug?

Post by onekk »

wandererfan wrote: Thu Aug 04, 2022 12:54 am Explanation of Face orientation is about half way down this: https://opencascade.blogspot.com/2009/02/continued.html
Thanks for the link, it contains many other interesting informations about the kernel.

Regards

Carlo D
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Face.Orientation bug?

Post by dprojects »

onekk wrote: Wed Aug 03, 2022 10:16 pm

Code: Select all

help(Part.Face.Orientation)
Maybe this works correctly only at the Cube because it is Part feature not PartDesign? For Cube the opposite face has always opposite orientation. But for Pads there is only one face with Reversed orientation. Looks like it is only supported for Part Cube objects.

However, I make my own sink function. I needed the information for new drilling holes feature. I needed to know to which direction I should drill the hole. However, this new function allow me to improve the magicDowels tool and now all the dowels by default can be re-positioned correctly, without manually rotation and offset from the edge adjustment, and with no matter which face is chosen. And also the dowels will be working for Pads now.

This is great because if I will be able to determine to which direction is the element, this push the woodworking tools to the another level, I guess.

Image

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Face.Orientation bug?

Post by onekk »

dprojects wrote: Thu Aug 04, 2022 7:45 am ....

Sorry, I've checked the help and in effect is not helping much.

In the link @wandererfan posted, you could read this.

Face orientation shows how face normal is aligned with its surface normal. If orientation is TopAbs_FORWARD then normals match, if TopAbs_REVERSED then they are opposite to each other.
Face normal shows where body material is – it lies ‘behind' the face. In a correct solid body all face normals go ‘outward' (see below):

So if the orientation is "reverse", probably Part Design is not following the rule:
In a correct solid body all face normals go ‘outward'
It is worth reporting it to the developers?

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Face.Orientation bug?

Post by dprojects »

onekk wrote: Thu Aug 04, 2022 9:24 am So if the orientation is "reverse", probably Part Design is not following the rule:
This might be the reason. Pad has different edges, faces and vertices order than Cubes. To get this dowels working with Pads I have also recalculate (switch) the vertices because they normally starts from other point. Also edges stored at faces are in different order. Normally for Cubes the are something like short, long, short, long but for Pads they are short, short, long, long.

onekk wrote: Thu Aug 04, 2022 9:24 am It is worth reporting it to the developers?
I am not sure. This is probably not bug. Maybe they use this for something. I was thinking this option will be useful to solve the sink problem but it is probably used for something different. I think the __doc__ there could be improved because there is no info what it is and how it works. So this may confuse other developers if they will be thinking like me. They make some tests with Cubes and this will be working, but for Pads this fail.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Face.Orientation bug?

Post by onekk »

dprojects wrote: Thu Aug 04, 2022 11:59 am I think the __doc__ there could be improved because there is no info what it is and how it works. So this may confuse other developers if they will be thinking like me.
I'm also confused and I've tried to obtain some more descriptive documentation, but it is a difficult task, as some code is old, dervied from OCCT that have his own solution, probably the best thing that we could obtain is some explanation and maybe some hints, on "how to ass proper doc code" to sources.

But I see that it is difficult to obtain "writing permssions" to the source code only to make some "documentation efforts" as you could risk to damage developers works.

And I see no other solutions, other than having a mean to "add documentation strings" as a separate sources, maybe with some "formatted files" that could be retrieved and output when you perform a:

Code: Select all

help(something)
but this is involving dealing with Python internals, other than FC internals.

Hoping to have expressed in a intelligible way.

:D

Regards

Carlo D:
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
dprojects
Posts: 721
Joined: Mon Mar 06, 2017 6:02 pm
Location: Poland
Contact:

Re: Face.Orientation bug?

Post by dprojects »

onekk wrote: Thu Aug 04, 2022 12:49 pm

Code: Select all

help(something)
But you can't call the command from macro? the __doc__ command works from macro so you can get all info at scanObjects just by browsing.

Thanks
Darek
github.com/dprojects

workbench for woodworking is available at: github.com/dprojects/Woodworking
Post Reply