# Copyright (c) 2026 JSOL CORPORATION # # 本スクリプトはMITライセンスのもとで公開しています。 # ライセンス全文は以下を参照してください。 # https://www.jmag-international.com/jp/scriptlibrary/jmag_script_library_mit/ def createEdgeSet(targetmodel): """x>=0のXZ平面上のエッジのセットを作成""" setList = targetmodel.GetSetList() pbedgeSet = setList.CreateEdgeSet(u"PeriodicBoundary") pbedgeSet.SetUpdateByRelation(False) pbedgeSet.SetMatcherType(u"OnHalfPlane") # "OnHalfPlane":面上で選択(半平面) pbedgeSet.SetParameter(u"axis_type", 1) # The 2nd argumet of SetCoordinateSystem # 名称かインデックス # プリセット座標系の名称は言語設定に従って固定 # インデックスはプロジェクト-モデル-座標系の下にある座標系定義から0ベースで指定 pbedgeSet.SetCoordinateSystem(u"coordinate", 3) #pbedgeSet.SetCoordinateSystem(u"coordinate", u"直交座標系(ローカル:Z-X-Y)") pbedgeSet.SetParameter(u"tolerance", 1e-06) pbedgeSet.Rebuild() return pbedgeSet def createPeriodicBoundary(targetStudy, targetEdgeEntities): """スタディに、渡されたエンティティセットを設定対象とする周期境界条件を作成する""" pdcond = targetStudy.CreateCondition(u"RotationPeriodicBoundary", u"pd") pdcond.ClearParts() pdcond.AddSet(targetEdgeEntities, 0) pdcond.SetValue(u"BoundaryType", u"Reverse") pdcond.SetValue(u"Angle", 90) pdcond.SetXYZPoint(u"Origin", 0, 0, 0) app = designer.GetApplication() model = app.GetModel(0) edgeEntities = createEdgeSet(model) study = model.GetStudy(0) createPeriodicBoundary(study, edgeEntities)