淘宝官方店 推荐课程 在线工具 联系方式 关于我们 | |
微波射频仿真设计 Ansoft Designer 中文培训教程 | HFSS视频培训教程套装 |
|
首页 >> Ansoft Designer >> Ansoft Designer在线帮助文档 |
Script Guide > Additional Property Scripting ExampleThe following is a sample script that creates a PlanarEM design, draws a rectangle in the layout editor and uses the GetPropertyValue, SetPropertyValue and GetProperties functions. The script gets all properties of the rectangle. It then loops through the properties and for each one, shows the user the current value and asks if the value should be changed. Note that the last call to GetPropertyValue in the script will fail if you change the name of the rectangle from the script.
---------------------------------------------------------------------- ' Script Recorded by Designer/Nexxim ' 8:10 AM Dec 05, 2003 ----------------------------------------------------------------------
Dim oAnsoftApp Dim oDesktop Dim oProject Dim oDesign Dim oEditor Dim oModule Set oAnsoftApp = CreateObject("AnsoftDesigner.DesignerScript") Set oDesktop = oAnsoftApp.GetAppDesktop() ' oDesktop.RestoreWindow oDesktop.NewProject Set oProject = oDesktop.GetActiveProject ' ' CREATE A RECTANGLE IN PLANAR_EM ' oProject.InsertDesign "Planar EM", "PlanarEM1", _ "C:\testinstall\Designer\syslib\PCB - SingleSided.asty", "" Set oDesign = oProject.SetActiveDesign("PlanarEM1") Set oEditor = oDesign.SetActiveEditor("Layout") oEditor.CreateRectangle Array("NAME:Contents", _ "rectGeometry:=", Array("Name:=", _ "rect_1", "LayerName:=", "Top", "lw:=", _ "0mm", "Ax:=", "-22mm", "Ay:=", "20mm", "Bx:=", _ "29mm", "By:=", "-4mm", "ang:=", "0deg")) ' ' GET ALL PROPERTIES OF THE RECTANGLE ' Dim all_props Dim prop Dim val Dim new_val ' all_props = oEditor.GetProperties("BaseElementTab","rect_1") ' ' LOOP OVER ALL PROPERTIES ' For Each prop in all_props val = oEditor.GetPropertyValue("BaseElementTab","rect_1",prop) ' ' DISPLAY VALUE TO THE USER ' new_val = InputBox("New Value of "+prop+":",_ "Current Value of "+prop+" is "+val,val) ' ' CHANGE THE VALUE IF DESIRED ' If new_val <> val Then oEditor.SetPropertyValue _ "BaseElementTab","rect_1",prop,new_val val = _ oEditor.GetPropertyValue("BaseElementTab","rect_1",prop)
MsgBox("Now the value of "+prop+" is "+val) End If ' Next '
HFSS视频教程 ADS视频教程 CST视频教程 Ansoft Designer 中文教程 |
Copyright © 2006 - 2013 微波EDA网, All Rights Reserved 业务联系:mweda@163.com |