hexagon logo

Saving Part programs to newer version automatic VB.NET

Hello there,

We have recently updated to the version of 2021R2 of PCDMIS.
But PCMIS 2021R2 supports only versions newer then V2014.
we still have a version of 2020 that support all versions.

But to open every program and save it to the latest version of 2020R2.
Would take up a lot of time, because we have a lot of Part Programs (over 6000)

I now it is possible to open a part program with VB.NET.
but my question is, is it possible to save it to the active version of pcdmis (2020R2)

App = CreateObject("PCDLRN.Application")
Parts = App.PartPrograms("PartProgram.PRG")
Part = Parts.Open

I think it will be something like ...

Part.SaveAs("programNewVersion.PRG") ????? version ?????



Personally, I find it very unfortunate that Hexagon does not come up with the initiative for this solution


Thanks in advance for your answer.
Parents
  • here is a bit of extra code, this script opens a part program at the stored path and saves it in the same place with the new version.
    you just have to put it in a loop and change the path, so that a whole bulk of measurement programs should be able to be changed

    ' dim something
      Dim retVal
      Dim vVersion
      vVersion = "2021.2"
    
      Dim vPath As String
    
      Dim vpcDMIS_App, vpcDMIS_Part As Object
      Set vpcDMIS_App = CreateObject("PCDLRN.Application")
      Set vpcDMIS_Part = Nothing
    
    
    ' scan folder
       ' here start loop if needed
      vPath = "D:\test123.PRG"
    
    
    ' open Partprogramm
      Set vpcDMIS_Part = vpcDMIS_App.PartPrograms.Open(vPath, "Offline")
      If vVersion <> vpcDMIS_Part.ProgramVersionName Then
        retVal = vpcDMIS_Part.SaveAs3(vPath, vVersion, False)
      End If
    
    
    ' close Partprogramm
      vpcDMIS_Part.Quit
      Set vpcDMIS_Part = Nothing
       ' here end loop if needed
    
    
    ' un-dim something
      Set vpcDMIS_App = Nothing
Reply
  • here is a bit of extra code, this script opens a part program at the stored path and saves it in the same place with the new version.
    you just have to put it in a loop and change the path, so that a whole bulk of measurement programs should be able to be changed

    ' dim something
      Dim retVal
      Dim vVersion
      vVersion = "2021.2"
    
      Dim vPath As String
    
      Dim vpcDMIS_App, vpcDMIS_Part As Object
      Set vpcDMIS_App = CreateObject("PCDLRN.Application")
      Set vpcDMIS_Part = Nothing
    
    
    ' scan folder
       ' here start loop if needed
      vPath = "D:\test123.PRG"
    
    
    ' open Partprogramm
      Set vpcDMIS_Part = vpcDMIS_App.PartPrograms.Open(vPath, "Offline")
      If vVersion <> vpcDMIS_Part.ProgramVersionName Then
        retVal = vpcDMIS_Part.SaveAs3(vPath, vVersion, False)
      End If
    
    
    ' close Partprogramm
      vpcDMIS_Part.Quit
      Set vpcDMIS_Part = Nothing
       ' here end loop if needed
    
    
    ' un-dim something
      Set vpcDMIS_App = Nothing
Children
No Data