Python new point indices after points have been deleted
-
Hello,
can someone help me to find out how i can get (in Python) the new point index for a PointObject's old point index after some points have been deleted? MSG_POINTS_CHANGED is aid to send a translation map, but apparently this is optional and I had no success in receiving it. There surely is an easier way than to compare each point after the change with each point before the change? Thanks for any hint.
Fabian
Edit a_block: Entire post was heading2, fixed
-
Ok, got it. I was confused by the way Cinema reordered the indices. I was expecting all indices to shift, so when the point with index 10 gets deleted, 11 would become 10, 12 would be 11 and so on. In fact only the point with the highest index jumps down to fill the gap while all others remain the same. Makes sense of course, but it had me confused
So I can work with that. However, if someone does know how to retrieve the translation map from MSG_POINTS_CHANGED, I'd be very interested. What does it actually mean that the map is optional? Is it that I could include a map if I were to send the message myself?
-
Hello Fabian,
I suggest to take a look at the snippets provided in the
VariableChanged
documentation (the data structure used in conjunction withMSG_POINTS_CHANGED
).The availability of the translation map depends on the situation. As shown in the docs, there may be no need for it, if the last point gets deleted or a new one is added at the end. But it may also depend on the actual tool sending the message.
You can not request the map. And you also should not send the message, unless you develop a tool that changes the points array, because for example tags attached to an object would react to the message and interpret it as a new change.I turned this thread into a question.
Cheers,
Andreas -
Hi Andreas,
thanks for the reply. I wasn't planing to send the message, just trying to understand what's happening. It would make my life sonmewhat easier if there was a way to request the map and having that map sent under all circumstances. But since that's not happening, I'll have to work around that. -
I forgot to turn this thread into a question. Done now, and as I regard the last post as a "solved" message, I also marked it as solved. Please, don't hesitate to turn back to unresolved, if I was wrong.