Delete via point programatically

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pavlos Silvestros
Posts: 13
Joined: Tue Apr 12, 2022 9:57 am

Delete via point programatically

Post by Pavlos Silvestros » Fri Aug 19, 2022 2:56 pm

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

Tags:

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

Re: Delete via point programatically

Post by Ayman Habib » Thu Sep 01, 2022 12:11 pm

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

User avatar
Pavlos Silvestros
Posts: 13
Joined: Tue Apr 12, 2022 9:57 am

Re: Delete via point programatically

Post by Pavlos Silvestros » Fri Sep 16, 2022 3:26 pm

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

POST REPLY