AEDT的函式庫是以物件導向,階層式的方式建構而成(如圖一)。最上層為oDesktop。底下衍生出來的不同模塊有各自的函數可以操作。比方說oDesktop不存在函式讓我們可以加入新的design。而在oProject底下可以找到InsertDesign()的指令可以插入新的設計。所以正確的順序是先從oDesktop建立新的project並指定到變數oProject,接著再使用oProject.InsertDesign()加入設計並指定到oDesign變數當中。這個順序跟我們手動設定方法是一致的。
oProject = oDesktop.NewProject()
oDesign = oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenTerminal", "")
以此類推,假設我們要在設計當中加入圓柱,需要用到oEditor.CreateCylinder()指令,而oEditor需要從oDesign當中取得,這時候程式碼為:
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCylinder(
[
"NAME:CylinderParameters",
"XCenter:=" , "-0.4mm",
"YCenter:=" , "-0.4mm",
"ZCenter:=" , "0mm",
"Radius:=" , "0.447213595499958mm",
"Height:=" , "1.2mm",
"WhichAxis:=" , "Z",
"NumSides:=" , "0"
],
[
"NAME:Attributes",
"Name:=" , "Cylinder1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])
以上的描述乍看有些複雜,實際使用過幾次之後,抓到訣竅之後其實並不難懂。這樣的架構好處是可以同時控制多個專案及設計,舉例來說,將某一個HFSS設計的局部結構複製到另一個Q3D的設計。我們可以用變量oHFSS及oQ3D分別代表HFSSDesign1及Q3DDesign1,並將HFSSDesign1當中的圓柱Cylinder1複製到Q3DDesign1設計當中。
oHFSS = oProject.SetActiveDesign("HFSSDesign1")
oHFSSEditor = oHFSS.SetActiveEditor("3D Modeler")
oHFSSEditor.Copy(
[
"NAME:Selections",
"Selections:=" , "Cylinder1"
])
oQ3D = oProject.SetActiveDesign("Q3DDesign1")
oQ3DEditor = oQ3D.SetActiveEditor("3D Modeler")
oQ3DEditor.Paste()
oModule可以細分成不同功能模組,底下是HFSS的模組列表。每個模組有各自的函式可以使用,功能包含設定端口,網格,邊界條件或是輸出模擬資料等等。其他產品有各自不同的模組,細節可以查詢說明文件,點選本連結可以下載函式總表。
oProject = oDesktop.NewProject()
oDesign = oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenTerminal", "")
(圖一) AEDT函式庫階層 |
以此類推,假設我們要在設計當中加入圓柱,需要用到oEditor.CreateCylinder()指令,而oEditor需要從oDesign當中取得,這時候程式碼為:
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCylinder(
[
"NAME:CylinderParameters",
"XCenter:=" , "-0.4mm",
"YCenter:=" , "-0.4mm",
"ZCenter:=" , "0mm",
"Radius:=" , "0.447213595499958mm",
"Height:=" , "1.2mm",
"WhichAxis:=" , "Z",
"NumSides:=" , "0"
],
[
"NAME:Attributes",
"Name:=" , "Cylinder1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])
以上的描述乍看有些複雜,實際使用過幾次之後,抓到訣竅之後其實並不難懂。這樣的架構好處是可以同時控制多個專案及設計,舉例來說,將某一個HFSS設計的局部結構複製到另一個Q3D的設計。我們可以用變量oHFSS及oQ3D分別代表HFSSDesign1及Q3DDesign1,並將HFSSDesign1當中的圓柱Cylinder1複製到Q3DDesign1設計當中。
oHFSS = oProject.SetActiveDesign("HFSSDesign1")
oHFSSEditor = oHFSS.SetActiveEditor("3D Modeler")
oHFSSEditor.Copy(
[
"NAME:Selections",
"Selections:=" , "Cylinder1"
])
oQ3D = oProject.SetActiveDesign("Q3DDesign1")
oQ3DEditor = oQ3D.SetActiveEditor("3D Modeler")
oQ3DEditor.Paste()
oModule可以細分成不同功能模組,底下是HFSS的模組列表。每個模組有各自的函式可以使用,功能包含設定端口,網格,邊界條件或是輸出模擬資料等等。其他產品有各自不同的模組,細節可以查詢說明文件,點選本連結可以下載函式總表。
- BoundarySetup
- MeshSetup
- AnalysisSetup
- Optimetrics
- Solutions
- ModelSetup
- FieldsReporter
- RadField
- ReportSetup
- OutputVariable
- UserDefinedSolutionModule
沒有留言:
張貼留言