Monkey Work Memo2

Saori Yoshimoto work notes since 2018

Tuesday, November 14, 2023

[Hython]Shows a list of default path.

How to display a list of directories where Houdini reads for Python files by default.

>>> import sys

>>> a = sys.path

>>> for i in a:

...     print i

... 

C:/PROGRA~1/SIDEEF~1/HOUDIN~1.759/python27/lib/site-packages-ui-forced

C:/Users/user01/Documents/houdini18.5/python2.7libs   <------- I confirmed adding the directory.

Monday, November 6, 2023

[Python] Basic syntax

  • range()
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(5,10)
[5, 6, 7, 8, 9]
>>> list(range(0,10,3))
[0, 3, 6, 9]
>>> list(range(10,0,-3))
[10, 7, 4, 1]

range(stop)                0 ≦ i < stop
range(start, stop)          start ≦ i < stop
range(start, stop, step)  start ≦ i < stop
range(stop, start, -step)  stop ≧ i > start

  • for()
>>> names = ['pico', 'ted', 'hop']
>>> for i in names:
...      print i
pico
ted
hop
  • remove(), del()
>>> names = ['pico', 'ted', 'hop']
>>> names.remove('pico')
>>> names
['ted', 'hop']
>>> names.pop(1)
'hop'
>>> names
['ted']
  • random(), uniform(), randrange(), randint()
>>> num = range(5)
>>> num
[0, 1, 2, 3, 4]
>>> random.randint(0, len(nums)-1)
4

Monday, September 12, 2022

[Dos]robocopy

robocopy : Synchronize the contents of two folders

ex.)

robocopy source destination [file [file]...] [options]

Wednesday, January 12, 2022

[Hython] My shelf

◆◆◆◆New Tool◆◆◆◆

source_nodes = hou.selectedNodes()

for m in source_nodes:
    allsub_nodes = m.allSubChildren()
    for n in allsub_nodes:
        if n.type().name() == 'file':
            print n.path()
            print n.evalParm('file')
            print '----'

Monday, September 20, 2021

[VEX] Modify Packed Primitive: Intrinsic

◆PackedAlembic

--Transform off (= jump to origin)

setprimintrinsic(0, "abcusetransform", @primnum, 0, "set");


--back to default pos

-Transform position on point

@P = point(1, "P", @primnum);

-Transform scale & rot on prim

matrix xform = primintrinsic(1, "packedfulltransform", @primnum);

matrix scale = ident() * 100;

matrix3 rot = matrix3(xform * scale);

setprimintrinsic(0, "transform", @primnum, rot, "set");

Friday, August 20, 2021

[Linux-centOS] Useful command "ZIP", "UNZIP"

-ZIP compress :                     zip -r <compress file name>.zip <target name>

-ZIP compress + password:    zip -er <compress file name>.zip <target name>

------

◆unzip

unzip '*.zip'

◆If you have a large number of zip files to unzip, use "xargs"

find . -name '*.zip' | xargs -n1 unzip

◆"unzip" + "xargs" + Specify the output destination.

find . -name '*.zip' | xargs -n1 unzip -d <output directory name>

※The files hit by "find" command are passed to "xargs" command for unzipping. 

"xargs" will "unzip" every time it finds a file by specifying "-n1".