Hi,
I am having issue with autocad with .net addin.
Here is the scenario :
I am showing model up of wpf application on autocad application.
As am showing wpf application as model popup,Once i opne the model popups , autocad applications is in disable mode untill wpf model pop up closed. This is working fine.
But, while doing any operations in wpf model pupup, if wpf addin is throughs any exception
Wpf model is in open,Autocad is getting enabled but is should not enable.,
Please help me on this.
Regards,
Raman
Hi Raman,
I'n very sorry, but I don't understand your question. Please would you rewrite it more expansively. Also, providing a small sample to demonstrate the problem will help the people on this forum better understand your problem.
Hi,
Please find the attachment with below details
1. Project -- solution structure with two projects.
2. Netload -- Net loading the autocad dll
3. showmodelpopup - displaying popup using below code snippet
[CommandMethod("ShowModelPopUp")]
publicvoid ShowModelPopUp()
{ newModelPopUpViewModel().ShowModelPopUP(); }
4. Execeptionmessagefrom autocad -- Getting autocad error message
5. EditingAutocad -- Able to access autocad menu bar, even though model pup up is in open state.
I am facing issue as shown in image 4 (Execeptionmessagefrom). When ever some error throws from autocad main application. i will get access to autocad application access, even though model popop is open state.
I don't allow to access autocad application access, when model popup is in open state
Please help me on this.
Regards,
Raman
The only files you've posted so far are image files.
I woudln't expect much in the way of help without showing the code (and when I say 'show', I don't mean an image showing the code).
Hi,
I am here with sample project for explaining the issue.
Net load the given sample project into autocad application and given the command as "ShowModelPopUp"
We can see one model pop up with Button and some text.
On click of the button("Rise Unhandled exception"). Autocad application throws an exception message.
After closing the autocad error message box, I am able to access autocad application, even though the model pop up is in open state., Actually i should not allow user to access autocad application and show model pop up.
Please guide me on this.
Regards,
Raman
Hello Raman,
The project that you shared is not in a buildable form. So cant really try to reproduce that behavior.
If you are trying to show a WPF window inside AutoCAD as a modal window then you must be using :
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalWindow()
Also, I fail to understand the reason why it is so important for you to have this modal behavior when there is an exception. If there is an exception, AutoCAD will try and want to grab the user's attention to submit a CER which is mostly what a user would want to do in such a scenario.
Hi,
Thanks for your response on this issue.
As you have mentioned above post, I have used below statement for opening model pop up
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalWindow().
Now, on getting error, model popup is not minimizing , that's what I am excepting.
One issue here is, even though, model pop up is open on AutoCAD, I am able to access AutoCAD tool bar, that should not be.
Please help me on this issue
Regards,
Raman
Can you post some code showing the error?
Also why can't you use a palette? I have programs that bring up palettes automatically while in a command and automatically disappear when the comment ends. If you want i can post some code.
Hi,
I am here with sample project.
Please netload the dll named "IssuewWithModelPopup.dll"
After loading above dll to autocad application
Enter command as "SHOWAUTOCADMODELPOPUP"
We will get one popup with button text "Rise Unhandled exception".
On Click of button we will get autocad exception dialog.
Once i closed, autocad exception dialog,
Autocad is getting enabled but is should not enable.,
Please help me on this.
Regards,
Raman
Hello Raman,
Sorry, I still dont get the whole picture of why this is so important for your plugin.
When you say,
"Once i closed, autocad exception dialog, Autocad is getting enabled but is should not enable"
Unhandled exceptions in plugins should not ideally cause AutoCAD to hang, so why is that you expect that AutoCAD should not enable again ?
You plugin should gracefully handle all the exceptions including a catch-all for System.Exception and take appropriate action without passing them on to AutoCAD. I dont think the behavior of AutoCAD to react to those unhandled exceptions from plugins can be configured.