1 Reply Latest reply on May 3, 2013 7:50 AM by michael.weber

    Problem with IsPointInside in Windows 7 / 64bit Expedition 7.9.4

    michael.weber

      Hi All,

       

      I have a little script, that check, if is a via inside a pad. On Windows XP (32Bit) my script works well:

       

      Code Snippet:

       

      Set pads = pcbDoc.PadstackObjects(epcbPadstackObjectPin,epcbSelectPlaced)

      Set Vias = pcbDoc.Vias(epcbSelectAll)

          i = 0

          'lege Grösse des Arrays fest

          ReDim viaarray(3, Vias.Count)

          'collect Via Coordinates and drillsizes

          For Each via In Vias

              x = FormatNumber(via.PositionX,PRECISION)

              y = FormatNumber(via.PositionX,PRECISION)

              viaarray(0, i) = x

              viaarray(1, i) = y

              viaarray(2, i) = via.holes(1).DrillSize

              viaarray(3, i) = via.Name

              i = i + 1

          Next

          i = 0

          For Each pad In pads

              i = i + 1

              If pad.holes.Count = 0 Then        'pcbPinClassSMD kein Loch = SMD ?

                  For j = 0 To UBound(viaarray, 1)

       

                      x = viaarray(0, j)

                      y = viaarray(1, j)

                      d = viaarray(2, j)

                      ViaName = viaarray(3, j)

       

                      If pad.IsPointInside(x, y) Then

      ...

       

      Now it seems, that IsPointInside doesn't works anymore. Has anyone the same problem ?

       

      BR Michi

        • 1. Re: Problem with IsPointInside in Windows 7 / 64bit Expedition 7.9.4
          michael.weber

          Hi All,

           

          I answer myself ... ... on any reason, I cannot save Via-Positions in an array to speed up the whole checking for-next loops...

           

          I don't no why, I cannot define:

           

          Dim X as Double

           

          This causes erros in running VBA-Script. So I have to solve (with speed slowing down .. ) the whole thing so:

           

          ...

           

              Call pcbApp.Gui.ProgressBarInitialize(True, "Progess", pads.count, 0) 'initialize the progress bar from o to cnt

              For Each pad In pads

                  pcbApp.Gui.ProgressBar (i)

                  i = i + 1

                  Call pcbAppObj.Gui.StatusBarText("Checking " & i & ": "& pad.name, epcbStatusField3)

                  If pad.holes.Count = 0 Then        'pcbPinClassSMD kein Loch = SMD ?

                      For Each via In Vias

                          If pad.IsPointInside(via.PositionX, via.PositionY) Or pad.IsPointInside(via.PositionX - via.holes(1).DrillSize, via.PositionY)_

                              Or pad.IsPointInside(via.PositionX - via.holes(1).DrillSize*0.71, via.PositionY - via.holes(1).DrillSize*0.71)_

                              Or pad.IsPointInside(via.PositionX, via.PositionY - via.holes(1).DrillSize)_

                              Or pad.IsPointInside(via.PositionX + via.holes(1).DrillSize, via.PositionY)_

                              Or pad.IsPointInside(via.PositionX + via.holes(1).DrillSize*0.71, via.PositionY + via.holes(1).DrillSize*0.71)_

                              or pad.IsPointInside(via.PositionX, via.PositionY + via.holes(1).DrillSize) Then

                                  zaehler = zaehler + 1

                                  '----------------------------------------------------------------------

                                  'linked Output

                                  'Note: Layer : via.PositionX : via.PositionY

                                  'Dim sRCCPattern : sRCCPattern = "^TPCheck: (Note|Warning|Error):: (.*) : (.*) : (.*)"

                                  objOutputTab.AppendHTML("TPCheck: Warning:: " & via.Name & " : " & via.PositionX & " : " & via.PositionY)

                                  '----------------------------------------------------------------------

                          End If

                      Next

                  End If

              Next