<?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: Copy and paste in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913458#M115386</link>
    <description>&lt;P&gt;It would be great to have both solutions. One with the names&amp;nbsp; and one with the selection.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2015 12:10:56 GMT</pubDate>
    <dc:creator>GeorgK</dc:creator>
    <dc:date>2015-11-18T12:10:56Z</dc:date>
    <item>
      <title>Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5827454#M115377</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it possible to copy&amp;nbsp;parts / assemblys and paste them at given point?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 12:46:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5827454#M115377</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2015-09-22T12:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5832857#M115378</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The API does not provide a functionality like that directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, you can create a new instance which is based on the same definition as the existing occurrence, then set its transformation to whatever you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 14:23:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5832857#M115378</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2015-09-25T14:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5911916#M115379</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;
&lt;P&gt;Do you have an example for copy " 2 parts constrained" and paste in the same assembly.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 15:13:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5911916#M115379</guid>
      <dc:creator>Crstiano</dc:creator>
      <dc:date>2015-11-17T15:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913096#M115380</link>
      <description>&lt;P&gt;Hello Adam,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also interested in a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 07:09:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913096#M115380</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2015-11-18T07:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913110#M115381</link>
      <description>&lt;P&gt;I use this to copy a sketch to a workplane in a part document. But my guess is it could also be used to copy parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim Part1 As part component = ...&lt;/P&gt;&lt;P&gt;Dim Part2 As part component = ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paste?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        ' Select sketch
        Dim oSketchToCopy As PlanarSketch = oDef.Sketches.Item("Vorm_C1")
        Call oDoc.SelectSet.Clear()
        Call oDoc.SelectSet.Select(oSketchToCopy)

        ' copy sketch
        Dim oCopyControlDef As ControlDefinition = oInvApp.CommandManager.ControlDefinitions.Item("AppCopyCmd")
        oCopyControlDef.Execute()

        ' Select workplane for paste sketch
        Call oDoc.SelectSet.Clear()
        Call oDoc.SelectSet.Select(oNewplane)

        ' Paste sketch
        Dim oPasteControlDef As ControlDefinition = oInvApp.CommandManager.ControlDefinitions.Item("AppPasteCmd")
        oPasteControlDef.Execute()&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Nov 2015 07:22:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913110#M115381</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2015-11-18T07:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913382#M115382</link>
      <description>&lt;P&gt;Maybe not the best way, but a brutal way for execute that. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 11:02:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913382#M115382</guid>
      <dc:creator>Crstiano</dc:creator>
      <dc:date>2015-11-18T11:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913383#M115383</link>
      <description>&lt;P&gt;Hi, I believe that you can modifi the code below to your needs. Or just tell me what else you want it to do and I'll rewrite it for you.&lt;/P&gt;&lt;P&gt;You can specify the file name in highlighted part of code. It works for both assemblies and parts.&lt;/P&gt;&lt;P&gt;You can change the point where the part/assembly will be placed in the second highlighted part of code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDocument&lt;BR /&gt;Dim oAsmCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim Acd As ComponentOccurrencesEnumerator = oAsmCompDef.Occurrences.AllLeafOccurrences
