Wrangle x Python book I tried it [2]

What is this?

This is a continuation of this

Wrangle x Python book I tried it [1] http://qiita.com/it_ks/items/baba553ca587ed52a316

Last time it was on p.10. This time, I will work on Python example sentences from p.11 to p.15.

Before accepting

** Houdini Practical Handbook Wrangle x Python ** This is a book produced by the circle "Magic Distilled Water". http://majou.jp/archives/667/

I was wondering if you are interested here. https://www.toranoana.jp/mailorder/article/04/0030/38/99/040030389986.html If you look at it now, it's gone! If you have circle stock, you may be able to buy it at an event.

hmath.buildRotate

p.11 Rotation.

for point in geo.points():
    pos = point.position()
    mtx = hou.hmath.buildRotate(0,45,0)
    pos = pos*mtx
    point.setPosition(pos)

It will be like this py_p11.png It's rotated, oh oh oh

By the way, Make another Grid and use it as a template The original state is compared with the one after rotation.

find/add/set attribute

The attributes on p.14 are also

py_p14.png This doesn't happen in the screenshot

Suddenly the opening line

hou.pwd().geometry()

It was a taste that became.

evalParm

Get the value from the parameter using p.15, evalParm.

First you have to create the parameters.

Parameter creation

From the action menu at the top right of the parameter panel 「Edit Parameter Interface...」 edit_param.png

Such a UI will appear ↓ edit_param_dialog.png

Select the data type in the left column and go to the right column. (Drag and drop is fine, or the arrow on the column partition is OK)

Change the parameter names as instructed in the book.

A slider will appear below the Python Code field.

Run

py_p15.png If you move the slider, it will move up and down.

Summary

It's getting interesting, isn't it?

(Even if it is attached to it, there are abundant data types when adding parameters. It is reliable.)

reference

Edit Parameter Interface window http://sidefx.jp/doc/ref/windows/edit_parameter_interface.html

Geometry > findPointAttrib http://sidefx.jp/doc/hom/hou/Geometry.html#findPointAttrib Geometry > addAttrib http://sidefx.jp/doc/hom/hou/Geometry.html#addAttrib

Point > setAttribValue http://sidefx.jp/doc/hom/hou/Point.html#setAttribValue

Recommended Posts

Wrangle x Python book I tried it [2]
Wrangle x Python book I tried it [1]
I tried Python> autopep8
I tried Python> decorator
I tried fp-growth with python
I tried scraping with Python
I tried Python C extension
[Python] I tried using OpenPose
AWS Lambda now supports Python so I tried it
I tried gRPC with Python
I tried scraping with python
I tried to touch Python (installation)
I tried web scraping with python.
I tried using Thonny (Python / IDE)
I tried Grumpy (Go running Python).
I tried running prolog with python 3.8.2.
I tried Line notification in Python
I tried SMTP communication with Python
[Python] I tried using YOLO v3
I tried to solve the ant book beginner's edition with python
I tried ChatOps with Slack x API Gateway x Lambda (Python) x RDS
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried to implement permutation in Python
I installed DSX Desktop and tried it
I tried scraping Yahoo News with Python
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried sending an email with python.
I tried using Bayesian Optimization in Python
I tried non-photorealistic rendering with Python + opencv
I tried using UnityCloudBuild API from Python
I tried to implement ADALINE in Python
I tried a functional language with Python
I tried recursion with Python ② (Fibonacci sequence)
I tried to implement PPO in Python
Python: I tried the traveling salesman problem
Mayungo's Python Learning Episode 8: I tried input
[Python] I tried to calculate TF-IDF steadily
I tried scraping Yahoo weather (Python edition)
I tried to touch Python (basic syntax)
CheckIO (Python)> Non-unique Elements> I implemented it
I tried the Python Tornado Testing Framework
#I tried something like Vlookup with Python # 2
When I tried to run Python, it was skipped to the Microsoft Store
I tried to imitate Python x Kivy de Kinoppy (Kinokuniya bookstore app)
[Zaif] I tried to make it easy to trade virtual currencies with Python
[Python / DynamoDB / boto3] List of operations I tried
I tried "smoothing" the image with Python + OpenCV
I tried hundreds of millions of SQLite with python
[Python] I introduced Word2Vec and played with it.
vprof --I tried using the profiler for Python
I tried web scraping using python and selenium
I tried "differentiating" the image with Python + OpenCV
I tried scraping
I tried object detection using Python and OpenCV
I tried PyQ
I tried playing a typing game in Python
When I try matplotlib in Python, it says'cairo.Context'
I tried simulating the "birthday paradox" in Python
I tried the least squares method in Python