Filter elements from AnyFloat

Hi,

I was wondering if it is possible to delete elements from an AnyFloat object. For example to delete every element smaller than zero in the AnyFloat.

Kind regards,

Laura

There is no easy way to do this in directly in AnyScript. At least not deleting elements. That is because the array could then change size dynamically.

It may be possible to implement this as an external Python function which can be called from AnyBody. I could give you an example of this. But the return value can’t change size after model load.

What is your use case? That may give me some better way of helping you. Maybe there is even an other way around your problem.

Hi Morten,

Thanks for your answer!
I am trying to select part of the points on the stl of the bones to fit the wrapping surfaces too. this in order to be able to more easily transfer to a different subject, without having to split the stl’s manually and load in each of them separately. Do you know an easy way to do this?

Kind regards,

Laura

Hi Laura,

You can get selected vertices of an STL if you know indices of this selection and they stay the same throughout your data:

    AnyInt NumPoints0 = STL_Size(SourceSTL, 1)[0];
    AnyFileVar SourceSTL = FilePathCompleteOf(...Source.Right.FilenamePelvis) + ".stl";
    AnyMatrix Points0unscaled = STL_Vertices(SourceSTL, iarr(0, floor(NumPoints0/NumPoints), NumPoints0 - 1), 1);

The second argument of the STL_Vertices function is the integer array of selected vertices. In this case we selected “NumPoints” number of vertices evenly spaced on the STL in terms of index.

So the task comes down to the selection of indices. Does that make sense?

Kind regards,
Pavel