ArchiCADで仮設計画〜仮囲いオブジェクト②〜

2024年10月31日木曜日

define extrude GDL gosub 仮囲い

t f B! P L
前回に引き続き、仮囲いオブジェクトに機能を追加していきます。今回は、調整パネルを実装し、半端な長さにも対応できるようにします。また、単管の横地と各種ジョイント金物の3D表示機能も実装していきたいと思います。

調整パネル

調整パネルは、画像のように端部から2枚目の位置に配置される仕組みにしています。範囲の長さがパネル幅で割り切れない場合、自動的に調整パネルが挿入されます。また、調整パネルの材質を通常のパネルと異なるものに設定しているため、調整材がどこに配置されているかが一目でわかるようになっています。
archicad gdl
調整パネルの材質を変更可能に

このオブジェクトを作成するには、以下のような3Dスクリプトを使用します。「調整パネル」ラベルでは、主に材質とパネルの形状のみを定義しています。

工夫すべき点は、スクリプト内のif文の部分です。ここで調整パネルの可動域を設定し、範囲外の数値が入力された場合には調整パネルが表示されない仕組みを作っています。詳しい挙動については、下の動画をご参照ください。

3Dスクリプト
unid = 3000

gosub "マテリアル定義"

hotspot 0, 		0, 0, unid, scope, 1+128 	:unid=unid+1
hotspot scope, 	0, 0, unid, scope, 2		:unid=unid+1
hotspot -1, 	0, 0, unid, scope, 3	 	:unid=unid+1

for i=1 to panel_num - 1
	gosub "パネル"
	addx panel_W
next i

if (scope%panel_W) > 0.05 & (scope%panel_W) <= 0.48 then
	gosub "調整パネル"
endif

del panel_num - 1

!最後の一枚
add scope - panel_W, -panel_t, 0
	gosub "パネル"
del 1


end


~~~~~~~~~~~~~~~~~~~~~~~~~~~~省略~~~~~~~~~~~~~~~~~~~~~~~~~~~

"調整パネル":
	building_material panel_bm
	material adjust_mat
	extrude 14, 0, 0, height, 1+2+4+16+32,
		0, 0, 0,
		panel_W+0.02, 0, 0,
		panel_W+0.02, - panel_t, 0,
		panel_t, - panel_t, 0,
		panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.022, 0,
		0.024, -0.022, 0,
		0.024, -0.030, 0,
		0.008, -0.030, 0,
		0.008, -0.014, 0,
		0, -0.014,0

return


マスタースクリプトにif文を2つ追加し、調整外の数値が入力された場合に自動的に標準パネルで割り切れるように値を調整する仕組みを組み込みました。こちらも詳しい挙動については、下の動画をご覧ください。
マスタースクリプト
eps = 0.0000001

height = panel_h
panel_W = 0.5
panel_t = 0.003

panel_num = int(scope/panel_W)
parameters panel_num = panel_num

if (scope%panel_W) <= 0.05 then
	parameters scope = panel_W*panel_num
endif

if (scope%panel_W) >= 0.48 then
	parameters scope = panel_W*(panel_num+1)
endif


adjust_matを追加



ジョイント金具と単管

次にジョイント金具と単管の実装に進みます。今回は、必要な位置に金具が付いていることがわかる程度のシンプルな3D表現にとどめ、金具の細かな形状は作成していません。また、単管はひとまず一本もので表示されるようになっています。

詳しい挙動は動画をご覧いただけると理解しやすいかと思います。

以下はスクリプト全体で、要点は次の3つです。

  1. "マテリアル定義"ラベル
    マテリアル定義を行っており、数が増えたときに管理しやすいよう、一箇所にまとめています。

  2. 各種金具の定義
    複雑な処理はしていませんが、どの金具をどこでgosubコマンドで呼び出しているかを注目してください。

  3. 単管の横地の定義
    「単管」と「横地」ラベルに分けて作成しています。単管は縦地でも使用するため、汎用性を持たせています。横地の本数はパネルの高さによって変わるため、"横地"ラベル内で判定式を使って調整しています。


(基本的な説明をかなり省いてますので、初歩的な部分については過去の記事を漁っていただけると良いかと思います。)

3Dスクリプト
unid = 3000

gosub "マテリアル定義"

hotspot 0, 	0, 0, unid, scope, 1+128 	:unid=unid+1
hotspot scope, 	0, 0, unid, scope, 2		:unid=unid+1
hotspot -1, 	0, 0, unid, scope, 3	 	:unid=unid+1

for i=1 to panel_num - 1
	gosub "パネル"
	addx panel_W
next i

if (scope%panel_W) > 0.05 & (scope%panel_W) <= 0.48 then
	gosub "調整パネル"
