hexagon logo

Saving the Snapshots of CAD View as files

Hello,

Does anyone have implemented to save the report CAD View images produced by the Snapshot commands as each image file such as bipmap (.BMP)?

It would be great if you can share something similar code or advise me.

Thank you in advance.

Best Regards,
Aki

Parents Reply Children
  • What about a basic script to press a hotkey combination set to this function, with a delay before pasting in a proper file name based on an internal program variable, then hitting the Enter key to save? I know this sounds very basic in explanation, but could that work?

  • basically yes
    but there are problems:

    1.)
    the command creates a copy of the current CAD view
    This is not the same as a snapshot command at a specific point within the program flow. Because if you load other views, it can constantly change

    2.)
    Unfortunately, it is not possible to press keys in the menu bar while a routine is running.
    You would first have to laboriously wait for events until the machine stops or trigger everything by hand

  • I was just able to do a keypress command for a screenshot to file while I was running a routine. But this was while offline.

    Can you create custom views and recall them?

  • It's new for me that you can "keypress command for a screenshot" via automation while a program is running. It's nice that this is possible now.
    You would then have to use an event to intercept when the corresponding command comes and then trigger the screenshot, that could work ^^


    I'm not sure what you mean by "Can you create custom views and recall them"?

    Insert these commands with “automation”: yes
    you cannot add commands while a pcdmis routine is running (not even with automation)

    Rotate and adjust CAD with “automation”: not that I know of

  • Sorry, I am new to viewsets, and I just fiddled with it a bit. Something like this.

    VIEWSET1   =VIEWSET/
                RECALL/VIEWSET,VIEWSET1
    CS1        =SCRIPT/FILENAME= SNAPSHOTTEST.BAS
                FUNCTION/Main,SHOW=YES,,
                STARTSCRIPT/
                ENDSCRIPT/

    Viewsets allow you to save a CAD View to exactly how it is in the Graphics Display Window.

    So load a viewset before each script for snapshots.

    Sub Main
    
    Dim WScript As Object
    Set WScript = CreateObject("WScript.Shell")
    WScript.AppActivate "PC-DMIS CAD++ 2021.2"
    WScript.SendKeys "%{s}"
    
    End Sub

    I then set my hotkey for snapshot to alt + s, and it brings up the save dialog window, but I haven't pushed further yet. Still learning how to use these commands.

  • hm you don't even need events if you copy this script before every "snapshot command".

    You don't need to load any extra viewsets because everything has to be set correctly before the "snapshot command" anyway.

    You just have to get rid of the “save as” dialog then that would be a usable solution

  • Sub Main
    
    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim PartVersion As String
    Dim WScript As Object
    
    Set WScript = CreateObject("WScript.Shell")
    
    WScript.AppActivate "PC-DMIS CAD++ 2021.2"
    WScript.SendKeys "%{s}"
    WScript.SendKeys "testimage"
    WScript.SendKeys "{ENTER}"
    
    End Sub

    This works, just need to learn how to set a variable for the file name or another method. Or keep the text the same and just append date/time to the end of it.