Hi Maksym,
The joys of wrapping C++ in Python! You need to do something like:
my_node = fea.CastToChNodeFEAxyz(fea.CastToChNodeFEAbase(mesh.GetNode(1)))
print("t = ", sys.GetChTime(), " ", my_node.GetPos())
--Radu
From: [email protected] <[email protected]> On Behalf
Of Maksym Riabov
Sent: Wednesday, November 27, 2024 10:28 AM
To: ProjectChrono <[email protected]>
Subject: [chrono] Re: Get positions of FEA nodes in pychrono
Hello folks.
I'm completely blocked by this. Any simple way of solving it? It should be via
a single command or such.
Or is this a bug that needs fixing?
On Tuesday, November 26, 2024 at 12:17:14 AM UTC Maksym Riabov wrote:
Hello Chrono,
I've ran into the problem that it seems impossible to extract ChNodeFEAxyz
positions from pychrono.
The obvious thing would be:
```
for ch_node in ch_mesh.GetNodes():
position = ch_node_xyz.GetPos()
```
But GetNodes returns ChNodeFEAbase which does not contain xyz position.
I've tried typecasting, like this:
```
for ch_node in ch_mesh.GetNodes():
ch_node_xyz: fea.ChNodeFEAxyz = fea.CastToChNodeFEAxyz(ch_node)
# ch_node = ch_mesh.GetNode(ch_node.GetIndex()) #and something
like this, hoping that it would return ChNodeFEAxyz
position = ch_node_xyz.GetPos()
```
But the `ch_node_xyz.x`, `.y`, `.z` returns `nan`.
So, what can we do get positions of each node?
My usecase: given known AABB positions, find ones which a specific mesh
intersects. I believe it's possible to do through creating a separate
CollisionSystem instance and attempting to run it separately (I don't know if
it's possible), but then AABBs intersect that too.
Is it possible to solve this in PyChrono? Examples only export positions for
visualization and that's not what I need.
Thank you,
Maksym
--
You received this message because you are subscribed to the Google Groups
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
[email protected]<mailto:[email protected]>.
To view this discussion visit
https://groups.google.com/d/msgid/projectchrono/40c97670-6dfd-444c-9d2e-21619d1f48dan%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/40c97670-6dfd-444c-9d2e-21619d1f48dan*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!KteBtWCHh75Ul3PUzs-uxYsahLqLpuQBAQAbmulkpNVMUD_CUrn1JBbgM8NEs0S0nQ5OrLi__gGVzBSy-LJsFym44A$>.
--
You received this message because you are subscribed to the Google Groups
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/projectchrono/CH3PPF46CDC2185FBC2E0913D71D138B705A72B2%40CH3PPF46CDC2185.namprd06.prod.outlook.com.