Reply

unspecified error for getting a reference to the active documen

[ Edited ]

 

Hello,

I'm using C# winform and trying to connect to open Solid Edge document. Connecting the Solid Edge, no problem. But when try to referen to the active document, I got this error.

Can anyone point out what is wrong with my code?

Thank you

Fulin

Fulin.Xiang@delaval.com

Here is the codeprivate void button1_Click(object sender, EventArgs e){ SolidEdgeFramework.Application m_application = null; SolidEdgePart.PartDocument document = null; try { m_application = (SolidEdgeFramework.Application) Marshal.GetActiveObject("SolidEdge.Application"); document = (SolidEdgePart.PartDocument) m_application.ActiveDocument; } catch (exception ex) { MessageBox.Show(ex.Message); }}

 

 

 

Posted by: Fulin Xiang
Post date: 9/30/2008 11:04:33 PM

2 REPLIES

RE: unspecified error for getting a reference to the active documen

[ Edited ]

Fulin,

 

You should always use SolidEdgeFramework.SolidEdgedocument when accessing the ActiveDocument property. From there, you can check the .Type property to see what kind of document you're dealing with. You are not guaranteed to always get a "SolidEdgePart.PartDocument".

 

Posted by: Jason Newell
Post date: 10/1/2008 7:45:09 AM

RE: unspecified error for getting a reference to the active documen

[ Edited ]

Thank you Jason for your help.

 

I re-installed my SolidEdge v19 sp11 and took away all the add-ins. Then it works well.

 

/Fulin

 

Posted by: Fulin Xiang
Post date: 10/1/2008 9:57:19 PM