
Originally Posted by
fikri
Hello,
I dont want to open new question because it is linked with this.
I am creating nesting optimisation from Vb Net with following code and I can get qty of pieces from loaded nesting list.
After some time I have error, please check code.
This worked before, but I cannot solve this error for a couple of days. I tried reinstall all, but nothing.
What I see that when I open Alphacam manualy and then run this code, it will work sometime.
I tried this with AlphaCam version 2017 and 2019 and same error.
Thanks
Dim alp As New AlphaCAMRouter.App
alp.Visible = True
Dim Drw As AlphaCAMRouter.Drawing
Dim Sheet As AlphaCAMRouter.Path
Dim Nest As NestData
Drw = alp.ActiveDrawing
Nest = Drw.CreateNestData("c:\1.anl") ------ HERE IS ERROR: Exception thrown 'System.Runtime.InteropServices.COMException' in AplhaCamNesting.exe, Additional Information: Error HRESULT E_FAIL has been returned from a Call To a COM component.
Sheet = Drw.CreateRectangle(0, 0, 2800, 2070)
Nest.AddSheet(Sheet, Drw.Materials(1).Name, 0.25, 2)
Nest.DoNest()
Dim qty As Decimal = 0
Dim col As AlphaCAMRouter.AcamColor = AcamColor.acamCYAN
For a As Integer = 1 To Drw.ToolPaths.Count
qty = qty + Drw.ToolPaths.Item(a).GetArea(AcamColor.acamBROWN)
Next
Hi,
try something like this.
Not tested, write from a "hand´"
Also do not forgot on a reference Alphacam nesting Type library
Code:
Dim drw As Drawing
Set drw = App.ActiveDrawing
Dim Sheet As Path
Dim Nest As NestData
Nest = drw.CreateNestData("C:\Alphacam\LICOMDIR\NestLists\1.anl")
Set Sheet = drw.CreateRectangle(0, 0, 2800, 2070)
Nest.AddSheet Sheet, "MDF", 0.25, 2
Nest.DoNest
Dim qty As Double
qty = 0
Dim col As AcamColor
col = AcamColor.acamCYAN
Dim a As Integer
For a = 1 To drw.ToolPaths.Count
qty = qty + drw.ToolPaths.Item(a).GetArea(AcamColor.acamBROWN)
Next