hexagon logo

Yet another example of PC-Dmis Automation in VB

I've received a few requests from folks on the forum if I could provide an example of PC-Dmis Automation in VB. While perusing through old Forum questions I found one from a use asking is there was a way to start a PC-Dmis measurement program at a specific time. So here is my answer to that question in the form of a PC-Dmis Automation program written in VB on Visual Studio 2019.



The above image is what it looks like when you start it up. Note the bottom status line informing you that PC-Dmis is starting up. It will take a few moments before you see the PC-Dmis IDE appear momentarily then disappear into the background.

I have two zipfiles on Google Drive (the links are below) One is named "PcdmisClock VB Project.zip" and the other is named "PcdmisClock Application.zip".

The first is a Visual Studio VB project folder that you can unzip into your Visual Studio project folder.
The second is zipfile of a folder that you can unzip whereever you like.
Both should be on a system that has PC-Dmis installed.

https://drive.google.com/file/d/1F_fpZ4YFjlM2tbZyuUS73wtu1SzTMpRj/view?usp=sharing

Parents
  • Here are some notes on the VB Project files:



    Referring to the snapshot of the VB Project Solution:

    You can see that the 'Solution' actually has two projects, "PcdmisStartClock" and "Pcdmis-VB-Library". The first is the User Application, the second is a Class library which I use to hold all reusable code. To keep things simple for this example VB project, this class library is a stripped-down version of my own library. The one single class in the library "PcdmisWrapper" is also a stripped-down version of my own wrapper, again to keep things simple.

    In my Visual Studio IDE, the Pcdmis-VB_Library is in its own solution, separate from any user application projects. While developing and enhancing the PcdmisWrapper functionality, it's convenient to have both the library and user application in the same solution. Eventually, PcdmisWrapper becomes mature enough that you can move it to its own solution.

    Note that only the library has a reference to the PCDLRN (the PC-Dmis executable). All interactions between the User application (in this case PcdmisStartClock) are handled by the PcdmisWrapper class, thus only this class needs the reference to the PCDLRN. The User application has a reference to the class library.

    Note: I don't actually have a license to run PC-Dmis, but I do have a copy of the PCDLRN file which enables me to write code that references the PC-Dmis API. I can compile my code, but I can't execute. I can't thank enough the willingness of two users (with licenses) to test my code and give me feedback.

    Note: In the User application the TimeSelection.vb file can be deleted, it was just a test file for testing some code.

Reply
  • Here are some notes on the VB Project files:



    Referring to the snapshot of the VB Project Solution:

    You can see that the 'Solution' actually has two projects, "PcdmisStartClock" and "Pcdmis-VB-Library". The first is the User Application, the second is a Class library which I use to hold all reusable code. To keep things simple for this example VB project, this class library is a stripped-down version of my own library. The one single class in the library "PcdmisWrapper" is also a stripped-down version of my own wrapper, again to keep things simple.

    In my Visual Studio IDE, the Pcdmis-VB_Library is in its own solution, separate from any user application projects. While developing and enhancing the PcdmisWrapper functionality, it's convenient to have both the library and user application in the same solution. Eventually, PcdmisWrapper becomes mature enough that you can move it to its own solution.

    Note that only the library has a reference to the PCDLRN (the PC-Dmis executable). All interactions between the User application (in this case PcdmisStartClock) are handled by the PcdmisWrapper class, thus only this class needs the reference to the PCDLRN. The User application has a reference to the class library.

    Note: I don't actually have a license to run PC-Dmis, but I do have a copy of the PCDLRN file which enables me to write code that references the PC-Dmis API. I can compile my code, but I can't execute. I can't thank enough the willingness of two users (with licenses) to test my code and give me feedback.

    Note: In the User application the TimeSelection.vb file can be deleted, it was just a test file for testing some code.

Children
No Data