編寫Q3D自動化程式需要取得設計當中的net name及類別(signal, ground, floating)。也必須知道物件所對應的net名稱。底下程式碼可以取得以上所提到的資訊:
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor('3D Modeler')
oModule = oDesign.GetModule('BoundarySetup')
x = oModule.GetExcitations()
info = zip(x[0::2], x[1::2])
AddWarningMessage(str(info))
signal_nets = [i for i, j in info if j=='SignalNet']
result = {}
for s in signal_nets:
result[s] = []
for i in oModule.GetExcitationAssignment(s):
objname = oEditor.GetObjectNameByID(int(i))
result[s].append(objname)
AddWarningMessage(str(result))
(圖一)輸出net名稱及其類型,輸出net所包括的物件名 |
沒有留言:
張貼留言