endif

del panel_num - 1

!最後の一枚
add scope - panel_W, -panel_t, 0
	gosub "パネル"
del 1

add scope , -panel_t, 0
	gosub "ジョイントJ右"
del 1

gosub "横地"

!==============================================
end
!==============================================

!===============================================
!マテリアル定義
!===============================================
"マテリアル定義":
	DEFINE MATERIAL "フック材質" 0,
		1.0, 0.8, 0.2,! 表面 RGB [0.0..1.0]
		1.0, ! 環境係数 [0.0..1.0]
		0.5, ! 拡散係数 [0.0..1.0]
		0.5, ! 鏡係数 [0.0..1.0]
		0.0, ! 透過係数 [0.0..1.0]
		100.0, ! 光沢 [0.0..100.0]
		1, ! 透過減衰量 [0.0..4.0]
		0.5284, 0.5989, 0.6167,! 鏡面 RGB [0.0..1.0]
		0, 0, 0, ! 放射 RGB [0.0..1.0]
		0.0 ! 放射減衰量 [0.0..65.5]

	DEFINE MATERIAL "ジョイントS材質" 0,
		0.2, 0.8, 1.0,! 表面 RGB [0.0..1.0]
		1.0, ! 環境係数 [0.0..1.0]
		0.5, ! 拡散係数 [0.0..1.0]
		0.5, ! 鏡係数 [0.0..1.0]
		0.0, ! 透過係数 [0.0..1.0]
		100.0, ! 光沢 [0.0..100.0]
		1, ! 透過減衰量 [0.0..4.0]
		0.5284, 0.5989, 0.6167,! 鏡面 RGB [0.0..1.0]
		0, 0, 0, ! 放射 RGB [0.0..1.0]
		0.0 ! 放射減衰量 [0.0..65.5]
	
	DEFINE MATERIAL "ジョイントL材質" 0,
		0.2, 1.0, 0.5,! 表面 RGB [0.0..1.0]
		1.0, ! 環境係数 [0.0..1.0]
		0.5, ! 拡散係数 [0.0..1.0]
		0.5, ! 鏡係数 [0.0..1.0]
		0.0, ! 透過係数 [0.0..1.0]
		100.0, ! 光沢 [0.0..100.0]
		1, ! 透過減衰量 [0.0..4.0]
		0.5284, 0.5989, 0.6167,! 鏡面 RGB [0.0..1.0]
		0, 0, 0, ! 放射 RGB [0.0..1.0]
		0.0 ! 放射減衰量 [0.0..65.5]

	DEFINE MATERIAL "ジョイントJ材質" 0,
		1.0, 0.6, 0.2,! 表面 RGB [0.0..1.0]
		1.0, ! 環境係数 [0.0..1.0]
		0.5, ! 拡散係数 [0.0..1.0]
		0.5, ! 鏡係数 [0.0..1.0]
		0.0, ! 透過係数 [0.0..1.0]
		100.0, ! 光沢 [0.0..100.0]
		1, ! 透過減衰量 [0.0..4.0]
		0.5284, 0.5989, 0.6167,! 鏡面 RGB [0.0..1.0]
		0, 0, 0, ! 放射 RGB [0.0..1.0]
		0.0 ! 放射減衰量 [0.0..65.5]
return

!===============================================
!パネル
!===============================================
"パネル":
	building_material panel_bm
	material panel_mat
	extrude 24, 0, 0, height, 1+2+4+16+32,
		0, 0, 0,
		panel_W, 0, 0,
		panel_W, -0.016, 0,
		panel_W + 0.008, -0.016, 0,
		panel_W + 0.008, -0.030, 0,
		panel_W - 0.008, -0.030, 0,
		panel_W - 0.008, -0.022, 0,
		panel_W - 0.008 + panel_t, -0.022, 0,
		panel_W - 0.008 + panel_t, -0.030 + panel_t, 0,
		panel_W + 0.008 - panel_t, -0.030 + panel_t, 0,
		panel_W + 0.008 - panel_t, -0.016 - panel_t, 0,
		panel_W - panel_t, -0.016 - panel_t, 0,
		panel_W - panel_t, - panel_t, 0,
		panel_t, - panel_t, 0,
		panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.022, 0,
		0.024, -0.022, 0,
		0.024, -0.030, 0,
		0.008, -0.030, 0,
		0.008, -0.014, 0,
		0, -0.014,0

	gosub "ジョイントJ左"

	if i > 1 then
		gosub "ジョイントJ右"
	endif
return

