CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > FloEFD, FloWorks & FloTHERM

FloEFD API - SolidWorks Modeling

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2009, 10:08
Default FloEFD API - SolidWorks Modeling
  #1
New Member
 
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 16
j.gerber is on a distinguished road
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.
j.gerber is offline   Reply With Quote

Old   June 11, 2009, 06:45
Default
  #2
Ive
New Member
 
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 16
Ive is on a distinguished road
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
Ive is offline   Reply With Quote

Old   June 11, 2009, 07:54
Default
  #3
New Member
 
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 16
j.gerber is on a distinguished road
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?
j.gerber is offline   Reply With Quote

Old   June 11, 2009, 08:08
Default
  #4
Ive
New Member
 
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 16
Ive is on a distinguished road
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.
Attached Files
File Type: zip api_sample.zip (53.5 KB, 126 views)
Ive is offline   Reply With Quote

Old   June 12, 2009, 09:10
Default
  #5
New Member
 
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 16
j.gerber is on a distinguished road
Thank you Ive, your response was helpful.
j.gerber is offline   Reply With Quote

Old   June 12, 2009, 11:32
Default
  #6
New Member
 
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 16
j.gerber is on a distinguished road
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")
Attached Images
File Type: jpg screen print efd api status.jpg (49.0 KB, 85 views)
j.gerber is offline   Reply With Quote

Old   June 15, 2009, 12:17
Default
  #7
Ive
New Member
 
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 16
Ive is on a distinguished road
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")
Ive is offline   Reply With Quote

Old   June 17, 2009, 04:11
Default
  #8
New Member
 
Juan Gerber
Join Date: May 2009
Posts: 11
Rep Power: 16
j.gerber is on a distinguished road
Thank you Ive, it's working just fine now.
j.gerber is offline   Reply With Quote

Old   December 6, 2010, 23:36
Default
  #9
New Member
 
Scott Vader
Join Date: Aug 2009
Posts: 5
Rep Power: 16
Vader is on a distinguished road
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.
Vader is offline   Reply With Quote

Old   December 7, 2010, 05:08
Default
  #10
Ive
New Member
 
Ivan Andronov
Join Date: Jun 2009
Posts: 25
Rep Power: 16
Ive is on a distinguished road
As I remember, we haven't changed the api sample since version 2010. Do you experience any troubles with it in Flow Simulation 2011 ?
Ive is offline   Reply With Quote

Old   December 7, 2010, 22:14
Default
  #11
New Member
 
Scott Vader
Join Date: Aug 2009
Posts: 5
Rep Power: 16
Vader is on a distinguished road
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
Attached Files
File Type: zip api_sample FW 2011 x64.zip (35.3 KB, 105 views)
Vader is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solidworks CFX MAB CFX 8 June 12, 2008 13:38
May Focus Area: Turbulence Modeling Jonas Larsson CFD-Wiki 0 May 2, 2006 12:48
Modeling Flow/Saturation/Absorption in Fibers Gene Dougherty Main CFD Forum 0 June 6, 2003 15:49
CFD Modeling of Two-phase Flow in Small Dia.Tubes Eric Poindexter Main CFD Forum 2 September 22, 2000 10:21
Extrusion Modeling Elliot Schwartz Main CFD Forum 1 September 11, 1998 20:08


All times are GMT -4. The time now is 08:19.