3 Replies Latest reply on May 10, 2012 1:18 AM by Andreas.Schaefer

    PutComponent always returns Nothing for drawing cells

    jtaschereau

      I'm using the PutComponent method to place multiple instances of a drawing cell in my design. The drawing cell contains route obstructs, and will be added to our plane layers after the design has been routed up. I'd like to know the coordinates for each instance placed, as well as whether or not the placement was successful or not. Currently, the return value that I get from PutComponent is nothing so it's as if it's always failing, but looking at the design, it clearly has many places where placement was successful and a few places where it was not.

       

      Does anyone have any explanation, or perhaps a better way to accomplish my goal?

        • 1. Re: PutComponent always returns Nothing for drawing cells
          Andreas.Schaefer

          Hi,

           

          when the putComponet returns Nothing, the placement has failed.

           

          I would propose to set a LockServer ( with set DRC=FALSE) before the PutComponent (at the end do not forget UnlockServer)

          The it should place the component and return the component object as desired.

           

          Another way for debugging is, to look for all the placed cells in the design.

           

          Last Idea is to put a user property on the cell by automation.

          Then, when selecting the cell later interactively, you can see it in the properties window.

          You could use this to show, which number in your placement sequence it was.

           

          Kind regards,

          Andreas

          • 2. Re: PutComponent always returns Nothing for drawing cells
            jtaschereau

            Thanks for the reply, Andreas.

             

            I understand that when putComponent returns nothing, it means the placement has failed. From what I've tested in my code, though, the putComponent method returns nothing even though the drawing cells were placed successfully. I have tried setting a variable to become the component object that is returned and testing the placed property, and that seems to always come back as true, regardless if the drawing cell was successfully placed or not.

             

            Here's the snippet of code:

             

            pcbDoc.TransactionStart(1)

            Ycoord = 0

            Do While Ycoord > Ymin

                 Xcoord = 0

                 Do While Xcoord > Xmin

                      Err.Clear

                      Set rtnVal = pcbDoc.PutComponent(cell,False,Xcoord,Ycoord,0)

                      oFile.WriteLine(rtnVal.Placed)

                      '                              If rtnVal Is Nothing Then

                           '                                        oFile.WriteLine("Placement failed at " & Xcoord & "," & Ycoord)

                      '                              Else

                           '                                        oFile.WriteLine("..." & rtnVal & "...")

                      '                              End If

                      Xcoord = Xcoord - pitch

                 Loop

                 Ycoord = Ycoord - pitch

            Loop

            pcbDoc.TransactionEnd()

             

            I also tried gathering the collection of drawing cells that were placed, and reporting their x-y coordinates... but to no avail! The comp.Count property is correct (I checked it, deleted a few drawing cells, then re-checked), and I can get the comp.Level property to report but neither the comp.CenterX/Y or comp.PositionX/Y properties report anything! Here's the code that I used to test this:

             

            Set compColl = pcbDoc.Components(4,-1,1)

            '          msgBox cellColl.Count

            x = 1

            dFile.WriteLine("Start")

            For Each comp In compColl

            '     Xcoord = comp.PositionX(curUnits)

            '     Ycoord = comp.PositionY(curUnits)

                 Xcoord = comp.CenterX(curUnits)

                 Ycoord = comp.CenterY(curUnits)

                 dFile.WriteLine(x & ". " & Xcoord & "," & Ycoord & " Level = " & comp.Level)

                 x = x + 1

            Next

            dFile.WriteLine("End")

             

            I've attached the debug.txt that this code was reporting to.

            • 3. Re: PutComponent always returns Nothing for drawing cells
              Andreas.Schaefer

              Hi,

               

              As next step I would try o one step back.

              Just test your code snippets by

              • select a placed drwaing cell interactive
              • use pcbDoc.Components(epcbSelcetSelected,epcbCompAll,epcbCelltypeDrawing) to create a one item component collection
              • in CompCollection.item(1) search for all your properties like positionand so on.

               

              I assume there is an wron

              comp.PositionX(curUnits)

              call.

               

              Kind regards,

              Andreas