[D0003] コイルに電流条件を追加

 

現在のスタディで、名前が「コイル」の部品に対して電流条件を設定する。

from designer import *

def main():      
	DeApp = GetApplication()
	study =  DeApp.GetCurrentStudy()
	if study.IsValid() == 0:
		MsgBox("No current study")
		return

	model = DeApp.GetCurrentModel()
	selection =model.CreateSelection()
	selection.SelectPart("Coil")

	if selection.NumParts() == 0:
		MsgBox("Coil parts cannot be found")
		return

	current = study.CreateCondition("Current","Current/Coil")
	point = DeApp.CreatePoint(-5.925, 0.237231, -4.85)
	direction = DeApp.CreatePoint(0,1,0)
	current.SetPointWithUnit ("origin", point,"mm")
	current.SetPointWithUnit ("direction", direction,"mm")

	current.AddSelected(selection)
	selection.Clear()
	amp = 0.0216
	turn = 14600
	current.SetValue( "current", amp)	
	current.SetValue( "turn", turn)	

if __name__ == "__main__":
    main()

Download Python source code

ファイルご利用の注意点

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