programming memo 1 (e)

日本語はこちら(去年のポスト) Python: print  (command to show text lines of data on console,  for checking changes of numerical data mostly invisible in your code) “indent”  , “carriage return” are  important for python scripting syntax. # for comment out. put ‘#‘ at the beginning of line, then that line will be unfunctional. import (command to import “modules” which extend functions, as  can allow you to use the module in short name which you defined) for  repeating, possible to code with Lambda functions Grasshopper  component: input from left side , output to right side Grasshopper Python  component: left side inputs labeled like “x”, “y” can be used in your code as variable namedRead More »

  • Comments Off on programming memo 1 (e)

technical memo

質問があったのでメモしておきます。ライノパイソンとGhPythonの主な違いについて technical topics from last(kick start) session, There was question about difference between using rhino-Python and using GhPython Rhino-Python, command “EditPythonScript” and write your script on the editor.. You can run your python script and send command to Rhino directry. You will get the 3d model without preview. http://am.d-xx.com/?p=67 GH-Python, command “grasshopper”, after launching, place Python component and write your script into the component. You can preview the model until you “bake” it. http://am.d-xx.com/?p=54

  • Comments Off on technical memo

Utility モジュール / Pythonのリストの入れ子をGrasshopperのデータツリーに

Pythonのリストの入れ子をGrasshopperのデータツリーに 変換する関数 ListlistToTreeをモジュールにしました。 Utility.py ↑をCA_Neighbour.pyと同様 c:\MASunit フォルダに保存して、rhinocerosを再起動してください。 Pythonコンポーネント上で使うときは Utility.ListlistToTree の引数にネストされたリストを渡すと Tree に変換されたデータ型が返ってきます。今後も何かとUtilityモジュールの機能を拡張していきたいと思います。

  • Comments Off on Utility モジュール / Pythonのリストの入れ子をGrasshopperのデータツリーに

Simple Histogram python Object

simple_histogram.ghuser  修正版を使ってください。 ヒストグラムを描画するPythonオブジェクトです。GHのワークスペースにドロップすればインストールされます。使い方はオブジェクト内のpythonスクリプトのコメントを読んでください。詳しくはミーティング中に説明します。

  • Comments Off on Simple Histogram python Object

CA 近傍チェックモジュール 注意点

CA_neighbourは3Dで記述してありますので、高さ1のマトリックス(結果的に2Dのマトリックス)を組むときにはFront,BackをUp,Downと取り違えないように気をつけてください。 id = チェックするid w=セルマトリックス幅 d=セルマトリックス奥行 h=セルマトリックス高さ 左__ cn.Left(id, w, d, h) 右__ cn.Right(id, w, d, h) 前__ cn.Front(id, w, d, h) 後__ cn.Back(id, w, d, h) 前左_ cn.FrontLeft(id, w, d, h) 前右_ cn.FrontRight(id, w, d, h) 後左_ cn.BackLeft(id, w, d, h) 後右_ cn.BackRight(id, w, d, h) 上__ cn.Up(id, w, d, h) 上左_ cn.UpLeft(id, w, d, h) 上右_ cn.UpRight(id, w, d, h) 上前_ cn.UpFront(id, w, d, h) 上後_ cn.UpBack(id, w, d, h) 上前左 cn.UpFrontLeft(id, w, d, h) 上前右 cn.UpFrontRight(id, w, d, h) 上後左 cn.UpBackLeft(id, w, d, h) 上後右 cn.UpBackRight(id, w, d, h) 下__ cn.Down(id, w, d, h) 下左_ cn.DownLeft(id, w, d, h) 下右_ cn.DownRight(id, w, d, h) 下前_ cn.DownFront(id, w, d, h) 下後_ cn.DownBack(id, w, d, h) 下前左 cn.DownFrontLeft(id, w, d, h) 下前右 cn.DownFrontRight(id, w, d, h) 下後左 cn.DownBackLeft(id, w, d, h) 下後右 cn.DownBackRight(id, w, d,Read More »

  • Comments Off on CA 近傍チェックモジュール 注意点

シミュレーション Reaction-diffusion system 反応拡散系モデル

Reaction-diffusion system 反応拡散系モデル Reaction-diffusion.gh CA_neighbour module required イマイチダイレクトに論文の係数どおりにならないので、モデルの実装が正確かどうか怪しいですが、なんとなく現象は再現できているようです。係数の研究はこちら↓ http://mrob.com/pub/comp/xmorphia/pde-uc-classes.html http://www.aliensaint.com/uo/java/rd/ 「反応拡散」のうち「拡散 diffusion」 はよく使われる考え方なので、他のモデルにも応用できるかもしれません。この辺りを参考に ラプラス方程式  

  • Comments Off on シミュレーション Reaction-diffusion system 反応拡散系モデル

CA 近傍チェックモジュール

おそらく佐伯さんと蒔苗さんの扱うモデルはCAになります。となるとセルの近傍をidチェックするユーティリティが便利だと思われますので、群ユニット用にCA_neighbourというモジュールを作りました。セルをリニアーに格納した場合の近傍チェックです(多元配列では使えません)。 c:\MASunit というフォルダを作る ↓をDLしフォルダ内にコピーする CA_neighbour.py Rhinoceros を起動→Rhino の コマンドラインで “EditPythonScript” リターン すると Rhino Python Editorが起動するのでTool メニューから optionsを選択→Module Search Pathsの窓の下の + ボタンから 上で作った c:\MASunitフォルダを指定する→ ok →Rhino Python Editorを閉じる→Rhinocerosを再起動→Grasshopperを起動 <使い方> :セル id 0 における セル全体数 幅 5 セル 奥行 5 セル 高さ 5 セル での ノイマン近傍のリストを返しprintします :セル id 0 における セル全体数 幅 5 セル 奥行 5 セル 高さ 5 セル での ムーア近傍のリストを返しprintします :セル全体数 幅 5 セル 奥行 5 セル 高さ 5 セル の全てのセルにおける近傍(ノイマン近傍、ムーア近傍 両方)のリストのリストを表示します。 :セル空間をトーラス(無境界)に設定します。デフォルトはFalse(各辺 境界有り)。

  • Comments Off on CA 近傍チェックモジュール