AnsweredAssumed Answered

Why Display Control become slow after scripts run

Question asked by ziyu.wang on Oct 16, 2019
Latest reply on Oct 16, 2019 by ziyu.wang

Hello All,

 

In Xpedition VX, does anybody know why Display Control dialog become very slow to the pcb view after I have run the scripts down there?

The Script is simply used for the display layer change.

 

Thanks.

__________________________________________________
Option Explicit

Dim pcbAppObj
Set pcbAppObj = Application
Dim pcbDocObj
Set pcbDocObj = pcbAppObj.ActiveDocument
ValidateServer(pcbDocObj)
Scripting.AddTypeLibrary("MGCPCB.ExpeditionPCBApplication")
pcbAppObj.LockServer
 Dim dispCntrlObj
 Set dispCntrlObj = pcbDocObj.ActiveViewEx.DisplayControl
    '--------------------------------------------------------------
  pcbAppObj.Gui.CursorBusy (True)
  pcbDocObj.TransactionStart
   If (pcbAppObj.LockServer = True) Then
    if dispCntrlObj.Option("Option.ActiveLayerOnly")= False then
    Else
     dispCntrlObj.Option("Option.ActiveLayerOnly")= False
    End If
   dispCntrlObj.Visible( "LayerControl.2" ) = epcbGraphicsItemStateOffEnabled
   dispCntrlObj.Visible( "LayerControl.3" ) = epcbGraphicsItemStateOffEnabled
   dispCntrlObj.Visible( "LayerControl.4" ) = epcbGraphicsItemStateOffEnabled
   
   pcbAppObj.Gui.ProcessKeyin("cl 1")

   End If
  
  pcbDocObj.TransactionEnd
  pcbAppObj.Gui.CursorBusy (False)  
    '--------------------------------------------------------------
    pcbAppObj.UnlockServer

Private Function ValidateServer(doc)
 
    dim key, licenseServer, licenseToken
    key = doc.Validate(0)
    Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
    licenseToken = licenseServer.GetToken(key)
    Set licenseServer = nothing
    On Error Resume Next
    Err.Clear
    doc.Validate(licenseToken)
    If Err Then
        ValidateServer = 0   
    Else
        ValidateServer = 1
    End If
End Function

Outcomes