|
running solidworks swp file from other programs
probably a simple answer, but i have an excel spreadsheet that has alot of data in it, all specifically formatted to how it needs to be. i want to take this data and pass it to my sw macro that is already programmed and just use a single line of my excel code.
for this i will be running a loop from excel to move through the rows until all the data has been run against sw.
it will build the custom data type that is already setup in the sw macro.
i will use a public function in the sw macro to accept the data from excel and set a few parameters to make it an automated process, and close windows when it is done with each line of the code from excel..
just how do i call this public function from excel is my question..... remember it is in a swp file that runs in sw already....
almost positive its not possible to call a function from a macro file unless you are in that macro.
your best bet is to copy/paste or export/import the swp macro into the excel file then call it from there
i guess ill export the swp from sw vba and import into excel vba, see if it works like that. i think i will have to add the one the one section of code that calls the swapp to make it work correctly....
only problem with that is, if i updated the one macro, i have to update the other macro so there is no control between the 2...
you could also access the excel spreadsheet from the sw macro. add a reference to excel (under "tools --> references") and create an excel application object in your code to get started.
whatever program runs the macro it can access sw or excel, so you could do this from excel to access sw, or from the sw macro to access excel, or to be daft to prove the example you could have the macro run from word to access excel and sw
well, i am assembling a "engineering tool box" per say that runs from excel, since the data it uses is imported from excel. so in excel i have a menu selection that will create these files for me from the data in excel, that you work with in excel before attemping to use solidworks....
still, not sure if i can completely get this to work correctly, or if there is a better way.
luke, this is part of the programming stuff / questions that i emailed you a couple weeks back about....
and yes, while we are using the api, we should see if we can daisy chain it through like 10 applications before the one we want to get to opens
adam, did i ever give you a reply for the question? i have been really busy and may have overlooked it so will check emails again shortly.
not to that specific one, it was more of implemtation down the line type thing. if you want i can email you the files that will be sent to sw and stuff if you want to look them over..
on a side note, the drawing position, i think i stumped api help on that one
ye sure feel free to email me the files. i won't be able to take a look at them til the weekend as i have just moved house and am renovating shall we say, so my spare time is all taken up atm |
|