Writing to the CAD database of a non-main thread
Hello everyone,
I am creating a task on a thread, which creates entities in the CAD database. This is working perfectly, but some people have told me that I should only do this on the main thread.
On a button in a WPF window, I'm creating a task on a thread using C #, as follows:
await Task.Run (() =>
{
CreateEntity ();
}
The CreateEntity method, accesses C ++ code, and creates a custom entity in the BricsCAD database.
Is it safe to write in the CAD database, from another thread ?? Can I have problems with this?
thanks to everyone who can help me,
André
Comments
-
@lordone
I think your problem is you need to treat bcad like autocad when researching the APIs.
I just googled "autocad .net write on main thread" and the three first items were perfect for your question, as well as others after being close.
I don't get how this happens because programmers are the more advanced users.
Surely you know the autocad and bcad APIs are the same? Did you not, by chance?
thanks0 -
@James Maeding said:
@lordone
I think your problem is you need to treat bcad like autocad when researching the APIs.
I just googled "autocad .net write on main thread" and the three first items were perfect for your question, as well as others after being close.
I don't get how this happens because programmers are the more advanced users.
Surely you know the autocad and bcad APIs are the same? Did you not, by chance?
thanksYes, I know that the APIs are the same. I didn't understand it because I can create entities from other threads without any problem. Maybe it was a coincidence, in some cases I think I may have some problems.
Anyway, I will try to modify my code to write on database only on the main thread.
thanks0 -
@lordone
Ok, but that basic google search gives all the answers.
I'm seeing people post here that clearly are decent cad users and programmers, but seem to be skipping the basics.
Just wondering why so I can work with Bricsys on how to avoid encouraging "bricscad forum only" usage without advertising a competing product.0