Hello,
I'm trying to automate the updating of View files in a Project setting. My client has an extensive set of LISP routines to run VPLAYER in Viewports and set visibility & color for different scenarios. When the Model has been updated however, these View .dwgs need to be opened and have the LISP routines run again to make sure new objects are displayed.
I had thought to write a .NET routine in which the user picked a folder, I found all of the .dwg files, opened each .dwg, activated each Viewport in turn and ran the correct LISP routine. I've already updated their LISP so that as each routine is used it stores an Xrecord of it's name in a custom dictionary, keyed by the Viewport handle. I can present the dialog, find .dwg files in a selected folder, loop through layouts & Viewports just fine however...
...I can't seem to open .dwgs programmatically and have access to LISP commands. I have the LISP routines set to load in the Startup Suite of the AppLoad Dialog, and they're certainly available when you open the .dwg manually. I've tried 2 approaches to automating this:
AcadApplication.Invoke(args)
When this runs, the LISP command is not recognized "No function definition..". This is especially strange as a custom *error* message from my LISP library is displayed. The LISP must be loaded, other posts here seem to indicate that Invoke() (managed wrapper for acedInvoke() I believe) cannot operate outside the document the .NET routine was called from.
acadApp.GetType().InvokeMember("SendCommand",System.Reflection.BindingFlags.InvokeMethod, null,acadApp, acCommand);
This throws an error, "Unknown name. (Exception from HRESULT:0x80020006(DISP_E_UNKNOWNNAME))"
SentToCommand is obviously out as it only runs once the .NET has exited.
Anyone done anything similar? Am I missing something in the above, or is there a different approach possible?
Any help is appreciated,
cc