Page 1 of 1

Trouble finding GeometryPath of a PathSpring

Posted: Fri Jan 06, 2023 11:34 am
by finn.eagen
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

Re: Trouble finding GeometryPath of a PathSpring

Posted: Fri Jan 06, 2023 1:25 pm
by aymanh
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

Re: Trouble finding GeometryPath of a PathSpring

Posted: Mon Jan 09, 2023 11:57 am
by finn.eagen
It did! Thank you so much for your help.