動画は前回と同じものです。
ラベルの作成
ラベルの作成方法については、この記事を読んでいただけると理解が深まります。今回作成するラベルに必要なパラメータは以下となります。本当に簡単な部分だけの実装にしていますので、パラメータ数は少ないです。
![]() |
追加パラメータリスト |
LIBRARYGLOBAL
実際にMVO(モデル表示オプション)のようなライブラリグローバルオブジェクトから値を取得する際には、LIBRARYGLOBALコマンドを使用します。以下のマスタースクリプトにあるように、LIBRARYGLOBAL("オブジェクト名", "パラメータ名", "格納する変数")のような形にすることで値を呼び出すことができます。今回MVO設定から呼び出したいデータはいずれも配列値なので、DIMを使って先に宣言しておきます。
また、GLOB_IDは要素IDを返してくれるグローバル変数です。MVOに登録した符号の中に、要素IDと一致するものがあるかどうかを検索します。一致するものがあれば、そのデータを呼び出し、無ければとりあえずの値を入れるようにしています。
マスタースクリプト
width=BEAM_THICKNESS length=(BEAM_LENGTH_RIGHT+BEAM_LENGTH_LEFT)/2 index=0 dim _symbol[], _top_num[], _stp_pitch[] success = LIBRARYGLOBAL ("rbSetting", "symbol", _symbol) success = LIBRARYGLOBAL ("rbSetting", "top1_num", _top_num) success = LIBRARYGLOBAL ("rbSetting", "stp_pitch", _stp_pitch) for i=1 to vardim1(_symbol) if GLOB_ID = _symbol[i] then index=i endif next i IF NOT(index=0) THEN top_num=_top_num[index] stp_pitch=_stp_pitch[index] else top_num=2 stp_pitch=0.5 ENDIF
2Dスクリプトで書いている内容は、簡易鉄筋ラベルの時とほとんど変わりませんので、そこまで説明する必要はないかと思います。詳しくはこちらをご覧ください。
2Dスクリプト
unid=2000 !ラベルの回転 rotBy = -LABEL_ROTANGLE !ビューの回転 _unused = REQUEST ("View_Rotangle", "", angleViewRot) corr = 0 if AC_bLabelAlwaysReadable & (AC_LabelOrientation = 1 | AC_LabelOrientation = 5) then summarot = (LABEL_ROTANGLE + angleViewRot) % 360 if summarot > 90 & 270 >= summarot then corr = 180 endif rot2 rotBy + corr add2 -LABEL_POSITION [1][1], -LABEL_POSITION [1][2] add2 BEAM_POSITION[1],BEAM_POSITION[2] rot2 BEAM_DIRECTION !基準線オフセット add2 0, BEAM_REFLINE_OFFSET !かぶり line2 0, width/2 - left_cover_thickness, cos(ac_beam_inclination)*length,width/2 - left_cover_thickness line2 0, -(width/2 - right_cover_thickness), cos(ac_beam_inclination)*length, -(width/2 - right_cover_thickness) add2 stp_dim, 0 for i=1 to int(length/stp_pitch)+1 arc2 (i-1)*stp_pitch, width/2 - (left_cover_thickness+stp_dim/2) , stp_dim/2, 0, 180 arc2 (i-1)*stp_pitch, -width/2 + (right_cover_thickness+stp_dim/2) , stp_dim/2, 180, 360 line2 (i-1)*stp_pitch - stp_dim/2, width/2 - (left_cover_thickness+stp_dim/2) ,(i-1)*stp_pitch - stp_dim/2, -width/2 + (right_cover_thickness+stp_dim/2) line2 (i-1)*stp_pitch + stp_dim/2, width/2 - (left_cover_thickness+stp_dim/2) ,(i-1)*stp_pitch + stp_dim/2, -width/2 + (right_cover_thickness+stp_dim/2) next i del 1 scope= width - (stp_dim*2 + left_cover_thickness + right_cover_thickness + top_dim) pitch=scope/(top_num-1) add2 0, width/2 - (left_cover_thickness+stp_dim+top_dim/2) for i=1 to top_num add2 0, -pitch*(i-1) arc2 -st_anchorage_length,0, top_dim/2, 90, 270 arc2 length+ed_anchorage_length, 0, top_dim/2, 270, 90 line2 -st_anchorage_length, top_dim/2, cos(ac_beam_inclination)*length + ed_anchorage_length,top_dim/2 hotline2 -st_anchorage_length, top_dim/2, cos(ac_beam_inclination)*length +ed_anchorage_length ,top_dim/2, unid :unid=unid+1 line2 -st_anchorage_length, -top_dim/2, cos(ac_beam_inclination)*length + ed_anchorage_length,-top_dim/2 hotline2 -st_anchorage_length, -top_dim/2, cos(ac_beam_inclination)*length + ed_anchorage_length,-top_dim/2, unid :unid=unid+1 del 1 next i del 1 !定着ホットスポット hotspot2 0 , 0, unid, st_anchorage_length,1+128 :unid=unid+1 hotspot2 -st_anchorage_length, 0, unid, st_anchorage_length,2 :unid=unid+1 hotspot2 1 , 0, unid, st_anchorage_length,3 :unid=unid+1 hotspot2 length , 0, unid, ed_anchorage_length,1+128 :unid=unid+1 hotspot2 length+ed_anchorage_length , 0, unid, ed_anchorage_length,2 :unid=unid+1 hotspot2 length-1 , 0, unid, ed_anchorage_length,3 :unid=unid+1
このように個々のオブジェクト単位ではなく、プロジェクト単位での共通のデータをまとめて管理するようにすることで、管理しやすくなると思います。それをMVOでやるべきかどうかの議論はあるかと思いますが、こんなことも出来るという一例として考えていただければと思います。APIを使えばUserData等に任意のデータを格納できたりしますが、GDLだけでこれをやる手法がMVO以外にあるのか分かりませんので、もし他の方法をご存知の方がいらっしゃいましたら教えていただけると幸いです。
今回は以上となりますが、記事の要望やお悩みごと等ございましたらお気軽にお問い合わせください。
【お知らせ】
ココナラでのサポートサービスも承っておりますので、
ご活用いただければと思います。
1日GDL作成やArchiCAD関連の相談のります 自分でGDLを作成している方へXのアカウントもありますので、ぜひフォロー頂けると嬉しいです。
アカウントはこちらから⇨https://x.com/BIM_arekore
世界の建設業従事者、BIM推進者と繋がりたいです。よろしくお願いします。
0 件のコメント:
コメントを投稿
何でも気軽にコメントください。