Jim: The thing about the Femap API is that its class methods use tons of ByRef arguments to return data to the caller. This is not something Python really supports. PythonCOM gets around it by turning the output arguments in to return values, but I find that only works if I enforce early binding. Here's what I recommend:
iRet, nVals, liIds, lrData = zOutVec.GetOutputList(). The key thing in all this is to import that PyFemap file. When you do that, it's infinitely easier to use the Femap API in Python than it is in VB or C++. If you don't do it, you'll just never get it to work. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.an...@ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) Jim Ragsdale wrote, On 12/2/2010 6:59 AM: I am trying to access the femap API, and having a bit of trouble. Here is a simple example: from win32com.client import Dispatch femap = Dispatch("femap.model") rc = femap.feAppGetActiveView(viewID) This method, according to the documentation, is supposed to return a long integer in viewID. If I do not define viewID, python returns the error: NameError: name 'viewID' is not defined if I define viewID=0, python returns: com_error: (-2147352571, 'Type mismatch.', None, 1) I ran makepy and it generates a file, but I don't know if it is using it or not. In the file, I can find the definition for the method: def feAppGetActiveView(self, nViewID=pythoncom.Missing): return self._ApplyTypes_(20376, 1, (3, 0), ((16387, 2),), u'feAppGetActiveView', None,nViewID ) To me it looks like win32 is not getting the information about the variable types from com. Is there any way to get around this or am I out of luck? Thanks, Jim _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 |
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32