Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

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?

 

Link to comment
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?

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • 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

×
×
  • Create New...