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?
    thanks

  • @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?
    thanks

    Yes, 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.
    thanks

  • @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.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!