AnsweredAssumed Answered

Utility.NewLayerRanges ?

Question asked by kate_lee on Jan 7, 2015
Latest reply on Jan 7, 2015 by kate_lee

Hi, in below script, if I use

Set NewLayerRangesCol = UtilityObj.NewObjects

it has no error

but if I use

Set NewLayerRangesCol = UtilityObj.NewLayerRanges

it has an error for "Add" method.

It seems to have problem to "Remove" either.

 

How can I Add an object to 'NewLayerRangesCol/' Collection?

 

 

--------------------------------------------------------------------------------

Option Explicit

 

' Get the Application object

Dim pcbAppObj

Set pcbAppObj = Application

 

' Get the active document

Dim pcbDocObj

Set pcbDocObj = pcbAppObj.ActiveDocument

 

 

ValidateServer(pcbDocObj)

 

Scripting.AddTypeLibrary("MGCPCB.Application")

 

 

Dim EditConObj

Set EditConObj = pcbDocObj.EditorControl

 

 

Dim UtilityObj

Set UtilityObj = pcbAppObj.Utility

 

  Dim ePcbPadShapesArg

  ePcbPadShapesArg=Array("epcbRectPad", "epcbOblongPad", "epcbRoundPad", "epcbSquarePad", "epcbCustomPad")

  Dim EPcbECSelPadsViaPosRulesArgs, LayerRange3, Text5

  EPcbECSelPadsViaPosRulesArgs = Array("epcbECAllowViasUnderPad","epcbECAllowOffPadOrigin","epcbECAlignViaOnLongAxis","epcbECLocateViaAtPadEdge","epcbECKeepViaCenterInsidePad","epcbECKeepViaPadInsidePad")

 

 

  Dim i,j,PadsCol,Text1,PadsShapeCol,PadShape,Text7

  Dim LayerRange,LayerRangesCol,NewLayerRangesCol,NewLayerRangesObj,k,LayerRangesCol1,LayerRange1,m

 

 

  For j = 0 to 4

  Set PadsShapeCol = EditConObj.Pads(j)

  Text1 = Text1 & vbCrlf & "Pad Shape Type: " & ePcbPadShapesArg(j) & vbCrlf &_

  "->Pads Count: " & PadsShapeCol.count & vbCrlf

 

  For Each PadShape in PadsShapeCol

  'Set NewLayerRangesCol = UtilityObj.NewObjects

  Set NewLayerRangesCol = UtilityObj.NewLayerRanges

  Text1 = Text1 & " --> " & PadShape & vbCrlf

 

  Set LayerRangesCol = EditConObj.PadEntryViaSpansForPad(PadShape)

  NewLayerRangesCol.Add(LayerRangesCol(1))

  NewLayerRangesCol.Add(LayerRangesCol(LayerRangesCol.count))

 

  For Each NewLayerRangesObj in NewLayerRangesCol

  Text1 = Text1 & NewLayerRangesObj & vbCrlf

  Next

 

 

  Next

  Next

 

 

  MsgBox Text1

Outcomes