|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 17 ![]() |
Hello,
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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 17 ![]() |
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") swApp.ExitApp 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") swApp.ExitApp Set swApp = Nothing End Sub |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 17 ![]() |
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? |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 17 ![]() |
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.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 17 ![]() |
Thank you Ive, your response was helpful.
|
|
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 17 ![]() |
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") |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 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") |
|
![]() |
![]() |
![]() |
![]() |
#8 |
New Member
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 17 ![]() |
Thank you Ive, it's working just fine now.
|
|
![]() |
![]() |
![]() |
![]() |
#9 |
New Member
Scott Vader
Join Date: Aug 2009
Posts: 5
Rep Power: 17 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#10 |
New Member
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 17 ![]() |
As I remember, we haven't changed the api sample since version 2010. Do you experience any troubles with it in Flow Simulation 2011 ?
|
|
![]() |
![]() |
![]() |
![]() |
#11 |
New Member
Scott Vader
Join Date: Aug 2009
Posts: 5
Rep Power: 17 ![]() |
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. Scott |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Solidworks CFX | MAB | CFX | 8 | June 12, 2008 12:38 |
May Focus Area: Turbulence Modeling | Jonas Larsson | CFD-Wiki | 0 | May 2, 2006 11:48 |
Modeling Flow/Saturation/Absorption in Fibers | Gene Dougherty | Main CFD Forum | 0 | June 6, 2003 14:49 |
CFD Modeling of Two-phase Flow in Small Dia.Tubes | Eric Poindexter | Main CFD Forum | 2 | September 22, 2000 09:21 |
Extrusion Modeling | Elliot Schwartz | Main CFD Forum | 1 | September 11, 1998 19:08 |