Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Run new Inventor application with selected addins

Cadkunde.nl
Collaborator

Run new Inventor application with selected addins

Cadkunde.nl
Collaborator
Collaborator

I have a script that creates Autocad DWG exports of all drawings in an assembly.

I close and open a new Inventor instance after a set number of drawings.

However, this gives a lot of delay in the process.

Sometimes Inventor crashes after making just 10 drawings, so some engineers set the tool to open and close after 5 drawings.

With 100+ drawings in an assembly, this gives a lot of extra time.

 

Inventor apprentice is not suitable for dwg export.

Is there a way to start up Inventor super light, without loading any addins, except the one for dwg export?

 

Other tips are welcome too,

 

Thanks in advance,

 

Arnold

0 Likes
Reply
1,112 Views
23 Replies
Replies (23)

JamieVJohnson2
Collaborator
Collaborator

Yes they are.  Your limitation being Inventor's stability makes for a series of workarounds that are not going to be 'easy' one liners.  So we must always ask ourselves, how bad do we want it.  My batch publishing tool is thousands of lines of code with years of improvements, totally customized to our design process and file management, and even it isn't flawless because of Inventor's limitations.  However, I would never put that code inside of an add-in because of Inventor's instability.  My code can keep working even if Inventor doesn't.  My code also doesn't cause Inventor to come crashing down, because it is not in process with the Inventor application.  So there are 2 issues I eliminated that way.  Add-ins are useful for autoloading code, but not necessary for your batch publish tool.  Perhaps this limitation you are facing is going to force you to step it up.  NEVER GIVE UP... NEVER SURRENDER!

jvj
0 Likes

pball
Advisor
Advisor

@Cadkunde.nlCan you share your code? There might be some improvements that could be made to prevent the crashing issue. I have an addin that can export dwg/dxf/pdf for every drawing in an assembly and I've routinely exported 100-200 drawings in a single run with zero issues.

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes

Cadkunde.nl
Collaborator
Collaborator

Then I think its better that you shared yours :grinning_face_with_smiling_eyes:

 

But the base is just:

https://modthemachine.typepad.com/my_weblog/2009/03/accessing-assembly-components.html

with the Export to dwg translator example in the help file

VBA Sample Code

Public Sub PublishDWG()
    ' Get the DWG translator Add-In.
    Dim DWGAddIn As TranslatorAddIn
    Set DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")

    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    Set oDocument = ThisApplication.ActiveDocument

    Dim oContext As TranslationContext
    Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    ' Create a NameValueMap object
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    ' Create a DataMedium object
    Dim oDataMedium As DataMedium
    Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    ' Check whether the translator has 'SaveCopyAs' options
    If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

        Dim strIniFile As String
        strIniFile = "C:\tempDWGOut.ini"
        ' Create the name-value that specifies the ini file to use.
        oOptions.Value("Export_Acad_IniFile") = strIniFile
    End If

    'Set the destination file name
    oDataMedium.FileName = "c:\tempdwgout.dwg"

    'Publish document.
    Call DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub

 

Then I keep all drawings found in an array. Doing first XX of array, close, restart, next XX of array, restart etc

 

Do it too much and client crashes. It depends when it crashes:

- The pc of user

- The size of the drawings (>10mb)

- If memory usage was already high when script starts (ctrl+alt+del)

0 Likes

Cadkunde.nl
Collaborator
Collaborator

oh and plz plz plz don't say you just use save as idw to dwg

0 Likes