4 Replies Latest reply on Jan 19, 2011 2:56 AM by mans.joling

    Put contour

    mans.joling

      Hello,

       

      I want to put by automation a contour from A to B

      I known the hole name "Rnd 2 +/-Tol 0.05 Non-Plated"

      This hole is not be used on the board but is available in the local library

      How do I get the right hole assigned to the phole in the PutContourEx command

       

      Regards

       

      Mans

       

        • 1. Re: Put contour
          Andreas.Schaefer

          Hello Mans,

          the idea is, to put the hole in th edocument first:

          set HoleObject = docObject.PutHole("Rnd 2 +/-Tol 0.05 Non-Plated")

          If the hole is not in your loclib, it should be retriefed from Central Lib anyway.


          Next you can place the countour:

          set ContourHandle = docObject.PutContour(Length, PointsArray, HoleObject, epcbCompensationCenter, epcbContourInternal, 0, ComponentObject)

           

          I just translated it from TCL, so may be syntax is not correct.

          It shows the way it works.

           

          regards,

          Andreas

          • 2. Re: Put contour
            mans.joling

            Hello Adreas,

             

            What you suggested that works.

            But a new problem has been occured I can run the sub 3 times and then he gives a Exception ("invalid access to memory location (Exception from HRESULT:0x800703E6)

            What I am trying is I select 2 filled circles in the layout extract the x,y coordinates from start and end and put a contour between the 2 circles

            Here is my peace of code (written in VB.net)

            Any idea

             

            Public Sub Find_SlectedShapes_And_PutContourLine()

            Gfxs = pcbDoc.UserLayerGfxs(MGCPCB.

            EPcbSelectionType.epcbSelectSelected)

             

            Dim name As String = String.Empty

             

            Dim Iposx1 As Double = 0

             

            Dim Iposx2 As Double = 0

             

            Dim Iposy1 As Double = 0

             

            Dim Iposy2 As Double = 0

            Dim GfxSelected As Integer = 0

             

            Dim Pnts As Integer = 0

             

            Dim Comp As MGCPCB.Component

             

            Dim SafeArrayOfPnts(2, 1) As Double

             

            Dim I As Integer = 0

             

            For Each Gfx In Gfxs

             

            If StrComp(Gfx.UserLayer.Name, "General Remarks") = 0 Then

             

            If Gfx.Geometry.Filled = True Then

             

            If Gfx.Selected = True Then

            GfxSelected = GfxSelected + 1

             

            Select Case GfxSelected

             

            Case 1

            Iposx1 = Gfx.Geometry.CircleX

            Iposy1 = Gfx.Geometry.CircleY

             

            Case 2

            Iposx2 = Gfx.Geometry.CircleX

            Iposy2 = Gfx.Geometry.CircleY

             

            Case 3

             

            MessageBox.Show("more the 2 items selected (exit)")

             

            Exit Sub

             

            End Select

             

            End If

             

            End If

             

            End If

             

            Next

             

            If GfxSelected = 1 Then

            contours = pcbDoc.Contours(MGCPCB.

            EPcbSelectionType.epcbSelectSelected)

             

            For Each contour In contours

             

            Next

             

            End If

            Comp =

            Nothing

            SafeArrayOfPnts(0, 0) = Iposx1 : SafeArrayOfPnts(1, 0) = Iposy1 : SafeArrayOfPnts(2, 0) = 0.0

            SafeArrayOfPnts(0, 1) = Iposx2 : SafeArrayOfPnts(1, 1) = Iposy2 : SafeArrayOfPnts(2, 1) = 0.0

             

            Try

            pcbDoc.PutContourEx(2, SafeArrayOfPnts, 1, 4, Phole, MGCPCB.

            EPcbCompensationType.epcbCompensationLeft, _

            MGCPCB.

            EPcbContourType.epcbContourInternal, False, Comp, MGCPCB.EPcbUnit.epcbUnitCurrent)

             

            Catch E As Exception

            MsgBox(E.Message)

             

            End Try

            pcbDoc.Save()

             

            End Sub

             

             

             

             

             

             

             

             

            • 3. Re: Put contour
              Andreas.Schaefer

              Hello Mans,

               

              I have no idea, but some thoughts to look on.

              Its strngly depending, from what you do outside the sub.

              Try to isolate the sub and run it as a loop. Does it occur again?

              How many library accesse dou you have?

              E.g. we have seen a Cell Editor issue, with exeption after more than 50 opens.

              So I would have a look into the library accesses and minimize them.

               

              regards,

              Andreas

              • 4. Re: Put contour
                mans.joling

                Hello Adreas,

                 

                I stripped the sub and everything works fine now.

                 

                Regards

                 

                Mans