FastFieldSolvers Forum
FastFieldSolvers Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
 All Forums
 FastFieldSolvers
 FastHenry2
 Automation in Python
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dave

2 Posts

Posted - Sep 29 2017 :  11:44:45  Show Profile  Reply with Quote
Hey,

i'm trying to automate FastHenry with Python.
Any suggestion how to create a FastHenry2Object?

Can anyone provide me the FastHenry2 Automation Example Programs mentioned in the FastHenry help. I cannot find them in my install directory.

Best Regards

David

Enrico

542 Posts

Posted - Sep 30 2017 :  20:01:02  Show Profile  Reply with Quote
The sample files changed position after Windows Vista, where the installation directories became protected and required admin privileges for writing into.

The online help of FastHenry still reports the old information, thanks for spotting that. The updated information is in the FastModel online help, "Installation" page:

  • Under a root directory (usually FastFieldSolvers under 'Program Files' folder in the English version of Windows, but you could have chosen a different path during installation), a structure containing the four directories FastModel, FasterCap, FastCap2 and FastHenry2. These directories contain the executable files, the help files and the licenses. Due to Windows user's policies, standard users cannot modify the content of these folders.

  • Under the 'Shared Documents' folder (in the English version of Windows XP, this usually is 'C:\Documents and Settings\All Users\Shared Documents', or in Windows Vista and Windows 7, this usually is the folder 'Public'), visible and fully accessible to all users, a root directory called "FastFieldSolvers" containing three folders FasterCap, FastCap2, FastHenry2. In these folders you'll find the samples related to the three programs. Please take some time to browse around and get accustomed with the contents.


Regarding COM Automation from Python, you need to install the Windows extensions for Python, as this technology is pretty MS Windows specific (in spite of the original intention of having a common agnostic interface). You can search the web for the instructions on how to do so.

Best Regards,
Enrico



Go to Top of Page

sdattalo

USA
2 Posts

Posted - Oct 03 2019 :  00:21:51  Show Profile  Reply with Quote
I know this thread is rather dated, but I had the a similar question about using Python to interface to FasterCap. I managed to get it working. Here's the Python equivalent script for the VBS example.

# Fastercap python example
# This is a python implementation of the Visual basic script example in
# the Fastercap automation examples
# This example has been tested with Python 3.7.0
#

import os
import win32com.client
import win32api
FasterCap = win32com.client.Dispatch("FasterCap.Document")
pathStr = os.getcwd()

s = ["sphere0.txt", "sphere1.txt", "sphere2.txt", "sphere3.txt"]

for sphere in s:
  FasterCap.Run(pathStr+"\\" +sphere +" -a0.01")

  while FasterCap.IsRunning():
    win32api.Sleep(500)

  cap = FasterCap.getCapacitance()
  print (sphere+"  Cap={}".format(cap[0][0]))


If your python script crashes for some reason, you may need to go into the Windows task manager and manually kill FasterCap.exe.
Go to Top of Page

Enrico

542 Posts

Posted - Oct 03 2019 :  01:08:32  Show Profile  Reply with Quote
Thanks for posting the code! Hope this will help the users.

Enrico
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
FastFieldSolvers Forum © 2020 FastFieldSolvers S.R.L. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06