VB.net is not the same as vbscript so you might be able to just omit entering anything since the default value is null for no component.
Tried leaving the argument blank but with the same results.
This doesn't work?
DocObj.PutUserLayerGfx((uLayer, gWidth, nPts, ArrayPts)
No. The component argument is not an option, it is required. That is why the automation reference says to put in Nothing if you don't want it to be attached to a component.
Document.PutUserLayerGfx(ByVal pUserLayer As IMGCPCBUserLayer ,
ByVal dGraphicsWidth As Double ,
ByVal nPnts As Long , pSafeArrayOfPnts As Variant ,
[ByVal bFilled As Boolean = False] ,
[ByVal pComponent As IMGCPCBComponent] ,
[ByVal eUnit As EPcbUnit = epcbUnitCurrent]) As IMGCPCBUserLayerGfx
hmm, you are correct, won't work for me either. I was always under the impression that the arguments in brackets [ ] were optional to specify.
well I get a slightly different result in C# by specifying null I get the error "Could not covert argument 1 for call to PutUserLayerGfx" which is basically the same problem I am having with PutObstruct which I have another thread open on...
I guess at the very least my problem appears to be consistent...
im not on my computer but try wrapping it with a transaction start and end.
things I learned to make this work
if you're copying an existing user layer graphic that is currently stored in MGCPCB.UserLayerGfxs userGfxs
int nPts = userGfx.Geometry.PointsArray.Length /3;
Each point has 3 entries in the array (X, Y, R) so you have to divide by 3 to get the number of points. I was originally just taking the length which isn't going to work.
object pSafeArrayOfPnts = userGfx.Geometry.PointsArray;
I was defining my pSafeArrayOfPnts as a var previously which wasn't working, switched to object and things started working for me.
The transaction start and end didn't help any at all for me, maybe it will help mgeisler though. We were having different issues.
Now that I have the arguments formatted correctly, I did test leaving out the arguments with brackets  and the code did work in C#.
If you use this function in Expedition, the argument is required:
ulgfx = pcbdoc.PutUserLayerGfx(ulr, 0, 1+ubound(ptary, 2), ptary, false, nothing)
In Fablink and Drawing Editor, there is no 'component', so you can omit the argument:
ulgfx = fabdoc.PutUserLayerGfx(ulr, 5, 5, ptary, false, , 0)
This is using VB.net, so there may be differences with VBA. The COM object reference is the same though, so I have been under the impression that it works similarly.
mgeisler, perhaps you could post the code you are using. There may be some other problem with it.
Back at it again, but this time with PutTrace, which also requires 'Nothing' to be in the arguments. I have wrapped it in a transaction but with the same results. I tried doing a FindComponent method with an erroneous refdes to return Nothing to an object variable, but that variable didn't work either when I put it in the PutTrace method arguments. I also tried Dim nullObj as Object = Nothing, and Dim nullObj = Nothing, and Dim nullObj as New Object, but none of these worked either. I keep getting the Type Mismatch error. Somehow I need to find a way to set a variable to equal the 'Nothing' that the Mentor PutUserLayerGfx and PutTrace methods will accept as the correct type of object.
Without confirming this, try Type.Missing
Negative. Did not work.
Did you try just Nothing? This works for me:
PutTrace(1, myNet, 10, 2, pointsArray, Nothing, MGCPCB.EPcbAnchorType.epcbAnchorNone, MGCPCB.EPcbUnit.epcbUnitCurrent)
Just using Nothing and getting the type mismatch is what started this discussion.
I tried the following with continued negative results:
trcObj = pcbDoc.PutTrace(6, netObj, 25.0, 2, pntsArr,Type.Missing, 0, 5)
trcObj = pcbDoc.PutTrace(6, netObj, 25.0, 2, pntsArr,Nothing, 0, 5)
Which version of Expedition? I'm on 7.9.5