Trouble finding GeometryPath of a PathSpring

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Finn Eagen
Posts: 10
Joined: Fri Jun 24, 2022 1:13 pm

Trouble finding GeometryPath of a PathSpring

Post by Finn Eagen » Fri Jan 06, 2023 11:34 am

Hello,

I am working with a path spring that wraps around a surface, and I am attempting to find the coordinates of the wrapping points as they change throughout a movement. It is similar to the question asked about muscle wrapping here (viewtopicPhpbb.php?f=91&t=7831).

However when I tried to implement similar code (adapted from the 4.0 code listed here viewtopicPhpbb.php?f=91&t=7723) for the path spring, it said that path springs have no function .getGeometryPath. Is the geometry path stored differently for a spring? How might I access it in MatLab?

The code in question:

spring = model.getForceSet.get('spring');
pathPointSet = spring.getGeometryPath().getPathPointSet();

Thank you for your help,
Finn

Tags:

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

Re: Trouble finding GeometryPath of a PathSpring

Post by Ayman Habib » Fri Jan 06, 2023 1:25 pm

Hi Finn,

When you retrieve a force from the ForceSet of the model, it comes back as a generic Force, as such it may or may not have an attached GeometryPath. To use methods specific to PathSpring for example you need to safeDownCast to it before making the call
springAsForce = model.getForceSet.get('spring');
pathSpring = PathSpring.safeDownCast(sprigAsForce);
path = pathSpring.get_GeometryPath();
Please let us know if that works for you,
-Ayman

User avatar
Finn Eagen
Posts: 10
Joined: Fri Jun 24, 2022 1:13 pm

Re: Trouble finding GeometryPath of a PathSpring

Post by Finn Eagen » Mon Jan 09, 2023 11:57 am

It did! Thank you so much for your help.

POST REPLY