edge selection -> points [SOLVED]



  • On 10/10/2014 at 12:09, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   r14 
    Platform:      
    Language(s) :     C++  ;

    ---------
    hi there,
    can someone please point me to where i find informations about how to walk thru selected edges in a BaseSelect and how to get the point coordinates of those edges?

    thanks in advance,
    ello



  • On 11/10/2014 at 01:16, xxxxxxxx wrote:

    In the docs see PolyInfo and GetSelectedEdges.



  • On 11/10/2014 at 02:53, xxxxxxxx wrote:

    thank you. but how does it lead to the points of the selected edges..



  • On 11/10/2014 at 08:53, xxxxxxxx wrote:

    ello,
    have you had a look at the function and class hinted by Katachi?
    The SDK docs contain example code, at the beginning of the PolyInfo structure page:
    R16 SDK Docs: PolyInfo struct

    I think, it's exactly what you asked for.
    If you need any more help, let us know.



  • On 11/10/2014 at 09:26, xxxxxxxx wrote:

    hm, guess i just don't understand that example (i came across them already by searching the sdk). from looking at that code i don't see where i get the points. maybe, because i dont know how the used variables are defined. also, i don't really understand how to get there based on an edgeselection. I'd like to have a Link field where the user puts an edge selection. But i don't understand how to get to the points based on only that information.

    SelectionTag* linkedSelection = static_cast<SelectionTag*>(mainContainer->GetLink(SELECTION,doc));
    BaseObject* obj = linkedSelection->GetObject();
    

    edit: your link shows up slightly different information than the r14 chm, so i'll look at that if i understand it...



  • On 11/10/2014 at 09:41, xxxxxxxx wrote:

    ello, I haven't used the example code myself, yet. But I would think, a,b,c and d are the point-vectors. Or are you looking for point indeces?



  • On 11/10/2014 at 09:49, xxxxxxxx wrote:

    if there was a way to get the point indeces i think it would be better, since i would know how to handle things from that point on... i will however try to understand the example



  • On 11/10/2014 at 09:51, xxxxxxxx wrote:

    Can you give me any more details on what you are actually trying to achieve? Because in your original question, you asked for coordinates...



  • On 11/10/2014 at 10:17, xxxxxxxx wrote:

    sure. i want to create some polygons which align to the edges given by the edge selection. something like the matrix extrude but based on the edges. so in the end i need the coordinates of the points belonging to the selected edges



  • On 11/10/2014 at 10:22, xxxxxxxx wrote:

    Then I'd recommend to go with the example. If you fail with that, please give me a short code example, which demonstrates, in which way it's not doing what you want.

    Oh and by the way, I think, you should get the point indeces from the original BaseSelect.



  • On 11/10/2014 at 10:25, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Oh and by the way, I think, you should get the point indeces from the original BaseSelect.

    really?? how? as i don't see a member which would give me those.



  • On 11/10/2014 at 10:28, xxxxxxxx wrote:

    It may be a bit cumbersome and there may be better ways to do so, but you can query indeces via IsSelected().



  • On 11/10/2014 at 10:29, xxxxxxxx wrote:

    i'll try things out now... thank you so far



  • On 11/10/2014 at 10:31, xxxxxxxx wrote:

    You are welcome. 🙂



  • On 11/10/2014 at 11:45, xxxxxxxx wrote:

    Got it working using the following code:

    	selection = linkedSelection->GetBaseSelect();
    	
    	LONG pcnt = ToPoly(source)->GetPointCount();
    	LONG fcnt = ToPoly(source)->GetPolygonCount();
    	const CPolygon *fadr = ToPoly(source)->GetPolygonR();
    	LONG p1;
    	LONG p2;
    	
    	Neighbor neighbor;
    	if (!neighbor.Init(pcnt, fadr, fcnt, nullptr)) return NULL;
      
    	LONG edgeCount = neighbor.GetEdgeCount();
    	for (int i=0; i<edgeCount;i++)
    	{
    		fadr->EdgePoints(i,p1,p2);
    		String nfo = "";
    		if (selection->IsSelected(i)) nfo = "Selected";
    		GePrint(LongToString(i)+": "+LongToString(p1)+"->"+LongToString(p2)+" "+nfo);
    	}
    

    Thanks again to everybode helping here :)



  • On 11/10/2014 at 12:44, xxxxxxxx wrote:

    hm, probably a bit to early with my joy...

    for example if i have a cube as a basemesh and use the edge selection shown in the image. the console gives me the proper counting thru the edges and it seems the IsSelected works, too (it reacts twice edge 1 and 9).. but for the EdgePoints i get weird results. the first result makes sense (edge 1: point 1 and 3) but why does it return point 1 and 3 also for edge 9??



  • On 11/10/2014 at 13:01, xxxxxxxx wrote:

    Could it be, EdgePoints() delivers the point index on the polygon?
    I'm not sure and haven't tried it. And it's getting a bit late for today for me to do so.
    Doesn't the CPolygon contain the vertex indeces directly (a, b, c ,d)?



  • On 11/10/2014 at 13:04, xxxxxxxx wrote:

    yes, it does. but i need to get the indices for the points which build the selected edges only. not the whole polygon. i'll keep on trying :)



  • On 11/10/2014 at 13:07, xxxxxxxx wrote:

    Yes, I understood that. Via the index received from GetEdgePoints() you should be able to choose between a, b, c and d (like in the example on PolyInfo struct). I probably should have elaborated a bit further. Sorry.

    Once more I'm sorry, not like in the example. But in a similar way. I'd expect the indeces from GetEdgePoints() to correspond directly to a, b, c and d.



  • On 11/10/2014 at 13:09, xxxxxxxx wrote:

    ah, wait, i guess i understand now. is it that EdgePoints can only return 0 to 3


Log in to reply