Having trouble creating faces with inner loops


#1

Hi Group,

I need help getting faces with inner loops to work right. Here is what I’m doing in a nutshell.

  1. add vertexes to an SUGeometryInputRef with SUGeometryInputAddVertex()
  2. create an SULoopInputRef with SULoopInputCreate()
  3. add vertex indexes from 1) to loop with SULoopInputAddVertexIndex()
  4. create a face from the loop with SUGeometryInputAddFace()
  5. repeat steps 2) and 3) for inner loop(s)
  6. add inner loop to face with SUGeometryInputFaceAddInnerLoop()
  7. repeat steps 5) and 6) for any additional inner loops
  8. use SUEntitiesFill to fill an SUEntitiesRef with the contents of the SUGeometryInputRef.

The above steps will only create edges for all but the simplest examples, ie a square outer boundary with a square inner boundary having the same orientation.

Any thoughts as to what I might be doing wrong?

Thanks.

Tim


#2

@Paul, @bugra . ping()


#3

Hi Group,

I don’t think I need any assistance with this any longer. I wrote a small command line app to demonstrate my problem so I could post it here. However, I cannot repeat the problem in the command line app though so there must be something I’m doing wrong in the Rhino plugin code. I’m very sorry for wasting your time.

Tim


#4

if you managed well outer_loop geometry_input filling but you are failing with inner loop, the code below can help :

We suppose that geometry_input is already filled and hold only one outer face (so we pass face_index = 0 ) and this face is made of an outer_loop with 4 vertex (so we pass vertex_index_start = 4)

NOW :

bool AddInnerLoop(SUGeometryInputRef	geometry_input, typedef std::vector < CPoint3d  &polygon,  long vertex_index_start, long face_index)
    {
    	SULoopInputRef loop = SU_INVALID;
    	SU_CALL(SULoopInputCreate(&loop));
    	    	for (size_t i = 0; i < polygon.size(); ++i) {
    		SU_CALL(SUGeometryInputAddVertex(geometry_input, &polygon[i]));
    		SU_CALL(SULoopInputAddVertexIndex(loop, vertex_index_start + i));
    	}
    
    	SUResult add_inner_loop = SUGeometryInputFaceAddInnerLoop(geometry_input, face_index, &loop);

    	return(SU_SUCCESS(add_inner_loop)); // SU_SUCCESS is just a macro I added 
    
    }