<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can i speed up adding parts to an assembly? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926409#M130775</link>
    <description>Robert thanks for these tips - some of them i have in place already like the invisible document and screenupdating - i'm going to add the others and see what happens !</description>
    <pubDate>Fri, 17 May 2013 12:15:25 GMT</pubDate>
    <dc:creator>mitcham_boy</dc:creator>
    <dc:date>2013-05-17T12:15:25Z</dc:date>
    <item>
      <title>How can i speed up adding parts to an assembly?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926348#M130773</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hi &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I have a VB code that gets an instance of inventor.&amp;nbsp; It creates a new assembly and then starts adding parts to it.&amp;nbsp; &lt;/FONT&gt;&lt;FONT size="2"&gt;The code works fine and is reliable but I am suprised by how slow the process is.. the process is as follows&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;'psuedo code...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff"&gt;do&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff" size="1"&gt;myAssembly.ComponentDefinition.Occurrences.Add(my_component_file&lt;/FONT&gt;&lt;FONT size="1"&gt;&lt;FONT color="#99ccff"&gt;&lt;FONT color="#3366ff"&gt;, my_position)&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#339966"&gt; 'add my next occurrence to the assembly&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT color="#3366ff"&gt;&lt;FONT size="1"&gt;myOccurrence&lt;/FONT&gt;.Transformation = my_position&lt;/FONT&gt; &lt;FONT color="#008000"&gt;&lt;FONT color="#008000"&gt;' move the occurrence to a new&amp;nbsp;position in assembly space.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff" size="1"&gt;With &lt;/FONT&gt;&lt;FONT size="1"&gt;&lt;FONT color="#3366ff"&gt;myOccurrence.Definition&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#339966"&gt; 'go thru the occurrence and change its dimensions&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color="#3366ff"&gt; ForEach p In.Parameters&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff"&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If p.Name = my_parameter_name Then&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="1"&gt;p.Value = my_parameter_value&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff" size="1"&gt;&amp;nbsp;&amp;nbsp; Next&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff" size="1"&gt;EndWith&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366ff" size="1"&gt;loop until my_last_component&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;...I notice that the green progress bar is frequently on with messages in the Inventor statusbar such as "Executing update component" and "Executing change component position".&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I wonder is Inventor performing many read/write operations which is causing the slow performance?&amp;nbsp; Perhaps&amp;nbsp;it is updating files after each of my 3 operations in the loop...&amp;nbsp;and if so is there a way i can achieve this faster such as delaying read/write until after all three operations have been performed or until all occurrences have been added??&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Any tips appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Thanks.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Dan &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;(Belfast, Inventor 2013)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2013 10:29:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926348#M130773</guid>
      <dc:creator>mitcham_boy</dc:creator>
      <dc:date>2013-05-17T10:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can i speed up adding parts to an assembly?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926385#M130774</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following VBA code demonstrates some of the ways you can optimize your Inventor plugins:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub PerformanceIncrease()

    Dim Invapp As Inventor.Application
    Set Invapp = ThisApplication

    '' Turn off user interaction so that inventor can focus on your API calls exclusively
    Invapp.UserInterfaceManager.UserInteractionDisabled = True
    
    '' Turn off screenupdating to speed up performance
    Invapp.ScreenUpdating = False
    
    '' Set Defer updates to true and force an update when you're finished with your API commands
    '' This can be done on drawings and sketches as well
    Invapp.AssemblyOptions.DeferUpdate = True
    
    '' Create the document invisible
    Dim oAssDoc As Inventor.AssemblyDocument
    Set oAssDoc = Invapp.Documents.Add( _
        Inventor.DocumentTypeEnum.kAssemblyDocumentObject, , True)
        
    ''Wrap your command into a global transaction so only one undo point is created.
    Dim oTrans As Inventor.Transaction
    
    Set oTrans = Invapp.TransactionManager.StartGlobalTransaction(oAssDoc, _
        "My API Calls")
        
    '' perform your functions here
    
    '' Be sure to end a global transaction when you are finished
    oTrans.End
        
    '' Wrap up
    Invapp.ScreenUpdating = True
    Invapp.UserInterfaceManager.UserInteractionDisabled = False
    
    '' Make the assembly document visible
    Call oAssDoc.Views.Add
    Call oAssDoc.Update
    Invapp.AssemblyOptions.DeferUpdate = False
    
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2013 11:48:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926385#M130774</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-17T11:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: How can i speed up adding parts to an assembly?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926409#M130775</link>
      <description>Robert thanks for these tips - some of them i have in place already like the invisible document and screenupdating - i'm going to add the others and see what happens !</description>
      <pubDate>Fri, 17 May 2013 12:15:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/3926409#M130775</guid>
      <dc:creator>mitcham_boy</dc:creator>
      <dc:date>2013-05-17T12:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can i speed up adding parts to an assembly?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/12157257#M130776</link>
      <description>&lt;P&gt;here is one for the books that works for some reason really well in 2022 you dont need to set it to false either.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.Windows.Forms
Imports Inventor
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Imports System
AddReference "System.Drawing.dll"

ThisApplication.AssemblyOptions.EnableAssemblyExpress = True
ThisApplication.ScreenUpdating = True

SendKeys.SendWait("{ESC}")
AppActivate(ThisApplication.Caption)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 15:54:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-can-i-speed-up-adding-parts-to-an-assembly/m-p/12157257#M130776</guid>
      <dc:creator>maxim.teleguz</dc:creator>
      <dc:date>2023-08-08T15:54:14Z</dc:date>
    </item>
  </channel>
</rss>

