aaaand I find the answer right after posting the question. the command I need to use is PutObstruct....
Is it the weekend yet?
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.
An object expression that evaluates to a Document object. For more information about this object, refer to "Document Object".
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.
The width that will be used to display the outline of the obstruct.
The number of points in safeArrayOfPnts.
A three element (X,Y,R) array that defines the geometry of the obstruct. Refer to “Using PointsArrays” for more information on points arrays.
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;
//ExpDoc.PutPlacementObstruct(layer, gWidth, pArrayLength, pArray, 0);
ExpDoc.PutObstruct(layer, gWidth, pArrayLength, pArray, MGCPCB.EPcbObstructType.epcbObstructTraceVia, true);
catch (Exception ex)
the solution to this problem was to define the array of points as an object, not a var.