Page 1 of 1

Delete via point programatically

Posted: Fri Aug 19, 2022 2:56 pm
by silvestros
Hello all,

I am having some trouble figuring out how to safely delete muscle via points through the Matlab API.

Currently I am using:

Code: Select all

% Delete via point
if flag_delt2ViaDelete == true
   delt2_GP.deletePathPoint(init_state, point_count);
   osim_model.initSystem();
   osim_model.finalizeConnections();
   osim_model.initSystem();
end
but I am not sure about calling initSystem() on my model like this. If I do not call initSystem() after finalizeConnections() then I cannot place my model in any poses that I want to analyse. And if I do not call finalizeConnections() then Matlab crashes on the next API call.

Is this an ok way to work around this problem or am I missing something?

Thanks a lot!

Pavlos

Re: Delete via point programatically

Posted: Thu Sep 01, 2022 12:11 pm
by aymanh
Hi Pavlos,

This looks fine.

After deleting the point from the Set we require the recreation of the tree of components which is done in initSystem. We should not crash if finalizeConnections is not called but rather give a meaningful error message. If that's not the case I'd open a bug/issue report and include a minimal example to help us reproduce.

All the best,
-Ayman

Re: Delete via point programatically

Posted: Fri Sep 16, 2022 3:26 pm
by silvestros
Hi Ayman,

Thanks for confirming this for me! If I come across the issue again I will do as you suggested.

All the best,
Pavlos