Use buttons in tags. Rope tag.
-
Hello again, everyone. I still can't figure out how I can use a button in a tag using python. I need to select two points and fix them in a tag. Can you tell me the correct solution? Use Python Generator.
-
Hi @SmetK,
Please make sure you have made yourself familiar with our Support Procedures, especially the "How to Ask Question" part:Repeatable: Your claims or problem should be repeatable for us. In most cases this means posting executable code which demonstrates your problem
Currently I can only guess the exact context you're asking this question in. Please note that attaching the project scene file that illustrates your setup is not prohibited, rather just the opposite - is highly appreciated.
Regarding your question. If you were in the Python Script context with a normal spline + Rope tag, you could simulate pressing the Fix button in a normal way by sending c4d.MSG_DESCRIPTION_COMMAND (e.g. in a way Maxime showed here: Update button) :
import c4d def main() -> None: opSpline: c4d.PointObject = op if op is None: return print('No object found') ropeTag = opSpline.GetTag(c4d.Trope) if ropeTag is None: return print('No rope tag found') bs = opSpline.GetPointS() bs.Select(0) data: dict = { 'id': c4d.HAIR_SDYNAMICS_PBD_SET_FIXED } ropeTag.Message(c4d.MSG_DESCRIPTION_COMMAND, data) if __name__ == '__main__': main()
However, assuming you'd like to have Rope tag on the Python generator, this doesn't seem to be possible. The aforementioned buttons only make effect, when the Rope tag is applied to the spline object (c4d.Ospline), otherwise nothing happens. You could potentially send the message to the Ospline cache object inside main() of the Python Generator, but this still wouldn't work as the Rope tag of the cache object is different from the one on the Python generator, and copying it is not allowed due to threaded nature of the python generator.
Cheers,
Ilia -
@i_mazlov Thank you for your reply. That was very helpful!