"調整パネル":
	building_material panel_bm
	material adjust_mat
	extrude 14, 0, 0, height, 1+2+4+16+32,
		0, 0, 0,
		panel_W+0.02, 0, 0,
		panel_W+0.02, - panel_t, 0,
		panel_t, - panel_t, 0,
		panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.014 + panel_t, 0,
		0.008 + panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.030 + panel_t, 0,
		0.024 - panel_t, -0.022, 0,
		0.024, -0.022, 0,
		0.024, -0.030, 0,
		0.008, -0.030, 0,
		0.008, -0.014, 0,
		0, -0.014,0

	add panel_W - 0.03, -0.007, height - 0.049
		gosub "フック"
	del 1

	add panel_W - 0.03, -0.007, - 0.001
		gosub "ジョイントS"
	del 1

	IF int(panel_h) = 3 then
		add - 0.022, -0.031, height/2 + 0.1
		gosub "ジョイントL"
		del 1
	endif

	add - 0.022, -0.031, 0.25
		gosub "ジョイントL"
	del 1

	add - 0.022, -0.031, height - 0.27
		gosub "ジョイントL"
	del 1

	gosub "ジョイントJ左"
return

!===============================================
!各種ジョイント金具
!===============================================

"ジョイントL":
	material "ジョイントL材質"
	brick 0.06, 0.015,0.02
return

"ジョイントS":
	material "ジョイントS材質"
	brick 0.02, 0.008,0.05
return

"フック":
	material "フック材質"
	brick 0.02, 0.008,0.05
return

"ジョイントJ":
	material "ジョイントJ材質"
	j_w = 48.6/2000 + 0.002
	extrude 4, 0, 0, 0.01, 1+2+4+16+32,
		0.01, j_w, 0,
		0.01, -j_w, 0,
		54.3/1000, -j_w, 0,
		54.3/1000, j_w, 1000
return

"ジョイントJ左":
	add 0.034, 0, 0.15
	rotx 90
	roty -90
	gosub "ジョイントJ"
	del 3

	add 0.034, 0, height - 0.15
	rotx 90
	roty -90
	gosub "ジョイントJ"
	del 3

	if int(panel_h) = 3 then
		add 0.034, 0, height/2
		rotx 90
		roty -90
		gosub "ジョイントJ"
		del 3	
	endif
return

"ジョイントJ右":
	add -0.008, 0, 0.15
	rotx 90
	roty -90
	gosub "ジョイントJ"
	del 3

	add -0.008, 0, height - 0.15
	rotx 90
	roty -90
	gosub "ジョイントJ"
	del 3

	if int(panel_h) = 3 then
		add -0.008, 0, height/2
		rotx 90
		roty -90
		gosub "ジョイントJ"
		del 3	
	endif	
return

!===============================================
!単管
!===============================================

"横地":
	if int(panel_h) = 2 then
		tankan_l = scope
		add 0, -54.3/1000, 0.15
		roty 90
		gosub "単管"
		del 2

		add 0, -54.3/1000, height - 0.15
		roty 90
		gosub "単管"
		del 2
	endif

	if int(panel_h) = 3 then
		tankan_l = scope
		add 0, -54.3/1000, 0.15
		roty 90
		gosub "単管"
		del 2

		add 0, -54.3/1000, height/2
		roty 90
		gosub "単管"
		del 2

		add 0, -54.3/1000, height - 0.15
		roty 90
		gosub "単管"
		del 2
	endif
return

"単管":
	material tankan_mat
	cylind tankan_l, 48.6/2000
return

長くなりましたが、今回はここまでとします。次回は、ジョイント金具の数量を算出し、控えの単管などを追加していく予定です。


仮囲い関連の記事はこちら


なお、基本的なGDLの学習はこちらの教材がおすすめです!
GDLリファレンスがgraphisoftが用意していますが、初見では理解しづらいので、
簡単にまとめられたやさしく学ぶArchiCAD GDLプログラミングという本で基礎をしっかり学びましょう!

【お知らせ】
Xのアカウントを作成しましたので、ぜひフォロー頂けると嬉しいです。
アカウントはこちらから⇨https://x.com/BIM_arekore

世界の建設業従事者、BIM推進者と繋がりたいです。


検索

GDLオブジェクト

UI (4) ユニーク (1) ラベル (2) 仮囲い (6) 多角形 (3) 小ネタ (4) (7) 椅子 (4) 法規 (1) 無償DL (4) 足場 (15) 足場計画 (4)

ブログ アーカイブ

自己紹介

自分の写真
GDL作成などBIM活用のお仕事の相談お待ちしております。 #中堅ゼネコン出身 #施工管理職 #生産設計部 #BIM開発部門
ArchiCADのGDLをコスパよく作成します ArchiCADユーザーでGDL作成を外部委託されている方へ

QooQ