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:

Recommended Posts

I would like a pony and full access to Mastercam's source code. biggrin.gif

 

That's a very big request. Here's a very abbreviated list of functions to look at to get you started.

 

 

get_ent To search through MC geometry

select_ent and related functions: get user selected entity or entities.

 

operation_manager create, add, delete modify operations.

 

postOps and/or run_post_exe_dll generate nci and post nc code through post processors.

 

Bryan smile.gif

Link to comment
Share on other sites

OK, thank you! You really helped me, because I didn'n know which functions to use nor how to use them. I succesfully used select_ent function in main.cpp:

code:

MC_BOOL succf;

LPCTSTR cs2 = "Select entities";

DB_LIST_ENT_PTR **eptrs = NULL;

int *num_eptrs = 0;

select_ents (cs2, 0, &succf, PRESEL_CLEAR, &*eptrs, num_eptrs);

but then I didn't manage to use the operation_manager function:

code:

operation op;

op.op_idn = 1;

DB_LIST_ENT_PTR d_ptr4 = NULL;

operation_manager (&op, OPMGR_ADD, &d_ptr4, &succf);

Linker complains:

quote:

main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl operation_manager(struct operation *,short,struct db_list_ent_type * *,char *)" (__imp_?operation_manager@@YAXPAUoperation@@FPAPAUdb_list_ent_type@@PAD@Z) referenced in function _RunMyDialog


Please, try to explain, what I'm doing wrong. I don't know what the 3rd parameter in operation_manager ("pointer to operation entity" d_ptr4) is used for. I also don't know if I positioned all the &s and *s correctly. I will appreciate any help!

Link to comment
Share on other sites

This occurs AFTER the C-Hook asks me to enter two variables into MyDialog and draws a point at a location I show by the mouse.

 

No, I don't run the debug version. I simply compile, link and copy the C-hook DLL into the mcamxCHooks folder. Then I launch Mastercam and click the icon of my C-hook.

I know there are two versions of Mastercam.exe, one for Release and the other for Debug, but I didn't manage to run my C-Hook directly from VisualStudio.

 

Thank you for your quick reply.

Link to comment
Share on other sites

I have redesigned my code for creating an operation into the following:

 

code:

MC_BOOL succf;

operation *op = new operation;

op->op_idn = 1;

DB_LIST_ENT_PTR d_ptr4 = NULL;

 

operation_manager (op, OPMGR_ADD, &d_ptr4, &succf);

But the c-hook still crashes. Can anybody please provide a correction of my code or any other way to create an operation?

 

Respect.

Link to comment
Share on other sites

If the function is successful the eptr just points to the memory mastercam allocates for the operation. It's short for entity pointer. Your op variable is just a copy of eptr->eptr.u.op

 

check out the structures:

db_list_ent_type (eptr)

ent (eptr->eptr)

operation (eptr->eptr.u.op)

in 3dvars_ch.h

 

Don't do any manipulations on the eptr directly unless you know what your doing (or even if you know) since it's a really quick and easy way to crash mastercam if you're not careful. biggrin.gif

 

Bryan smile.gif

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