要在HFSS 3D Layout運行script來取得PCB上面的電阻/電容/電感編號,可以參考以下代碼:
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.GetActiveEditor()
R_top = []
R_bot = []
for i in oEditor.FindObjects('Type', 'component'):
part_type = oEditor.GetPropertyValue('BaseElementTab', i, 'Part Type')
placement_layer = oEditor.GetPropertyValue('BaseElementTab', i, 'PlacementLayer')
if part_type == 'Resistor':
if placement_layer == 'TOP':
R_top.append(i)
elif placement_layer == 'BOTTOM':
R_bot.append(i)
AddWarningMessage(str(R_top))
AddWarningMessage(str(R_bot))
(圖一) TOP層以以及BOTTOM層的電阻 |
沒有留言:
張貼留言