5 Replies Latest reply on Jan 24, 2011 3:03 AM by Andreas.Schaefer

    Automation CopperBalancingDatas getting Outline of areas

    Flowy

      Hello,

       

      i got following problem.

       

      I manuelley generate Cooper Balancing datas with the "Copper Balancing Processor" (Setting: Shape - Circle)

      With automation i would like to get the PointsArray of each area "convex hull", but I "only" get all Circle points coordinates. Is there a way solve this problem with automation?

       

      docObj.CopperBalancingDatas.Item(1).Geometry.Outline(epcbUnitCurrent)
      returns an Array of all "Shape - Circles" but not the Outline

       

      CODE:

       

      Set PCBAPP = GetObject(, "MGCPCB.Application")
      Call Scripting.AddTypeLibrary("MGCPCB.Application")

      Set docObj = GetLicensedDoc(PCBAPP)

      PCBAPP.Gui.DisplayMessage("Debug")

      Dim A
      Dim cnt
      Dim lastx,lasty

      Dim userObj2, length, newObj
      Set userObj = docObj.FindUserLayer("test")
      Set userObj2 = docObj.FindUserLayer("test2")


      PCBAPP.Gui.DisplayMessage("Anzahl Items: " & docObj.CopperBalancingDatas.Count)
      'PCBAPP.Gui.DisplayMessage("Anzahl Items: " & docObj.CopperBalancingDatas.Item(1).Geometry)
      A = docObj.CopperBalancingDatas.Item(1).Geometry.Outline(epcbUnitCurrent)
      PCBAPP.Gui.DisplayMessage("IsPath: " & docObj.CopperBalancingDatas.Item(1).Geometry.IsPath)


      For cnt = 1 to Ubound(A, 2)
        PCBAPP.Gui.DisplayMessage("X:Y: " & A(0,cnt-1) & " " & A(1,cnt-1))
        Call docObj.PutConstructionLine(userObj, A(0,cnt-1), A(1,cnt-1), A(0,cnt), A(1,cnt), False, epcbUnitCurrent)
      Next

       

       

       

      THX

        • 1. Re: Automation CopperBalancingDatas getting Outline of areas
          kendall_hiles

          It looks like you are correct, I couldn't get the circles either in Automation.  I could get at them with the mask generator.  I "and"ed copper balancing Top with itself and put it on user layer fred and saw the data.  If you can do it in the GUI, you could probably get the Mask Generarator Engine Automation to see it as well.

          • 2. Re: Automation CopperBalancingDatas getting Outline of areas
            Flowy

            Thanks for your answer Kendall.

             

            I probably described my problem wrong.

             

            Getting the point(x,y) informations of the Copper Balancing isn´t the problem.

             

            I need the "convex hull" of the point array of the Copper Balancing, I like to replace the Points with a Planeshape .

             

            I thought the Geometry would be the right way:

            docObj.CopperBalancingDatas.Item(1).Geometry.Outline(epcbUnitCurrent) => should be the Outline of the individual Points of the Copper Balancing?

             

            but its the same as:

            docObj.CopperBalancingDatas.Item(1).Geometry.PointsArray => All Points in a Point array

             

             

            Here this Picture shows the "Convex Hull" which i like to get over the API

            Is there a possibility?

             

            Thx

            • 3. Re: Automation CopperBalancingDatas getting Outline of areas
              Andreas.Schaefer

              Hi Flowy,

               

                  it seems, that you are following the wrong approach, or i do not really know your intention, but there is a simply way to get your result:

              1. Create the copperbalancing not with circles, but with vertical lines, distance =1 and size=1. The result is a completele filled copper area.
                Exactla what you need.
              2. If you only want to get your "copper balancing shapes enclosing outline" to really put a plane on a second layer, you need the following steps:
                • Create the copperbalancing by automation as described in 1.)
                • read out the copper balancing outline then. You can see it in the Layout by not filling copper balancing in display control.
                • Copy the outline into the mask engine by automation and shrink /grow it to get round corners if needed.
                • Read out the resulting mask and copy it to a graphic for your purpose, e.g a plane shape.
                • Delete the copperbalancing and create new one with circles.
              3. The algorithm approach: much effort but the exact result
                • Choose a starting point (e.g one of the shapes with the lowes x coordinate
                • draw a line on a user layer from the center to south direction (length = hatch distance*sqrt(2) )
                • Pick by automation with the line on copper balancing shapes
                • if you found a new shape, this is the second  coordinate of your enclosing shape. If not finding a new shape, draw a new user layer graphic but now into southwest direction (always invrease by 45° clockwise)
                • go on up to finding a new shape with pick.
                • add all coordinates of the found shapes to your polygone
                • you can finis, when finding the start poin again.

              The algorith will workalso at narrow points of the area.

               

               

              Hope I could help, and much fun with the algorithm ;-)

               

              regards,

              Andreas

              • 4. Re: Automation CopperBalancingDatas getting Outline of areas
                Flowy

                Hi Andreas,

                 

                thanks for your post. You helped me a lot!

                 

                2. is the right way for my problem

                 

                But a little tricky with the PointsArray in the PointsArray (Last Items of the Pointsarray of the CopperBalancing are the Geometry form of the Outlines)

                 

                Best regards,

                 

                Flowy

                • 5. Re: Automation CopperBalancingDatas getting Outline of areas
                  Andreas.Schaefer

                  Hi Flowy,

                   

                  that's nice feedback

                   

                  thanks,

                  Andreas