revised version, which receive multiple breps, count vertical surfaces count eaves ceiling do not count surface touches ground (Z axis == 0) but still the input breps must be boolean unioned, would be better to make simple shape model(not that precise) analyse_test01.zip
Category: GhPython
Graph module sample (how to set up studio python modules)
download python files from here Studio Python Modules put python files in the same folder of .gh file import and initialize in your code graph_test.3dm graph_test1.gh actual code of get shortest path in network and visualize the path shortest distance calculation by Dijkstra method (e / j )
GA_SA_sample2
modification from last tutorial set penalty if points are closer less 10 distance in case if there are fixed 3 points evaluation = mesh area – total network_length GA_SA_sample2.gh GA_SA_sample2.3dm
GA / SA sample
very simple sample, how to apply GA(Genetic Algorithm)/SA(Simulated Annealing) to a problem through grasshopper:galapagos. Applying this problem as simple example, GA_SA_sample.gh
some basic practices
01.zip 各パイソンコンポーネントのpreviewをon/off 切り替えながら試してみてください.このポストに対するブログからのお知らせメールが届いたら、1回目だけ市川まで確認メールください。 Just for 1st time, when you got notification email from this blog, please email to Ichkawa.
find Hamilton Path
出発ノードを指定して、ハミルトン閉路を探す関数のサンプルです。グラフモジュール graph_1_1.py を使います。 maxim_1Stroke.zip ハミルトン閉路がない場合、最も多くノードを介する閉路のリストを返します。 GH-Pythonだと計算フレームが問題になりそうです。サンプルは30ノード38エッジ程度。
graph_1_1 グラフモジュール bugfix
traceroute (passcountの不具合など)が適切に作動しないバグを修正しました。 graph_1_1.py 各自アップデートをお願いします。
graph_1_1 グラフモジュール バージョン1.1
graph_1_0 はモジュールからクラスインスタンスを作る形でしたが、クラス内の関数などがエディタ補完機能で、補完されずに使いにくかったので、モジュール対して直に初期化するようにしました(その代わり複数のグラフを同時に作れません)。その他、関数も追加してあります(ネットワーク距離でのクラスタリング、ward, k-means++ など)。 graph_1_1.py 座標精度により、カーブの頂点がマッチしていないと、グラフがうまく生成されない、というやっかいな問題ですが、スタジオユーティリティーモジュール studio_utility_1_0.py に という関数が実装されています。ライン、ポリラインの始点・終点の座標の指定桁を丸める(切り捨てる)関数です。 これで無理やりライン、ポリラインを変換すると割りとグラフ化できる率があがります。
studio_utility_1_0 更新
download studio_utility_1_0.py studio_utility_1_0.py ユーティリティモジュールを更新しました。 新しい関数は、渋谷さんのプロジェクトで必要そうなものです。 木を配置→ヴォロノイダイアグラムを描く→ghpc.Voronoi(self.treepoints)ヴォロノイセル毎にポリラインが返ってくる→ポリラインを線に分解(su.explodeRsPolyline)→線の重複を除去(su.delDupLineInList)→一筆書きのエッジ組み合わせを作る(オイラー経路を調べること!)→グラフを作る
CPlane 原点
CPlane origin 原点を変更すると、Rhino.Geometry Point などで座標が一致しないことがあるようです。 コードを書くときはなるべくCPlaneをデフォルトの原点にあわせておきましょう。