07-20-2015, 01:57 PM
Merhaba Tekrar,
ACAD isimli bir obje tanımladım :
Kod:
Autodesk.AutoCAD.Interop.AcadApplication ACAD = new Autodesk.AutoCAD.Interop.AcadApplication();Sonra bu objeyi aşağıdaki metoda göndermek istiyorum ;
Kod:
psADH_Netload(ACAD, AppDomain.CurrentDomain.BaseDirectory + "AdhAcadLib.dll");Ama şu hatayı alıyorum ACAD objesini algılayamadı ,çok basit bir hata ama vb.net te çalışan yöntem burada niye çalışmadı anlayamadım ...
Kod:
OleMessageFilter.Register();
try
{
string path = AppDomain.CurrentDomain.BaseDirectory;
path = path + "şablon.dwt";
Autodesk.AutoCAD.Interop.AcadApplication ACAD = new Autodesk.AutoCAD.Interop.AcadApplication();
ACAD.Visible = true;
//ACAD.Application.WindowState =
ACAD.ActiveDocument.Close();
ACAD.Application.Documents.Add(path);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
OleMessageFilter.Revoke();
// Netload AdhAcadLib.dll
psADH_Netload(ACAD, AppDomain.CurrentDomain.BaseDirectory + "AdhAcadLib.dll");"Error 3 The name 'ACAD' does not exist in the current context "
içine göndermek istediğim metod da böyle birşey :
Kod:
public static void psADH_Netload(Autodesk.AutoCAD.Interop.AcadApplication ACAD, string path)
{
AcadDocument doc = ACAD.ActiveDocument;
try
{
doc.SendCommand("SETVAR\rFILEDIA\r0\r");
doc.SendCommand("NETLOAD\r" + path + "\r");
doc.SendCommand("SETVAR\rFILEDIA\r1\r");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
