How to activate signal layers

Sometimes it's necessary to activate special layer types, in this example we activate all signal layers of the first step. We use the Interface of PCB-Investigator to get information about the Embedded ODB++ job.

PCB-Investigator loads the ODB++ Matrix from the embedded data, who contains types of layers (and many more information, just check the methods). At the beginning we have to add the reference to our class by using PCBI.Automation;

And do not forget to add the reference to your project like here.

Here is the example code in C Sharp and VB:

/// <summary>
    /// Activate all signal layers from the current step of given PCBI-Embedded-Design.
    /// </summary>
    private void ActivateAllSignalLayers()
    {
      IAutomation.IAutomationInit();
 
      //create a window to handle your actions
      IPCBIWindow mainWindowPCBI = IAutomation.OpenEmbeddedDesign(@"D:\tests\PCB-Investigator-Design.exe", false);
 
      //we use the first step and work only with this one
      IStep currentStep = mainWindowPCBI.GetCurrentStep();
 
      //the matirx contains all important informations of the job
      IMatrix matrix = mainWindowPCBI.GetMatrix();
 
      //show the loaded embedded design with active signal layers
      mainWindowPCBI.Show();
 
      foreach (string layername in matrix.GetAllLayerNames())
      {
        //only board layer of interest
        if (matrix.GetMatrixLayerContext(layername) != MatrixLayerContext.Board)
          continue;
 
        //only signal layers
        if (matrix.GetMatrixLayerType(layername) != MatrixLayerType.Signal)
          continue;
 
        //load the layer
        ILayer layerSignal = currentStep.GetLayer(layername);
 
        //activate the layer
        layerSignal.EnableLayer(true);
      }
 
      //at the end its important to update view, then PCB-Investigator draws the elements to grahic pane
      mainWindowPCBI.UpdateView();