[Sidefx-houdini-list] Setting python expression with HOM

Sandy Sutherland sandy.maillists at gmail.com
Tue Dec 13 11:02:04 EST 2016


Heh - no problem Andy - thanks for replying anyway.

S.

On Mon, Dec 12, 2016 at 4:47 PM, Andy Nicholas <andy at andynicholas.com>
wrote:

> Doh! I should've read the question better ;)
>
>
> On 12/12/2016 16:46, Christopher Crouzet wrote:
>
>> The most intuitive way would be to use Python's triple quote syntax to
>> create multi-line strings:
>>
>> expr = """
>> if ch('../switch') == 0:
>>       do something amazing
>> elif ch('../switch') == 1:
>>       do another more amazing thing
>> """
>> i.parm('polysoup').setExpression(expr, hou.exprLanguage.Python)
>>
>>
>> On 12 December 2016 at 23:42, Andy Nicholas <andy at andynicholas.com>
>> wrote:
>>
>> Hi Sandy,
>>> You can right click on the parameter and do "Edit Expression" to open up
>>> a
>>> multi-line editor.
>>> Cheers,
>>> A
>>>
>>>
>>> On 12/12/2016 16:39, Sandy Sutherland wrote:
>>>
>>> Hi All,
>>>>
>>>> Anyone how how to apply an expression using something like this -
>>>>
>>>> i.parm('polysoup').setExpression(expr, hou.exprLanguage.Python)
>>>>
>>>> Basically I need to have a python expression something like this -
>>>>
>>>> if ch("../switch") == 0:
>>>> do something amazing
>>>> elif ch("../switch") == 1:
>>>> do another more amazing thing
>>>>
>>>> But I am not sure how to do this from a line of code setting up expr =
>>>> '.....my python expression..', adding in the necessary indents etc...
>>>>
>>>> Thanks
>>>>
>>>> Sandy
>>>> _______________________________________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>
>>>> _______________________________________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>
>>>
>>
>>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list