Home › Forum › SOFA › Programming with SOFA › [SOLVED] SofaPython Pick objects
Tagged: 64_bits, Linux_mint, python, SOFA_1712, SofaPython
- This topic has 10 replies, 3 voices, and was last updated 6 years, 1 month ago by Rishabh.
-
AuthorPosts
-
19 September 2018 at 17:33 #11961RishabhBlocked
Hello, I am working on a cloth simulation problem and in my framework I plan to manipulate the cloth with a point object, now to pick up the object, in a manner similar to SHIFT+LeftMouseClick, is there a function in python to do the same? If not, is there anything similar to that?
19 September 2018 at 17:42 #11962ElDiwinyBlockedHi Rishabh,
I didnot get what you are looking for exactly, could you please elaborate more with more details?.
19 September 2018 at 17:51 #11963RishabhBlockedHello ElDiwiny, thanks for your quick response.
So, in the way that we can use SHIFT+LeftMouseClick in GUI to pick up objects, is there a functionality in SofaPython Plugin which allows us to pick up objects in a similar manner?
For example, if I have a cloth lying on a table and I wish to pick it up by attaching its vertex to a small point object, just like you would do it with the mouse arrow in the GUI
Please let me know if it’s still unclear, I could upload a video/image to show what I mean
20 September 2018 at 21:32 #11974ElDiwinyBlockedHi Rishabh,
Sorry for the late reply! Could you please check these files that I have uploaded and see whether this could answer your question. If that doesnot answer your question, I will try to help you as much as I can.
https://drive.google.com/open?id=1WlAn9ya-8dRUoXfxK1JliaOCrCJ-1ocs
https://drive.google.com/open?id=15Wc9sN-hu7C58Rfb5EHoNgF2UG0m4pPX21 September 2018 at 11:51 #11982RishabhBlockedHello ElDiwiny, that was a good illustration of what my simulation looks like! and now assume that rather than using the mouse to move the cloth points, I want an automated python script to move a pointer object, a red sphere in this case, please have a look at this video
https://drive.google.com/open?id=1w_FKrmAFR8tbYbwUDaYzHieifI19aiq8
Here, the sphere can be moved from within a python script, and made to go at an part of the cloth that we want, now, If we want to stick the cloth to this sphere, so that the cloth moves with this sphere, how can we do it?
To make it easier to comprehend, I am looking for a method that would attach this sphere to a point on the cloth and release it afterwards.
Thanks a lot
24 September 2018 at 23:30 #12001ElDiwinyBlockedHi Rishabh,
Sorry for my late reply! I understand you question, it is related to RigidMapping probably, however, I cannot guarantee that I can solve, but I will try to do my best, would be able to share the scene script.
24 September 2018 at 23:30 #12002ElDiwinyBlocked.
25 September 2018 at 18:09 #12020RishabhBlockedHello, yes sure, here is my script, https://gist.github.com/jangirrishabh/20ac603134528219a8b3a2c2667172f5
1 October 2018 at 15:34 #12072RishabhBlockedHello ElDwiniy, if you would be able to give me a hint towards how to go about doing it with RigidMapping, I might be able to help as well! any minor directions would be appreciated π
2 October 2018 at 18:03 #12078etagliabueBlockedHi @jangirrishabh,
I’ve come across your post and I think you should have a look at this post. I think that either the AttachConstraint or the BilateralInteractionConstraint components could work for you.
I hope you’ll find it useful.
Eleonora5 October 2018 at 16:22 #12117RishabhBlockedHi @eleonora, your suggestion was very valuable! I finally figured out how to carry out my task by the method mentioned in the post that you suggested, thanks a lot π
Hello @meldiwiny I figured out a solution, AttachConstraint works here! thanks a lot for your help
Cheers!
Rishabh -
AuthorPosts
- You must be logged in to reply to this topic.