11 Replies Latest reply on Jun 5, 2014 5:46 AM by andrew_french

    How to place a Placement Obstruct via Automation in Expedition

    andrew_french

      Code for trying to debug this.  The objective is to create a copy of the user draft layer object (userGfxs) onto a specific layer as a placement obstruct.  I have PutObstruct working now and it is not much different than PutPlacementObstruct as far as the required arguments to pass in so I'm confused why it wont work.  PutPlacementObstruct line errors out on me stating that the "Object reference is not set to an object".  I checked all the arguments that I am passing and they are all equal to something so I'm not sure what object its refering to.

       

      private static void createUserCopy(MGCPCB.Document ExpDoc, MGCPCB.UserLayerGfxs userGfxs, string modeOfOp)

              {

                  int layer = 1;

                  double gWidth = 1;

       

                  foreach (MGCPCB.UserLayerGfx userGfx in userGfxs)

                  {

                      int pArrayLength = userGfx.Geometry.PointsArray.Length /3;

                      obj pArray = userGfx.Geometry.PointsArray;

       

                      try

                      {

                          ExpDoc.PutPlacementObstruct(layer, gWidth, pArrayLength, pArray, 0);

                          //ExpDoc.PutObstruct(layer, gWidth, pArrayLength, pArray, MGCPCB.EPcbObstructType.epcbObstructTraceVia, true);

       

                      }

                      catch (Exception ex)

                      {

                          MessageBox.Show(ex.Message);

                      }

                  }

              }

        • 2. Re: How to place a Placement Obstruct via Automation in Expedition
          kendall_hiles

          In AATK FlipChip Utils there is a script called Design Data Util (DDU) that has examples of taking user graphics and creating objects.  You can look at this for your example or just use it.

           

          -kendall

          • 3. Re: How to place a Placement Obstruct via Automation in Expedition
            andrew_french

            I'll take a look to see if there is a specific example of PutPlacementObstruct working but I have no issues now placing a route or via obstruct using PutObstruct.  I'm leaning towards theres an issue with the command itself at this point since the parameters for both are basically identical.

            • 4. Re: How to place a Placement Obstruct via Automation in Expedition
              kendall_hiles

              It works for me in VB the only change I made was how many array points there are in the array.

               

                  Layer = 1

                  gWidth = 1
                  Set userGfxs = pcbDoc.UserLayerGfxs(epcbSelectSelected)

                  For Each userGfx In userGfxs

                      pArray = userGfx.Geometry.PointsArray
                      pArrayLength = UBound(pArray, 2) + 1

                      Call pcbDoc.PutPlacementObstruct(Layer, gWidth, pArrayLength, pArray, 0)

                      Call pcbDoc.PutObstruct(Layer, gWidth, pArrayLength, pArray, MGCPCB.EPcbObstructType.epcbObstructTraceVia, True)

                  Next

               

              obs.png

              • 5. Re: How to place a Placement Obstruct via Automation in Expedition
                andrew_french

                pArrayLength = UBound(pArray, 2) + 1

                and

                pArrayLength = userGfx.Geometry.PointsArray.Length /3;

                 

                both lines of code result in the same value, I still get the error that "An object reference is not set to an object".

                 

                Why would values work for PutObstruct but yet the same exact values not work for PutPlacementObstruct for me?  I feel like I'm missing something fundamental at this point.

                • 6. Re: How to place a Placement Obstruct via Automation in Expedition
                  kendall_hiles

                  Try using the constants value instead of the call.  For Trace Via using 16 or hex 10.

                   

                  obstruct_type.png

                  • 7. Re: How to place a Placement Obstruct via Automation in Expedition
                    andrew_french

                    I'm trying to put down a Placement Obstruct.  I've got via and trace obstructs working already.

                    • 8. Re: How to place a Placement Obstruct via Automation in Expedition
                      kendall_hiles

                      In AATK look for koz.efm.  It has examples of keepout zones.

                      • 9. Re: How to place a Placement Obstruct via Automation in Expedition
                        andrew_french

                        Okay, that code proves my point that I've been trying to make here.  The arguments nPnts and safeArrayOfPnts are not the same for PutPlacementObstruct, PutUserLayerGfx, and PutObstruct but the documentation describes them as the same.  PutUserLayerGfx arguments = PutObstruct arguments but they are not the same for PutPlacementObstruct.

                         

                        i = 0

                         

                            al(0, i) = minx    'xval

                            ar(0, i) = maxx    'xval

                            at(0, i) = minx

                            ab(0, i) = minx

                         

                            al(1, i) = miny - kozb   'yval

                            ar(1, i) = miny - kozb  'yval

                            at(1, i) = maxy

                            ab(1, i) = miny

                         

                            al(2, i) = 0    'radius

                            ar(2, i) = 0    'radius

                            at(2, i) = 0    'radius

                            ab(2, i) = 0    'radius

                         

                            i = 1

                         

                            al(0, i) = minx - kozl  'xval

                            ar(0, i) = maxx + kozr  'xval

                            at(0, i) = maxx

                            ab(0, i) = maxx

                         

                            al(1, i) = miny - kozb   'yval

                            ar(1, i) = miny - kozb  'yval

                            at(1, i) = maxy

                            ab(1, i) = miny

                         

                            al(2, i) = 0    'radius

                            ar(2, i) = 0    'radius

                            at(2, i) = 0    'radius

                            ab(2, i) = 0    'radius

                         

                            i = 2

                         

                            al(0, i) = minx - kozl  'xval

                            ar(0, i) = maxx + kozr  'xval

                            at(0, i) = maxx

                            ab(0, i) = maxx

                         

                            al(1, i) = maxy + kozt   'yval

                            ar(1, i) = maxy + kozt 'yval

                            at(1, i) = maxy + kozt

                            ab(1, i) = miny - kozb

                         

                            al(2, i) = 0    'radius

                            ar(2, i) = 0    'radius

                            at(2, i) = 0    'radius

                            ab(2, i) = 0    'radius

                         

                         

                            i = 3

                         

                            al(0, i) = minx   'xval

                            ar(0, i) = maxx   'xval

                            at(0, i) = minx

                            ab(0, i) = minx

                         

                            al(1, i) = maxy + kozt  'yval

                            ar(1, i) = maxy + kozt  'yval

                            at(1, i) = maxy + kozt

                            ab(1, i) = miny - kozb

                         

                            al(2, i) = 0    'radius

                            ar(2, i) = 0    'radius

                            at(2, i) = 0    'radius

                            ab(2, i) = 0    'radius

                         

                            Dim bt, bra, bb, bla

                            Set fred = docObj.FindUserLayer(userLayerName)

                         

                            docObj.TransactionStart (epcbDRCModeNone)

                            Set bla = docObj.PutPlacementObstruct(1, 0, 4, al, 0, Nothing, epcbUnitCurrent)

                            Call bla.putproperty(userLayerName,"kozepoxy")

                            Set bt = docObj.PutPlacementObstruct(1, 0, 4, at, 0, Nothing, epcbUnitCurrent)

                            Call bt.putproperty(userLayerName,"kozepoxy")

                            Set bra = docObj.PutPlacementObstruct(1, 0, 4, ar, 0, Nothing, epcbUnitCurrent)

                            Call bra.putproperty(userLayerName,"kozepoxy")

                            Set bb = docObj.PutPlacementObstruct(1, 0, 4, ab, 0, Nothing, epcbUnitCurrent)

                            Call bb.putproperty(userLayerName,"kozepoxy")

                         

                            i = 4

                         

                            al(0, i) = minx    'xval

                            ar(0, i) = maxx    'xval

                            at(0, i) = minx

                            ab(0, i) = minx

                         

                            al(1, i) = miny - kozb   'yval

                            ar(1, i) = miny - kozb  'yval

                            at(1, i) = maxy

                            ab(1, i) = miny

                         

                            al(2, i) = 0    'radius

                            ar(2, i) = 0    'radius

                            at(2, i) = 0    'radius

                            ab(2, i) = 0    'radius

                         

                            Set sss = docObj.PutUserLayerGfx(fred, 0, 5, al, True, Nothing, epcbUnitCurrent)

                            Set ssss = docObj.PutUserLayerGfx(fred, 0, 5, at, True, Nothing, epcbUnitCurrent)

                            Set sssss = docObj.PutUserLayerGfx(fred, 0, 5, ar, True, Nothing, epcbUnitCurrent)

                            Set ssssss = docObj.PutUserLayerGfx(fred, 0, 5, ab, True, Nothing, epcbUnitCurrent)

                        • 10. Re: How to place a Placement Obstruct via Automation in Expedition
                          kendall_hiles

                          Hey;  Don't shoot the messenger.  I just write code using Automation, not the functions that control it:^)

                          • 11. Re: How to place a Placement Obstruct via Automation in Expedition
                            andrew_french

                            Just frustrated at something that should be simple at this point for me I guess.  I'm sorry, that was not my intended tone!  I always appreciate the help you provide here Kendall!