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,
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
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,
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,
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
this doesnt work anymore, could you please fix?