THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/07/2007 at 14:34, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.008
Platform: Windows ;
Language(s) : C++ ;
---------
I'm trying to get the polygons from a selection tag so I can write them out (writing an export plugin, based on the stl filter example) -- and with the code below, I can go through all the tags, but instead of pulling the selected polygons from each tag, it's grabbing what's currently selected. (I know that from debugging code that's in mine that I didn't post here -- it shows me which polys are selected, and those numbers line up with the polygon mode of the structure tab...) Now, I'm pretty sure it's because I'm using "GetPolygonS" but I'm not entirely convinced that I'm on the right path and that changing that one thing would fix it all, so I decided to post here. I'm pretty new to c++ so most of what's here is hobbled together from what I've found on this forum or through experimentation (which, I know, isn't really good), so I may have some bad coding in there (if I do, please point that out). Also, while I'm asking :) once I've got them below in "i" (where it says "do something - i is the selected element") -- what do I do with that polygon number? I know it relates to a poly in the list, but I'm not sure how to create some kind of poly holder (see my noobiness showing through?) to get the data I need from it.
Thanks in advance....
BaseTag* tag = op->GetFirstTag();
while (tag)
{
if (tag->IsInstanceOf(Tpolygonselection))
{
BaseObject* obj = op;
if (obj && obj->GetType() == Opolygon)
{
PolygonObject* poly = static_cast<PolygonObject*>(obj);
BaseSelect* sel = poly->GetPolygonS();
while(sel->GetRange(seg++,&a;,&b;))
{
GePrint("Segment " + LongToString(seg));
for (i=a; i<=b; ++i)
{
// ... do something - i is the selected element
GePrint("Found poly in range: " + LongToString(i));
}
}
}
}
tag = tag->GetNext();
}