How to wait for AutoCAD document to finish loading before proceeding in code
8 views (last 30 days)
Show older comments
Hi,
We have a Matlab application creating and working with AutoCAD drawings through COM interface. This is buggy, sometimes it works and mostly not. I have tracked down the issue to the following:
When creating the drawing, I have tried to add pause at different ranges before proceeding in the code, but this does not seem to be sufficient. The issue we are facing is that the COM object (AutoCAD drawing document) does not load correctly or fully. I have verfied this by converting it to a structure and using fieldnames() to get the different fields. A fully loaded object returns a large number of fields, but most times only a fraction is returned.
We need to find a way to loop or wait until the document is loaded and ready before we can proceed with manipulating it. This far, I have not been able to find a suitable solution and any help is wanted.
Br
Fredrik Walka
7 Comments
Mario Malic
on 25 Aug 2023
One thing you can try is to simply set a pause for several seconds and see if the properties are added after this time. Of course, it's not a great solution but it could reveal if what you are doing is right and document is opening in a corect way.
There is some info here https://forums.autodesk.com/t5/net/how-to-determine-when-a-document-is-completely-loaded/td-p/2684614 about the EndOpen event which could be a way to solve this.
Answers (0)
See Also
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!