.NET

Reply
New Member
jimmy118127071
Posts: 1
Registered: ‎05-13-2012
Message 1 of 2 (265 Views)

Silverlight OOB CAD error

265 Views, 1 Replies
05-13-2012 11:10 PM

    dynamic AutoCAD = AutomationFactory.CreateObject("AutoCAD.Application");
            //dynamic aCADutil = AutoCAD.Utility;
            AutoCAD.Visible = true;
            //dynamic mospace = AutoCAD.ModelSpace;
             dynamic doc = AutoCAD.ActiveDocument;
        
             doc.Open("D:\\2Dsample1.dwg");

 

 

error:smileyfrustrated:ystem.Runtime.InteropServices.COMException (0x80210070): 發生例外狀況於 HRESULT: 0x80210070 ---> MS.Internal.ComAutomation.ComAutomationObjectException: 發生例外狀況於 HRESULT: 0x80210070
(Source=AutoCAD)
(HelpFile=C:\Program Files (x86)\AutoCAD 2008\HELP\OLE_ERR.CHM#2149646448)
   於 MS.Internal.ComAutomation.ComAutomationNative.CheckInvokeHResult(UInt32 hr, String memberName, String exceptionSource, String exceptionDescription, String exceptionHelpFile, UInt32 exceptionHelpContext)
   於 MS.Internal.ComAutomation.ComAutomationNative.Invoke(Boolean tryInvoke, String memberName, ComAutomationInvokeType invokeType, ComAutomationInteropValue[] rgParams, IntPtr nativePeer, ComAutomationInteropValue& returnValue)
   於 MS.Internal.ComAutomation.ComAutomationObject.InvokeImpl(Boolean tryInvoke, String name, ComAutomationInvokeType invokeType, Object& returnValue, Object[] args)
   於 MS.Internal.ComAutomation.ComAutomationObject.Invoke(String name, ComAutomationInvokeType invokeType, Object[] args)
   於 System.Runtime.InteropServices.Automation.AutomationMetaObjectProvider.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
   於 System.Runtime.InteropServices.Automation.AutomationMetaObjectProviderBase.<.cctor>b__4(Object obj, InvokeMemberBinder binder, Object[] args)
   於 CallSite.Target(Closure , CallSite , Object , String )
   於 System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
   於 SilverlightOOBDemo.OutofBrowserMainPage.wordBtn_Click(Object sender, RoutedEventArgs e)
   於 System.Windows.Controls.Primitives.ButtonBase.OnClick()
   於 System.Windows.Controls.Button.OnClick()
   於 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   於 System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   於 MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)}

*Expert Elite*
norman.yuan
Posts: 1,064
Registered: ‎04-27-2009
Message 2 of 2 (245 Views)

Re: Silverlight OOB CAD error

05-14-2012 06:40 AM in reply to: jimmy118127071

You did not say, but I assume it is the last line of code you showed that causes the error:

 

doc.Open(....).

 

That is, you try to open a drawing document in SDI mode.

 

By default, AutoCAD is in MDI mode (it is very rare by now that someone still use AutoCAD in SDI mode). In MDI mode, AcadDocument.Open() cannot be called.

 

You should:

 

autoCAD.Visible=true;

dynamic doc=autoCAD.Documents.Open([path/name]);

//Then dosomething with doc object.

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.