Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

copy part *.ipt to clipboard

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
achmidt
701 Views, 5 Replies

copy part *.ipt to clipboard

Hi,

Is there any code similar to one below that copys part.ipt to the clipboard?

 

Imports System.Windows.Forms

Sub Main
   Clipboard.SetText(Description)
End Sub

 Any help is appreciated.

Thanks,

Inventor Virtual Parts Addin

http://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3Avirtualpartsadd-in_windows32and64%3Aen
5 REPLIES 5
Message 2 of 6
ekinsb
in reply to: achmidt

Can you please be a more specific about what you need and what you're trying to do.  I'm unclear if you want it to be the equivalent of selecting a .ipt file in Windows Explorer and doing ctrl-C or selecting the top node in the browser and doing ctrl-C or even something else.  The results in the two cases I mentioned, as far as what goes on the clipboard, are completely different.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 6
achmidt
in reply to: ekinsb

Brian,

I`m trying to find a code equivalent to selecting an ipt part In inventor in the assembly view tree and doing CTRL+C.

Thank you,

Inventor Virtual Parts Addin

http://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3Avirtualpartsadd-in_windows32and64%3Aen
Message 4 of 6
ekinsb
in reply to: achmidt

There isn't direct exposure of the Copy and Paste functionality on the ComponentOccurrence object, which is the API object that represents each of the nodes in the assembly tree (parts and subassemblies).  However, it is possible to directly call Inventor commands.  The code below illustrates this.

Public Sub CopyPaste()
    Dim asmDoc As AssemblyDocument
    Set asmDoc = ThisApplication.ActiveDocument

    Dim occ As ComponentOccurrence
    Set occ = asmDoc.ComponentDefinition.Occurrences.ItemByName("L:1")
    
    ' Get references to the copy and paste commands.
    Dim controlDefs As ControlDefinitions
    Set controlDefs = ThisApplication.CommandManager.ControlDefinitions
    Dim copyCommand As ControlDefinition
    Set copyCommand = controlDefs.Item("AppCopyCmd")
    Dim pasteCommand As ControlDefinition
    Set pasteCommand = controlDefs.Item("AppPasteCmd")

    ' Select the occurrence.
    asmDoc.SelectSet.Clear
    Call asmDoc.SelectSet.Select(occ)
    
    ' Execute the copy command.
    copyCommand.Execute
    
    ' Execute the paste command.
    pasteCommand.Execute
End Sub

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 6
achmidt
in reply to: ekinsb

Great! it works! I would never come up with something similar myself!
Thanks!
Inventor Virtual Parts Addin

http://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3Avirtualpartsadd-in_windows32and64%3Aen
Message 6 of 6
DeerSpotter
in reply to: ekinsb

this doesnt work anymore, could you please fix?

Image and video hosting by TinyPic
..........................................................................................................................
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
..........................................................................................................................


See My LinkedIn Profile

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report