Ah, I see what you mean. It is this line that generate the error:
Dim opt As New AeccPointImportOptions
The error message actually provided hint "...class not registered...", which I did not think too much and jumped to the usual suspect of
... = AcadApp.GetInterfaceObject("AeccXUiLand.AeccApplication.11.0")
The reason of this error is that NOT ALL AEC/AECC classes can be instantiated from outside of AEC/AECC context by " As New xxxx" or "Set xxx = New ....". Just as you go with AeccApplication, which you cannot do
Set civilApp = New AeccApplication
You have to do
Set civilApp = AcadApplication.GetInterfaceObject("xxxxxxx")
Because these objects are already instantiated in AutoCAD context as Aecc objects. The same applies to, you guess it, AeccPointImport/[Export]Options class. So, change your code to:
Dim opt As AeccPointImportOptions
Set opt=AcadApp.GetObjectInterface("AeccXLnad.AeccPointImportOptions.11.0")
Following code works form me (the same cope as my previous reply, plus on extra line in red):
class Program
{
static void Main(string[] args)
{
var cadApp = CreateAcadSession();
if (cadApp!=null)
{
Console.WriteLine("Press any key to continue...");
Console.Read();
GetCivilApp(cadApp);
Console.WriteLine("Press any key to exit...");
Console.Read();
}
else
{
Console.WriteLine("Press any key to exit...");
Console.Read();
}
}
private static AutoCAD.AcadApplication CreateAcadSession()
{
try
{
var cadApp = new AutoCAD.AcadApplication();
cadApp.Visible = true;
Console.WriteLine("AutoCAD started.");
return cadApp;
}
catch
{
Console.WriteLine("Cannot start AutoCAD!");
return null;
}
}
private static object GetCivilApp(AutoCAD.AcadApplication cadApp)
{
try
{
dynamic civilApp = cadApp.GetInterfaceObject("AeccXUiLand.AeccApplication.12.0");
dynamic civilDoc = civilApp.ActiveDocument;
Console.WriteLine("Connected to Civil Application successfully.");
var points = civilDoc.Points;
//var opt = new Autodesk.AECC.Interop.Land.AeccPointImportOptions();
dynamic opt = cadApp.GetInterfaceObject("AeccXLand.AeccPointImportOptions.12.0");
opt.PointDuplicateResolution = 4; // aeccPointDuplicateOverwrite
//....//
return (object)civilDoc;
}
catch
{
Console.WriteLine("Cannot get Civgil3D application!");
return null;
}
}
}