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:

Get stock-setup infos from a MachineGroup


Recommended Posts

Hi,

i need help,

 

i use NetHook (NETHook2_0.dll) with MicrosoftVisual C# 2008

and the MasterCam X3.

 

i would like get infos about stock-setup in a MachineGroup

i can get "JobSetupMaterial", "JobSetupStockOrigin", "JobSetupStockSize"

but i don't find how to get : the type of shape,

if the shape is file ,the path of the "stl" file, ...

 

thanks,

Thomas

Link to comment
Share on other sites

TNunes,

 

Not everything is available via a NETHook.

You could get more details using CHook methods.

*You could create a CHook just to retrieve this specific information and pass it back to your NETHook. (using P/Invoke Interop)

It's not that difficult to utilize a 'CHook' type DLL functions via a NETHook.

Matter of fact, the Zip2Go utility in Mastercam -

All the UI is a NETHook (Zip2Go.DLL), but all the data gathering is done via calls into a Chook (Z2GData.DLL).

 

PInvoke Interop - Mastercam

Link to comment
Share on other sites

Thanks Roger,

 

In fact i would like to get the infos in the struct "group_pg3"

which is in "op_group_info",

which is in "op_group",

 

And in the MCCore.dll i found the function :

op_group* TpGrpList::GroupByName(char *Name)

With the EntryPoint =

"?GroupByName@TpGrpList@@QAEPAU_op_group@@PAD@Z".

 

So i try that in my C# code :

code:

[DllImport("MCCore.dll", EntryPoint ="?GroupByName@TpGrpList@@QAEPAU_op_group@@PAD@Z")]

private extern static IntPtr GroupByName(ref string Name);

I'M NOT SURE OF THE PARAMATER(ref string Name) AND THE RETURN(IntPtr) //////////////

code:

private int GetStockInfo(string NameMachine)

{

IntPtr iIntPtr = IntPtr.Zero;

try

{

MessageBox.Show(NameMachine, "NameMachine"); //for DEBUG

iIntPtr = GroupByName(ref NameMachine);

MessageBox.Show(NameMachine, "NameMachine"); //for DEBUG

MessageBox.Show(iIntPtr.ToString(),"IntPtr"); //for DEBUG

...

...

}

catch (Exception e)

{

(...)

}

finally

{

//clean up memory

if (iIntPtr != IntPtr.Zero)

Marshal.FreeHGlobal(iIntPtr);

}

}

But finally i get the three messages box :

DMU_50_EVOLUTION //It's my Machine : OK

DMU_50_EVOLUTION //It's my Machine : OK

0 //Null Pointer (i don't understand)

 

Can you please give more informations about my problems ?

Does the EntryPoint change with the version of the dll ?

And to get the infos in group_pg3 with the "Pointer" ?

do i must define the structure like this :

code:

[structLayout(LayoutKind.Sequential)]

public struct _op_group

{

public int grp_idn;

[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_GROUP_NAME + 1)]

public char[] name;

public int parent_grp_idn;

(...)

public op_group_info ogi;

}

AND

code:

        

public struct op_group_info

{

(...)

[MarshalAs(UnmanagedType.Struct)]

public group_pg3 pg3;

[MarshalAs(UnmanagedType.Struct)]

public group_pg4 pg4;

} ;

AND ETC... ?

 

Thanks for your answers!

Link to comment
Share on other sites
  • 4 months later...

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