Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab-SolidWorks interaction API

Status
Not open for further replies.

tsakas13

Mechanical
Dec 13, 2011
2
I've been trying to use Solidlab matlab routines that i downloaded from here, without success. According to the description it is supposed to work on windows XP+Matlab+SolidWorks 2006 SP4.1. I've tried with Matlab 6.5 & 7 and SolidWorks 2011 & 2006 SP0.0-instead of SP4.1. All my tryouts came across "Run-time error '91':Object variable or With block variable not set" errors after initializating and opening the test model! Is there any idea of how to transcend these problems, or any other priceless equivalent API?
 
Replies continue below

Recommended for you

You might try stepping through the VB code in the macro editor.
SW makes changes to the API from year to year. You might have to go through line by line and check that.

I noticed that a call to preferences was in the VB. Preferences calls have made some changes over the year.

TOP
CSWP, BSSE
Phenom IIx6 1100T = 8GB = FX1400 = XP64SP2 = SW2009SP3
"Node news is good news."
 
It sounds like you have a references problem. From the VBA editor, go to Tools->References, look at the ones that are checked but marked as "MISSING" that reference the old version of SolidWorks. Find the corresponding references for your version of SolidWorks and check the boxes.

-handleman, CSWP (The new, easy test)
 
Thanks for the responses. I 'd like some more advice because i'm not that experienced at programming. First of all I want to count out one by one some basic issues in order to focus on the matters that need to be solved.
Concerning matlab edition, I now think that it's not the source of the whole problem weather I use 6.5 or 7, right?
Secondly, i want to mention that none of the "solidlab" files seems to be recognized by the macro editor, as they are neither .swp nor .swb , but .bas .vbp .vbw etc. Also, the VBA editor that I use [visual studio 6] doesn't have references option under Tools menu.
So what I have to do is to give commands in matlab and check line by line the execution of the code, hoping to find any syntax error of a function or a value that corrupts the debugging process.
Could it be that simple?
 
You go to the .bas files, copy them and paste them into a blank SW macro. I think you have to clean out a few statements at the beginning. Then step through. Since his VB doesn't use early binding you may not need to do much in Tools/References since it looks like Suresh is just using SW calls.

I'm wondering if this will work with my Matlab work-a-likes.

BTW, Krishnan Suresh' website is pretty cool stuff.

TOP
CSWP, BSSE
Phenom IIx6 1100T = 8GB = FX1400 = XP64SP2 = SW2009SP3
"Node news is good news."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor