On 11/01/2017 at 07:54, xxxxxxxx wrote:
Hi!
I'm using C4D R16 and I'm trying to write a short script that goes through all edge and polygon selection tags in the selected objects and exports the data of the selected edges to an external file. The documentation however is very superficial.
So far I have tried 2 approaches:
The BaseSelect object has a write method that uses a HyperFile. This output some data into a file. The file seemed to contain some extra information beyond the edges and polygons, as well as a large number of padding 0-s or 0-s that denoted who knows what. And not knowing how edge data is stored (I assumed originally that each edge would be 2 ints for the 2 end points' id-s, but the file didn't look like that, it contained too few non-zero words), I had no way of interpreting the data.
The second approach was to use BaseSelect.GetAll() and output the data with the built in IO functions of Python as text. The latter part worked fine, but GetAll() returned a series of 0-s instead of useful data. For the edges it output twice the number of selected edges, for the polygons it output as many 0-s as the olygons selected. This suggests to me that my initial assumption on edges couldn't have been too far off and polygons are stored with id-s that can be used to look up their vertices in which case what was up with the HyperFile?
My questions:
- How does C4D store polygon and edge data?
- Is there a more extensive documentation on the BaseSelect class than the one in the official documentation of the SDK? The official one is neat, but lacks any sort of information on data structures.
- What's up with all the 0-s?
- Is what I'm doing feasible at all and off only by overlooking a necessary step or two, or should I try a completely different approach? Is there one?
Thanks,
zoliking