CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FloEFD, FloWorks & FloTHERM (
-   -   FloEFD API - SolidWorks Modeling (

j.gerber June 4, 2009 09:08

FloEFD API - SolidWorks Modeling

I would like to know what steps should be taken in configuring Microsoft Excel/VBA so that access to the SolidWorks API is possible from the same code which is used to access the FloEFD API.

I am almost sure it is a Library Reference problem, as I tested with the examples given in the FloEFD API help file, under Geometry Modeling API.

Help would be very much appreciated.

Ive June 11, 2009 05:45

First, you need FloEFD v.9.0 or higher.
Then the following information from the API Help may be useful for you:

FloEFD Geometry Modeling API To use any of the Geometry Modeling API functions you must replace the top-level SldWorks.Application object with the FloEFD.9.Application object. The following example illustrates how to replace the object name to create a code that attaches to a running instance of FloEFD by calling the Visual Basic GetObject method or opens a new instance of FloEFD by calling the Visual Basic CreateObject method:

Sub main()
Dim swApp as SldWorks.SldWorks
' Attach to running instance of FloEFD
' In the next string we use FloEFD.9.Application instead of SldWorks.Application
Set swApp = GetObject(, "FloEFD.9.Application")
Set swApp = Nothing
End Sub

- or -
Sub main()
Dim swApp as SldWorks.SldWorks
' Open new instance of FloEFD
' In the next string we use FloEFD.9.Application instead of SldWorks.Application
Set swApp = CreateObject("FloEFD.9.Application")
Set swApp = Nothing
End Sub

j.gerber June 11, 2009 06:54

Thanks for the reply.
But I am aware of the information in the API Help file.

When I copy that code into my coding environment and execute it, I get an error which highlights "swApp As SldWorks.SldWorks" with the following message: "Compile error: User-defined type not defined".

I have used the usual FloEFD API successfully before, when not trying to access the geometry. I replaced the code in projects using the usual FloEFD API code with the code from this example, in order to ensure that the same settings are being used, but with no success.

Thus I would like to know whether or not this error is related to the References chosen under Tools > References? Or could there be some other underlying problem?

Ive June 11, 2009 07:08

1 Attachment(s)
There is a some internal problem when you are trying to call FloEFD API from Excel under x64 system. But it is not related to geometry manipulations. I attached our working Excel example to this message - probably if you look at our code you'll find what's wrong. See the 'Geometry study' sheet.

j.gerber June 12, 2009 08:10

Thank you Ive, your response was helpful.

j.gerber June 12, 2009 10:32

1 Attachment(s)
Ok, I think I am closer to pin-pointing the problem. When I run the example you posted, it reports back to the "Geometry Sheet" sheet successfully as illustrated in the following pic

The error given in the coding environment is "Run time error '429' ActiveX component can't create object", and highlights this code :
Set swApp = GetObject(, "FloEFD.9.Application")

Ive June 15, 2009 11:17

The source of this error is that geometry manipulation API object name wasn't updated with the change of the product name. The following string should work:

Set swApp = GetObject(, "EFDLab.9.Application")

j.gerber June 17, 2009 03:11

Thank you Ive, it's working just fine now.

Vader December 6, 2010 23:36

Hi Ive!

Do you have a version of api-sample.xls that runs under Solidworks Flow Simulation 2011 in x64? I understand that I will also need to install the Flow Simulation x32 API per the help file.

Ive December 7, 2010 05:08

As I remember, we haven't changed the api sample since version 2010. Do you experience any troubles with it in Flow Simulation 2011 ?

Vader December 7, 2010 22:14

1 Attachment(s)
Thanks for the quick reply Ive. No it wouldn't work in Flow Simulation 2011 under x64. However, I just got it up and running!

My VAR sent me the x32 verision of the API: Flow Simulation API sdk 2011.msi
Then I modified api-example.xls with the code from the help file. The working excel file is attached.


All times are GMT -4. The time now is 06:54.