PC-DMIS 2021.1 Object Library
AutomationSettings Object
See Also  Members  Example  Send Topic Feedback | See Object Hierarchy Chart
PCDLRN ActiveX DLL : AutomationSettings Object

Glossary Item Box

Description

The AutomationSettings object controls how to handle PC-DMIS automated behaviors. This includes, but is not limited to, automatic-generated messages in PC-DMIS.

Remarks

The object currently has properties that handle generated messages about probe tip errors.

Example

This example connects to PC-DMIS, loads a part program, and then allows you to control what messages appear through the available check boxes.

 

Example (C#)Copy Code
namespace PCD_112219_Test_Application
{
  public partial class Form1 : Form
  {
    PCDLRN.Application theApp = null;
    PCDLRN.AutomationSettings theAutomationSettings = null;
    public Form1()
    {
      InitializeComponent();
      enableDisableControls();
    }

    void enableDisableControls()
    {
      if (theApp != null)
      {
        AutomationShowTipMissingMessageBox.Enabled = true;
        AutomationShowTipNotAllowedMessageBox.Enabled = true;
        AutomationShowTipNotCalibratedMessageBox.Enabled = true;
        AutomationShowTipCalibrationIsOlderThanAllowedMessageBox.Enabled = true;
        AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox.Enabled = true;
        Connect.Enabled = false;
        Disconnect.Enabled = true;
        PcDmisVisible.Enabled = true;
        LoadPartProgram.Enabled = theApp.ActivePartProgram == null;
        ClosePartProgram.Enabled = theApp.ActivePartProgram != null;
        if (theApp.ActivePartProgram != null)
        {
          loadedPartProgram.Text = theApp.ActivePartProgram.FullName;
        }
        else
        {
          loadedPartProgram.Text = "";
        }
      }
      else
      {
        AutomationShowTipMissingMessageBox.Enabled = false;
        AutomationShowTipNotAllowedMessageBox.Enabled = false;
        AutomationShowTipNotCalibratedMessageBox.Enabled = false;
        AutomationShowTipCalibrationIsOlderThanAllowedMessageBox.Enabled = false;
        AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox.Enabled = false;
        Connect.Enabled = true;
        Disconnect.Enabled = false;
        LoadPartProgram.Enabled = false;
        ClosePartProgram.Enabled = false;
        PcDmisVisible.Enabled = false;
        loadedPartProgram.Text = "";
      }
    }

    private void AutomationShowTipMissingMessageBox_CheckedChanged(object sender, EventArgs e)
    {
      theAutomationSettings.AutomationShowTipMissingMessageBox = AutomationShowTipMissingMessageBox.Checked;
    }

    private void AutomationShowTipNotAllowedMessageBox_CheckedChanged(object sender, EventArgs e)
    {
      theAutomationSettings.AutomationShowTipNotAllowedMessageBox = AutomationShowTipNotAllowedMessageBox.Checked;
    }

    private void AutomationShowTipNotCalibratedMessageBox_CheckedChanged(object sender, EventArgs e)
    {
      theAutomationSettings.AutomationShowTipNotCalibratedMessageBox = AutomationShowTipNotCalibratedMessageBox.Checked;
    }

    private void AutomationShowTipCalibrationIsOlderThanAllowedMessageBox_CheckedChanged(object sender, EventArgs e)
    {
      theAutomationSettings.AutomationShowTipCalibrationIsOlderThanAllowedMessageBox = AutomationShowTipCalibrationIsOlderThanAllowedMessageBox.Checked;
    }

    private void AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox_CheckedChanged(object sender, EventArgs e)
    {
      theAutomationSettings.AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox = AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox.Checked;
    }

    private void Connect_Click(object sender, EventArgs e)
    {
      var comType = Type.GetTypeFromProgID(@"PCDLRN.Application");
      if (comType == null)
      {
        return;
      }

      theApp = (PCDLRN.Application)Activator.CreateInstance(comType);
      if (theApp != null)
      {
        theApp.WaitUntilReady(500);
        theAutomationSettings = theApp.AutomationSettings;
        PcDmisVisible.Checked = theApp.Visible;
        AutomationShowTipMissingMessageBox.Checked = theAutomationSettings.AutomationShowTipMissingMessageBox;
        AutomationShowTipCalibrationIsOlderThanAllowedMessageBox.Checked = theAutomationSettings.AutomationShowTipCalibrationIsOlderThanAllowedMessageBox;
        AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox.Checked = theAutomationSettings.AutomationShowTipCalibrationMinMaxDifferenceIsTooLargeMessageBox;
        AutomationShowTipNotAllowedMessageBox.Checked = theAutomationSettings.AutomationShowTipNotAllowedMessageBox;
        AutomationShowTipNotCalibratedMessageBox.Checked = theAutomationSettings.AutomationShowTipNotCalibratedMessageBox;
      }
      enableDisableControls();
    }

    private void Disconnect_Click(object sender, EventArgs e)
    {
      theAutomationSettings = null;
      theApp = null;
      GC.Collect();
      Thread.Sleep(20);
      enableDisableControls();
    }

    private void LoadPartProgram_Click(object sender, EventArgs e)
    {
      if (theApp != null && theApp.ActivePartProgram == null)
      {
        openProgramFileDialog.CheckFileExists = true;
        openProgramFileDialog.DefaultExt = @"PRG";
        openProgramFileDialog.Filter = "Part program  files (*.PRG)|*.PRG";
        openProgramFileDialog.ShowDialog();
        var name = openProgramFileDialog.FileName;
        theApp.PartPrograms.Open(name, "CMM1");
        Thread.Sleep(20);
      }
      enableDisableControls();
    }

    private void ClosePartProgram_Click(object sender, EventArgs e)
    {
      if (theApp != null && theApp.ActivePartProgram != null)
      {
        theApp.PartPrograms.CloseAll();
        Thread.Sleep(20);
      }
      enableDisableControls();
    }

    private void PcDmisVisible_CheckedChanged(object sender, EventArgs e)
    {
      theApp.Visible = PcDmisVisible.Checked;
    }
  }
}

See Also

Copyright © 2020. Hexagon Manufacturing Intelligence – Metrology Software, Inc. All Rights Reserved.