c4d.CallButton(myTagPSR,c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD)
-
Dear all,
I try to add a PSR constraint with 2 targets, and this I do with de callbutton. This is in a loop. But somehow I can't find what I doing wrong. Do I have to add something before I do a callbutton command?
#Add PSR constraint to CenterMid myTagPSR = ListCenterMid[Loop3].MakeTag(1019364) myTagPSR[c4d.ID_BASELIST_NAME] = "PSR " myTagPSR[c4d.ID_CA_CONSTRAINT_TAG_PSR] = True c4d.CallButton(myTagPSR,c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD) myTagPSR[10001] = ListCenterIn[Loop3] myTagPSR[10011] = ListCenterOut[Loop3]
-
Hi @kverhaar in which Cinema 4D version are you?
Where are you executing the script (in the script manager? I a tag?)In any case, I'm not able to reproduce in R23.008 the next code works as expected
import c4d # Main function def main(): myTagPSR = op.MakeTag(1019364) myTagPSR[c4d.ID_BASELIST_NAME] = "PSR " myTagPSR[c4d.ID_CA_CONSTRAINT_TAG_PSR] = True # Create 2 object and create a list so we can iterate over them sphere = c4d.BaseObject(c4d.Osphere) platonic = c4d.BaseObject(c4d.Oplatonic) doc.InsertObject(sphere) doc.InsertObject(platonic) objList = [sphere, platonic] # Add 2 times c4d.CallButton(myTagPSR, c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD) targetCount = myTagPSR[c4d.ID_CA_CONSTRAINT_TAG_PSR_TARGET_COUNT] for i in range(targetCount): CONSTRAINT_ELEMENT = 10 # This is hardcoded targetId = c4d.ID_CA_CONSTRAINT_TAG_PSR_TARGET_COUNT + i * CONSTRAINT_ELEMENT + 1 myTagPSR[targetId] = objList[i] c4d.EventAdd() # Execute main() if __name__=='__main__': main()
Cheers,
Maxime. -
I hoped it was something small, because the script I made is 700 rules long and is connected to a cinema file. I put the files to this reply. I work in version S22.123
If you open the cinema file you can run the script. I changed the PSR is changed in a AIM, and the command that is not working is in rule 245. In the tree the aim can be found on "Center Mid 02". I hope this gives something where you can find the problem.
Thanks for you reply
Sheaves of python.c4d [0_1600762843324_PY Sheaves9.py](Uploading 100%)
-
Hi @kverhaar, unfortunately I can't see your python file. but please kee pin mind we are not there to develop for you or even debug for you.
But only to support you or guide you via the API, so please try to reduce your example as small as possible before posting it (this is also a good habit for yourself to solve your issue yourself).Cheers,
Maxime. -
@m_adam said in c4d.CallButton(myTagPSR,c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD):
c4d.CallButton(myTagPSR, c4d.ID_CA_CONSTRAINT_TAG_PSR_ADD)
Thanks for this info. In de future I will try to do so. I my attempt to make it a small example I find my error. The command doc.InsertObject() was below the AIM in my script. For the AIM it is no problem but for the callbutton it is.
-
Gload you solved your issue, if you have any questions, please feel free to open a new topic.
Ho and I forget the most important, welcome in the plugincafe community
Cheers,
Maxime.