Accessing SW API in VB6 without loading SW?

May 17, 2004 4 Replies

Hello to all,



I would like to know if there is a way to use SW API in VB6 without loading SolidWorks.



For example, the following code works:


-=-=-=-



Const FileName = "F:\Assemblage_AB.SLDASM" Set swApp = CreateObject("SldWorks.Application") swApp.Visible (True) swApp.UserControl (True) Dependances = swApp.GetDocumentDependencies(Fichier, False, True)


-=-=-=-



However, it needs to load SW. Is there a way to avoid this?



It tried to remove the line with the CreateObject and use: Dependances = SldWorks.GetDocumentDependencies(Fichier, False, True, False)



However, I got an error.



Thank you for your help.



John H. Dewbert


Well, if you don't Set the SldWorks variable to anything, it will equal to Nothing. Nothing cannot do Anything, it is just like calling a dead man and expecting him to pick up the phone. You have to summon SolidWorks from death by creating an instance of it before calling any functions.

-h-

I guess it makes sense... :-)

Thanks!

John.

"Heikki Leivo" a écrit dans le message de news:%UAqc.1939$ snipped-for-privacy@reader1.news.jippii.net...

The first thing that you need to do is to load from the project refrence the TLB file that is located on the solidworks folder, that's load all the API and the intellisense to help with your programming.

After that you can do wherever you did, if don't do that you gonna have an error.

Remember, Project / Reference. sldworks.TLB

If you just want some file properties, or the preview, you can you dsofile.exe

Evan

de

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required