This is a discussion about how to solve the "referenced faces problem", both for 2D and 3D faces. 2D faces are enclosed, "colored" areas of a sketch that one can extrude, 3D faces are the flat surfaces that 3D objects are comprised of (a 3D cube has 6 faces).
The problem is simple: How do you refer to a selected face, e.g. during an extrusion?
Just ID
This is the simplest solution and what we've done till now, but it has a huge deal breaker: we're calculating faces and they're not static.
This simplest way to break this is approach is to create a sketch with 2 rectangles that share a line, do an extrusion on the second rectangle and then edit the sketch and remove the shared line. Now there's only 1 face and the face ID 2 does not exist
Centroid anchor
A very interesting idea @MattFerraro introduced with the document is to use anchors to refer to faces.
Every time a face is generated its centroid is also calculated and thus during extrusion the face centroid is referenced, not the face or its ID
After a sketch edit the face with centroid closest to the saved centroid is selected.
This approach though is also problematic:
- There's no way to "fail". For example if a sketch defines 3 faces and 3 extrusions are done and then edited to have only 1 extrusion all 3 extrusions will extrude the same face without producing any errors or warnings (as the closest centroid will be the single centroid of the new single face)
- Co-eccentricity introduces uncertainty. Since the centroid of 2 co-eccentric polygons is the same, the selection of the face is only based on the order of face generation
- Movement introduces uncertainty. If we have 2 rectangles that have the same size, select 1 of the two, extrude and then edit the sketch to move the selected rectangle more enough (more than width/2 for example) the other rectangle will now be selected
Some possible fixes for the second problem is:
- More robust face generation ordering - e.g. from the center to edge or vice versa and the introduction of an "index" along with the centroid so that a faces with the same centroid can be "favored" depending on that index
- Inclusion of the area along with the centroid so the face with the closest area can be used
About the failing problem I can't think of a good enough solution. Maybe we can store the amount of "independant" (they share no features) faces and if that drops we fail?
Do we just throw a warning when more than 1 extrusion with different centroids end up referring to the same face?
I think the correct approach is to introduce some kind of hashing to the faces that is able to produce a "hash distance" or "not found". the face with the closest hash distance (if any) is selected.
But what do we include the hash and how do we hash it so that a "distance" can be found?
This is a discussion about how to solve the "referenced faces problem", both for 2D and 3D faces. 2D faces are enclosed, "colored" areas of a sketch that one can extrude, 3D faces are the flat surfaces that 3D objects are comprised of (a 3D cube has 6 faces).
The problem is simple: How do you refer to a selected face, e.g. during an extrusion?
Just ID
This is the simplest solution and what we've done till now, but it has a huge deal breaker: we're calculating faces and they're not static.
This simplest way to break this is approach is to create a sketch with 2 rectangles that share a line, do an extrusion on the second rectangle and then edit the sketch and remove the shared line. Now there's only 1 face and the face ID 2 does not exist
Centroid anchor
A very interesting idea @MattFerraro introduced with the document is to use anchors to refer to faces.
Every time a face is generated its centroid is also calculated and thus during extrusion the face centroid is referenced, not the face or its ID
After a sketch edit the face with centroid closest to the saved centroid is selected.
This approach though is also problematic:
Some possible fixes for the second problem is:
About the failing problem I can't think of a good enough solution. Maybe we can store the amount of "independant" (they share no features) faces and if that drops we fail?
Do we just throw a warning when more than 1 extrusion with different centroids end up referring to the same face?
I think the correct approach is to introduce some kind of hashing to the faces that is able to produce a "hash distance" or "not found". the face with the closest hash distance (if any) is selected.
But what do we include the hash and how do we hash it so that a "distance" can be found?