Dim Occ As ComponentOccurrence&lt;BR /&gt;For Each Occ In Acd
    ModelFileName = Occ.Definition.Document.FullFileName&lt;BR /&gt;    FNamePos = InStrRev(ModelFileName, "\", - 1)&lt;BR /&gt;    docFName = Mid(ModelFileName, FNamePos + 1, Len(ModelFileName) - FNamePos)&lt;BR /&gt;    If docFName = "&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;MyWantedAssembly.iam&lt;/STRONG&gt;&lt;/FONT&gt;" Then
        Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
        Dim oMatrix As Matrix = oTG.CreateMatrix
        Call oMatrix.SetToRotation(3.14159265358979 / 4, _
            oTG.CreateVector(0, 0, 1), oTG.CreatePoint(&lt;FONT color="#000000"&gt;0, 0, 0&lt;/FONT&gt;))
        Call oMatrix.SetTranslation(oTG.CreateVector(&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;3, 2, 1&lt;/FONT&gt;&lt;/STRONG&gt;))
        Dim oOcc As ComponentOccurrence
        oOcc = oAsmCompDef.Occurrences.Add(ModelFileName, oMatrix)&lt;BR /&gt;        Exit Sub&lt;BR /&gt;    End If&lt;BR /&gt;Next&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 11:16:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913383#M115383</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-11-18T11:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913440#M115384</link>
      <description>&lt;P&gt;Hello Mike,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the solution. But is it possible to copy 2 or more parts with the constraints and paste them at a given position?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 11:54:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913440#M115384</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2015-11-18T11:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913444#M115385</link>
      <description>&lt;P&gt;Hi, it is possible, but first I need to know if you want to copy these parts by name (as in my code above) or from selection.&lt;/P&gt;&lt;P&gt;I can also place there an input box and you would write the wanted part/assembly names (with or without extensions).&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:00:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913444#M115385</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-11-18T12:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913458#M115386</link>
      <description>&lt;P&gt;It would be great to have both solutions. One with the names&amp;nbsp; and one with the selection.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 12:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913458#M115386</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2015-11-18T12:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913573#M115387</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1007817"&gt;@Crstiano&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Maybe not the best way, but a brutal way for execute that. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Could you please show me a better way to do this? I'm always looking to improve, and be less brutal &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:19:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913573#M115387</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2015-11-18T13:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913607#M115388</link>
      <description>&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;I say this because after running the "paste", I need to identify one of the inserted parts, and this way I still do not know how to do!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;I do not want to have to keep the whole list of pre-existing items and then find the newly inserted.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I think the best way is through a collection, but I'm standing (blind) in the way of inserting the collection (with constraints) again and controls it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I accept suggestions.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:35:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913607#M115388</guid>
      <dc:creator>Crstiano</dc:creator>
      <dc:date>2015-11-18T13:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913610#M115389</link>
      <description>&lt;P&gt;Executing the ControlDefinition for copying is the simplest solution.&lt;/P&gt;
&lt;P&gt;You just have to make sure that the Model view window is active otherwise nothing will happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other way would be much more cumbersome as you would have to copy over each component occurrence and then check the constraints between them and then recreate them in the new document.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 13:37:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913610#M115389</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2015-11-18T13:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913622#M115390</link>
      <description>As I said before, it would not be possible to insert a collection (with constraints)?</description>
      <pubDate>Wed, 18 Nov 2015 13:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913622#M115390</guid>
      <dc:creator>Crstiano</dc:creator>
      <dc:date>2015-11-18T13:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913673#M115391</link>
      <description>&lt;P&gt;Well, I still think you can, someone once wise once said: "If you can do it by hand, you can do it by code" But sometimes it just needs a big workaround, to do something small.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the question still remains:&lt;/P&gt;&lt;P&gt;Can you copy 2 parts within a assembly that are constraint to each other, and paste them keeping the constraints?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be done by hand? Yes, since 2014?&lt;/P&gt;&lt;P&gt;Select items + copy and paste --&amp;gt; simple as that..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code may be robust, but it does just that, but it raises another problem, find the latest placed. Could be me, but wouldn't these be the last 2 components in the collection? If you check the count and lets say its 10.. wouldn't 9+10 be your match? (just a idea, got no clue if it is that simple)&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 14:00:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5913673#M115391</guid>
      <dc:creator>Jef_E</dc:creator>
      <dc:date>2015-11-18T14:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Copy and paste</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5915808#M115392</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes I think it should be that simple that the last&amp;nbsp;components are the newly created ones:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://adndevblog.typepad.com/manufacturing/2015/11/copy-occurrences-with-constraints.html" target="_self"&gt;http://adndevblog.typepad.com/manufacturing/2015/11/copy-occurrences-with-constraints.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 14:55:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-and-paste/m-p/5915808#M115392</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2015-11-19T14:55:34Z</dc:date>
    </item>
  </channel>
</rss>

