Orienting faces consistently with the SDK


#1

Thanks @DanRathbun .

There is another question. SKP SDK provides the API to fix the inconsistent face orientation issue for component and model. Why is there no API to fix the inconsistent face orientation issue on group?


Is there a function to know a group or a component is a solid group or a solid component?
#2

A group is just a “special” class of component instance (whose definition is hidden from the Component Browser panel, and when there are more than 1 instance manually opening the instance for edit creates a new unique clone definition for the instance being edited.)

So groups, component instances and images all are instances of a “mother” definition.

The solution with the C API is like that given above. When you need functionality from related classes of objects you will need to cast your object to that other class. (So cast your SUGroupRef to an SUComponentInstanceRef and then call the desired function.)


#3

From the API comments:
SUComponentDefinitionOrientFacesConsistently() is available since SKP 2016 and API 4.0.
SUModelOrientFacesConsistently() is available since SKP 2018 and API 6.0.

Two questions:

  1. will model created in older SKP applications (say SKP 2015) fail these two functions?
  2. SUModelOrientFacesConsistently() fixes the orientation to be consistently in the file. Is it still necessary to call SUComponentDefinitionOrientFacesConsistently() for each component?

#4

SUModelOrientFacesConsistently() fixes the orientation if the reversed face number is small. However, it will reverse the correct face if majority faces are reversed before.
For example, I reversed 5 faces of a cube, which has 6 faces.
This API will reverse the left 1 face to keep they have the same consistence.
This is not I expect.
Is it as designed?
Is there an option to fix the 5 faces in above cube example?


#5

I believe so.

Consistent != Correct