The following code throws a System.InvalidCastException, although I'm pretty sure I'm doing it the right way:
SolidEdge.Framework.Interop.Window win = null;win = (SolidEdge.Framework.Interop.Window)Application.ActiveWindow;
whereas "Application" is a property of the type SolidEdge.Framework.Interop.Application.
I also tried to access the Window through:
SolidEdge.Draft.Interop.DraftDocument.Windows.Item(i), but the cast also fails there.
What am I missing?
Go to Solution.
Since I was in the 2D environment, I had to cast to SolidEdge.Draft.Interop.SheetWindow. The normal Window only works for 3D appearantly.
This is where Spy for Solid Edge can save you a lot of time and headaches. It takes the guesswork out of what the runtime type is of an object by telling you directly in the UI.
Wow thanks, thats absolutely awesome! I could have needed that a lot during my last project. Without this tool, its a lot of guessing and trial and error. I finished my project now, but I will use it in the future for sure!