Home
Reply
Contributor
elkott
Posts: 11

Use api_combine_edges within a loop

Hello all:

 

I have a list of edges, which I stored in an ENTITY_LIST. I would like to combine these edges (in a loop) to use the combined edge as the profile for a sweeping operation; I could not get that to work. Could someone be kind enough to point out what am I doing wrong, or point me to the right direction? Many thanks! My code is as follows:

 

 

// Declare, and initialise entity lists

ENTITY_LIST entityList, edgeList;
edgeList.init();
entityList.init();


// Construct a list of edges using an array of "SPAposition" points 

int    k = 0;
EDGE  *edge;

for (int i=0; i<pointArraySize-1; i++){
      api_mk_ed_line(pointArray[i], pointArray[i+1], edge);	
      k = edgeList.add(edge, TRUE);
}



// Create a "combined edge" using the first two edges of "edgeList"

EDGE   *combinedEdge;

rOutcome = api_combine_edges( (EDGE *)edgeList[0],
                              (EDGE *)edgeList[1],
                              combinedEdge, 
                              NULL);

//  Loop through "edgeList", and add the remaining edges to
//  "combinedEdge"

for (int i=2; i<edgeList.count(); i++)
{
    rOutcome = api_combine_edges( (EDGE *)edgeList[i],
                                 combinedEdge, 
                                 combinedEdge,
                                 NULL);
}

 

 

Spatial Moderator
ybiyani
Posts: 223

Re: Use api_combine_edges within a loop

Hello elkott,

 

As you have a set of points an easier api to use would be api_make_wire  which you can then pass to the sweeping api.

 

Please note api_combine_edges expects the edges to be G1 continious.  From the code you are creating a set of straight edges

 

for (int i=0; i<pointArraySize-1; i++){
      api_mk_ed_line(pointArray[i], pointArray[i+1], edge);
      k = edgeList.add(edge, TRUE);
}

 

so unless these edges are all in one line this api will not work.

 

 

I hope this helps.

 

Regards,

Yogesh

 

 



Contributor
elkott
Posts: 11

Re: Use api_combine_edges within a loop

Hello Yogesh:

 

Thanks a lot for your response to my question; it certainly helped a lot.

 

Thanks and have a wonderful day.

 

Diaa ElKott