Sign in to follow this  
byte

C# Hook issue : Calling 1 C++ function

Recommended Posts

Good Afternoon ,

I am writing this post due to a recent incident that I did not understand.

I was using a C# function to import some c++/cli exported from an external DLL to my NETHOOK.

The code was working perfectly until I called a function that draws the classic silhouette boundary from C# and my graphics were mangled.

The walls of SOLID entities could could no longer be seen. The selection window when I "clicked and dragged" was solid blue instead of just a square.

The operations would run it order returning the desired geometry however the graphics had many bugs after.

  Here is a snippet of the C# code that caused the issue :

//Construction
using cpp_export_dll;
    class CppFunction
    {
        MySilBndWrapper MySilBndInstance = new  MySilBndWrapper();
        var level = 2000;
        var sldisselect = true; 

        public void CreateSilhouetteBoundary()
        {
            //call cli wrapped function from c++/cli DLL
            MySilBndInstance.drawsilbn(sldisselected,level);
        }


    }
    
//Implentation
  CppFunction cppfunctionclass = new CppFunction();
  cppfunctionclass.CreateSilhouetteBoundary();

I rewrote the NETHOOK in F# with the same sequence and the undefined behavior stopped..

I have had this issues with C# in the past where I had to use the ASYNC method to force them to run in order.

Could this be an issue with operations running in the wrong sequence?

 

Share this post


Link to post
Share on other sites

It could be a timing or sequencing thing if you had to  wrap the C# call in an async Task although I have not come across this before. Feel free to log a Ticket in iCentral with an example and what version of Mastercam, VS, etc you are using and we can take a closer look.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, Mick George said:

It could be a timing or sequencing thing if you had to  wrap the C# call in an async Task although I have not come across this before. Feel free to log a Ticket in iCentral with an example and what version of Mastercam, VS, etc you are using and we can take a closer look.

Thank you Mick, how do I log a Ticket in ICENTRAL please?

Share this post


Link to post
Share on other sites

I think a customer can just log into iCentral and submit a support ticket (i'll need to verify), however, your reseller can certainly do it on your behalf. Once a ticket is submitted it gets into our system and someone will address it.

  • Thanks 1

Share this post


Link to post
Share on other sites
On ‎12‎/‎9‎/‎2019 at 8:28 AM, Mick George said:

I think a customer can just log into iCentral and submit a support ticket (i'll need to verify), however, your reseller can certainly do it on your behalf. Once a ticket is submitted it gets into our system and someone will address it.

It doesn't seem I have access to Icentral.

Share this post


Link to post
Share on other sites

Ok I just got verification that currently iCentral access is via your reseller only at this time so you will need to contact your reseller and give him the details of your support request and have them add a ticket on your behalf. Have them assign it to the SDK team.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/12/2019 at 9:00 AM, Mick George said:

Ok I just got verification that currently iCentral access is via your reseller only at this time so you will need to contact your reseller and give him the details of your support request and have them add a ticket on your behalf. Have them assign it to the SDK team.

Thank you for looking into this Mick. Thanks for everything else too, your toolpath door example I found in my old x7 install got me into programming and with yours and Rogers help I have developped add ons that save our programmers lots of headachee and time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us