ピ・プ

ピアノとプログラムが好きです。Houdiniの勉強内容をまとめたブログです

I started writing English since 2017/03/15

14Houdini AttribWrangleを使ってみた

attribwrangleを使うと点・線・面の追加・削除・編集が自由自在にできます。

 

以下のサイトを参考にした。

Houdiniレシピ:Wrangle Memo 01 | No More Retake

Houdiniレシピ:Wrangle Memo 02 | No More Retake

パラメーターには何が入るのか?Edit String&Expression - Qiita

VEX contexts

 

 

これらのAttributewrangleを書いてみました

f:id:karisuton:20161231203409p:plain

  • lineの作成

f:id:karisuton:20161231203352p:plain

  • faceの作成

f:id:karisuton:20161231203335p:plain

  • 四角形の作成

f:id:karisuton:20161231203240p:plain

コードが移りきらなかったのでいかに書いときます。

// create box
// 6 faces

// point
int Under_Points;
push(Under_Points,addpoint(geoself(), {0,0,0}));
push(Under_Points,addpoint(geoself(), {0,0,1}));
push(Under_Points,addpoint(geoself(), {1,0,1}));
push(Under_Points,addpoint(geoself(), {1,0,0}));

int Top_Points;
push(Top_Points,addpoint(geoself(), {0,1,0}));
push(Top_Points,addpoint(geoself(), {0,1,1}));
push(Top_Points,addpoint(geoself(), {1,1,1}));
push(Top_Points,addpoint(geoself(), {1,1,0}));

int underface = addprim(geoself(), "poly");
addvertex(geoself(), underface, Under_Points[0]);
addvertex(geoself(), underface, Under_Points[1]);
addvertex(geoself(), underface, Under_Points[2]);
addvertex(geoself(), underface, Under_Points[3]);

int topface = addprim(geoself(), "poly");
addvertex(geoself(), topface, Top_Points[0]);
addvertex(geoself(), topface, Top_Points[1]);
addvertex(geoself(), topface, Top_Points[2]);
addvertex(geoself(), topface, Top_Points[3]);

int sideface1 = addprim(geoself(), "poly");
addvertex(geoself(), sideface1, Under_Points[0]);
addvertex(geoself(), sideface1, Under_Points[1]);
addvertex(geoself(), sideface1, Top_Points[1]);
addvertex(geoself(), sideface1, Top_Points[0]);

int sideface2 = addprim(geoself(), "poly");
addvertex(geoself(), sideface2, Under_Points[1]);
addvertex(geoself(), sideface2, Under_Points[2]);
addvertex(geoself(), sideface2, Top_Points[2]);
addvertex(geoself(), sideface2, Top_Points[1]);

int sideface3 = addprim(geoself(), "poly");
addvertex(geoself(), sideface3, Under_Points[2]);
addvertex(geoself(), sideface3, Under_Points[3]);
addvertex(geoself(), sideface3, Top_Points[3]);
addvertex(geoself(), sideface3, Top_Points[2]);

int sideface4 = addprim(geoself(), "poly");
addvertex(geoself(), sideface4, Under_Points[3]);
addvertex(geoself(), sideface4, Under_Points[0]);
addvertex(geoself(), sideface4, Top_Points[0]);
addvertex(geoself(), sideface4, Top_Points[3]);