3 Replies Latest reply on May 15, 2014 10:36 AM by andrew_french

    How to place a route obstruct in Expedition via automation?

    andrew_french

      More specifically, how do I place a route obstruct of type via on layer n?

       

      I see something called Route Fence but it doesn't have the options I would expect like the other commands for obstructs like placement.  putRouteFence doesn't let me specify the layer or the type, not to mention I have no idea what haard or soft means in this context and why I would name the fence.  I'm guessing this isn't the command I am looking for...

       

      Any help would be appreciated.

        • 1. Re: How to place a route obstruct in Expedition via automation?
          andrew_french

          aaaand I find the answer right after posting the question.  the command I need to use is PutObstruct....

           

          Is it the weekend yet?

          • 2. Re: How to place a route obstruct in Expedition via automation?
            andrew_french

            PutObstruct Method

             

            Usage

             

             

            Document.PutObstruct(ByVal nLayer As Long ,

            ByVal dGraphicsWidth As Double ,

            ByVal nPnts As Long , pSafeArrayOfPnts As Variant ,

            ByVal eType As EPcbObstructType ,

            [ByVal bFilled As Boolean = False] ,

            [ByVal pComponent As IMGCPCBComponent] ,

            [ByVal eUnit As EPcbUnit = epcbUnitCurrent]) As IMGCPCBObstruct

             

             

            Description : Adds an obstruct to the document.

             

             

            Object

             

             

            Document

            An object expression that evaluates to a Document object. For more information about this object, refer to "Document Object".

            Arguments

             

             

            nLayer

            The layer number for the obstruct. In Cell Editor, specify the layer using the EPcbSide Enum with a value of epcbSideBottom, epcbSideMount, epcbSideOpposite, or epcbSideTop.

            dGraphicsWidth

            The width that will be used to display the outline of the obstruct.

            nPnts

            The number of points in safeArrayOfPnts.

            pSafeArrayOfPnts

            A three element (X,Y,R) array that defines the geometry of the obstruct. Refer to “Using PointsArrays” for more information on points arrays.

            eType

             

             

             

            When I use this method in Expedition, I always get the error "Could not convert argument 0 for call to PutObstruct.  Im assuming argument 0 is refering to the layer number to place the obstruct on.  I get the same error when I try the PutPlacementObstruct method as well.

             

            Code for trying to debug this.  The objective is to create a copy of the user draft layer object (userGfxs) onto a specific layer (any would be nice at this point) as a route obstruct.

             

            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;

                            var 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);

                            }

                        }

                    }

            • 3. Re: How to place a route obstruct in Expedition via automation?
              andrew_french

              the solution to this problem was to define the array of points as an object, not a var.