Hi,
a Python program needs to receive "z" from pd.
In pd I generate "z" values by moving a slider.
The Python code is already ready to receive z.
What is the correct patch to do this?
Thanks,
a.
pd2py.pd
Send data from pd to py
Hi,
a Python program needs to receive "z" from pd.
In pd I generate "z" values by moving a slider.
The Python code is already ready to receive z.
What is the correct patch to do this?
Thanks,
a.
pd2py.pd
Simply connect the slider to the sender.
Work in progress : FCPD a FreeCAD PureData connexion
@FFW said:
Simply connect the slider to the sender.
Ok, but I left the blank space between slider and netsend because I don't know how to write the variable z that python expects. Something like "send z $1".
@atux You can try that....... pd2py_v2.pd
Does it work?
If not then post your Python code and someone will tell you why not.
David.
@whale-av said:
@atux You can try that....... pd2py_v2.pd
Does it work?
If not then post your Python code and someone will tell you why not.
David.
Thanks, it works fine.
But in order for python to receive the values correctly, I had to remove "-b" from [netsend -u -b].
These are some values received from pd:
$ python3 py_from_pd.py
Socket bind completed on 127.0.0.1:9999. Waiting for messages...
Raw data received from ('127.0.0.1', 51903): b'z 0.5;\n'
Decoded message: z 0.5;
Value of z: 0.5
Raw data received from ('127.0.0.1', 51903): b'z 0.509868;\n'
Decoded message: z 0.509868;
Value of z: 0.509868
Raw data received from ('127.0.0.1', 51903): b'z 0.519737;\n'
Decoded message: z 0.519737;
It seems good to me.
I attach both files, so it can be useful:
py_from_pd.py
pd2py_v2.pd
Thank you,
a.
[netsend]
help for the [send(
message says "same as list" so you can also do
[hslider]
|
[list prepend z]
|
[netsend]
Work in progress : FCPD a FreeCAD PureData connexion
@FFW said:
[netsend]
help for the[send(
message says "same as list" so you can also do[hslider] | [list prepend z] | [netsend]
Yes, that's how it works too.
pd2py_v3.pd
For less computational effort, is one preferable to the other, or are they equivalent?
Thank you,
a.
I think it's easier to dynamically upgrade the variable name with the [list prepend] right inlet.
Work in progress : FCPD a FreeCAD PureData connexion
Oops! Looks like something went wrong!