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
  • 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.

Children
  • 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.