微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > Scripting in HFSS - particulary Python if you have used it.

Scripting in HFSS - particulary Python if you have used it.

时间:03-25 整理:3721RD 点击:
We are looking to buy a Linux version of an EM simulator, and HFSS is certainly being seriously considered. But I happened to ask Agilent what they see as the advantages of EMPro (their tool), over HFSS. One they pointed out what the EMPro uses Python for scripting, whereas HFSS uses Visual Basic. Now since I'd want a linux version, Visual Basic would be most unattractive.

I asked Ansys about this, who assure me you can use Python scripting in HFSS. But in the 300 and odd page HFSS manual on scripting, its all about VB and nothing about Python. I'm attending an advanced HFSS course later this month, and I'm told the lecturer will add something on Python scripting. But I'm still a bit concerned that Python might not be as well supported as Visual Basic.

Has anyone here used Python in HFSS? Have you used Visual basic for your scripts? Have you ever written a script for HFSS?

I'm a bit concerned about what I personally perceive as lack of support for Linux for HFSS. It is supposed to be supported in Redhat 4 and 5, but actually I could never get it to work under Redhat 5, due to the irritating FLEXlm license manager. The documentation for the license manager says it supports Redhat 3 and 4, with no mention of 5. I was sent a document by Ansys on installing HFSS on Redhat 5 and Ubuntu, but it was all about Ubuntu. Extensive use was made of "apt-get", despite no such command exists in Redhat. The equivalent is "yum"

Dave

I haven't used python to script, but have used javascript quite a bit in addition to vbscript. I transitioned to javascript when I found out it could be used and vbscript made me want to pull my hair out. The script recording features in HFSS only record in vbscript AFAIK, but it's fairly easy to convert to javascript. The one issue I did find was that there were a few function calls (which now I can't remember which) that seemed to be looking for VB arrays as inputs, and javascript arrays caused errors. I use this function to convert to VB arrays and don't have any more problems:

Code:
function toVB(jsArray) {
   var dict = new ActiveXObject("Scripting.Dictionary");
   for (var i = 0; i < jsArray.length; i++) {
      dict.add(i, jsArray[i]);
   }
   return dict.Items();
}
On a side note, I would be interested in the document on installing HFSS on Ubuntu. I had v13 working on it, but v14 failed if I remember.

Bill

There is a Matlab-HFSS API written by someone on the internet, which lets you call Matlab functions to create almost all features of HFSS GUI and creates the output VB script for you.

here is the download link

Talking with one of the Ansys folks, her preferred method of scripting for Hfss is in Python. I've been using VBScript and it is also driving me crazy. Anyone have sample code for running python in HFSS to get user input and create a geometry?

In HFSS, if you go to Tools > Record Script, and then change the files of type to Python, you will record your actions in a Python script. The syntax is almost identical between VB commands and Python commands as far as HFSS is concerned.

As far as Linux support goes, ANSYS does support both RHEL and Suse versions of Linux, and I have had few problems in the past getting HFSS to work on the supported versions. There are some issues with RHEL 6.4, but RHEL 5 is fully supported in the current version. I would recommend contacting the ANSYS support line for any more detailed questions.

Hello,

I am trying to use Spider to create scripts for HFSS in python.
I used the recorder in HFSS to record a simple Iron python script.
Then I tried to modify it using Spider in the Python(x,y) environment.
Spider gives me errors, like "invalid syntax for the simple like "Dim oAnsoftApp"
I understand that HFSS uses Iron Python, but looking at the syntax I can't figure out why it would not work.

what am I missing?

Thanks

Hi, Dim is VBS syntax actually. :)

I'm also trying to use Spyder to debug HFSS recorded script. However it doesn't recognizes "import clr" (says that there is no clr module). Anyone could help me on this one?

Thanks in advance.
Felipe

As far as the installation is concerned, HFSS 16 seems to be running fine in Centos 7. I needed to install it twice though. I am thinking of using IronPython myself, VBS is a real pain in linux (and in general). Do the Ansys material on scripting help at all or is it a waste of time?

it does help, but usually I just record stuff and edit later

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top