AnsweredAssumed Answered

How to place a Placement Obstruct via Automation in Expedition

Question asked by andrew_french on May 15, 2014
Latest reply on Jun 5, 2014 by 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);

                }

            }

        }

Outcomes