Calling Image to Clipboard from Script

Nick Ramseyer
Nick Ramseyer Member Posts: 26
10 Comments First Anniversary Name Dropper
**

I am looking to try to call the "Image To Clipboard" function from ACT scripting in Ansys Mechanical Python scripting. I've looked through the toolbar module and haven't found a way to call this function.

The context is that I am aware of the graphics export function that can be called from ExtAPI.Graphics, however the graphics saving function takes between 0.3-0.5 seconds to execute which is very slow when saving hundreds of images in a loop. I'm thinking that the copy to clipboard function may be faster but am not sure how to call it from scripting.

ExtAPI.Graphics.ExportImage(directory, GraphicsImageExportFormat.PNG, gset)

Answers

  • Naveen Kumar Begari
    Naveen Kumar Begari Member Posts: 102
    10 Comments 5 Likes First Answer First Anniversary
    **

    @Nick Ramseyer ,

    copy to clipboard function may be faster but am not sure how to call it from scripting.?

    Use 'ExportImageToClipboard' function to call it

    Below code might help you:

    image_settings = Ansys.Mechanical.Graphics.GraphicsImageExportSettings()
    image_settings.CurrentGraphicsDisplay = True
    ExtAPI.Graphics.ExportImageToClipboard(image_settings)
    
  • Matthias
    Matthias Member Posts: 35
    10 Comments Name Dropper First Anniversary
    **

    @Nick Ramseyer
    If you are talking about 'hundreds of images' and are operating on Windows OS you might run in to limitations of the clipboard history quite fast.