[S0015] プローブ・ベクトル・コンターを定義する

 

分布で出力される解析結果の確認手段は複数の方法があります。
このスクリプトでは、プローブ、ベクトルプロット、コンタープロットを作成しています。
プローブは、任意の位置での物理量を時系列グラフで表示します。
ベクトルプロットはベクトル値の物理量の流れを、コンタープロットは等値線図で分布量を視覚的に確認することができます。

前提条件

  • 分布量が出力されるスタディが1つ以上作成されていること
    このスクリプト例では、プロジェクトツリー上でアクティブな熱応力解析スタディに対して実行している

スクリプトにおける設定内容

  • 2点の測定位置を指定しプローブを作成
    このスクリプトでは接触力のX成分のプローブを作成している
    プローブの定義では測定位置が1つ以上必要なため、1つ目の測定位置はRenamePointとし、2つ目を追加のためAddLocationとしている
  • 全ての部品を対象にベクトルプロットを作成
    結果のタイプは面圧を設定
    ベクトルを示す矢印は、シンプルコーン、対象は表面、長さは自動、表示位置は要素面中心と設定
  • 全ての部品を対象にコンタープロットを作成
    結果のタイプは塑性ひずみのY成分を設定
    表示タイプは滑らかな塗りつぶしとなるシェーディングを設定
# Copyright (c) 2026 JSOL CORPORATION
#
# 本スクリプトはMITライセンスのもとで公開しています。
# ライセンス全文は以下を参照してください。
# https://www.jmag-international.com/jp/scriptlibrary/jmag_script_library_mit/

def createProbeByCoordinate(study, resultType, component):
    """引数で指定された結果タイプのプローブを作成する"""
    probeDefinition = study.CreateProbe(resultType)
    probeDefinition.SetResultType(resultType)
    # The 1st argumet of SetResultCoordinate
    # 名称かインデックス
    # プリセット座標系の名称は言語設定に従って固定
    # インデックスはプロジェクト-モデル-座標系の下にある座標系定義から0ベースで指定
    probeDefinition.SetResultCoordinate(0)
    # probeDefinition.SetResultCoordinate(u"直交座標系(全体)")
    probeDefinition.SetComponent(component)
    probeDefinition.SetProbeType(u"Coordinate")
    probeDefinition.SetLocationCoordinate(0)
    # probeDefinition.SetLocationCoordinate(u"直交座標系(全体)")
    probeDefinition.RenamePoint(0, u"PointA")
    probeDefinition.SetLocation(0, u"30", u"200", u"0")
    probeDefinition.AddLocation(u"50", u"150", u"0", u"PointB")
    probeDefinition.SetMoveWithPart(True)

def createVectorWithAllParts(study, resultType):
    """全ての部品を対象に引数で指定された結果タイプのベクトルプロットを作成する"""
    vectorDefinition = study.CreateVector(resultType)
    vectorDefinition.SetResultType(resultType)
    vectorDefinition.SetStyle(u"SimpleCone")
    vectorDefinition.SetScaled(True)
    vectorDefinition.SetPlace(u"FaceCenter")
    vectorDefinition.SetVectorType(0)
    vectorDefinition.SetNumSkips(u"2")
    vectorDefinition.SetDisplayAllParts(True)

def createContourWithAllParts(study, resultType, component):
    """全ての部品を対象に引数で指定された結果タイプのコンタープロットを作成する"""
    contourDefinition = study.CreateContour(resultType)
    contourDefinition.SetResultType(resultType)
    contourDefinition.SetResultCoordinate(0)
    # contourDefinition.SetResultCoordinate(u"直交座標系(全体)")
    contourDefinition.SetComponent(component)
    contourDefinition.SetContourType(u"Shading")
    contourDefinition.SetDisplayAllParts(True)

app = designer.GetApplication()
study = app.GetCurrentStudy()

resultType = u"ContactForce"
component = u"X"
createProbeByCoordinate(study, resultType, component)

resultType = u"FacePressure"
createVectorWithAllParts(study, resultType)

resultType = u"PlasticStrain"
component = u"Y"
createContourWithAllParts(study, resultType, component)

Download Python source code

ファイルご利用の注意点

JMAGスクリプトライブラリをご利用されるに際し、以下をよくお読みいただき、ご同意の上ご利用くださるようお願い申し上げます。

絞込み検索

  • カテゴリー 一覧

JMAG-Express Online
An engineer's diary