Hi Thomas,
I am trying to add an external force to my model in sconepy, however, I can't find a way to make it work:
When I try to call body.set_external_force(sconepy.Vec3(1, 0, 0)) on my body object, I get the error that no constructor is defined for sconepy.Vec3.
I tried to work around this by getting the current force as a Vec3 by calling f=body.external_force(). I then set f.x = 1, which gave me a new force vector. In a third step I wanted to apply the force to the body using the set_external_force(f) command, which seemed to work at first. However, when I called body.external_force() directly afterwards, it gave me the original force and not the one that I just set.
Can you tell me if I am doing something wrong, or what would be the correct way to apply an external force in sconepy?
Thanks in advance and best regards,
Sophie
Sconpy apply external force
- Thomas Geijtenbeek
- Posts: 457
- Joined: Wed Mar 12, 2014 8:08 am
Re: Sconpy apply external force
My apologies for the slow response. I will have to look into this. Can you send me the files I need to reproduce the issue?
- Mustafa Kamal
- Posts: 2
- Joined: Wed Mar 20, 2024 7:25 am
Re: Sconpy apply external force
Hi Thomas,
I'm encountering the same issue while trying to initialize a Vec3 vector in SconePy. I'm attempting to apply an external force to a body, but I keep getting the following error:
TypeError: sconepy.Vec3: No constructor defined!
The error occurs when I use the following code:
force = sconepy.Vec3(0.5, 0, 0)
Heres the relevant section of my code where the issue arises:
if t == 5:
pelvic_body = model.bodies()[1]
force = sconepy.Vec3(0.5, 0, 0)
pelvic_body.set_external_force(force)
What is the correct way to initialize a Vec3 vector in SconePy? Am I missing something here? Is there an alternative method for correctly initializing the Vec3 object?
Thanks in advance for your help!
I'm encountering the same issue while trying to initialize a Vec3 vector in SconePy. I'm attempting to apply an external force to a body, but I keep getting the following error:
TypeError: sconepy.Vec3: No constructor defined!
The error occurs when I use the following code:
force = sconepy.Vec3(0.5, 0, 0)
Heres the relevant section of my code where the issue arises:
if t == 5:
pelvic_body = model.bodies()[1]
force = sconepy.Vec3(0.5, 0, 0)
pelvic_body.set_external_force(force)
What is the correct way to initialize a Vec3 vector in SconePy? Am I missing something here? Is there an alternative method for correctly initializing the Vec3 object?
Thanks in advance for your help!
- Thomas Geijtenbeek
- Posts: 457
- Joined: Wed Mar 12, 2014 8:08 am
Re: Sconpy apply external force
This has been fixed for a while, but unfortunately the fix is not yet included in an official release.
If you contact me via email, I can send you a link to a preview release that includes the fix.
If you contact me via email, I can send you a link to a preview release that includes the fix.