[Binding/Sofa.Core] PointSetTopologyModifier#290
[Binding/Sofa.Core] PointSetTopologyModifier#290fredroy merged 3 commits intosofa-framework:masterfrom
Conversation
…nts works as expected, every call after that does not. Remove points works well, but validity of point to be removed is not checked yet.
|
Maybe the @epernod 's expert 👀 would be useful here :) |
|
Hi, could you develop what you mean by: every call after that does not Regarding removing of points, the process of renumbering is the same as I explained for removing tetrahedron in this issue: sofa-framework/sofa#3156 |
|
Case A:
So for 2. I would expect 10 more points to show up :D Case B:
Which is particularly weird, because I "reposition" them after trying to add them |
|
Still WIP ? |
Yes, because I still do not know where the observed behavior comes from. |
|
Ok I have further investigated the problem a bit, and I have a feeling that the changes are not properly passed to the MechanicalObject. |
|
During the sofadevmeeting we look at this PR. any update is it still in WIP ? |
Hi @damienmarchal |
Hello @damienmarchal, |
|
Hi all, After a quick investigation with @younesssss i would say the problem is in the c++ part. And @epernod is clearly the one to ask for insight, on my side I have zero knowledge on the topology change. |
|
Hi @damienmarchal @hugtalbot , When trying to write into py::array getPythonArrayFor(BaseData* d)
{
auto& memcache = getObjectCache();
if(d->isDirty() || memcache.find(d) == memcache.end())
{
auto capsule = py::capsule(new Base::SPtr(d->getOwner()), [](void*p){ delete static_cast<Base::SPtr*>(p); } );
py::buffer_info ninfo = toBufferInfo(*d);
py::array a(pybind11::dtype(ninfo), ninfo.shape,
ninfo.strides, ninfo.ptr, capsule);
memcache[d] = a;
return a;
}
return memcache[d];
}Since the binding itself is functional, I would like to merge it, and then open another issue to address the actual problem.
Cheers, |
|
Hi @damienmarchal could you have you 🐍 python eyes 👁️ on above Paul's comment? |
|
Hello @damienmarchal, |
I want to add bindings for
PointSetTopologyModifier'saddPointsandremovePointsin order to change the size of aPointSetTopologyContainerthat are propagated to components that are linked with the container (e.g.MechanicalObject,RestShapeSpringsForceField,FixedConstraint, ...).Work in Progress, because the binding does not work as expected and I could use some help on that.
I added an example in https://github.com/ScheiklP/SofaPython3/blob/point_topology_modifier/examples/pointSetTopologyModifier.py
On first call,
addPointsworks as expected, every call after that does not.removePointsworks well, but validity of point to be removed is not checked yet. Shouldrenumberalso be called?topology-2022-07-24_16.24.15.mp4
Also if I try to open the
MechanicalObjectfrom within the GUI after modifying the topology, I get a SegFault.