the idea is, to put the hole in th edocument first:
set HoleObject = docObject.PutHole("Rnd 2 +/-Tol 0.05 Non-Plated")
If the hole is not in your loclib, it should be retriefed from Central Lib anyway.
Next you can place the countour:
set ContourHandle = docObject.PutContour(Length, PointsArray, HoleObject, epcbCompensationCenter, epcbContourInternal, 0, ComponentObject)
I just translated it from TCL, so may be syntax is not correct.
It shows the way it works.
What you suggested that works.
But a new problem has been occured I can run the sub 3 times and then he gives a Exception ("invalid access to memory location (Exception from HRESULT:0x800703E6)
What I am trying is I select 2 filled circles in the layout extract the x,y coordinates from start and end and put a contour between the 2 circles
Here is my peace of code (written in VB.net)
Public Sub Find_SlectedShapes_And_PutContourLine()
Gfxs = pcbDoc.UserLayerGfxs(MGCPCB.
Dim name As String = String.Empty
Dim Iposx1 As Double = 0
Dim Iposx2 As Double = 0
Dim Iposy1 As Double = 0
Dim Iposy2 As Double = 0
Dim GfxSelected As Integer = 0
Dim Pnts As Integer = 0
Dim Comp As MGCPCB.Component
Dim SafeArrayOfPnts(2, 1) As Double
Dim I As Integer = 0
For Each Gfx In Gfxs
If StrComp(Gfx.UserLayer.Name, "General Remarks") = 0 Then
If Gfx.Geometry.Filled = True Then
If Gfx.Selected = True Then
GfxSelected = GfxSelected + 1
Select Case GfxSelected
Iposx1 = Gfx.Geometry.CircleX
Iposy1 = Gfx.Geometry.CircleY
Iposx2 = Gfx.Geometry.CircleX
Iposy2 = Gfx.Geometry.CircleY
MessageBox.Show("more the 2 items selected (exit)")
If GfxSelected = 1 Then
contours = pcbDoc.Contours(MGCPCB.
For Each contour In contours
SafeArrayOfPnts(0, 0) = Iposx1 : SafeArrayOfPnts(1, 0) = Iposy1 : SafeArrayOfPnts(2, 0) = 0.0
SafeArrayOfPnts(0, 1) = Iposx2 : SafeArrayOfPnts(1, 1) = Iposy2 : SafeArrayOfPnts(2, 1) = 0.0
pcbDoc.PutContourEx(2, SafeArrayOfPnts, 1, 4, Phole, MGCPCB.
EPcbContourType.epcbContourInternal, False, Comp, MGCPCB.EPcbUnit.epcbUnitCurrent)
Catch E As Exception
I have no idea, but some thoughts to look on.
Its strngly depending, from what you do outside the sub.
Try to isolate the sub and run it as a loop. Does it occur again?
How many library accesse dou you have?
E.g. we have seen a Cell Editor issue, with exeption after more than 50 opens.
So I would have a look into the library accesses and minimize them.
I stripped the sub and everything works fine now.