DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

DesignCAD 3D OLE Automation Document.paste() should block

Started by A.Jones, January 31, 2020, 02:08:33 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

A.Jones

DesignCAD 3D OLE Automation Document.paste() should block

Background:

3DMax-28-2019 64 bit on Windows 7

With even only very simple automated drawing tasks, it is not practical to use the main document for drawing components repeatedly. Copy and paste is therefore applied for efficiency.

Furthermore, it makes even more sense to draw some components in a separate component document do avoid clutter in the main document. Sometimes it makes sense to optionally load a component into a separate component document then paste it into the main document.

These operations take some time, and it cannot be predicted how long they take.

After the component is pasted into the main drawing, the component document needs to be closed  before new component drawing operations are started.

Issue:

The closing of the component drawing causes unpredictable behavior such as crashes or unpredictable responses from the component Document.close() command. This seems to be caused by the fact the  that the Document.paste() (or any other command such as the Document.close() command returns before the paste operation is completed. In other words the Document.paste() does not block for the duration of the operation.

I have seen the proof of this by programming a delay such as one second after the execution of the component Document.close() which works around the problem.

This behavior does not appear very plausible because the delay is after the close() command and I have seen problems with the close() command, but it works nevertheless.


Suggestion:

Preferably, DesignCAD would internally execute in a short term timer loop until an internal condition indicates that the paste operation, or whatever operation it is that returns before completion, is completed. I cannot suggest anything more specific.

I have experimented with a timer loop checking for Document.ActiveView before returning after the Document.close() command instead but I cannot remember why I stopped using this code. It might have caused additional problems.

I am waiting for your response to my suggestion. It would take me considerable time to prepare a test case that has a good chance of reproducing the issue at your end. If you require such a test case, then I would appreciate that you send me a Visual BASIC application template that you are familiar with, or any other suggestion about the format of the test case.