API: how can I eliminate dialogues to run my program in batch without interaction

Aug 09, 2007 2 Replies

Hello,



I want to get in a batch program the dependencies from an assembly with the method GetDependencies():



docName = "J:\\Company\\rade\\sld_dev\\myAss.SLDASM" swApp = win32com.client.Dispatch("SldWorks.Application") swMod = swApp.OpenDoc(docName, 2) dependencies = swMod.GetDependencies(1,1) swApp.CloseDoc(docName) swApp.ExitApp()



This works fine with assemblies was construct in my current SolidWorks



2005 installation. But when I open assemblies from an older installation, I get the dialogue "The following documents will be converted when saved" (in german: "Die folgenden Dokumente werden beim Speichern konvertiert werden.") and I must respond to this dialogue. How can I eliminate this dialogue to run my program in batch without interaction?

When I want to get the dependencies from an assembly with missing/ nonconforming files I get a dialogue "Internal ID of document does not match the internal ID saved with the referencing document. Select yes to except or no to browse for replacement model" and I must also respond to this dialogue. How can I eliminate this dialogue to run my program in batch without interaction?



Thanks for your answer, Thomas



You should note that according to API documentation, OpenDoc method is obsolete, and you should use OpenDoc6 instead. By using that method, you can use swOpenDocOptions_Silent setting to suppress all dialogs. Calling the method is a bit trickier since you have to declare variables for errors and warnings.

Hope this helps, peek at the API help for further details and examples! There is an example for opening document silently.

-h-

It seems to me that when I did some batch conversions around the beginning of the year the silent option didn't catch everything.

Thomas, can you run a SW conversion on the files first? I think that will run silently for the most part.

TOP

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required