Brilliant! Works perfectly.
Nicely written too. It's easy for a guy with weak math skillz like mine to follow. Thanks for that!
Find angle between adjacent faces
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Find angle between adjacent faces
How to define negative/positive and compute the distance of this point with the adjacent face? Is there any API in the python console?wmayer wrote: ↑Mon May 16, 2022 8:24 pm With the angle alone you cannot distinguish between the two cases. As already mentioned you have to distinguish between a convex area (face 1+2) and a concave area (face 2+3).
Now all what you need is e.g. a point that lies on one face but not on the adjacent face, i.e. the point must not be part of the common edge. Compute the distance of this point with the adjacent face.
If the distance is negative you have the convex case like face 1+2.
If the distance is positive you have the concave case like face 2+3.
If the distance is zero the two planes are co-planar.
Re: Find angle between adjacent faces
A plane is defined by a base point and a normal vector.
Example:
Example:
Code: Select all
point = App.Vector(4,6,7) # this is the point to check
base = App.Vector(1,0,1) # this is the base of the plane
normal = App.Vector(1,1,1) # this is the normal of the plane
# the distance of the point to the plane can be obtained with
point.distanceToPlane(base, normal)
Re: Find angle between adjacent faces
Thank you! that is great for the plane. It seems that it is not ok for the cylinder face or others.wmayer wrote: ↑Mon Oct 10, 2022 1:14 pm A plane is defined by a base point and a normal vector.
Example:Code: Select all
point = App.Vector(4,6,7) # this is the point to check base = App.Vector(1,0,1) # this is the base of the plane normal = App.Vector(1,1,1) # this is the normal of the plane # the distance of the point to the plane can be obtained with point.distanceToPlane(base, normal)
Re: Find angle between adjacent faces
It depends, you have to test.
Take in account that cylinder faces are 3, one (the side of the cylinder) is bended around the top and bottom face, so probably the chosen shape is the most problematic.
Probably for a cube it is different and more predictable.
Hope it helps
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Find angle between adjacent faces
This topic specifically is about planar faces. To test for infinite cylinder you can compute the distance to the cylinder axis. If it's lower than the radius the point is inside the cylinder, if it's equal to the radius the point is on the cylinder and if it's higher then the point is outside.Thank you! that is great for the plane. It seems that it is not ok for the cylinder face or others.