AnsweredAssumed Answered

Getting the whole pointer array of the IBody2:Operations2 method

Question asked by J. R. on Mar 18, 2018
Latest reply on Mar 18, 2018 by J. R.



I am using a IBody2:Operations2 to cut a temporary body in half, and then use the resulting body or bodies for various calculations. As I understand it, after the operation is complete, the pointers, if not assigned, are lost, and cannot be retrieved (I tried GetBodies2 method, to no avail). Problem is, the standard assignment, as expressed like this,


Set tempBody = tempBody.Operations2(swBodyOperationType_e.SWBODYCUT, swCutBody, 0)(0)


only assigns one value of the array (naturally, due to the (0) at the end). Trying to assign the whole array to an array, like this,


    Dim BodyArr() As Object
    Set BodyArr = BodyCopy.Operations2(swBodyOperationType_e.SWBODYCUT, swCutBody, 0)


returns an error "cannot assign to array". Obviously, one could make multiple copies of the temporary body, and run the Operations2 for each body, each time assigning a different value of returned array to a different variable, but that's a very inefficient code, and will decrease the performance (in my case, there will be thousands of these operations running already, so I'm trying to code lean). Furthermore, it is difficult to determine how many bodies will result after the Operations2 method. I'd like to run Operations2 only once, and assign the whole pointer array to BodyArr. How do I do that?


Thank you in advance.