5 Replies Latest reply on Nov 14, 2017 7:50 AM by kendall_hiles

    putobstruct works in excel but not in a script

    juergen.dickler

      Hello all

      I'm facing a problem and did not find it after hours of searching.

       

      In Excel it works fine but not in a script or mentor script form. Getting the message type conflictconflict.PNG.

       

      I will get a selected plane obstruct and copy it to x other layers

      Here the core code:

       

      Dim pcbApp
      Dim pcbDoc

      Dim putlayer
      Dim npoints
      Dim AoP
      Dim obst
      dim obtype

       

        Set pcbapp = GetObject(, "MGCPCB.ExpeditionPCBApplication")
        Scripting.AddTypeLibrary("MGCPCB.ExpeditionPCBApplication")
        Set pcbDoc = pcbapp.ActiveDocument

          If ValidateServer(pcbDoc) = 0 Then
              MsgBox "Document Validation failed."
          End If

       

      set obst = pcbDoc.Obstructs(epcbObstructAll, epcbSelectSelected)
      AoP = obst.item(1).Geometry.PointsArray
      obtype = obst.item(1).ObstructType
      npoints = UBound(AoP,2) +1
      putlayer = 2 ' only one for testing

      pcbDoc.TransactionStart(epcbDRCModeNoneWithBatchQuery)
      set obst = pcbDoc.PutObstruct(putlayer,0, npoints, AoP,obtype )

       

      Why it works in Excel and not in a script? What is wrong?

       

      Thx.