일부 응용 프로그램에는 일부 autocad 기능이 필요합니다. 그래서 독립형 응용 프로그램을 인터넷에서 시도했지만 아무것도 일어나지 않고 항상 오류를 반환합니다. (그것은 열어 사전 설치된 AutoCAD를 플러그인 뭔가를 그릴되지 않음) 내 첫 번째 시도 :독립 실행 형 autocad .net 응용 프로그램을 만드는 방법
AcadApplication gbl_app = new AcadApplication();
AcadDocument gbl_doc = gbl_app.ActiveDocument;
gbl_app.Application.Visible = true;
을 그리고 이것은 첫 번째 줄에 올릴 오류입니다.
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SBDesign.exe
Additional information:
Retrieving the COM class factory for component with CLSID {0D327DA6-B4DF-4842-B833-2CFF84F0948F}
failed due to the following error: 80040154
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
내 두 번째 시도 :
AcadApplication acAppComObj = null;
const string strProgId = "AutoCAD.Application.20";
// Get a running instance of AutoCAD
try
{
acAppComObj = (AcadApplication)Marshal.GetActiveObject(strProgId);
}
catch // An error occurs if no instance is running
{
try
{
// Create a new instance of AutoCAD
acAppComObj = (AcadApplication)Activator.CreateInstance(Type.GetTypeFromProgID(strProgId), true);
}
catch(Exception er)
{
// If an instance of AutoCAD is not created then message and exit
System.Windows.Forms.MessageBox.Show("Instance of 'AutoCAD.Application'" +
" could not be created.");
return;
}
}
// Display the application and return the name and version
acAppComObj.Visible = true;
System.Windows.Forms.MessageBox.Show("Now running " + acAppComObj.Name +
" version " + acAppComObj.Version);
그리고이 오류입니다 :
Unable to cast COM object of type 'System.__ComObject' to interface type 'Autodesk.AutoCAD.Interop.AcadApplication'.
This operation failed because the QueryInterface call on the COM component for
the interface with IID '{10E73D12-A037-47E5-8464-9B0716BE3990}'
failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
그래서 정말 내가 독립 실행 형 응용 프로그램을 만들 수있는 방법?
는
"AutoCAD.Application.20"은 AutoCAD 2015 및 2016에서만 작동합니다. "AutoCAD.Application"을 사용하여 AutoCAD 버전 (LT 제외)을 대상으로 해보십시오. – gileCAD
"AutoCAD.Application"을 사용할 때 아무 일도 일어나지 않습니다. AutoCAD가 2015입니다. –
@gileCAD "AutoCAD.Application"을 시도했지만 "AutoCAD.Application.20"과 동일한 오류가 발생합니다. –