円周上の節点に集中荷重条件を設定するスクリプトを例示します。
import math
# 選択対象位置を決める半径
R = 28
# 半径方向の選択範囲の幅 (狭すぎると節点が選択されない場合があります。)
dR = 0.1
# 選択対象位置の角度の初期位置
Theta_start = 0
# 選択対象位置の角度の最終位置
Theta_end = 90
# 選択角度の増分
Theta_add = 15
# 周方向の選択範囲の幅 (狭すぎると節点が選択されない場合があります。)
dTheta = 0.1
app = designer.GetApplication()
# メッシュ表示にする
app.View().ShowMesh()
# 節点選択モードに切り替える
app.View().SelectElementVertex()
# 円筒指定の位置を設定するためのcylinderオブジェクトを定義
cylinder = app.CreateCylinder()
# 中心点の座標を設定
cylinder.SetCenterPoint(0, 0, 0)
# 中心軸の成分を設定
cylinder.SetCenterAxis(0, 0, 1)
# X軸の軸方向の成分を設定
cylinder.SetXAxis(1, 0, 0)
# 選択範囲の内側の半径を設定
cylinder.SetInnerRadius(R - dR/2)
# 選択範囲の外側の半径を設定
cylinder.SetOuterRadius(R + dR/2)
# 選択範囲の高さを指定するかどうかを設定
cylinder.SetUseHeight(False)
# 選択範囲の角度を指定するかどうかを設定
cylinder.SetUseAngle(True)
# 指定された角度範囲でループ
for theta in range(int(Theta_start), int(Theta_end) + 1, int(Theta_add)):
# 選択する範囲の開始角度を指定
cylinder.SetStartAngle(theta - dTheta/2)
# 選択する範囲の終了角度を指定
cylinder.SetEndAngle(theta + dTheta/2)
# 節点グループを作成 (グループ名は角度を示す文字列とする)
objNodeGroup = app.GetCurrentStudy().GetMeshGroupList().CreateNodeGroup(f"{theta}deg")
# 節点グループ内の選択を削除する
objNodeGroup.ClearParts()
# 節点グループ内の節点の情報を取得
sel = objNodeGroup.GetSelection()
# 選択を解除
sel.Clear()
# cylinderオブジェクトで指定した範囲の節点を選択
sel.SelectNodeByCylinderObject(cylinder, 1)
# 選択した節点をグループに追加
objNodeGroup.AddSelected(sel)
# 集中荷重条件を作成 (条件名は角度を示す文字列とする)
objCond = app.GetCurrentStudy().CreateCondition("ConcentratedLoad", f"{theta}deg")
# 荷重を設定
objCond.SetValue(u"Load", 1)
# 角度を度からラジアンに変換してcosとsinを計算
direction_x = math.cos(math.radians(theta))
direction_y = math.sin(math.radians(theta))
# 荷重の方向を円周に沿って設定
objCond.SetXYZPoint(u"Direction", direction_x, direction_y, 0)
# 条件を適用する対象をクリア
objCond.ClearParts()
# 対象に節点グループを追加
objCond.AddGroup(objNodeGroup, 0)
# 選択を解除
sel.Clear()


