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

Discussion in 'SolidWorks' started by thomas.rademacher, Aug 9, 2007.

  1. 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
     
    thomas.rademacher, Aug 9, 2007
    #1
  2. thomas.rademacher

    Heikki Leivo Guest

    swMod = swApp.OpenDoc(docName, 2)

    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-
     
    Heikki Leivo, Aug 9, 2007
    #2
  3. thomas.rademacher

    TOP Guest

    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
     
    TOP, Aug 9, 2007
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.