<?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: Auto insert of an earlier done drawing in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6339406#M64065</link>
    <description>&lt;P&gt;Alright then, so there're (atleast) two possible&amp;nbsp;ways of doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) You can save the current drawing location in the part file when you save your drawing. Ussing OnSaveEvent in the drawing document. And then when you'll re-use these parts,&amp;nbsp;you can simply read the iProperty with the drawing location and copy it from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if the "library" as you speak of, is in one place (eighter in one folder or a group of folders) you can use one of these:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the part file maches, but the drawing name doesn't: Solution 1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the part file maches and so does the drawing name:&lt;/P&gt;
&lt;P&gt;2) Look for the drawing&amp;nbsp;in the library (e.g. by the part name), copy the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know which would suit to you and I'll take a look at the coding part.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2016 04:01:11 GMT</pubDate>
    <dc:creator>Owner2229</dc:creator>
    <dc:date>2016-05-20T04:01:11Z</dc:date>
    <item>
      <title>Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6312388#M63733</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any function or tool implemented in Inventor that would automatically insert part drawings from library as a sheet into documentation? I mean, for example, I am to make&amp;nbsp;technical drawings for about 100 machines. Each has 200 parts, however plenty of them are the same or almost the same. After making 5 of machines I have a lot of parts' drawings. Now I would like to make work&amp;nbsp;clever and create library which would contain drawings of parts, then with help of iLogic, VBA etc. I want Inventor to recognize every similar part and to put it's drawing from the library. Could You help me, please, with finding such an utility?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Mikey&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 15:51:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6312388#M63733</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-06T15:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6314671#M63749</link>
      <description>&lt;P&gt;Hi, the code for using pre-made drawings as templates is rather easy. The problem is in&amp;nbsp;identifing&amp;nbsp;the part.&lt;/P&gt;&lt;P&gt;When saying they're the same (or almost) you mean in shape, right? But that's not enough.&lt;/P&gt;&lt;P&gt;We need to find the best way to recognize them, so:&lt;/P&gt;&lt;P&gt;1) Do the "same" parts have the same features (type, amount)?&lt;/P&gt;&lt;P&gt;2) Do they have the same amount of edges?&lt;/P&gt;&lt;P&gt;3) Do they share similiar part numbering (that maybe differs from the other part types)?&lt;/P&gt;&lt;P&gt;4) Are there any specific parameters of iProperties that we could look for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might want to make a library (a folder, maybe somewhere on server, if you're plaing to share this with coleagues) containing all drawings for each of these part types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this recognition technique for future parts might be rather simple. You can make your library with part templates for each of these part types. In this template would be specified the drawing from the library, so the rule wont need to match the part type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main()
    Dim oDoc As Document = ThisApplication.ActiveDocument
    Dim oDocName As String = oDoc.FullFileName
    Dim oNewName As String = ThisDoc.Path &amp;amp; "\" &amp;amp; ThisDoc.FileName(False) &amp;amp; ".idw"
    Dim SearchedDrawing As String&lt;BR /&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Look for the iProperty containing the drawing template&lt;/STRONG&gt;&lt;/FONT&gt;
    Try
        SearchedDrawing = iProperties.Value("Custom", "tempDrawing")
    Catch
    End Try&lt;BR /&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Right now we don't have the recognition code, so I've placed here a simple code&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;    ' to make the new drawing based on the template drawing file name.&lt;/STRONG&gt;&lt;/FONT&gt;
    If SearchedDrawing = vbNullString Then
        Dim oPath As String = "&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;C:\PathToTheDrawingLibrary\&lt;/STRONG&gt;&lt;/FONT&gt;"&lt;BR /&gt;        SearchedDrawing = InputBox("Please enter the file name of the drawing you'd like to make this new drawing from." &amp;amp; vblf &amp;amp; vblf &amp;amp; "Without extension.", "Input", "")
        SearchedDrawing = oPath &amp;amp; SearchedDrawing &amp;amp; ".idw"&lt;BR /&gt;    End If&lt;BR /&gt;    If SearchedDrawing = vbNullString Then
        Exit Sub
    End If&lt;BR /&gt;    &lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Here is the code to create the new drawing&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;    iProperties.Value("Custom", "tempDrawing") = SearchedDrawing&lt;BR /&gt;    Dim oDrawing As Document
    Try
        oDrawing = ThisApplication.Documents.Open(SearchedDrawing, False)
    Catch&lt;BR /&gt;        MsgBox("Couldn't open the drawing.")&lt;BR /&gt;        Exit Sub
    End Try
    oDrawing.Update()
    oDrawing.SaveAs(oNewName, True)
    oDrawing.Close(True)
    Dim oNewDrawing As Document = ThisApplication.Documents.Open(oNewName, True)&lt;BR /&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Replace all the model references in the new drawing&lt;/STRONG&gt;&lt;/FONT&gt;
    Dim oRefFile As FileDescriptor
    For Each oRefFile In oNewDrawing.File.ReferencedFileDescriptors
        oRefFile.ReplaceReference(oDocName)
    Next
    oNewDrawing.Save&lt;BR /&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Close the new drawing&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;    oNewDrawing.Close(True)
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now the rule makes new drawing (IDW) for the currenty open part. You have sayd you want it to "&lt;SPAN&gt;&lt;STRONG&gt;insert part drawings from library as a sheet into documentation&lt;/STRONG&gt;". Do you mean to "just" insert new sheet in an actual drawing, so you'll have one drawing with one sheet for every part? It won't be as easy that way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 04:50:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6314671#M63749</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2016-05-09T04:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6337708#M64047</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You very much for giving a matter Your's attention. For some reason notification about reply was delayed. Anyway, the parts are the same and have the same name, so it cannot be more easier ; ). The code You have proposed is not what I fully meant, though. It should, rather, search for&amp;nbsp;given machine (assembly) within previously drawn documentation. Here goes an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Machine #1:&lt;/P&gt;&lt;P&gt;parts' names:&lt;/P&gt;&lt;P&gt;"A1"&lt;/P&gt;&lt;P&gt;"B3"&lt;/P&gt;&lt;P&gt;"C5"&lt;/P&gt;&lt;P&gt;"F7"&lt;/P&gt;&lt;P&gt;let's assume I had drawings for this parts already done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I start making documentation for machine #2:&lt;/P&gt;&lt;P&gt;consisting parts:&lt;/P&gt;&lt;P&gt;"B3"&lt;/P&gt;&lt;P&gt;"C5"&lt;/P&gt;&lt;P&gt;"D19"&lt;/P&gt;&lt;P&gt;"E6"&lt;/P&gt;&lt;P&gt;"F7"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In overall I would have 5 sheets with drawing of each part. 3 of them are the same, thus code should find it in "library" and paste into *.IDW drawing project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Mike&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 13:38:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6337708#M64047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-19T13:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6339406#M64065</link>
      <description>&lt;P&gt;Alright then, so there're (atleast) two possible&amp;nbsp;ways of doing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) You can save the current drawing location in the part file when you save your drawing. Ussing OnSaveEvent in the drawing document. And then when you'll re-use these parts,&amp;nbsp;you can simply read the iProperty with the drawing location and copy it from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if the "library" as you speak of, is in one place (eighter in one folder or a group of folders) you can use one of these:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the part file maches, but the drawing name doesn't: Solution 1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the part file maches and so does the drawing name:&lt;/P&gt;
&lt;P&gt;2) Look for the drawing&amp;nbsp;in the library (e.g. by the part name), copy the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know which would suit to you and I'll take a look at the coding part.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 04:01:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6339406#M64065</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2016-05-20T04:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6339617#M64070</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems for me that option with the iProperty is more flexible - in this case I can have only one *.IDW file with plenty of drawings as a library. In case of solution no. 2 I would have to have every IDW file for every drawn part. So, I choose the first one : )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 07:51:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6339617#M64070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-20T07:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Auto insert of an earlier done drawing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6340042#M64075</link>
      <description>&lt;P&gt;Very well, just a couple more question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Where would you like to store these new drawings and with which name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In the same folder and with the same name as the new part?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Or in an specific folder, like the library?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) I hope you understand that this solution would only work on parts which have this iProperty, so only on parts derived from parts which's drawing will be&amp;nbsp;made after these iLogic rules takes place. Note: You can still copy the rule to these older drawings to make it work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Do you know how to set up the OnSaveEvent, or you want me to guide you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Another option would be making a list of the partnames and according drawings, but it'll be a real pain, if&amp;nbsp;you have A LOT of parts.&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 12:34:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/auto-insert-of-an-earlier-done-drawing/m-p/6340042#M64075</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2016-05-20T12:34:25Z</dc:date>
    </item>
  </channel>
</rss>

